ReactOS  0.4.15-dev-1203-g0e5a4d5
libmpg123.c File Reference
#include "mpg123lib_intern.h"
#include "icy2utf8.h"
#include "debug.h"
#include "gapless.h"
#include "sample.h"
#include "parse.h"
Include dependency graph for libmpg123.c:

Go to the source code of this file.

Macros

#define FORCE_ACCURATE
 
#define SEEKFRAME(mh)   ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe)
 
#define track_need_init(mh)   ((mh)->num < 0)
 

Functions

int attribute_align_arg mpg123_init (void)
 
void attribute_align_arg mpg123_exit (void)
 
mpg123_handle attribute_align_argmpg123_new (const char *decoder, int *error)
 
mpg123_handle attribute_align_argmpg123_parnew (mpg123_pars *mp, const char *decoder, int *error)
 
int attribute_align_arg mpg123_decoder (mpg123_handle *mh, const char *decoder)
 
int attribute_align_arg mpg123_param (mpg123_handle *mh, enum mpg123_parms key, long val, double fval)
 
int attribute_align_arg mpg123_par (mpg123_pars *mp, enum mpg123_parms key, long val, double fval)
 
int attribute_align_arg mpg123_getparam (mpg123_handle *mh, enum mpg123_parms key, long *val, double *fval)
 
int attribute_align_arg mpg123_getpar (mpg123_pars *mp, enum mpg123_parms key, long *val, double *fval)
 
int attribute_align_arg mpg123_getstate (mpg123_handle *mh, enum mpg123_state key, long *val, double *fval)
 
int attribute_align_arg mpg123_eq (mpg123_handle *mh, enum mpg123_channels channel, int band, double val)
 
double attribute_align_arg mpg123_geteq (mpg123_handle *mh, enum mpg123_channels channel, int band)
 
int attribute_align_arg mpg123_open (mpg123_handle *mh, const char *path)
 
int open_fixed_pre (mpg123_handle *mh, int channels, int encoding)
 
int open_fixed_post (mpg123_handle *mh, int channels, int encoding)
 
int attribute_align_arg mpg123_open_fixed (mpg123_handle *mh, const char *path, int channels, int encoding)
 
int attribute_align_arg mpg123_open_fd (mpg123_handle *mh, int fd)
 
int attribute_align_arg mpg123_open_handle (mpg123_handle *mh, void *iohandle)
 
int attribute_align_arg mpg123_open_feed (mpg123_handle *mh)
 
int attribute_align_arg mpg123_replace_reader (mpg123_handle *mh, ssize_t(*r_read)(int, void *, size_t), off_t(*r_lseek)(int, off_t, int))
 
int attribute_align_arg mpg123_replace_reader_handle (mpg123_handle *mh, ssize_t(*r_read)(void *, void *, size_t), off_t(*r_lseek)(void *, off_t, int), void(*cleanup)(void *))
 
int decode_update (mpg123_handle *mh)
 
size_t attribute_align_arg mpg123_safe_buffer (void)
 
size_t attribute_align_arg mpg123_outblock (mpg123_handle *mh)
 
static int get_next_frame (mpg123_handle *mh)
 
static int zero_byte (mpg123_handle *fr)
 
static void decode_the_frame (mpg123_handle *fr)
 
int attribute_align_arg mpg123_framebyframe_decode (mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
 
int attribute_align_arg mpg123_framebyframe_next (mpg123_handle *mh)
 
int attribute_align_arg mpg123_decode_frame (mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
 
int attribute_align_arg mpg123_read (mpg123_handle *mh, void *out, size_t size, size_t *done)
 
int attribute_align_arg mpg123_feed (mpg123_handle *mh, const unsigned char *in, size_t size)
 
int attribute_align_arg mpg123_decode (mpg123_handle *mh, const unsigned char *inmemory, size_t inmemsize, void *outmem, size_t outmemsize, size_t *done)
 
long attribute_align_arg mpg123_clip (mpg123_handle *mh)
 
static int init_track (mpg123_handle *mh)
 
int attribute_align_arg mpg123_info (mpg123_handle *mh, struct mpg123_frameinfo *mi)
 
int attribute_align_arg mpg123_getformat2 (mpg123_handle *mh, long *rate, int *channels, int *encoding, int clear_flag)
 
int attribute_align_arg mpg123_getformat (mpg123_handle *mh, long *rate, int *channels, int *encoding)
 
off_t attribute_align_arg mpg123_timeframe (mpg123_handle *mh, double seconds)
 
off_t attribute_align_arg mpg123_tell (mpg123_handle *mh)
 
off_t attribute_align_arg mpg123_tellframe (mpg123_handle *mh)
 
off_t attribute_align_arg mpg123_tell_stream (mpg123_handle *mh)
 
static int do_the_seek (mpg123_handle *mh)
 
off_t attribute_align_arg mpg123_seek (mpg123_handle *mh, off_t sampleoff, int whence)
 
off_t attribute_align_arg mpg123_feedseek (mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset)
 
off_t attribute_align_arg mpg123_seek_frame (mpg123_handle *mh, off_t offset, int whence)
 
int attribute_align_arg mpg123_set_filesize (mpg123_handle *mh, off_t size)
 
off_t attribute_align_arg mpg123_framelength (mpg123_handle *mh)
 
off_t attribute_align_arg mpg123_length (mpg123_handle *mh)
 
int attribute_align_arg mpg123_scan (mpg123_handle *mh)
 
int attribute_align_arg mpg123_meta_check (mpg123_handle *mh)
 
void attribute_align_arg mpg123_meta_free (mpg123_handle *mh)
 
int attribute_align_arg mpg123_id3 (mpg123_handle *mh, mpg123_id3v1 **v1, mpg123_id3v2 **v2)
 
int attribute_align_arg mpg123_id3_raw (mpg123_handle *mh, unsigned char **v1, size_t *v1_size, unsigned char **v2, size_t *v2_size)
 
int attribute_align_arg mpg123_icy (mpg123_handle *mh, char **icy_meta)
 
char *attribute_align_arg mpg123_icy2utf8 (const char *icy_text)
 
enum mpg123_text_encoding attribute_align_arg mpg123_enc_from_id3 (unsigned char id3_enc_byte)
 
int mpg123_store_utf8 (mpg123_string *sb, enum mpg123_text_encoding enc, const unsigned char *source, size_t source_size)
 
int attribute_align_arg mpg123_index (mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill)
 
int attribute_align_arg mpg123_set_index (mpg123_handle *mh, off_t *offsets, off_t step, size_t fill)
 
int attribute_align_arg mpg123_close (mpg123_handle *mh)
 
void attribute_align_arg mpg123_delete (mpg123_handle *mh)
 
void attribute_align_arg mpg123_free (void *ptr)
 
const char *attribute_align_arg mpg123_plain_strerror (int errcode)
 
int attribute_align_arg mpg123_errcode (mpg123_handle *mh)
 
const char *attribute_align_arg mpg123_strerror (mpg123_handle *mh)
 

Variables

static int initialized = 0
 
static const charmpg123_error []
 

Macro Definition Documentation

◆ FORCE_ACCURATE

#define FORCE_ACCURATE

Definition at line 15 of file libmpg123.c.

◆ SEEKFRAME

#define SEEKFRAME (   mh)    ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe)

Definition at line 19 of file libmpg123.c.

◆ track_need_init

#define track_need_init (   mh)    ((mh)->num < 0)

Definition at line 1074 of file libmpg123.c.

Function Documentation

◆ decode_the_frame()

static void decode_the_frame ( mpg123_handle fr)
static

Definition at line 776 of file libmpg123.c.

777 {
778  size_t needed_bytes = decoder_synth_bytes(fr, frame_expect_outsamples(fr));
779  fr->clip += (fr->do_layer)(fr);
780  /*fprintf(stderr, "frame %"OFF_P": got %"SIZE_P" / %"SIZE_P"\n", fr->num,(size_p)fr->buffer.fill, (size_p)needed_bytes);*/
781  /* There could be less data than promised.
782  Also, then debugging, we look out for coding errors that could result in _more_ data than expected. */
783 #ifdef DEBUG
784  if(fr->buffer.fill != needed_bytes)
785  {
786 #endif
787  if(fr->buffer.fill < needed_bytes)
788  {
789  if(VERBOSE2)
790  fprintf(stderr, "Note: broken frame %li, filling up with %"SIZE_P" zeroes, from %"SIZE_P"\n", (long)fr->num, (size_p)(needed_bytes-fr->buffer.fill), (size_p)fr->buffer.fill);
791 
792  /*
793  One could do a loop with individual samples instead... but zero is zero
794  Actually, that is wrong: zero is mostly a series of null bytes,
795  but we have funny 8bit formats that have a different opinion on zero...
796  Unsigned 16 or 32 bit formats are handled later.
797  */
798  memset( fr->buffer.data + fr->buffer.fill, zero_byte(fr), needed_bytes - fr->buffer.fill );
799 
800  fr->buffer.fill = needed_bytes;
801 #ifndef NO_NTOM
802  /* ntom_val will be wrong when the decoding wasn't carried out completely */
803  ntom_set_ntom(fr, fr->num+1);
804 #endif
805  }
806 #ifdef DEBUG
807  else
808  {
809  if(NOQUIET)
810  error2("I got _more_ bytes than expected (%"SIZE_P" / %"SIZE_P"), that should not be possible!", (size_p)fr->buffer.fill, (size_p)needed_bytes);
811  }
812  }
813 #endif
814  postprocess_buffer(fr);
815 }
#define frame_expect_outsamples
Definition: intsym.h:196
struct outbuffer buffer
Definition: frame.h:267
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define postprocess_buffer
Definition: intsym.h:228
#define decoder_synth_bytes
Definition: intsym.h:224
#define VERBOSE2
static int zero_byte(mpg123_handle *fr)
Definition: libmpg123.c:763
#define error2(s, a, b)
Definition: debug.h:126
int(* do_layer)(mpg123_handle *)
Definition: frame.h:202
unsigned long size_p
Definition: compat.h:140
#define NOQUIET
#define SIZE_P
Definition: compat.h:139
FILE * stderr
#define memset(x, y, z)
Definition: compat.h:39
#define ntom_set_ntom
Definition: intsym.h:32

Referenced by mpg123_decode(), mpg123_decode_frame(), and mpg123_framebyframe_decode().

◆ decode_update()

int decode_update ( mpg123_handle mh)

Definition at line 573 of file libmpg123.c.

574 {
575  long native_rate;
576  int b;
577 
578  if(mh->num < 0)
579  {
580  if(!(mh->p.flags & MPG123_QUIET)) error("decode_update() has been called before reading the first MPEG frame! Internal programming error.");
581 
583  return MPG123_ERR;
584  }
585 
587  native_rate = frame_freq(mh);
588 
589  b = frame_output_format(mh); /* Select the new output format based on given constraints. */
590  if(b < 0) return MPG123_ERR;
591 
592  if(b == 1) mh->new_format = 1; /* Store for later... */
593 
594  debug3("updating decoder structure with native rate %li and af.rate %li (new format: %i)", native_rate, mh->af.rate, mh->new_format);
595  if(mh->af.rate == native_rate) mh->down_sample = 0;
596  else if(mh->af.rate == native_rate>>1) mh->down_sample = 1;
597  else if(mh->af.rate == native_rate>>2) mh->down_sample = 2;
598  else mh->down_sample = 3; /* flexible (fixed) rate */
599  switch(mh->down_sample)
600  {
601  case 0:
602  case 1:
603  case 2:
605  /* With downsampling I get less samples per frame */
606  mh->outblock = outblock_bytes(mh, (mh->spf>>mh->down_sample));
607  break;
608 #ifndef NO_NTOM
609  case 3:
610  {
611  if(synth_ntom_set_step(mh) != 0) return -1;
612  if(frame_freq(mh) > mh->af.rate)
613  {
614  mh->down_sample_sblimit = SBLIMIT * mh->af.rate;
615  mh->down_sample_sblimit /= frame_freq(mh);
616  if(mh->down_sample_sblimit < 1)
617  mh->down_sample_sblimit = 1;
618  }
619  else mh->down_sample_sblimit = SBLIMIT;
620  mh->outblock = outblock_bytes(mh,
621  ( ( NTOM_MUL-1+mh->spf
622  * (((size_t)NTOM_MUL*mh->af.rate)/frame_freq(mh))
623  )/NTOM_MUL ));
624  }
625  break;
626 #endif
627  }
628 
629  if(!(mh->p.flags & MPG123_FORCE_MONO))
630  {
631  if(mh->af.channels == 1) mh->single = SINGLE_MIX;
632  else mh->single = SINGLE_STEREO;
633  }
634  else mh->single = (mh->p.flags & MPG123_FORCE_MONO)-1;
635  if(set_synth_functions(mh) != 0) return -1;;
636 
637  /* The needed size of output buffer may have changed. */
638  if(frame_outbuffer(mh) != MPG123_OK) return -1;
639 
640  do_rva(mh);
641  debug3("done updating decoder structure with native rate %li and af.rate %li and down_sample %i", frame_freq(mh), mh->af.rate, mh->down_sample);
642 
643  mh->decoder_change = 0;
644  return 0;
645 }
struct mpg123_pars_struct p
Definition: frame.h:289
#define error(str)
Definition: mkdosfs.c:1605
#define SINGLE_STEREO
Definition: frame.h:188
#define SBLIMIT
#define NTOM_MUL
Definition: decode.h:32
#define outblock_bytes
Definition: intsym.h:227
#define debug3(s, a, b, c)
Definition: debug.h:63
#define set_synth_functions
Definition: intsym.h:232
int down_sample_sblimit
Definition: frame.h:194
#define b
Definition: ke_i.h:79
#define frame_outbuffer
Definition: intsym.h:181
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define synth_ntom_set_step
Definition: intsym.h:154
struct audioformat af
Definition: frame.h:268
#define do_rva
Definition: intsym.h:190
#define frame_freq
Definition: intsym.h:239
#define frame_output_format
Definition: intsym.h:182
#define SINGLE_MIX
Definition: frame.h:191

Referenced by do_the_seek(), get_next_frame(), mpg123_decode(), and mpg123_decode_frame().

◆ do_the_seek()

static int do_the_seek ( mpg123_handle mh)
static

Definition at line 1211 of file libmpg123.c.

1212 {
1213  int b;
1214  off_t fnum = SEEKFRAME(mh);
1215  mh->buffer.fill = 0;
1216 
1217  /* If we are inside the ignoreframe - firstframe window, we may get away without actual seeking. */
1218  if(mh->num < mh->firstframe)
1219  {
1220  mh->to_decode = FALSE; /* In any case, don't decode the current frame, perhaps ignore instead. */
1221  if(mh->num > fnum) return MPG123_OK;
1222  }
1223 
1224  /* If we are already there, we are fine either for decoding or for ignoring. */
1225  if(mh->num == fnum && (mh->to_decode || fnum < mh->firstframe)) return MPG123_OK;
1226  /* We have the frame before... just go ahead as normal. */
1227  if(mh->num == fnum-1)
1228  {
1229  mh->to_decode = FALSE;
1230  return MPG123_OK;
1231  }
1232 
1233  /* OK, real seeking follows... clear buffers and go for it. */
1234  frame_buffers_reset(mh);
1235 #ifndef NO_NTOM
1236  if(mh->down_sample == 3)
1237  {
1238  ntom_set_ntom(mh, fnum);
1239  debug3("fixed ntom for frame %"OFF_P" to %lu, num=%"OFF_P, (off_p)fnum, mh->ntom_val[0], (off_p)mh->num);
1240  }
1241 #endif
1242  b = mh->rd->seek_frame(mh, fnum);
1243  if(mh->header_change > 1)
1244  {
1245  if(decode_update(mh) < 0) return MPG123_ERR;
1246  mh->header_change = 0;
1247  }
1248  debug1("seek_frame returned: %i", b);
1249  if(b<0) return b;
1250  /* Only mh->to_ignore is TRUE. */
1251  if(mh->num < mh->firstframe) mh->to_decode = FALSE;
1252 
1253  mh->playnum = mh->num;
1254  return 0;
1255 }
int decode_update(mpg123_handle *mh)
Definition: libmpg123.c:573
__kernel_off_t off_t
Definition: linux.h:201
struct outbuffer buffer
Definition: frame.h:267
#define debug3(s, a, b, c)
Definition: debug.h:63
#define FALSE
Definition: types.h:117
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned long ntom_val[2]
Definition: frame.h:149
#define SEEKFRAME(mh)
Definition: libmpg123.c:19
#define frame_buffers_reset
Definition: intsym.h:185
long off_p
Definition: compat.h:132
struct reader * rd
Definition: frame.h:287
#define debug1(s, a)
Definition: debug.h:61
#define OFF_P
Definition: compat.h:131
#define ntom_set_ntom
Definition: intsym.h:32

Referenced by mpg123_seek(), and mpg123_seek_frame().

◆ get_next_frame()

static int get_next_frame ( mpg123_handle mh)
static

Definition at line 662 of file libmpg123.c.

663 {
664  int change = mh->decoder_change;
665  /* Ensure we got proper decoder for ignoring frames.
666  Header can be changed from seeking around. But be careful: Only after at
667  least one frame got read, decoder update makes sense. */
668  if(mh->header_change > 1 && mh->num >= 0)
669  {
670  change = 1;
671  mh->header_change = 0;
672  debug("starting with big header change");
673  if(decode_update(mh) < 0)
674  return MPG123_ERR;
675  }
676 
677  do
678  {
679  int b;
680  /* Decode & discard some frame(s) before beginning. */
681  if(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe)
682  {
683  debug1("ignoring frame %li", (long)mh->num);
684  /* Decoder structure must be current! decode_update has been called before... */
685  (mh->do_layer)(mh); mh->buffer.fill = 0;
686 #ifndef NO_NTOM
687  /* The ignored decoding may have failed. Make sure ntom stays consistent. */
688  if(mh->down_sample == 3) ntom_set_ntom(mh, mh->num+1);
689 #endif
690  mh->to_ignore = mh->to_decode = FALSE;
691  }
692  /* Read new frame data; possibly breaking out here for MPG123_NEED_MORE. */
693  debug("read frame");
694  mh->to_decode = FALSE;
695  b = read_frame(mh); /* That sets to_decode only if a full frame was read. */
696  debug4("read of frame %li returned %i (to_decode=%i) at sample %li", (long)mh->num, b, mh->to_decode, (long)mpg123_tell(mh));
697  if(b == MPG123_NEED_MORE) return MPG123_NEED_MORE; /* need another call with data */
698  else if(b <= 0)
699  {
700  /* More sophisticated error control? */
701  if(b==0 || (mh->rdat.filelen >= 0 && mh->rdat.filepos == mh->rdat.filelen))
702  { /* We simply reached the end. */
703  mh->track_frames = mh->num + 1;
704  debug("What about updating/checking gapless sample count here?");
705  return MPG123_DONE;
706  }
707  else return MPG123_ERR; /* Some real error. */
708  }
709  /* Now, there should be new data to decode ... and also possibly new stream properties */
710  if(mh->header_change > 1 || mh->decoder_change)
711  {
712  debug("big header or decoder change");
713  change = 1;
714  mh->header_change = 0;
715  /* Need to update decoder structure right away since frame might need to
716  be decoded on next loop iteration for properly ignoring its output. */
717  if(decode_update(mh) < 0)
718  return MPG123_ERR;
719  }
720  /* Now some accounting: Look at the numbers and decide if we want this frame. */
721  ++mh->playnum;
722  /* Plain skipping without decoding, only when frame is not ignored on next cycle. */
723  if(mh->num < mh->firstframe || (mh->p.doublespeed && (mh->playnum % mh->p.doublespeed)))
724  {
725  if(!(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe))
726  {
727  frame_skip(mh);
728  /* Should one fix NtoM here or not?
729  It is not work the trouble for doublespeed, but what with leading frames? */
730  }
731  }
732  /* Or, we are finally done and have a new frame. */
733  else break;
734  } while(1);
735 
736  /* If we reach this point, we got a new frame ready to be decoded.
737  All other situations resulted in returns from the loop. */
738  if(change)
739  {
740  if(mh->fresh)
741  {
742 #ifdef GAPLESS
743  int b=0;
744  /* Prepare offsets for gapless decoding. */
745  debug1("preparing gapless stuff with native rate %li", frame_freq(mh));
747  frame_set_frameseek(mh, mh->num);
748 #endif
749  mh->fresh = 0;
750 #ifdef GAPLESS
751  /* Could this possibly happen? With a real big gapless offset... */
752  if(mh->num < mh->firstframe) b = get_next_frame(mh);
753  if(b < 0) return b; /* Could be error, need for more, new format... */
754 #endif
755  }
756  }
757  return MPG123_OK;
758 }
int decode_update(mpg123_handle *mh)
Definition: libmpg123.c:573
struct mpg123_pars_struct p
Definition: frame.h:289
off_t attribute_align_arg mpg123_tell(mpg123_handle *mh)
Definition: libmpg123.c:1164
#define debug4(s, a, b, c, d)
Definition: debug.h:64
struct outbuffer buffer
Definition: frame.h:267
struct reader_data rdat
Definition: frame.h:288
#define frame_skip
Definition: intsym.h:197
off_t track_frames
Definition: frame.h:246
#define FALSE
Definition: types.h:117
#define b
Definition: ke_i.h:79
int(* do_layer)(mpg123_handle *)
Definition: frame.h:202
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
void frame_gapless_realinit(mpg123_handle *fr)
#define read_frame
Definition: intsym.h:241
static int get_next_frame(mpg123_handle *mh)
Definition: libmpg123.c:662
#define frame_set_frameseek
Definition: intsym.h:202
#define debug(msg)
Definition: key_call.c:71
#define frame_freq
Definition: intsym.h:239
#define debug1(s, a)
Definition: debug.h:61
#define ntom_set_ntom
Definition: intsym.h:32

Referenced by init_track(), mpg123_decode(), mpg123_decode_frame(), and mpg123_framebyframe_next().

◆ init_track()

static int init_track ( mpg123_handle mh)
static

Definition at line 1076 of file libmpg123.c.

1077 {
1078  if(track_need_init(mh))
1079  {
1080  /* Fresh track, need first frame for basic info. */
1081  int b = get_next_frame(mh);
1082  if(b < 0) return b;
1083  }
1084  return 0;
1085 }
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static int get_next_frame(mpg123_handle *mh)
Definition: libmpg123.c:662
#define track_need_init(mh)
Definition: libmpg123.c:1074

Referenced by mpg123_feedseek(), mpg123_framelength(), mpg123_getformat2(), mpg123_info(), mpg123_length(), mpg123_scan(), mpg123_seek(), mpg123_seek_frame(), and mpg123_timeframe().

◆ open_fixed_post()

int open_fixed_post ( mpg123_handle mh,
int  channels,
int  encoding 
)

Definition at line 480 of file libmpg123.c.

481 {
482  if(!mh)
483  return MPG123_BAD_HANDLE;
484  long rate;
485  int err = mpg123_getformat(mh, &rate, &channels, &encoding);
486  if(err == MPG123_OK)
487  err = mpg123_format_none(mh);
488  if(err == MPG123_OK)
490  if(err == MPG123_OK)
491  {
492  if(mh->track_frames < 1 && (mh->rdat.flags & READER_SEEKABLE))
493  {
494  debug("open_fixed_post: scan because we can seek and do not know track_frames");
495  err = mpg123_scan(mh);
496  }
497  }
498  if(err != MPG123_OK)
499  mpg123_close(mh);
500  return err;
501 }
#define READER_SEEKABLE
Definition: reader.h:115
int attribute_align_arg mpg123_getformat(mpg123_handle *mh, long *rate, int *channels, int *encoding)
Definition: libmpg123.c:1141
int This channels
Definition: rdpsnd_libao.c:37
int rate
Definition: pcmconverter.c:97
struct reader_data rdat
Definition: frame.h:288
off_t track_frames
Definition: frame.h:246
int attribute_align_arg mpg123_close(mpg123_handle *mh)
Definition: libmpg123.c:1694
MPG123_EXPORT int mpg123_format(mpg123_handle *mh, long rate, int channels, int encodings)
Definition: format.c:475
MPG123_EXPORT int mpg123_format_none(mpg123_handle *mh)
Definition: format.c:417
#define err(...)
ed encoding
Definition: write.c:2825
int attribute_align_arg mpg123_scan(mpg123_handle *mh)
Definition: libmpg123.c:1461
#define debug(msg)
Definition: key_call.c:71

Referenced by mpg123_open_fixed().

◆ open_fixed_pre()

int open_fixed_pre ( mpg123_handle mh,
int  channels,
int  encoding 
)

Definition at line 469 of file libmpg123.c.

470 {
471  if(!mh)
472  return MPG123_BAD_HANDLE;
473  mh->p.flags |= MPG123_NO_FRANKENSTEIN;
474  int err = mpg123_format_none(mh);
475  if(err == MPG123_OK)
476  err = mpg123_format2(mh, 0, channels, encoding);
477  return err;
478 }
struct mpg123_pars_struct p
Definition: frame.h:289
int This channels
Definition: rdpsnd_libao.c:37
MPG123_EXPORT int mpg123_format_none(mpg123_handle *mh)
Definition: format.c:417
#define err(...)
ed encoding
Definition: write.c:2825
MPG123_EXPORT int mpg123_format2(mpg123_handle *mh, long rate, int channels, int encodings)
Definition: format.c:464

Referenced by mpg123_open_fixed().

◆ zero_byte()

static int zero_byte ( mpg123_handle fr)
static

Definition at line 763 of file libmpg123.c.

764 {
765 #ifndef NO_8BIT
766  return fr->af.encoding & MPG123_ENC_8 ? fr->conv16to8[0] : 0;
767 #else
768  return 0; /* All normal signed formats have the zero here (even in byte form -- that may be an assumption for your funny machine...). */
769 #endif
770 }
unsigned char * conv16to8
Definition: frame.h:135
struct audioformat af
Definition: frame.h:268

Referenced by decode_the_frame(), test_trailing_slash(), and test_urlcacheA().

Variable Documentation

◆ initialized

int initialized = 0
static

Definition at line 21 of file libmpg123.c.

Referenced by mpg123_init(), and mpg123_parnew().

◆ mpg123_error

const char* mpg123_error[]
static

Definition at line 1727 of file libmpg123.c.

Referenced by mpg123_plain_strerror().