1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /**
20  * @file
21  * A public API for Vorbis parsing
22  *
23  * Determines the duration for each packet.
24  */
25 
26 module ffmpeg.libavcodec.vorbis_parser;
27 
28 extern (C):
29 import ffmpeg; @nogc nothrow:
30 
31 struct AVVorbisParseContext;
32 
33 /**
34  * Allocate and initialize the Vorbis parser using headers in the extradata.
35  */
36 AVVorbisParseContext* av_vorbis_parse_init (
37     const(ubyte)* extradata,
38     int extradata_size);
39 
40 /**
41  * Free the parser and everything associated with it.
42  */
43 void av_vorbis_parse_free (AVVorbisParseContext** s);
44 
45 enum VORBIS_FLAG_HEADER = 0x00000001;
46 enum VORBIS_FLAG_COMMENT = 0x00000002;
47 enum VORBIS_FLAG_SETUP = 0x00000004;
48 
49 /**
50  * Get the duration for a Vorbis packet.
51  *
52  * If @p flags is @c NULL,
53  * special frames are considered invalid.
54  *
55  * @param s        Vorbis parser context
56  * @param buf      buffer containing a Vorbis frame
57  * @param buf_size size of the buffer
58  * @param flags    flags for special frames
59  */
60 int av_vorbis_parse_frame_flags (
61     AVVorbisParseContext* s,
62     const(ubyte)* buf,
63     int buf_size,
64     int* flags);
65 
66 /**
67  * Get the duration for a Vorbis packet.
68  *
69  * @param s        Vorbis parser context
70  * @param buf      buffer containing a Vorbis frame
71  * @param buf_size size of the buffer
72  */
73 int av_vorbis_parse_frame (
74     AVVorbisParseContext* s,
75     const(ubyte)* buf,
76     int buf_size);
77 
78 void av_vorbis_parse_reset (AVVorbisParseContext* s);
79 
80 /* AVCODEC_VORBIS_PARSER_H */