Mercurial > mplayer.hg
annotate tremor/ivorbiscodec.h @ 33425:15659ae10207
Simplify NULL check.
author | reimar |
---|---|
date | Sun, 29 May 2011 11:41:40 +0000 |
parents | e83eef58b30a |
children |
rev | line source |
---|---|
14280 | 1 /******************************************************************** |
2 * * | |
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * | |
4 * * | |
19251
cd6b211be811
Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents:
14280
diff
changeset
|
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
cd6b211be811
Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents:
14280
diff
changeset
|
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
cd6b211be811
Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents:
14280
diff
changeset
|
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
cd6b211be811
Replace tremor files that had old headers saying "ALL REDISTRIBUTION
uau
parents:
14280
diff
changeset
|
8 * * |
14280 | 9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * |
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * | |
11 * * | |
12 ******************************************************************** | |
13 | |
14 function: libvorbis codec headers | |
15 | |
16 ********************************************************************/ | |
17 | |
18 #ifndef _vorbis_codec_h_ | |
19 #define _vorbis_codec_h_ | |
20 | |
21 #ifdef __cplusplus | |
22 extern "C" | |
23 { | |
24 #endif /* __cplusplus */ | |
25 | |
26 #include "ogg.h" | |
27 | |
28 typedef struct vorbis_info{ | |
29 int version; | |
30 int channels; | |
31 long rate; | |
32 | |
33 /* The below bitrate declarations are *hints*. | |
34 Combinations of the three values carry the following implications: | |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
35 |
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
36 all three set to the same value: |
14280 | 37 implies a fixed rate bitstream |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
38 only nominal set: |
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
39 implies a VBR stream that averages the nominal bitrate. No hard |
14280 | 40 upper/lower limit |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
41 upper and or lower set: |
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
42 implies a VBR bitstream that obeys the bitrate limits. nominal |
14280 | 43 may also be set to give a nominal rate. |
44 none set: | |
45 the coder does not care to speculate. | |
46 */ | |
47 | |
48 long bitrate_upper; | |
49 long bitrate_nominal; | |
50 long bitrate_lower; | |
51 long bitrate_window; | |
52 | |
53 void *codec_setup; | |
54 } vorbis_info; | |
55 | |
56 /* vorbis_dsp_state buffers the current vorbis audio | |
57 analysis/synthesis state. The DSP state belongs to a specific | |
58 logical bitstream ****************************************************/ | |
59 typedef struct vorbis_dsp_state{ | |
60 int analysisp; | |
61 vorbis_info *vi; | |
62 | |
63 ogg_int32_t **pcm; | |
64 ogg_int32_t **pcmret; | |
65 int pcm_storage; | |
66 int pcm_current; | |
67 int pcm_returned; | |
68 | |
69 int preextrapolate; | |
70 int eofflag; | |
71 | |
72 long lW; | |
73 long W; | |
74 long nW; | |
75 long centerW; | |
76 | |
77 ogg_int64_t granulepos; | |
78 ogg_int64_t sequence; | |
79 | |
80 void *backend_state; | |
81 } vorbis_dsp_state; | |
82 | |
83 typedef struct vorbis_block{ | |
84 /* necessary stream state for linking to the framing abstraction */ | |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
85 ogg_int32_t **pcm; /* this is a pointer into local storage */ |
14280 | 86 oggpack_buffer opb; |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
87 |
14280 | 88 long lW; |
89 long W; | |
90 long nW; | |
91 int pcmend; | |
92 int mode; | |
93 | |
94 int eofflag; | |
95 ogg_int64_t granulepos; | |
96 ogg_int64_t sequence; | |
97 vorbis_dsp_state *vd; /* For read-only access of configuration */ | |
98 | |
99 /* local storage to avoid remallocing; it's up to the mapping to | |
100 structure it */ | |
101 void *localstore; | |
102 long localtop; | |
103 long localalloc; | |
104 long totaluse; | |
105 struct alloc_chain *reap; | |
106 | |
107 } vorbis_block; | |
108 | |
109 /* vorbis_block is a single block of data to be processed as part of | |
110 the analysis/synthesis stream; it belongs to a specific logical | |
111 bitstream, but is independant from other vorbis_blocks belonging to | |
112 that logical bitstream. *************************************************/ | |
113 | |
114 struct alloc_chain{ | |
115 void *ptr; | |
116 struct alloc_chain *next; | |
117 }; | |
118 | |
119 /* vorbis_info contains all the setup information specific to the | |
120 specific compression/decompression mode in progress (eg, | |
121 psychoacoustic settings, channel setup, options, codebook | |
122 etc). vorbis_info and substructures are in backends.h. | |
123 *********************************************************************/ | |
124 | |
125 /* the comments are not part of vorbis_info so that vorbis_info can be | |
126 static storage */ | |
127 typedef struct vorbis_comment{ | |
128 /* unlimited user comment fields. libvorbis writes 'libvorbis' | |
129 whatever vendor is set to in encode */ | |
130 char **user_comments; | |
131 int *comment_lengths; | |
132 int comments; | |
133 char *vendor; | |
134 | |
135 } vorbis_comment; | |
136 | |
137 | |
138 /* libvorbis encodes in two abstraction layers; first we perform DSP | |
139 and produce a packet (see docs/analysis.txt). The packet is then | |
140 coded into a framed OggSquish bitstream by the second layer (see | |
141 docs/framing.txt). Decode is the reverse process; we sync/frame | |
142 the bitstream and extract individual packets, then decode the | |
143 packet back into PCM audio. | |
144 | |
145 The extra framing/packetizing is used in streaming formats, such as | |
146 files. Over the net (such as with UDP), the framing and | |
147 packetization aren't necessary as they're provided by the transport | |
148 and the streaming layer is not used */ | |
149 | |
150 /* Vorbis PRIMITIVES: general ***************************************/ | |
151 | |
152 extern void vorbis_info_init(vorbis_info *vi); | |
153 extern void vorbis_info_clear(vorbis_info *vi); | |
154 extern int vorbis_info_blocksize(vorbis_info *vi,int zo); | |
155 extern void vorbis_comment_init(vorbis_comment *vc); | |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
156 extern void vorbis_comment_add(vorbis_comment *vc, char *comment); |
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
157 extern void vorbis_comment_add_tag(vorbis_comment *vc, |
14280 | 158 char *tag, char *contents); |
159 extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count); | |
160 extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag); | |
161 extern void vorbis_comment_clear(vorbis_comment *vc); | |
162 | |
163 extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); | |
164 extern int vorbis_block_clear(vorbis_block *vb); | |
165 extern void vorbis_dsp_clear(vorbis_dsp_state *v); | |
166 | |
167 /* Vorbis PRIMITIVES: synthesis layer *******************************/ | |
168 extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, | |
169 ogg_packet *op); | |
170 | |
171 extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); | |
172 extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); | |
173 extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); | |
174 extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm); | |
175 extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); | |
176 extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); | |
177 | |
178 /* Vorbis ERRORS and return codes ***********************************/ | |
179 | |
29264
e83eef58b30a
Remove all kind of trailing whitespaces from all MPlayer's files.
bircoph
parents:
19251
diff
changeset
|
180 #define OV_FALSE -1 |
14280 | 181 #define OV_EOF -2 |
182 #define OV_HOLE -3 | |
183 | |
184 #define OV_EREAD -128 | |
185 #define OV_EFAULT -129 | |
186 #define OV_EIMPL -130 | |
187 #define OV_EINVAL -131 | |
188 #define OV_ENOTVORBIS -132 | |
189 #define OV_EBADHEADER -133 | |
190 #define OV_EVERSION -134 | |
191 #define OV_ENOTAUDIO -135 | |
192 #define OV_EBADPACKET -136 | |
193 #define OV_EBADLINK -137 | |
194 #define OV_ENOSEEK -138 | |
195 | |
196 #ifdef __cplusplus | |
197 } | |
198 #endif /* __cplusplus */ | |
199 | |
200 #endif | |
201 |