Rev 1905 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1905 | Rev 3960 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | }; |
36 | }; |
Line 37... | Line 37... | ||
37 | 37 | ||
38 | /* the output buffer, used to be pcm_sample, pcm_point and audiobufsize */ |
38 | /* the output buffer, used to be pcm_sample, pcm_point and audiobufsize */ |
39 | struct outbuffer |
39 | struct outbuffer |
40 | { |
40 | { |
41 | unsigned char *data; |
41 | unsigned char *data; /* main data pointer, aligned */ |
42 | unsigned char *p; /* read pointer */ |
42 | unsigned char *p; /* read pointer */ |
- | 43 | size_t fill; /* fill from read pointer */ |
|
43 | size_t fill; /* fill from read pointer */ |
44 | size_t size; |
44 | size_t size; /* that's actually more like a safe size, after we have more than that, flush it */ |
45 | unsigned char *rdata; /* unaligned base pointer */ |
Line 45... | Line 46... | ||
45 | }; |
46 | }; |
46 | 47 | ||
47 | struct audioformat |
48 | struct audioformat |
Line 63... | Line 64... | ||
63 | #endif |
64 | #endif |
64 | int down_sample; |
65 | int down_sample; |
65 | int rva; /* (which) rva to do: 0: nothing, 1: radio/mix/track 2: album/audiophile */ |
66 | int rva; /* (which) rva to do: 0: nothing, 1: radio/mix/track 2: album/audiophile */ |
66 | long halfspeed; |
67 | long halfspeed; |
67 | long doublespeed; |
68 | long doublespeed; |
68 | #ifndef WIN32 |
- | |
69 | long timeout; |
69 | long timeout; |
70 | #endif |
- | |
71 | #define NUM_CHANNELS 2 |
70 | #define NUM_CHANNELS 2 |
72 | char audio_caps[NUM_CHANNELS][MPG123_RATES+1][MPG123_ENCODINGS]; |
71 | char audio_caps[NUM_CHANNELS][MPG123_RATES+1][MPG123_ENCODINGS]; |
73 | /* long start_frame; */ /* frame offset to begin with */ |
72 | /* long start_frame; */ /* frame offset to begin with */ |
74 | /* long frame_number;*/ /* number of frames to decode */ |
73 | /* long frame_number;*/ /* number of frames to decode */ |
75 | #ifndef NO_ICY |
74 | #ifndef NO_ICY |
Line 77... | Line 76... | ||
77 | #endif |
76 | #endif |
78 | double outscale; |
77 | double outscale; |
79 | long resync_limit; |
78 | long resync_limit; |
80 | long index_size; /* Long, because: negative values have a meaning. */ |
79 | long index_size; /* Long, because: negative values have a meaning. */ |
81 | long preframes; |
80 | long preframes; |
- | 81 | #ifndef NO_FEEDER |
|
- | 82 | long feedpool; |
|
- | 83 | long feedbuffer; |
|
- | 84 | #endif |
|
82 | }; |
85 | }; |
Line -... | Line 86... | ||
- | 86 | ||
83 | 87 | enum frame_state_flags |
|
- | 88 | { |
|
- | 89 | FRAME_ACCURATE = 0x1 /**< 0001 Positions are considered accurate. */ |
|
- | 90 | ,FRAME_FRANKENSTEIN = 0x2 /**< 0010 This stream is concatenated. */ |
|
Line 84... | Line 91... | ||
84 | 91 | }; |
|
85 | 92 | ||
86 | /* There is a lot to condense here... many ints can be merged as flags; though the main space is still consumed by buffers. */ |
93 | /* There is a lot to condense here... many ints can be merged as flags; though the main space is still consumed by buffers. */ |
87 | struct mpg123_handle_struct |
94 | struct mpg123_handle_struct |
Line 150... | Line 157... | ||
150 | { |
157 | { |
151 | #ifdef OPT_MULTI |
158 | #ifdef OPT_MULTI |
Line 152... | Line 159... | ||
152 | 159 | ||
153 | #ifndef NO_LAYER3 |
160 | #ifndef NO_LAYER3 |
154 | #if (defined OPT_3DNOW || defined OPT_3DNOWEXT) |
161 | #if (defined OPT_3DNOW || defined OPT_3DNOWEXT) |
155 | void (*dct36)(real *,real *,real *,real *,real *); |
162 | void (*the_dct36)(real *,real *,real *,real *,real *); |
156 | #endif |
163 | #endif |
Line 157... | Line 164... | ||
157 | #endif |
164 | #endif |
158 | 165 | ||
Line 199... | Line 206... | ||
199 | int emphasis; |
206 | int emphasis; |
200 | int framesize; /* computed framesize */ |
207 | int framesize; /* computed framesize */ |
201 | int freesize; /* free format frame size */ |
208 | int freesize; /* free format frame size */ |
202 | enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */ |
209 | enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */ |
203 | off_t num; /* frame offset ... */ |
210 | off_t num; /* frame offset ... */ |
- | 211 | off_t input_offset; /* byte offset of this frame in input stream */ |
|
204 | off_t playnum; /* playback offset... includes repetitions, reset at seeks */ |
212 | off_t playnum; /* playback offset... includes repetitions, reset at seeks */ |
205 | off_t audio_start; /* The byte offset in the file where audio data begins. */ |
213 | off_t audio_start; /* The byte offset in the file where audio data begins. */ |
206 | char accurate; /* Flag to see if we trust the frame number. */ |
214 | int state_flags; |
207 | char silent_resync; /* Do not complain for the next n resyncs. */ |
215 | char silent_resync; /* Do not complain for the next n resyncs. */ |
208 | unsigned char* xing_toc; /* The seek TOC from Xing header. */ |
216 | unsigned char* xing_toc; /* The seek TOC from Xing header. */ |
209 | int freeformat; |
217 | int freeformat; |
210 | long freeformat_framesize; |
218 | long freeformat_framesize; |
Line 237... | Line 245... | ||
237 | unsigned int bitreservoir; |
245 | unsigned int bitreservoir; |
238 | unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */ |
246 | unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */ |
239 | unsigned char *bsbuf; |
247 | unsigned char *bsbuf; |
240 | unsigned char *bsbufold; |
248 | unsigned char *bsbufold; |
241 | int bsnum; |
249 | int bsnum; |
- | 250 | /* That is the header matching the last read frame body. */ |
|
242 | unsigned long oldhead; |
251 | unsigned long oldhead; |
- | 252 | /* That is the header that is supposedly the first of the stream. */ |
|
243 | unsigned long firsthead; |
253 | unsigned long firsthead; |
244 | int abr_rate; |
254 | int abr_rate; |
245 | #ifdef FRAME_INDEX |
255 | #ifdef FRAME_INDEX |
246 | struct frame_index index; |
256 | struct frame_index index; |
247 | #endif |
257 | #endif |
Line 255... | Line 265... | ||
255 | int to_ignore; /* the same, somehow */ |
265 | int to_ignore; /* the same, somehow */ |
256 | off_t firstframe; /* start decoding from here */ |
266 | off_t firstframe; /* start decoding from here */ |
257 | off_t lastframe; /* last frame to decode (for gapless or num_frames limit) */ |
267 | off_t lastframe; /* last frame to decode (for gapless or num_frames limit) */ |
258 | off_t ignoreframe; /* frames to decode but discard before firstframe */ |
268 | off_t ignoreframe; /* frames to decode but discard before firstframe */ |
259 | #ifdef GAPLESS |
269 | #ifdef GAPLESS |
- | 270 | off_t gapless_frames; /* frame count for the gapless part */ |
|
260 | off_t firstoff; /* number of samples to ignore from firstframe */ |
271 | off_t firstoff; /* number of samples to ignore from firstframe */ |
261 | off_t lastoff; /* number of samples to use from lastframe */ |
272 | off_t lastoff; /* number of samples to use from lastframe */ |
262 | off_t begin_s; /* overall begin offset in samples */ |
273 | off_t begin_s; /* overall begin offset in samples */ |
263 | off_t begin_os; |
274 | off_t begin_os; |
264 | off_t end_s; /* overall end offset in samples */ |
275 | off_t end_s; /* overall end offset in samples */ |
265 | off_t end_os; |
276 | off_t end_os; |
- | 277 | off_t fullend_os; /* gapless_frames translated to output samples */ |
|
266 | #endif |
278 | #endif |
267 | unsigned int crc; /* Well, I need a safe 16bit type, actually. But wider doesn't hurt. */ |
279 | unsigned int crc; /* Well, I need a safe 16bit type, actually. But wider doesn't hurt. */ |
268 | struct reader *rd; /* pointer to the reading functions */ |
280 | struct reader *rd; /* pointer to the reading functions */ |
269 | struct reader_data rdat; /* reader data and state info */ |
281 | struct reader_data rdat; /* reader data and state info */ |
270 | struct mpg123_pars_struct p; |
282 | struct mpg123_pars_struct p; |
Line 279... | Line 291... | ||
279 | mpg123_id3v2 id3v2; |
291 | mpg123_id3v2 id3v2; |
280 | #endif |
292 | #endif |
281 | #ifndef NO_ICY |
293 | #ifndef NO_ICY |
282 | struct icy_meta icy; |
294 | struct icy_meta icy; |
283 | #endif |
295 | #endif |
- | 296 | /* |
|
- | 297 | More variables needed for decoders, layerX.c. |
|
- | 298 | This time it is not about static variables but about the need for alignment which cannot be guaranteed on the stack by certain compilers (Sun Studio). |
|
- | 299 | We do not require the compiler to align stuff for our hand-written assembly. We only hope that it's able to align stuff for SSE and similar ops it generates itself. |
|
- | 300 | */ |
|
- | 301 | /* |
|
- | 302 | Those layer-specific structs could actually share memory, as they are not in use simultaneously. One might allocate on decoder switch, too. |
|
- | 303 | They all reside in one lump of memory (after each other), allocated to layerscratch. |
|
- | 304 | */ |
|
- | 305 | real *layerscratch; |
|
- | 306 | #ifndef NO_LAYER1 |
|
- | 307 | struct |
|
- | 308 | { |
|
- | 309 | real (*fraction)[SBLIMIT]; /* ALIGNED(16) real fraction[2][SBLIMIT]; */ |
|
- | 310 | } layer1; |
|
- | 311 | #endif |
|
- | 312 | #ifndef NO_LAYER2 |
|
- | 313 | struct |
|
- | 314 | { |
|
- | 315 | real (*fraction)[4][SBLIMIT]; /* ALIGNED(16) real fraction[2][4][SBLIMIT] */ |
|
- | 316 | } layer2; |
|
- | 317 | #endif |
|
- | 318 | #ifndef NO_LAYER3 |
|
- | 319 | /* These are significant chunks of memory already... */ |
|
- | 320 | struct |
|
- | 321 | { |
|
- | 322 | real (*hybrid_in)[SBLIMIT][SSLIMIT]; /* ALIGNED(16) real hybridIn[2][SBLIMIT][SSLIMIT]; */ |
|
- | 323 | real (*hybrid_out)[SSLIMIT][SBLIMIT]; /* ALIGNED(16) real hybridOut[2][SSLIMIT][SBLIMIT]; */ |
|
- | 324 | } layer3; |
|
- | 325 | #endif |
|
- | 326 | /* A place for storing additional data for the large file wrapper. |
|
- | 327 | This is cruft! */ |
|
- | 328 | void *wrapperdata; |
|
- | 329 | /* A callback used to properly destruct the wrapper data. */ |
|
- | 330 | void (*wrapperclean)(void*); |
|
284 | }; |
331 | }; |
Line 285... | Line 332... | ||
285 | 332 | ||
286 | /* generic init, does not include dynamic buffers */ |
333 | /* generic init, does not include dynamic buffers */ |
287 | void frame_init(mpg123_handle *fr); |
334 | void frame_init(mpg123_handle *fr); |
Line 326... | Line 373... | ||
326 | #define spf(fr) ((fr)->lay == 1 ? 384 : ((fr)->lay==2 ? 1152 : ((fr)->lsf || (fr)->mpeg25 ? 576 : 1152))) |
373 | #define spf(fr) ((fr)->lay == 1 ? 384 : ((fr)->lay==2 ? 1152 : ((fr)->lsf || (fr)->mpeg25 ? 576 : 1152))) |
Line 327... | Line 374... | ||
327 | 374 | ||
328 | #ifdef GAPLESS |
375 | #ifdef GAPLESS |
329 | /* well, I take that one for granted... at least layer3 */ |
376 | /* well, I take that one for granted... at least layer3 */ |
330 | #define GAPLESS_DELAY 529 |
- | |
331 | /* still fine-tuning the "real music" window... see read_frame */ |
377 | #define GAPLESS_DELAY 529 |
332 | void frame_gapless_init(mpg123_handle *fr, off_t b, off_t e); |
378 | void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip); |
333 | void frame_gapless_realinit(mpg123_handle *fr); |
379 | void frame_gapless_realinit(mpg123_handle *fr); |
334 | void frame_gapless_update(mpg123_handle *mh, off_t total_samples); |
380 | void frame_gapless_update(mpg123_handle *mh, off_t total_samples); |
335 | /*void frame_gapless_position(mpg123_handle* fr); |
381 | /*void frame_gapless_position(mpg123_handle* fr); |
336 | void frame_gapless_bytify(mpg123_handle *fr); |
382 | void frame_gapless_bytify(mpg123_handle *fr); |
337 | void frame_gapless_ignore(mpg123_handle *fr, off_t frames);*/ |
383 | void frame_gapless_ignore(mpg123_handle *fr, off_t frames);*/ |
338 | /* void frame_gapless_buffercheck(mpg123_handle *fr); */ |
384 | /* void frame_gapless_buffercheck(mpg123_handle *fr); */ |
Line -... | Line 385... | ||
- | 385 | #endif |
|
- | 386 | ||
- | 387 | /* Number of samples the decoding of the current frame should yield. */ |
|
339 | #endif |
388 | off_t frame_expect_outsamples(mpg123_handle *fr); |
340 | 389 | ||
Line 341... | Line 390... | ||
341 | /* Skip this frame... do some fake action to get away without actually decoding it. */ |
390 | /* Skip this frame... do some fake action to get away without actually decoding it. */ |
342 | void frame_skip(mpg123_handle *fr); |
391 | void frame_skip(mpg123_handle *fr); |
Line 348... | Line 397... | ||
348 | - get leading frame offset for output sample offset |
397 | - get leading frame offset for output sample offset |
349 | The offsets are "unadjusted"/internal; resampling is being taken care of. |
398 | The offsets are "unadjusted"/internal; resampling is being taken care of. |
350 | */ |
399 | */ |
351 | off_t frame_ins2outs(mpg123_handle *fr, off_t ins); |
400 | off_t frame_ins2outs(mpg123_handle *fr, off_t ins); |
352 | off_t frame_outs(mpg123_handle *fr, off_t num); |
401 | off_t frame_outs(mpg123_handle *fr, off_t num); |
- | 402 | /* This one just computes the expected sample count for _this_ frame. */ |
|
- | 403 | off_t frame_expect_outsampels(mpg123_handle *fr); |
|
353 | off_t frame_offset(mpg123_handle *fr, off_t outs); |
404 | off_t frame_offset(mpg123_handle *fr, off_t outs); |
354 | void frame_set_frameseek(mpg123_handle *fr, off_t fe); |
405 | void frame_set_frameseek(mpg123_handle *fr, off_t fe); |
355 | void frame_set_seek(mpg123_handle *fr, off_t sp); |
406 | void frame_set_seek(mpg123_handle *fr, off_t sp); |
356 | off_t frame_tell_seek(mpg123_handle *fr); |
407 | off_t frame_tell_seek(mpg123_handle *fr); |
357 | /* Take a copy of the Xing VBR TOC for fuzzy seeking. */ |
408 | /* Take a copy of the Xing VBR TOC for fuzzy seeking. */ |
358 | int frame_fill_toc(mpg123_handle *fr, unsigned char* in); |
409 | int frame_fill_toc(mpg123_handle *fr, unsigned char* in); |
359 | - | ||
360 | - | ||
361 | /* adjust volume to current outscale and rva values if wanted */ |
- | |
362 | void do_rva(mpg123_handle *fr); |
- | |
363 | #endif |
410 | #endif>> |