ReactOS 0.4.15-dev-7942-gd23573b
mpg123 library and handle setup
Collaboration diagram for mpg123 library and handle setup:

Modules

 mpg123 error handling
 

Typedefs

typedef struct mpg123_handle_struct mpg123_handle
 

Enumerations

enum  mpg123_parms {
  MPG123_VERBOSE = 0 , MPG123_FLAGS , MPG123_ADD_FLAGS , MPG123_FORCE_RATE ,
  MPG123_DOWN_SAMPLE , MPG123_RVA , MPG123_DOWNSPEED , MPG123_UPSPEED ,
  MPG123_START_FRAME , MPG123_DECODE_FRAMES , MPG123_ICY_INTERVAL , MPG123_OUTSCALE ,
  MPG123_TIMEOUT , MPG123_REMOVE_FLAGS , MPG123_RESYNC_LIMIT , MPG123_INDEX_SIZE ,
  MPG123_PREFRAMES , MPG123_FEEDPOOL , MPG123_FEEDBUFFER , MPG123_FREEFORMAT_SIZE
}
 
enum  mpg123_param_flags {
  MPG123_FORCE_MONO = 0x7 , MPG123_MONO_LEFT = 0x1 , MPG123_MONO_RIGHT = 0x2 , MPG123_MONO_MIX = 0x4 ,
  MPG123_FORCE_STEREO = 0x8 , MPG123_FORCE_8BIT = 0x10 , MPG123_QUIET = 0x20 , MPG123_GAPLESS = 0x40 ,
  MPG123_NO_RESYNC = 0x80 , MPG123_SEEKBUFFER = 0x100 , MPG123_FUZZY = 0x200 , MPG123_FORCE_FLOAT = 0x400 ,
  MPG123_PLAIN_ID3TEXT = 0x800 , MPG123_IGNORE_STREAMLENGTH = 0x1000 , MPG123_SKIP_ID3V2 = 0x2000 , MPG123_IGNORE_INFOFRAME = 0x4000 ,
  MPG123_AUTO_RESAMPLE = 0x8000 , MPG123_PICTURE = 0x10000 , MPG123_NO_PEEK_END = 0x20000 , MPG123_FORCE_SEEKABLE = 0x40000 ,
  MPG123_STORE_RAW_ID3 = 0x80000 , MPG123_FORCE_ENDIAN = 0x100000 , MPG123_BIG_ENDIAN = 0x200000 , MPG123_NO_READAHEAD = 0x400000 ,
  MPG123_FLOAT_FALLBACK = 0x800000 , MPG123_NO_FRANKENSTEIN = 0x1000000
}
 
enum  mpg123_param_rva { MPG123_RVA_OFF = 0 , MPG123_RVA_MIX = 1 , MPG123_RVA_ALBUM = 2 , MPG123_RVA_MAX = MPG123_RVA_ALBUM }
 
enum  mpg123_feature_set {
  MPG123_FEATURE_ABI_UTF8OPEN = 0 , MPG123_FEATURE_OUTPUT_8BIT , MPG123_FEATURE_OUTPUT_16BIT , MPG123_FEATURE_OUTPUT_32BIT ,
  MPG123_FEATURE_INDEX , MPG123_FEATURE_PARSE_ID3V2 , MPG123_FEATURE_DECODE_LAYER1 , MPG123_FEATURE_DECODE_LAYER2 ,
  MPG123_FEATURE_DECODE_LAYER3 , MPG123_FEATURE_DECODE_ACCURATE , MPG123_FEATURE_DECODE_DOWNSAMPLE , MPG123_FEATURE_DECODE_NTOM ,
  MPG123_FEATURE_PARSE_ICY , MPG123_FEATURE_TIMEOUT_READ , MPG123_FEATURE_EQUALIZER , MPG123_FEATURE_MOREINFO ,
  MPG123_FEATURE_OUTPUT_FLOAT32 , MPG123_FEATURE_OUTPUT_FLOAT64
}
 

Functions

MPG123_EXPORT int mpg123_init (void)
 
MPG123_EXPORT void mpg123_exit (void)
 
MPG123_EXPORT mpg123_handlempg123_new (const char *decoder, int *error)
 
MPG123_EXPORT void mpg123_delete (mpg123_handle *mh)
 
MPG123_EXPORT void mpg123_free (void *ptr)
 
MPG123_EXPORT int mpg123_param (mpg123_handle *mh, enum mpg123_parms type, long value, double fvalue)
 
MPG123_EXPORT int mpg123_getparam (mpg123_handle *mh, enum mpg123_parms type, long *value, double *fvalue)
 
MPG123_EXPORT int mpg123_feature (const enum mpg123_feature_set key)
 
MPG123_EXPORT int mpg123_feature2 (int key)
 

Detailed Description

Functions to initialise and shutdown the mpg123 library and handles. The parameters of handles have workable defaults, you only have to tune them when you want to tune something;-) Tip: Use a RVA setting...

Typedef Documentation

◆ mpg123_handle

Opaque structure for the libmpg123 decoder handle. Most functions take a pointer to a mpg123_handle as first argument and operate on its data in an object-oriented manner.

Definition at line 140 of file mpg123.h.

Enumeration Type Documentation

◆ mpg123_feature_set

Feature set available for query with mpg123_feature.

Enumerator
MPG123_FEATURE_ABI_UTF8OPEN 

mpg123 expects path names to be given in UTF-8 encoding instead of plain native.

MPG123_FEATURE_OUTPUT_8BIT 

8bit output

MPG123_FEATURE_OUTPUT_16BIT 

16bit output

MPG123_FEATURE_OUTPUT_32BIT 

32bit output

MPG123_FEATURE_INDEX 

support for building a frame index for accurate seeking

MPG123_FEATURE_PARSE_ID3V2 

id3v2 parsing

MPG123_FEATURE_DECODE_LAYER1 

mpeg layer-1 decoder enabled

MPG123_FEATURE_DECODE_LAYER2 

mpeg layer-2 decoder enabled

MPG123_FEATURE_DECODE_LAYER3 

mpeg layer-3 decoder enabled

MPG123_FEATURE_DECODE_ACCURATE 

accurate decoder rounding

MPG123_FEATURE_DECODE_DOWNSAMPLE 

downsample (sample omit)

MPG123_FEATURE_DECODE_NTOM 

flexible rate decoding

MPG123_FEATURE_PARSE_ICY 

ICY support

MPG123_FEATURE_TIMEOUT_READ 

Reader with timeout (network).

MPG123_FEATURE_EQUALIZER 

tunable equalizer

MPG123_FEATURE_MOREINFO 

more info extraction (for frame analyzer)

MPG123_FEATURE_OUTPUT_FLOAT32 

32 bit float output

MPG123_FEATURE_OUTPUT_FLOAT64 

64 bit float output (usually never)

Definition at line 303 of file mpg123.h.

304{
323};
@ MPG123_FEATURE_INDEX
Definition: mpg123.h:309
@ MPG123_FEATURE_TIMEOUT_READ
Definition: mpg123.h:318
@ MPG123_FEATURE_DECODE_LAYER3
Definition: mpg123.h:313
@ MPG123_FEATURE_DECODE_NTOM
Definition: mpg123.h:316
@ MPG123_FEATURE_EQUALIZER
Definition: mpg123.h:319
@ MPG123_FEATURE_MOREINFO
Definition: mpg123.h:320
@ MPG123_FEATURE_PARSE_ID3V2
Definition: mpg123.h:310
@ MPG123_FEATURE_PARSE_ICY
Definition: mpg123.h:317
@ MPG123_FEATURE_OUTPUT_FLOAT32
Definition: mpg123.h:321
@ MPG123_FEATURE_OUTPUT_32BIT
Definition: mpg123.h:308
@ MPG123_FEATURE_OUTPUT_FLOAT64
Definition: mpg123.h:322
@ MPG123_FEATURE_OUTPUT_8BIT
Definition: mpg123.h:306
@ MPG123_FEATURE_ABI_UTF8OPEN
Definition: mpg123.h:305
@ MPG123_FEATURE_DECODE_ACCURATE
Definition: mpg123.h:314
@ MPG123_FEATURE_DECODE_DOWNSAMPLE
Definition: mpg123.h:315
@ MPG123_FEATURE_DECODE_LAYER2
Definition: mpg123.h:312
@ MPG123_FEATURE_OUTPUT_16BIT
Definition: mpg123.h:307
@ MPG123_FEATURE_DECODE_LAYER1
Definition: mpg123.h:311

◆ mpg123_param_flags

Flag bits for MPG123_FLAGS, use the usual binary or to combine.

Enumerator
MPG123_FORCE_MONO 

0111 Force some mono mode: This is a test bitmask for seeing if any mono forcing is active.

MPG123_MONO_LEFT 

0001 Force playback of left channel only.

MPG123_MONO_RIGHT 

0010 Force playback of right channel only.

MPG123_MONO_MIX 

0100 Force playback of mixed mono.

MPG123_FORCE_STEREO 

1000 Force stereo output.

MPG123_FORCE_8BIT 

00010000 Force 8bit formats.

MPG123_QUIET 

00100000 Suppress any printouts (overrules verbose).

MPG123_GAPLESS 

01000000 Enable gapless decoding (default on if libmpg123 has support).

MPG123_NO_RESYNC 

10000000 Disable resync stream after error.

MPG123_SEEKBUFFER 

000100000000 Enable small buffer on non-seekable streams to allow some peek-ahead (for better MPEG sync).

MPG123_FUZZY 

001000000000 Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC)

MPG123_FORCE_FLOAT 

010000000000 Force floating point output (32 or 64 bits depends on mpg123 internal precision).

MPG123_PLAIN_ID3TEXT 

100000000000 Do not translate ID3 text data to UTF-8. ID3 strings will contain the raw text data, with the first byte containing the ID3 encoding code.

MPG123_IGNORE_STREAMLENGTH 

1000000000000 Ignore any stream length information contained in the stream, which can be contained in a 'TLEN' frame of an ID3v2 tag or a Xing tag

MPG123_SKIP_ID3V2 

10 0000 0000 0000 Do not parse ID3v2 tags, just skip them.

MPG123_IGNORE_INFOFRAME 

100 0000 0000 0000 Do not parse the LAME/Xing info frame, treat it as normal MPEG data.

MPG123_AUTO_RESAMPLE 

1000 0000 0000 0000 Allow automatic internal resampling of any kind (default on if supported). Especially when going lowlevel with replacing output buffer, you might want to unset this flag. Setting MPG123_DOWNSAMPLE or MPG123_FORCE_RATE will override this.

MPG123_PICTURE 

17th bit: Enable storage of pictures from tags (ID3v2 APIC).

MPG123_NO_PEEK_END 

18th bit: Do not seek to the end of the stream in order to probe the stream length and search for the id3v1 field. This also means the file size is unknown unless set using mpg123_set_filesize() and the stream is assumed as non-seekable unless overridden.

MPG123_FORCE_SEEKABLE 

19th bit: Force the stream to be seekable.

MPG123_STORE_RAW_ID3 

store raw ID3 data (even if skipping)

MPG123_FORCE_ENDIAN 

Enforce endianess of output samples. This is not reflected in the format codes. If this flag is set along with MPG123_BIG_ENDIAN, MPG123_ENC_SIGNED16 means s16be, without MPG123_BIG_ENDIAN, it means s16le. Normal operation without MPG123_FORCE_ENDIAN produces output in native byte order.

MPG123_BIG_ENDIAN 

Choose big endian instead of little.

MPG123_NO_READAHEAD 

Disable read-ahead in parser. If you know you provide full frames to the feeder API, this enables decoder output from the first one on, instead of having to wait for the next frame to confirm that the stream is healthy. It also disables free format support unless you provide a frame size using MPG123_FREEFORMAT_SIZE.

MPG123_FLOAT_FALLBACK 

Consider floating point output encoding only after trying other (possibly downsampled) rates and encodings first. This is to support efficient playback where floating point output is only configured for an external resampler, bypassing that resampler when the desired rate can be produced directly. This is enabled by default to be closer to older versions of libmpg123 which did not enable float automatically at all. If disabled, float is considered after the 16 bit default and higher-bit integer encodings for any rate.

MPG123_NO_FRANKENSTEIN 

Disable support for Frankenstein streams (different MPEG streams stiched together). Do not accept serious change of MPEG header inside a single stream. With this flag, the audio output format cannot change during decoding unless you open a new stream. This also stops decoding after an announced end of stream (Info header contained a number of frames and this number has been reached). This makes your MP3 files behave more like ordinary media files with defined structure, rather than stream dumps with some sugar.

Definition at line 211 of file mpg123.h.

212{
213 MPG123_FORCE_MONO = 0x7
214 ,MPG123_MONO_LEFT = 0x1
215 ,MPG123_MONO_RIGHT = 0x2
216 ,MPG123_MONO_MIX = 0x4
217 ,MPG123_FORCE_STEREO = 0x8
218 ,MPG123_FORCE_8BIT = 0x10
219 ,MPG123_QUIET = 0x20
220 ,MPG123_GAPLESS = 0x40
221 ,MPG123_NO_RESYNC = 0x80
222 ,MPG123_SEEKBUFFER = 0x100
223 ,MPG123_FUZZY = 0x200
224 ,MPG123_FORCE_FLOAT = 0x400
225 ,MPG123_PLAIN_ID3TEXT = 0x800
227 ,MPG123_SKIP_ID3V2 = 0x2000
228 ,MPG123_IGNORE_INFOFRAME = 0x4000
229 ,MPG123_AUTO_RESAMPLE = 0x8000
230 ,MPG123_PICTURE = 0x10000
231 ,MPG123_NO_PEEK_END = 0x20000
237 ,MPG123_FORCE_SEEKABLE = 0x40000
238 ,MPG123_STORE_RAW_ID3 = 0x80000
239 ,MPG123_FORCE_ENDIAN = 0x100000
245 ,MPG123_BIG_ENDIAN = 0x200000
246 ,MPG123_NO_READAHEAD = 0x400000
253 ,MPG123_FLOAT_FALLBACK = 0x800000
261 ,MPG123_NO_FRANKENSTEIN = 0x1000000
269};
@ MPG123_IGNORE_STREAMLENGTH
Definition: mpg123.h:226
@ MPG123_FORCE_MONO
Definition: mpg123.h:213
@ MPG123_FUZZY
Definition: mpg123.h:223
@ MPG123_FORCE_FLOAT
Definition: mpg123.h:224
@ MPG123_QUIET
Definition: mpg123.h:219
@ MPG123_NO_RESYNC
Definition: mpg123.h:221
@ MPG123_IGNORE_INFOFRAME
Definition: mpg123.h:228
@ MPG123_MONO_LEFT
Definition: mpg123.h:214
@ MPG123_FORCE_8BIT
Definition: mpg123.h:218
@ MPG123_BIG_ENDIAN
Definition: mpg123.h:245
@ MPG123_PICTURE
Definition: mpg123.h:230
@ MPG123_SEEKBUFFER
Definition: mpg123.h:222
@ MPG123_GAPLESS
Definition: mpg123.h:220
@ MPG123_FORCE_STEREO
Definition: mpg123.h:217
@ MPG123_NO_PEEK_END
Definition: mpg123.h:231
@ MPG123_STORE_RAW_ID3
Definition: mpg123.h:238
@ MPG123_MONO_RIGHT
Definition: mpg123.h:215
@ MPG123_FORCE_SEEKABLE
Definition: mpg123.h:237
@ MPG123_AUTO_RESAMPLE
Definition: mpg123.h:229
@ MPG123_NO_READAHEAD
Definition: mpg123.h:246
@ MPG123_PLAIN_ID3TEXT
Definition: mpg123.h:225
@ MPG123_FORCE_ENDIAN
Definition: mpg123.h:239
@ MPG123_FLOAT_FALLBACK
Definition: mpg123.h:253
@ MPG123_MONO_MIX
Definition: mpg123.h:216
@ MPG123_SKIP_ID3V2
Definition: mpg123.h:227
@ MPG123_NO_FRANKENSTEIN
Definition: mpg123.h:261

◆ mpg123_param_rva

choices for MPG123_RVA

Enumerator
MPG123_RVA_OFF 

RVA disabled (default).

MPG123_RVA_MIX 

Use mix/track/radio gain.

MPG123_RVA_ALBUM 

Use album/audiophile gain

MPG123_RVA_MAX 

The maximum RVA code, may increase in future.

Definition at line 272 of file mpg123.h.

273{
274 MPG123_RVA_OFF = 0
275 ,MPG123_RVA_MIX = 1
276 ,MPG123_RVA_ALBUM = 2
278};
@ MPG123_RVA_MIX
Definition: mpg123.h:275
@ MPG123_RVA_ALBUM
Definition: mpg123.h:276
@ MPG123_RVA_MAX
Definition: mpg123.h:277
@ MPG123_RVA_OFF
Definition: mpg123.h:274

◆ mpg123_parms

Enumeration of the parameters types that it is possible to set/get.

Enumerator
MPG123_VERBOSE 

set verbosity value for enabling messages to stderr, >= 0 makes sense (integer)

MPG123_FLAGS 

set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer)

MPG123_ADD_FLAGS 

add some flags (integer)

MPG123_FORCE_RATE 

when value > 0, force output rate to that value (integer)

MPG123_DOWN_SAMPLE 

0=native rate, 1=half rate, 2=quarter rate (integer)

MPG123_RVA 

one of the RVA choices above (integer)

MPG123_DOWNSPEED 

play a frame N times (integer)

MPG123_UPSPEED 

play every Nth frame (integer)

MPG123_START_FRAME 

start with this frame (skip frames before that, integer)

MPG123_DECODE_FRAMES 

decode only this number of frames (integer)

MPG123_ICY_INTERVAL 

Stream contains ICY metadata with this interval (integer). Make sure to set this before opening a stream.

MPG123_OUTSCALE 

the scale for output samples (amplitude - integer or float according to mpg123 output format, normally integer)

MPG123_TIMEOUT 

timeout for reading from a stream (not supported on win32, integer)

MPG123_REMOVE_FLAGS 

remove some flags (inverse of MPG123_ADD_FLAGS, integer)

MPG123_RESYNC_LIMIT 

Try resync on frame parsing for that many bytes or until end of stream (<0 ... integer). This can enlarge the limit for skipping junk on beginning, too (but not reduce it).

MPG123_INDEX_SIZE 

Set the frame index size (if supported). Values <0 mean that the index is allowed to grow dynamically in these steps (in positive direction, of course) – Use this when you really want a full index with every individual frame.

MPG123_PREFRAMES 

Decode/ignore that many frames in advance for layer 3. This is needed to fill bit reservoir after seeking, for example (but also at least one frame in advance is needed to have all "normal" data for layer 3). Give a positive integer value, please.

MPG123_FEEDPOOL 

For feeder mode, keep that many buffers in a pool to avoid frequent malloc/free. The pool is allocated on mpg123_open_feed(). If you change this parameter afterwards, you can trigger growth and shrinkage during decoding. The default value could change any time. If you care about this, then set it. (integer)

MPG123_FEEDBUFFER 

Minimal size of one internal feeder buffer, again, the default value is subject to change. (integer)

MPG123_FREEFORMAT_SIZE 

Tell the parser a free-format frame size to avoid read-ahead to get it. A value of -1 (default) means that the parser will determine it. The parameter value is applied during decoder setup for a freshly opened stream only.

Definition at line 181 of file mpg123.h.

182{
183 MPG123_VERBOSE = 0,
188 MPG123_RVA,
208};
@ MPG123_VERBOSE
Definition: mpg123.h:183
@ MPG123_UPSPEED
Definition: mpg123.h:190
@ MPG123_TIMEOUT
Definition: mpg123.h:196
@ MPG123_DOWNSPEED
Definition: mpg123.h:189
@ MPG123_START_FRAME
Definition: mpg123.h:191
@ MPG123_DOWN_SAMPLE
Definition: mpg123.h:187
@ MPG123_RESYNC_LIMIT
Definition: mpg123.h:198
@ MPG123_INDEX_SIZE
Definition: mpg123.h:199
@ MPG123_ADD_FLAGS
Definition: mpg123.h:185
@ MPG123_OUTSCALE
Definition: mpg123.h:195
@ MPG123_FREEFORMAT_SIZE
Definition: mpg123.h:203
@ MPG123_ICY_INTERVAL
Definition: mpg123.h:193
@ MPG123_FEEDPOOL
Definition: mpg123.h:201
@ MPG123_FEEDBUFFER
Definition: mpg123.h:202
@ MPG123_REMOVE_FLAGS
Definition: mpg123.h:197
@ MPG123_FLAGS
Definition: mpg123.h:184
@ MPG123_FORCE_RATE
Definition: mpg123.h:186
@ MPG123_DECODE_FRAMES
Definition: mpg123.h:192
@ MPG123_PREFRAMES
Definition: mpg123.h:200
@ MPG123_RVA
Definition: mpg123.h:188

Function Documentation

◆ mpg123_delete()

MPG123_EXPORT void mpg123_delete ( mpg123_handle mh)

Delete handle, mh is either a valid mpg123 handle or NULL.

Parameters
mhhandle

Definition at line 1712 of file libmpg123.c.

1713{
1714 if(mh != NULL)
1715 {
1716 mpg123_close(mh);
1717 frame_exit(mh); /* free buffers in frame */
1718 free(mh); /* free struct; cast? */
1719 }
1720}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
int attribute_align_arg mpg123_close(mpg123_handle *mh)
Definition: libmpg123.c:1694
#define frame_exit
Definition: intsym.h:186

◆ mpg123_exit()

MPG123_EXPORT void mpg123_exit ( void  )

Superfluous Function to close down the mpg123 library. This was created with the thought that there sometime will be cleanup code to be run after library use. This never materialized. You can forget about this function and it is only here for old programs that do call it.

Definition at line 50 of file libmpg123.c.

51{
52 /* nothing yet, but something later perhaps */
53 /* Nope. This is dead space. */
54}

◆ mpg123_feature()

MPG123_EXPORT int mpg123_feature ( const enum mpg123_feature_set  key)

Query libmpg123 features.

Parameters
keyfeature selection
Returns
1 for success, 0 for unimplemented functions

Definition at line 8 of file feature.c.

9{
10 switch(key)
11 {
13#ifdef WANT_WIN32_UNICODE
14 return 1;
15#else
16 return 0;
17#endif /* WANT_WIN32_UNICODE */
18
20#ifdef NO_8BIT
21 return 0;
22#else
23 return 1;
24#endif /* mpg123_output_8bit */
25
27#ifdef NO_16BIT
28 return 0;
29#else
30 return 1;
31#endif /* mpg123_output_16bit */
32
34#ifdef NO_32BIT
35 return 0;
36#else
37 return 1;
38#endif /* mpg123_output_32bit */
39
41#if defined(NO_REAL) || defined(REAL_IS_DOUBLE)
42 return 0;
43#else
44 return 1;
45#endif
46
48#if defined(NO_REAL) || !defined(REAL_IS_DOUBLE)
49 return 0;
50#else
51 return 1;
52#endif
53
55#ifdef NO_ID3V2
56 return 0;
57#else
58 return 1;
59#endif /* NO_ID3V2 */
60
62#ifdef NO_LAYER1
63 return 0;
64#else
65 return 1;
66#endif /* NO_LAYER1 */
67
69#ifdef NO_LAYER2
70 return 0;
71#else
72 return 1;
73#endif /* NO_LAYER2 */
74
76#ifdef NO_LAYER3
77 return 0;
78#else
79 return 1;
80#endif /* NO_LAYER3 */
81
83#ifdef ACCURATE_ROUNDING
84 return 1;
85#else
86 return 0;
87#endif /* ACCURATE_ROUNDING */
88
90#ifdef NO_DOWNSAMPLE
91 return 0;
92#else
93 return 1;
94#endif /* NO_DOWNSAMPLE */
95
97#ifdef NO_NTOM
98 return 0;
99#else
100 return 1;
101#endif /* NO_NTOM */
102
104#ifdef NO_ICY
105 return 0;
106#else
107 return 1;
108#endif /* NO_ICY */
109
111#ifdef FRAME_INDEX
112 return 1;
113#else
114 return 0;
115#endif /* FRAME_INDEX */
117#ifdef TIMEOUT_READ
118 return 1;
119#else
120 return 0;
121#endif
123#ifndef NO_EQUALIZER
124 return 1;
125#else
126 return 0;
127#endif
129#ifndef NO_MOREINFO
130 return 1;
131#else
132 return 0;
133#endif
134
135 default: return 0;
136 }
137}
Definition: copy.c:22

Referenced by mpg123_feature2().

◆ mpg123_feature2()

MPG123_EXPORT int mpg123_feature2 ( int  key)

Query libmpg123 features with better ABI compatibility

This is the same as mpg123_feature(), but this time not using the enum as argument. Compilers don't have to agree on the size of enums and hence they are not safe in public API.

Parameters
keyfeature selection
Returns
1 for success, 0 for unimplemented functions

Definition at line 3 of file feature.c.

4{
5 return mpg123_feature(key);
6}
int attribute_align_arg mpg123_feature(const enum mpg123_feature_set key)
Definition: feature.c:8

◆ mpg123_free()

MPG123_EXPORT void mpg123_free ( void ptr)

Free plain memory allocated within libmpg123. This is for library users that are not sure to use the same underlying memory allocator as libmpg123. It is just a wrapper over free() in the underlying C library.

Definition at line 1722 of file libmpg123.c.

1723{
1724 free(ptr);
1725}
static PVOID ptr
Definition: dispmode.c:27

◆ mpg123_getparam()

MPG123_EXPORT int mpg123_getparam ( mpg123_handle mh,
enum mpg123_parms  type,
long value,
double fvalue 
)

Get a specific parameter, for a specific mpg123_handle. See the mpg123_parms enumeration for a list of available parameters.

Parameters
mhhandle
typeparameter choice
valueinteger value return address
fvaluefloating point value return address
Returns
MPG123_OK on success

Definition at line 268 of file libmpg123.c.

269{
270 int r;
271
272 if(mh == NULL) return MPG123_BAD_HANDLE;
273 r = mpg123_getpar(&mh->p, key, val, fval);
274 if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
275 return r;
276}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLfloat * val
Definition: glext.h:7180
int attribute_align_arg mpg123_getpar(mpg123_pars *mp, enum mpg123_parms key, long *val, double *fval)
Definition: libmpg123.c:278
@ MPG123_BAD_HANDLE
Definition: mpg123.h:393
@ MPG123_ERR
Definition: mpg123.h:382
@ MPG123_OK
Definition: mpg123.h:383
struct mpg123_pars_struct p
Definition: frame.h:289

◆ mpg123_init()

MPG123_EXPORT int mpg123_init ( void  )

Function to initialise the mpg123 library. This should be called once in a non-parallel context. It is not explicitly thread-safe, but repeated/concurrent calls still should be safe as static tables are filled with the same values anyway.

Returns
MPG123_OK if successful, otherwise an error number.

Definition at line 23 of file libmpg123.c.

24{
25 if((sizeof(short) != 2) || (sizeof(long) < 4)) return MPG123_BAD_TYPES;
26
27 if(initialized) return MPG123_OK; /* no need to initialize twice */
28
29#ifndef NO_LAYER12
30 init_layer12(); /* inits also shared tables with layer1 */
31#endif
32#ifndef NO_LAYER3
34#endif
37 initialized = 1;
38#if (defined REAL_IS_FLOAT) && (defined IEEE_FLOAT)
39 /* This is rather pointless but it eases my mind to check that we did
40 not enable the special rounding on a VAX or something. */
41 if(12346 != REAL_TO_SHORT_ACCURATE(12345.67f))
42 {
43 error("Bad IEEE 754 rounding. Re-build libmpg123 properly.");
44 return MPG123_ERR;
45 }
46#endif
47 return MPG123_OK;
48}
@ MPG123_BAD_TYPES
Definition: mpg123.h:398
#define prepare_decode_tables
Definition: intsym.h:166
#define check_decoders
Definition: intsym.h:236
#define init_layer12
Definition: intsym.h:163
#define init_layer3
Definition: intsym.h:160
static int initialized
Definition: libmpg123.c:21
#define error(str)
Definition: mkdosfs.c:1605

◆ mpg123_new()

MPG123_EXPORT mpg123_handle * mpg123_new ( const char decoder,
int error 
)

Create a handle with optional choice of decoder (named by a string, see mpg123_decoders() or mpg123_supported_decoders()). and optional retrieval of an error code to feed to mpg123_plain_strerror(). Optional means: Any of or both the parameters may be NULL.

Parameters
decoderoptional choice of decoder variant (NULL for default)
erroroptional address to store error codes
Returns
Non-NULL pointer to fresh handle when successful.

Definition at line 57 of file libmpg123.c.

58{
59 return mpg123_parnew(NULL, decoder, error);
60}
mpg123_handle attribute_align_arg * mpg123_parnew(mpg123_pars *mp, const char *decoder, int *error)
Definition: libmpg123.c:63

◆ mpg123_param()

MPG123_EXPORT int mpg123_param ( mpg123_handle mh,
enum mpg123_parms  type,
long  value,
double  fvalue 
)

Set a specific parameter, for a specific mpg123_handle, using a parameter type key chosen from the mpg123_parms enumeration, to the specified value.

Parameters
mhhandle
typeparameter choice
valueinteger value
fvaluefloating point value
Returns
MPG123_OK on success

Definition at line 127 of file libmpg123.c.

128{
129 int r;
130
131 if(mh == NULL) return MPG123_BAD_HANDLE;
132 r = mpg123_par(&mh->p, key, val, fval);
133 if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
134 else
135 { /* Special treatment for some settings. */
136#ifdef FRAME_INDEX
138 { /* Apply frame index size and grow property on the fly. */
139 r = frame_index_setup(mh);
140 if(r != MPG123_OK) mh->err = MPG123_INDEX_FAIL;
141 }
142#endif
143#ifndef NO_FEEDER
144 /* Feeder pool size is applied right away, reader will react to that. */
146 bc_poolsize(&mh->rdat.buffer, mh->p.feedpool, mh->p.feedbuffer);
147#endif
148 }
149 return r;
150}
int attribute_align_arg mpg123_par(mpg123_pars *mp, enum mpg123_parms key, long val, double fval)
Definition: libmpg123.c:152
@ MPG123_INDEX_FAIL
Definition: mpg123.h:419
#define frame_index_setup
Definition: intsym.h:188
#define bc_poolsize
Definition: intsym.h:249
struct reader_data rdat
Definition: frame.h:288