#include "mpg123lib_intern.h"
#include "sample.h"
#include "debug.h"
#include "swap_bytes_impl.h"
Go to the source code of this file.
|
static int | good_enc (const int enc) |
|
void attribute_align_arg | mpg123_rates (const long **list, size_t *number) |
|
void attribute_align_arg | mpg123_encodings (const int **list, size_t *number) |
|
int attribute_align_arg | mpg123_encsize (int encoding) |
|
static int | rate2num (mpg123_pars *mp, long r) |
|
static int | enc2num (int encoding) |
|
static int | cap_fit (mpg123_pars *p, struct audioformat *nf, int f0, int f2) |
|
static int | imin (int a, int b) |
|
static int | imax (int a, int b) |
|
static int | enc_chan_fit (mpg123_pars *p, long rate, struct audioformat *nnf, int f0, int f2, int try_float) |
|
int | frame_output_format (mpg123_handle *fr) |
|
int attribute_align_arg | mpg123_format_none (mpg123_handle *mh) |
|
int attribute_align_arg | mpg123_fmt_none (mpg123_pars *mp) |
|
int attribute_align_arg | mpg123_format_all (mpg123_handle *mh) |
|
int attribute_align_arg | mpg123_fmt_all (mpg123_pars *mp) |
|
int attribute_align_arg | mpg123_format2 (mpg123_handle *mh, long rate, int channels, int encodings) |
|
int attribute_align_arg | mpg123_format (mpg123_handle *mh, long rate, int channels, int encodings) |
|
int attribute_align_arg | mpg123_fmt2 (mpg123_pars *mp, long rate, int channels, int encodings) |
|
int attribute_align_arg | mpg123_fmt (mpg123_pars *mp, long rate, int channels, int encodings) |
|
int attribute_align_arg | mpg123_format_support (mpg123_handle *mh, long rate, int encoding) |
|
int attribute_align_arg | mpg123_fmt_support (mpg123_pars *mp, long rate, int encoding) |
|
void | invalidate_format (struct audioformat *af) |
|
off_t | decoder_synth_bytes (mpg123_handle *fr, off_t s) |
|
off_t | samples_to_bytes (mpg123_handle *fr, off_t s) |
|
off_t | bytes_to_samples (mpg123_handle *fr, off_t b) |
|
off_t | outblock_bytes (mpg123_handle *fr, off_t s) |
|
static void | chop_fourth_byte (struct outbuffer *buf) |
|
static void | conv_s32_to_u32 (struct outbuffer *buf) |
|
static void | conv_s16_to_u16 (struct outbuffer *buf) |
|
static void | conv_s16_to_f32 (struct outbuffer *buf) |
|
static void | conv_s16_to_s32 (struct outbuffer *buf) |
|
void | swap_endian (struct outbuffer *buf, int block) |
|
void | postprocess_buffer (mpg123_handle *fr) |
|
◆ ENCRANGE
◆ MPG123_FLOAT_ENC
◆ bytes_to_samples()
Definition at line 570 of file format.c.
571{
572 return b / fr->
af.encsize / fr->
af.channels;
573}
GLboolean GLboolean GLboolean b
◆ cap_fit()
Definition at line 158 of file format.c.
159{
163 if(rn >= 0)
for(
i=f0;
i<
f2;
i++)
164 {
165 if(
p->audio_caps[
c][rn][
i])
166 {
168 return 1;
169 }
170 }
171 return 0;
172}
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
Referenced by enc_chan_fit().
◆ chop_fourth_byte()
Definition at line 590 of file format.c.
591{
592 unsigned char *wpos =
buf->data;
593 unsigned char *rpos =
buf->data;
598 buf->fill = wpos-
buf->data;
599}
GLenum GLuint GLenum GLsizei const GLchar * buf
Referenced by postprocess_buffer().
◆ conv_s16_to_f32()
Definition at line 635 of file format.c.
636{
639 float *
out = (
float*)
buf->data;
641
642
643
645
647 {
649 return;
650 }
651
652
655
657}
GLuint GLuint GLsizei count
GLenum GLenum GLenum GLenum GLenum scale
static float(__cdecl *square_half_float)(float x
Referenced by postprocess_buffer().
◆ conv_s16_to_s32()
◆ conv_s16_to_u16()
◆ conv_s32_to_u32()
◆ decoder_synth_bytes()
Definition at line 558 of file format.c.
559{
560 return s * fr->
af.dec_encsize * fr->
af.channels;
561}
◆ enc2num()
static int enc2num |
( |
int |
encoding | ) |
|
|
static |
◆ enc_chan_fit()
Definition at line 188 of file format.c.
190{
191#define ENCRANGE(range) imax(f0, range[0]), imin(f2, range[1])
195 goto eend;
197 goto eend;
198 if(try_float &&
200 goto eend;
202 goto eend;
203
204
207
209 goto eend;
211 goto eend;
212 if(try_float &&
214 goto eend;
216 goto eend;
218eend:
219 *nnf = nf;
221#undef ENCRANGE
222}
Referenced by frame_output_format().
◆ frame_output_format()
Definition at line 226 of file format.c.
227{
229 int f0=0;
233
235
236
237
238
239
240
242 {
245 }
247 {
248 try_float = 1;
251 }
252
253
256
257
258
259
260
261
262
263
264
265
266
267#ifndef NO_NTOM
269 {
272
273 if(!try_float &&
276
277 merror(
"Unable to set up output format! Constraints: %s%s%liHz."
283
284
286 return -1;
287 }
288#endif
289
292
294 {
296 , f0,
f2, try_float ))
299 , f0,
f2, try_float ))
301 }
302
303 if(!try_float)
304 {
307
309 {
316 }
317 }
318#ifndef NO_NTOM
319
321 {
324 int rrn;
325 if(rn < 0) return 0;
326
330
331 for(
i=f0;
i<
f2;
i++)
for(rrn=rn-1; rrn>=0; --rrn)
334
335 if(!try_float)
336 {
337
341
342 for(
i=f0;
i<
f2;
i++)
for(rrn=rn-1; rrn>=0; --rrn)
345 }
346 }
347#endif
348
349
350 merror(
"Unable to set up output format! Constraints: %s%s%li, %li or %liHz."
356
357
359 return -1;
360
362
363 if(nf.rate == fr->
af.rate && nf.channels == fr->
af.channels && nf.encoding == fr->
af.encoding)
364 {
366 return 0;
367 }
368 else
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
376 if(fr->
af.encsize < 1)
377 {
378 error1(
"Some unknown encoding??? (%i)", fr->
af.encoding);
379
381 return -1;
382 }
383
384#ifdef NO_SYNTH32
385
386
387 if(fr->
af.encsize > 2)
389 else
390 {
391#endif
392 switch(fr->
af.encoding)
393 {
394#ifndef NO_32BIT
399 break;
400#endif
401#ifndef NO_16BIT
404 break;
405#endif
406 default:
407 fr->
af.dec_enc = fr->
af.encoding;
408 }
409#ifdef NO_SYNTH32
410 }
411#endif
413 return 1;
414 }
415}
int attribute_align_arg mpg123_encsize(int encoding)
struct mpg123_pars_struct p
◆ good_enc()
◆ imax()
◆ imin()
◆ invalidate_format()
◆ outblock_bytes()
Definition at line 576 of file format.c.
577{
579 ? 4
580 : (fr->
af.encsize > fr->
af.dec_encsize
582 : fr->
af.dec_encsize);
583 return s * encsize * fr->
af.channels;
584}
◆ postprocess_buffer()
Definition at line 700 of file format.c.
701{
702
703
704
705
706
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 }
762 {
763 if(
764#ifdef WORDS_BIGENDIAN
765 !(
766#endif
768#ifdef WORDS_BIGENDIAN
769 )
770#endif
771 )
773 }
774}
◆ rate2num()
◆ samples_to_bytes()
Definition at line 565 of file format.c.
566{
567 return s * fr->
af.encsize * fr->
af.channels;
568}
◆ swap_endian()
Definition at line 689 of file format.c.
690{
692
694 {
697 }
698}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static void swap_bytes(void *buf, size_t samplesize, size_t samplecount)
static unsigned int block
Referenced by postprocess_buffer().
◆ bufsizeerr
◆ enc_16bit_range
◆ enc_24bit_range
◆ enc_8bit_range
◆ enc_float_range
◆ good_encodings
◆ my_encodings
◆ my_rates
Initial value:=
{
8000, 11025, 12000,
16000, 22050, 24000,
32000, 44100, 48000,
}
Definition at line 33 of file format.c.
Referenced by frame_output_format(), mpg123_rates(), and rate2num().