ReactOS 0.4.15-dev-8241-g63935f8
format.c
Go to the documentation of this file.
1/*
2 format: routines to deal with audio (output) format
3
4 copyright 2008-20 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by Thomas Orgis, starting with parts of the old audio.c, with only faintly manage to show now
7
8 A Major change from mpg123 <= 1.18 is that all encodings are only really
9 disabled when done so via specific build configuration. Otherwise, the
10 missing support of decoders to produce a certain format is augmented by
11 postprocessing that converts the samples. This means happily creating
12 data with higher resolution from less accurate decoder output.
13
14 The main point is to still offer float encoding when the decoding core uses
15 a fixed point representation that has only 16 bit output. Actually, that's
16 the only point: A fixed-point build needs to create float from 16 bit, also
17 32 or 24 bit from the same source. That's all there is to it: Everything else
18 is covered by fallback synth functions. It may be a further step to check if
19 there are cases where conversion in postprocessing works well enough to omit
20 a certain specialized decoder ... but usually, they are justified by some
21 special way to get from float to integer to begin with.
22
23 I won't cover the case of faking double output with float/s16 decoders here.
24 Double precision output is a thing for experimental builds anyway. Mostly
25 theoretical and without a point.
26*/
27
28#include "mpg123lib_intern.h"
29#include "sample.h"
30#include "debug.h"
31
32/* static int chans[NUM_CHANNELS] = { 1 , 2 }; */
33static const long my_rates[MPG123_RATES] = /* only the standard rates */
34{
35 8000, 11025, 12000,
36 16000, 22050, 24000,
37 32000, 44100, 48000,
38};
39
40static const int my_encodings[MPG123_ENCODINGS] =
41{
48 /* Floating point range, see below. */
51 /* 8 bit range, see below. */
56};
57
58/* Make that match the above table.
59 And yes, I still don't like this kludgy stuff. */
60/* range[0] <= i < range[1] for forced floating point */
61static const int enc_float_range[2] = { 6, 8 };
62/* same for 8 bit encodings */
63static const int enc_8bit_range[2] = { 8, 12 };
64// for 24 bit quality (24 and 32 bit integers)
65static const int enc_24bit_range[2] = { 2, 6 };
66// for completeness, the 16 bits
67static const int enc_16bit_range[2] = { 0, 2};
68
69/*
70 Only one type of float is supported.
71 Actually, double is a very special experimental case not occuring in normal
72 builds. Might actually get rid of it.
73
74 Remember here: Also with REAL_IS_FIXED, I want to be able to produce float
75 output (f32) via post-processing.
76*/
77# ifdef REAL_IS_DOUBLE
78# define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_64
79# else
80# define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_32
81# endif
82
83/* The list of actually possible encodings. */
84static const int good_encodings[] =
85{
86#ifndef NO_16BIT
89#endif
90#ifndef NO_32BIT
95#endif
96#ifndef NO_REAL
98#endif
99#ifndef NO_8BIT
104#endif
105};
106
107/* Check if encoding is a valid one in this build.
108 ...lazy programming: linear search. */
109static int good_enc(const int enc)
110{
111 size_t i;
112 for(i=0; i<sizeof(good_encodings)/sizeof(int); ++i)
113 if(enc == good_encodings[i]) return TRUE;
114
115 return FALSE;
116}
117
118void attribute_align_arg mpg123_rates(const long **list, size_t *number)
119{
120 if(list != NULL) *list = my_rates;
121 if(number != NULL) *number = sizeof(my_rates)/sizeof(long);
122}
123
124/* Now that's a bit tricky... One build of the library knows only a subset of the encodings. */
126{
127 if(list != NULL) *list = good_encodings;
128 if(number != NULL) *number = sizeof(good_encodings)/sizeof(int);
129}
130
132{
134}
135
136/* char audio_caps[NUM_CHANNELS][MPG123_RATES+1][MPG123_ENCODINGS]; */
137
138static int rate2num(mpg123_pars *mp, long r)
139{
140 int i;
141 for(i=0;i<MPG123_RATES;i++) if(my_rates[i] == r) return i;
142#ifndef NO_NTOM
143 if(mp && mp->force_rate != 0 && mp->force_rate == r) return MPG123_RATES;
144#endif
145
146 return -1;
147}
148
149static int enc2num(int encoding)
150{
151 int i;
152 for(i=0;i<MPG123_ENCODINGS;++i)
153 if(my_encodings[i] == encoding) return i;
154
155 return -1;
156}
157
158static int cap_fit(mpg123_pars *p, struct audioformat *nf, int f0, int f2)
159{
160 int i;
161 int c = nf->channels-1;
162 int rn = rate2num(p, nf->rate);
163 if(rn >= 0) for(i=f0;i<f2;i++)
164 {
165 if(p->audio_caps[c][rn][i])
166 {
167 nf->encoding = my_encodings[i];
168 return 1;
169 }
170 }
171 return 0;
172}
173
174static int imin(int a, int b)
175{
176 return a < b ? a : b;
177}
178
179static int imax(int a, int b)
180{
181 return a > b ? a : b;
182}
183
184// Find a possible encoding with given rate and channel count,
185// try differing channel count, too.
186// This updates the given format and returns TRUE if an encoding
187// was found.
188static int enc_chan_fit( mpg123_pars *p, long rate, struct audioformat *nnf
189, int f0, int f2, int try_float )
190{
191#define ENCRANGE(range) imax(f0, range[0]), imin(f2, range[1])
192 struct audioformat nf = *nnf;
193 nf.rate = rate;
195 goto eend;
197 goto eend;
198 if(try_float &&
200 goto eend;
201 if(cap_fit(p, &nf, ENCRANGE(enc_8bit_range)))
202 goto eend;
203
204 /* try again with different stereoness */
205 if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1;
206 else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2;
207
209 goto eend;
211 goto eend;
212 if(try_float &&
214 goto eend;
215 if(cap_fit(p, &nf, ENCRANGE(enc_8bit_range)))
216 goto eend;
217 return FALSE;
218eend:
219 *nnf = nf;
220 return TRUE;
221#undef ENCRANGE
222}
223
224/* match constraints against supported audio formats, store possible setup in frame
225 return: -1: error; 0: no format change; 1: format change */
227{
228 struct audioformat nf;
229 int f0=0;
230 int f2=MPG123_ENCODINGS+1; // Include all encodings by default.
231 mpg123_pars *p = &fr->p;
232 int try_float = (p->flags & MPG123_FLOAT_FALLBACK) ? 0 : 1;
233 /* initialize new format, encoding comes later */
234 nf.channels = fr->stereo;
235
236 // I intended the forcing stuff to be weaved into the format support table,
237 // but this probably will never happen, as this would change library behaviour.
238 // One could introduce an additional effective format table that takes for
239 // forcings into account, but that would have to be updated on any flag
240 // change. Tedious.
241 if(p->flags & MPG123_FORCE_8BIT)
242 {
243 f0 = enc_8bit_range[0];
244 f2 = enc_8bit_range[1];
245 }
246 if(p->flags & MPG123_FORCE_FLOAT)
247 {
248 try_float = 1;
249 f0 = enc_float_range[0];
250 f2 = enc_float_range[1];
251 }
252
253 /* force stereo is stronger */
254 if(p->flags & MPG123_FORCE_MONO) nf.channels = 1;
255 if(p->flags & MPG123_FORCE_STEREO) nf.channels = 2;
256
257 // Strategy update: Avoid too early triggering of the NtoM decoder.
258 // Main target is the native rate, with any encoding.
259 // Then, native rate with any channel count and any encoding.
260 // Then, it's down_sample from native rate.
261 // As last resort: NtoM rate.
262 // So the priority is 1. rate 2. channels 3. encoding.
263 // As encodings go, 16 bit is tranditionally preferred as efficient choice.
264 // Next in line are wider float and integer encodings, then 8 bit as
265 // last resort.
266
267#ifndef NO_NTOM
268 if(p->force_rate)
269 {
270 if(enc_chan_fit(p, p->force_rate, &nf, f0, f2, try_float))
271 goto end;
272 // Keep the order consistent if float is considered fallback only.
273 if(!try_float &&
274 enc_chan_fit(p, p->force_rate, &nf, f0, f2, TRUE))
275 goto end;
276
277 merror( "Unable to set up output format! Constraints: %s%s%liHz."
278 , ( p->flags & MPG123_FORCE_STEREO ? "stereo, " :
279 (p->flags & MPG123_FORCE_MONO ? "mono, " : "") )
280 , ( p->flags & MPG123_FORCE_FLOAT ? "float, " :
281 (p->flags & MPG123_FORCE_8BIT ? "8bit, " : "") )
282 , p->force_rate );
283/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
284
286 return -1;
287 }
288#endif
289 // Native decoder rate first.
290 if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, try_float))
291 goto end;
292 // Then downsamplings.
293 if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
294 {
295 if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
296 , f0, f2, try_float ))
297 goto end;
298 if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
299 , f0, f2, try_float ))
300 goto end;
301 }
302 // And again the whole deal with float fallback.
303 if(!try_float)
304 {
305 if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, TRUE))
306 goto end;
307 // Then downsamplings.
308 if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
309 {
310 if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
311 , f0, f2, TRUE ))
312 goto end;
313 if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
314 , f0, f2, TRUE ))
315 goto end;
316 }
317 }
318#ifndef NO_NTOM
319 // Try to find any rate that works and resample using NtoM hackery.
320 if( p->flags & MPG123_AUTO_RESAMPLE && fr->p.down_sample == 0)
321 {
322 int i;
323 int rn = rate2num(p, frame_freq(fr));
324 int rrn;
325 if(rn < 0) return 0;
326 /* Try higher rates first. */
327 for(rrn=rn+1; rrn<MPG123_RATES; ++rrn)
328 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, try_float))
329 goto end;
330 /* Then lower rates. */
331 for(i=f0;i<f2;i++) for(rrn=rn-1; rrn>=0; --rrn)
332 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, try_float))
333 goto end;
334 // And again for float fallback.
335 if(!try_float)
336 {
337 /* Try higher rates first. */
338 for(rrn=rn+1; rrn<MPG123_RATES; ++rrn)
339 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, TRUE))
340 goto end;
341 /* Then lower rates. */
342 for(i=f0;i<f2;i++) for(rrn=rn-1; rrn>=0; --rrn)
343 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, TRUE))
344 goto end;
345 }
346 }
347#endif
348
349 /* Here is the _bad_ end. */
350 merror( "Unable to set up output format! Constraints: %s%s%li, %li or %liHz."
351 , ( p->flags & MPG123_FORCE_STEREO ? "stereo, " :
352 (p->flags & MPG123_FORCE_MONO ? "mono, " : "") )
353 , ( p->flags & MPG123_FORCE_FLOAT ? "float, " :
354 (p->flags & MPG123_FORCE_8BIT ? "8bit, " : "") )
355 , frame_freq(fr), frame_freq(fr)>>1, frame_freq(fr)>>2 );
356/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
357
359 return -1;
360
361end: /* Here is the _good_ end. */
362 /* we had a successful match, now see if there's a change */
363 if(nf.rate == fr->af.rate && nf.channels == fr->af.channels && nf.encoding == fr->af.encoding)
364 {
365 debug2("Old format with %i channels, and FORCE_MONO=%li", nf.channels, p->flags & MPG123_FORCE_MONO);
366 return 0; /* the same format as before */
367 }
368 else /* a new format */
369 {
370 debug1("New format with %i channels!", nf.channels);
371 fr->af.rate = nf.rate;
372 fr->af.channels = nf.channels;
373 fr->af.encoding = nf.encoding;
374 /* Cache the size of one sample in bytes, for ease of use. */
375 fr->af.encsize = mpg123_encsize(fr->af.encoding);
376 if(fr->af.encsize < 1)
377 {
378 error1("Some unknown encoding??? (%i)", fr->af.encoding);
379
381 return -1;
382 }
383 /* Set up the decoder synth format. Might differ. */
384#ifdef NO_SYNTH32
385 /* Without high-precision synths, 16 bit signed is the basis for
386 everything higher than 8 bit. */
387 if(fr->af.encsize > 2)
388 fr->af.dec_enc = MPG123_ENC_SIGNED_16;
389 else
390 {
391#endif
392 switch(fr->af.encoding)
393 {
394#ifndef NO_32BIT
398 fr->af.dec_enc = MPG123_ENC_SIGNED_32;
399 break;
400#endif
401#ifndef NO_16BIT
403 fr->af.dec_enc = MPG123_ENC_SIGNED_16;
404 break;
405#endif
406 default:
407 fr->af.dec_enc = fr->af.encoding;
408 }
409#ifdef NO_SYNTH32
410 }
411#endif
412 fr->af.dec_encsize = mpg123_encsize(fr->af.dec_enc);
413 return 1;
414 }
415}
416
418{
419 int r;
420 if(mh == NULL) return MPG123_BAD_HANDLE;
421
422 r = mpg123_fmt_none(&mh->p);
423 if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
424
425 return r;
426}
427
429{
430 if(mp == NULL) return MPG123_BAD_PARS;
431
432 if(PVERB(mp,3)) fprintf(stderr, "Note: Disabling all formats.\n");
433
434 memset(mp->audio_caps,0,sizeof(mp->audio_caps));
435 return MPG123_OK;
436}
437
439{
440 int r;
441 if(mh == NULL) return MPG123_BAD_HANDLE;
442
443 r = mpg123_fmt_all(&mh->p);
444 if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
445
446 return r;
447}
448
450{
451 size_t rate, ch, enc;
452 if(mp == NULL) return MPG123_BAD_PARS;
453
454 if(PVERB(mp,3)) fprintf(stderr, "Note: Enabling all formats.\n");
455
456 for(ch=0; ch < NUM_CHANNELS; ++ch)
457 for(rate=0; rate < MPG123_RATES+1; ++rate)
458 for(enc=0; enc < MPG123_ENCODINGS; ++enc)
459 mp->audio_caps[ch][rate][enc] = good_enc(my_encodings[enc]) ? 1 : 0;
460
461 return MPG123_OK;
462}
463
465{
466 int r;
467 if(mh == NULL) return MPG123_BAD_HANDLE;
468 r = mpg123_fmt2(&mh->p, rate, channels, encodings);
469 if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
470
471 return r;
472}
473
474// Keep old behaviour.
476{
477 int r;
478 if(mh == NULL) return MPG123_BAD_HANDLE;
479 r = mpg123_fmt(&mh->p, rate, channels, encodings);
480 if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
481
482 return r;
483}
484
485int attribute_align_arg mpg123_fmt2(mpg123_pars *mp, long rate, int channels, int encodings)
486{
487 int ie, ic, ratei, r1, r2;
488 int ch[2] = {0, 1};
489 if(mp == NULL) return MPG123_BAD_PARS;
491
492 if(PVERB(mp,3)) fprintf(stderr, "Note: Want to enable format %li/%i for encodings 0x%x.\n", rate, channels, encodings);
493
494 if(!(channels & MPG123_STEREO)) ch[1] = 0; /* {0,0} */
495 else if(!(channels & MPG123_MONO)) ch[0] = 1; /* {1,1} */
496 if(rate)
497 {
498 r1 = rate2num(mp, rate);
499 r2 = r1+1;
500 }
501 else
502 {
503 r1 = 0;
504 r2 = MPG123_RATES+1; /* including forced rate */
505 }
506
507 if(r1 < 0) return MPG123_BAD_RATE;
508
509 /* now match the encodings */
510 for(ratei = r1; ratei < r2; ++ratei)
511 for(ic = 0; ic < 2; ++ic)
512 {
513 for(ie = 0; ie < MPG123_ENCODINGS; ++ie)
514 if(good_enc(my_encodings[ie]) && ((my_encodings[ie] & encodings) == my_encodings[ie]))
515 mp->audio_caps[ch[ic]][ratei][ie] = 1;
516
517 if(ch[0] == ch[1]) break; /* no need to do it again */
518 }
519
520 return MPG123_OK;
521}
522
523// Keep old behaviour, error on rate=0.
524int attribute_align_arg mpg123_fmt(mpg123_pars *mp, long rate, int channels, int encodings)
525{
526 return (rate == 0)
528 : mpg123_fmt2(mp, rate, channels, encodings);
529}
530
532{
533 if(mh == NULL) return 0;
534 else return mpg123_fmt_support(&mh->p, rate, encoding);
535}
536
538{
539 int ch = 0;
540 int ratei, enci;
541 ratei = rate2num(mp, rate);
542 enci = enc2num(encoding);
543 if(mp == NULL || ratei < 0 || enci < 0) return 0;
544 if(mp->audio_caps[0][ratei][enci]) ch |= MPG123_MONO;
545 if(mp->audio_caps[1][ratei][enci]) ch |= MPG123_STEREO;
546 return ch;
547}
548
549/* Call this one to ensure that any valid format will be something different than this. */
551{
552 af->encoding = 0;
553 af->rate = 0;
554 af->channels = 0;
555}
556
557/* Number of bytes the decoder produces. */
559{
560 return s * fr->af.dec_encsize * fr->af.channels;
561}
562
563/* Samples/bytes for output buffer after post-processing. */
564/* take into account: channels, bytes per sample -- NOT resampling!*/
566{
567 return s * fr->af.encsize * fr->af.channels;
568}
569
571{
572 return b / fr->af.encsize / fr->af.channels;
573}
574
575/* Number of bytes needed for decoding _and_ post-processing. */
577{
578 int encsize = (fr->af.encoding & MPG123_ENC_24)
579 ? 4 /* Intermediate 32 bit. */
580 : (fr->af.encsize > fr->af.dec_encsize
581 ? fr->af.encsize
582 : fr->af.dec_encsize);
583 return s * encsize * fr->af.channels;
584}
585
586#ifndef NO_32BIT
587
588/* Remove every fourth byte, facilitating conversion from 32 bit to 24 bit integers.
589 This has to be aware of endianness, of course. */
590static void chop_fourth_byte(struct outbuffer *buf)
591{
592 unsigned char *wpos = buf->data;
593 unsigned char *rpos = buf->data;
594 size_t blocks = buf->fill/4;
595 size_t i;
596 for(i=0; i<blocks; ++i,wpos+=3,rpos+=4)
597 DROP4BYTE(wpos, rpos)
598 buf->fill = wpos-buf->data;
599}
600
601static void conv_s32_to_u32(struct outbuffer *buf)
602{
603 size_t i;
604 int32_t *ssamples = (int32_t*) buf->data;
605 uint32_t *usamples = (uint32_t*) buf->data;
606 size_t count = buf->fill/sizeof(int32_t);
607
608 for(i=0; i<count; ++i)
609 usamples[i] = CONV_SU32(ssamples[i]);
610}
611
612#endif
613
614
615/* We always assume that whole numbers are written!
616 partials will be cut out. */
617
618static const char *bufsizeerr = "Fatal: Buffer too small for postprocessing!";
619
620
621#ifndef NO_16BIT
622
623static void conv_s16_to_u16(struct outbuffer *buf)
624{
625 size_t i;
626 int16_t *ssamples = (int16_t*) buf->data;
627 uint16_t *usamples = (uint16_t*)buf->data;
628 size_t count = buf->fill/sizeof(int16_t);
629
630 for(i=0; i<count; ++i)
631 usamples[i] = CONV_SU16(ssamples[i]);
632}
633
634#ifndef NO_REAL
635static void conv_s16_to_f32(struct outbuffer *buf)
636{
637 ssize_t i;
638 int16_t *in = (int16_t*) buf->data;
639 float *out = (float*) buf->data;
640 size_t count = buf->fill/sizeof(int16_t);
641 /* Does that make any sense? In x86, there is an actual instruction to divide
642 float by integer ... but then, if we have that FPU, we don't really need
643 fixed point decoder hacks ...? */
644 float scale = 1./SHORT_SCALE;
645
646 if(buf->size < count*sizeof(float))
647 {
648 error1("%s", bufsizeerr);
649 return;
650 }
651
652 /* Work from the back since output is bigger. */
653 for(i=count-1; i>=0; --i)
654 out[i] = (float)in[i] * scale;
655
656 buf->fill = count*sizeof(float);
657}
658#endif
659
660#ifndef NO_32BIT
661static void conv_s16_to_s32(struct outbuffer *buf)
662{
663 ssize_t i;
664 int16_t *in = (int16_t*) buf->data;
665 int32_t *out = (int32_t*) buf->data;
666 size_t count = buf->fill/sizeof(int16_t);
667
668 if(buf->size < count*sizeof(int32_t))
669 {
670 error1("%s", bufsizeerr);
671 return;
672 }
673
674 /* Work from the back since output is bigger. */
675 for(i=count-1; i>=0; --i)
676 {
677 out[i] = in[i];
678 /* Could just shift bytes, but would have to mess with sign bit. */
679 out[i] *= S32_RESCALE;
680 }
681
682 buf->fill = count*sizeof(int32_t);
683}
684#endif
685#endif
686
687#include "swap_bytes_impl.h"
688
689void swap_endian(struct outbuffer *buf, int block)
690{
691 size_t count;
692
693 if(block >= 2)
694 {
695 count = buf->fill/(unsigned int)block;
696 swap_bytes(buf->data, (size_t)block, count);
697 }
698}
699
701{
702 /*
703 This caters for the final output formats that are never produced by
704 decoder synth directly (wide unsigned and 24 bit formats) or that are
705 missing because of limited decoder precision (16 bit synth but 32 or
706 24 bit output).
707 */
708 switch(fr->af.dec_enc)
709 {
710#ifndef NO_32BIT
712 switch(fr->af.encoding)
713 {
716 break;
720 break;
723 break;
724 }
725 break;
726#endif
727#ifndef NO_16BIT
729 switch(fr->af.encoding)
730 {
733 break;
734#ifndef NO_REAL
737 break;
738#endif
739#ifndef NO_32BIT
742 break;
746 break;
751 break;
755 break;
756#endif
757 }
758 break;
759#endif
760 }
761 if(fr->p.flags & MPG123_FORCE_ENDIAN)
762 {
763 if(
764#ifdef WORDS_BIGENDIAN
765 !(
766#endif
767 fr->p.flags & MPG123_BIG_ENDIAN
768#ifdef WORDS_BIGENDIAN
769 )
770#endif
771 )
772 swap_endian(&fr->buffer, mpg123_encsize(fr->af.encoding));
773 }
774}
#define attribute_align_arg
Definition: abi_align.h:30
unsigned short int uint16_t
Definition: acefiex.h:54
Definition: list.h:37
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
INT32 int32_t
Definition: types.h:71
UINT32 uint32_t
Definition: types.h:75
INT16 int16_t
Definition: types.h:70
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
__kernel_off_t off_t
Definition: linux.h:201
#define NUM_CHANNELS
Definition: frame.h:72
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint in
Definition: glext.h:9616
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int attribute_align_arg mpg123_fmt2(mpg123_pars *mp, long rate, int channels, int encodings)
Definition: format.c:485
int attribute_align_arg mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding)
Definition: format.c:537
int attribute_align_arg mpg123_fmt_all(mpg123_pars *mp)
Definition: format.c:449
int attribute_align_arg mpg123_fmt_none(mpg123_pars *mp)
Definition: format.c:428
#define MPG123_SAMPLESIZE(enc)
Definition: fmt123.h:101
@ MPG123_ENC_UNSIGNED_32
Definition: fmt123.h:72
@ MPG123_ENC_SIGNED_16
Definition: fmt123.h:58
@ MPG123_ENC_ULAW_8
Definition: fmt123.h:66
@ MPG123_ENC_UNSIGNED_24
Definition: fmt123.h:76
@ MPG123_ENC_SIGNED_24
Definition: fmt123.h:74
@ MPG123_ENC_SIGNED_8
Definition: fmt123.h:64
@ MPG123_ENC_FLOAT_64
Definition: fmt123.h:80
@ MPG123_ENC_24
Definition: fmt123.h:50
@ MPG123_ENC_ALAW_8
Definition: fmt123.h:68
@ MPG123_ENC_SIGNED_32
Definition: fmt123.h:70
@ MPG123_ENC_UNSIGNED_16
Definition: fmt123.h:60
@ MPG123_ENC_UNSIGNED_8
Definition: fmt123.h:62
@ MPG123_ENC_FLOAT_32
Definition: fmt123.h:78
@ MPG123_BAD_CHANNEL
Definition: mpg123.h:385
@ MPG123_BAD_PARS
Definition: mpg123.h:408
@ MPG123_BAD_HANDLE
Definition: mpg123.h:393
@ MPG123_BAD_OUTFORMAT
Definition: mpg123.h:384
@ MPG123_ERR
Definition: mpg123.h:382
@ MPG123_OK
Definition: mpg123.h:383
@ MPG123_BAD_RATE
Definition: mpg123.h:386
@ MPG123_FORCE_MONO
Definition: mpg123.h:213
@ MPG123_FORCE_FLOAT
Definition: mpg123.h:224
@ MPG123_FORCE_8BIT
Definition: mpg123.h:218
@ MPG123_BIG_ENDIAN
Definition: mpg123.h:245
@ MPG123_FORCE_STEREO
Definition: mpg123.h:217
@ MPG123_AUTO_RESAMPLE
Definition: mpg123.h:229
@ MPG123_FORCE_ENDIAN
Definition: mpg123.h:239
@ MPG123_FLOAT_FALLBACK
Definition: mpg123.h:253
int attribute_align_arg mpg123_format2(mpg123_handle *mh, long rate, int channels, int encodings)
Definition: format.c:464
int attribute_align_arg mpg123_format_all(mpg123_handle *mh)
Definition: format.c:438
int attribute_align_arg mpg123_format_none(mpg123_handle *mh)
Definition: format.c:417
void attribute_align_arg mpg123_encodings(const int **list, size_t *number)
Definition: format.c:125
void attribute_align_arg mpg123_rates(const long **list, size_t *number)
Definition: format.c:118
int attribute_align_arg mpg123_format(mpg123_handle *mh, long rate, int channels, int encodings)
Definition: format.c:475
int attribute_align_arg mpg123_format_support(mpg123_handle *mh, long rate, int encoding)
Definition: format.c:531
int attribute_align_arg mpg123_encsize(int encoding)
Definition: format.c:131
@ MPG123_STEREO
Definition: mpg123.h:518
@ MPG123_MONO
Definition: mpg123.h:517
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define invalidate_format
Definition: intsym.h:178
#define frame_freq
Definition: intsym.h:239
#define decoder_synth_bytes
Definition: intsym.h:224
#define bytes_to_samples
Definition: intsym.h:226
#define samples_to_bytes
Definition: intsym.h:225
#define outblock_bytes
Definition: intsym.h:227
#define postprocess_buffer
Definition: intsym.h:228
#define frame_output_format
Definition: intsym.h:182
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
static int blocks
Definition: mkdosfs.c:527
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
static unsigned int number
Definition: dsound.c:1479
static float(__cdecl *square_half_float)(float x
#define S32_RESCALE
#define MPG123_RATES
#define PVERB(mp, level)
#define MPG123_ENCODINGS
#define SHORT_SCALE
#define int32_t
Definition: nsiface.idl:56
#define int16_t
Definition: nsiface.idl:55
int rate
Definition: pcmconverter.c:97
int This channels
Definition: rdpsnd_libao.c:37
static FILE * out
Definition: regtests2xml.c:44
int ssize_t
Definition: rosdhcp.h:48
#define CONV_SU32(s)
Definition: sample.h:155
#define DROP4BYTE(w, r)
Definition: sample.h:191
#define CONV_SU16(s)
Definition: sample.h:164
#define debug1(s, a)
Definition: debug.h:61
#define debug2(s, a, b)
Definition: debug.h:62
#define error1(s, a)
Definition: debug.h:125
#define merror(s,...)
Definition: debug.h:122
static int good_enc(const int enc)
Definition: format.c:109
static const int enc_16bit_range[2]
Definition: format.c:67
static int enc_chan_fit(mpg123_pars *p, long rate, struct audioformat *nnf, int f0, int f2, int try_float)
Definition: format.c:188
void swap_endian(struct outbuffer *buf, int block)
Definition: format.c:689
static void conv_s16_to_s32(struct outbuffer *buf)
Definition: format.c:661
static const int enc_24bit_range[2]
Definition: format.c:65
static void conv_s32_to_u32(struct outbuffer *buf)
Definition: format.c:601
static int enc2num(int encoding)
Definition: format.c:149
static void conv_s16_to_u16(struct outbuffer *buf)
Definition: format.c:623
static const long my_rates[MPG123_RATES]
Definition: format.c:33
static const int good_encodings[]
Definition: format.c:84
static int rate2num(mpg123_pars *mp, long r)
Definition: format.c:138
static int cap_fit(mpg123_pars *p, struct audioformat *nf, int f0, int f2)
Definition: format.c:158
#define MPG123_FLOAT_ENC
Definition: format.c:80
static const int my_encodings[MPG123_ENCODINGS]
Definition: format.c:40
static int imin(int a, int b)
Definition: format.c:174
#define ENCRANGE(range)
static const int enc_8bit_range[2]
Definition: format.c:63
static const char * bufsizeerr
Definition: format.c:618
static void chop_fourth_byte(struct outbuffer *buf)
Definition: format.c:590
static void conv_s16_to_f32(struct outbuffer *buf)
Definition: format.c:635
static const int enc_float_range[2]
Definition: format.c:61
static int imax(int a, int b)
Definition: format.c:179
#define f2(x, y, z)
Definition: sha1.c:31
#define memset(x, y, z)
Definition: compat.h:39
int encoding
Definition: frame.h:50
int channels
Definition: frame.h:54
int encsize
Definition: frame.h:51
long rate
Definition: frame.h:55
struct mpg123_pars_struct p
Definition: frame.h:289
struct audioformat af
Definition: frame.h:268
struct outbuffer buffer
Definition: frame.h:267
long force_rate
Definition: frame.h:65
char audio_caps[NUM_CHANNELS][MPG123_RATES+1][MPG123_ENCODINGS]
Definition: frame.h:73
static void swap_bytes(void *buf, size_t samplesize, size_t samplecount)
static char * encoding
Definition: xmllint.c:155
static unsigned int block
Definition: xmlmemory.c:101