Commit | Line | Data |
---|---|---|
9146ca37 MR |
1 | /** |
2 | Copyright (C) 2005 Michael Ahlberg, Måns Rullgård | |
3 | ||
4 | Permission is hereby granted, free of charge, to any person | |
5 | obtaining a copy of this software and associated documentation | |
6 | files (the "Software"), to deal in the Software without | |
7 | restriction, including without limitation the rights to use, copy, | |
8 | modify, merge, publish, distribute, sublicense, and/or sell copies | |
9 | of the Software, and to permit persons to whom the Software is | |
10 | furnished to do so, subject to the following conditions: | |
11 | ||
12 | The above copyright notice and this permission notice shall be | |
13 | included in all copies or substantial portions of the Software. | |
14 | ||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
22 | DEALINGS IN THE SOFTWARE. | |
23 | **/ | |
24 | ||
25 | #ifndef OGG_H | |
26 | #define OGG_H | |
27 | ||
28 | #include "avformat.h" | |
29 | ||
30 | typedef struct ogg_codec { | |
31 | uint8_t *magic; | |
32 | uint8_t magicsize; | |
33 | int8_t *name; | |
34 | int (*header)(AVFormatContext *, int); | |
35 | int (*packet)(AVFormatContext *, int); | |
36 | } ogg_codec_t; | |
37 | ||
38 | typedef struct ogg_stream { | |
39 | uint8_t *buf; | |
40 | unsigned int bufsize; | |
41 | unsigned int bufpos; | |
42 | unsigned int pstart; | |
43 | unsigned int psize; | |
44 | uint32_t serial; | |
45 | uint32_t seq; | |
46 | uint64_t granule, lastgp; | |
47 | int flags; | |
48 | ogg_codec_t *codec; | |
49 | int header; | |
50 | int nsegs, segp; | |
51 | uint8_t segments[255]; | |
52 | } ogg_stream_t; | |
53 | ||
54 | typedef struct ogg_state { | |
55 | uint64_t pos; | |
56 | int curidx; | |
57 | struct ogg_state *next; | |
ad3aa874 | 58 | ogg_stream_t streams[1]; |
9146ca37 MR |
59 | } ogg_state_t; |
60 | ||
61 | typedef struct ogg { | |
62 | ogg_stream_t *streams; | |
63 | int nstreams; | |
64 | int headers; | |
65 | int curidx; | |
66 | uint64_t size; | |
67 | ogg_state_t *state; | |
68 | } ogg_t; | |
69 | ||
70 | #define OGG_FLAG_CONT 1 | |
71 | #define OGG_FLAG_BOS 2 | |
72 | #define OGG_FLAG_EOS 4 | |
73 | ||
74 | extern ogg_codec_t vorbis_codec; | |
75 | #if 0 | |
76 | extern ogg_codec_t ogm_video_codec; | |
77 | extern ogg_codec_t ogm_audio_codec; | |
78 | extern ogg_codec_t ogm_old_codec; | |
79 | extern ogg_codec_t flac_codec; | |
80 | #endif | |
81 | ||
82 | extern int vorbis_comment(AVFormatContext *ms, char *buf, int size); | |
83 | ||
84 | #endif |