API documentation for libmpg123 and libout123
Let me emphasize that the policy for libmpg123 and libout123 is to always stay backwards compatible -- only additions are planned (and it's not yet planned to change the plans;-).
|typedef struct mpg123_handle_struct||mpg123_handle|
|MPG123_EXPORT int||mpg123_init (void)|
|MPG123_EXPORT void||mpg123_exit (void)|
|MPG123_EXPORT mpg123_handle *||mpg123_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)|
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 struct mpg123_handle_struct mpg123_handle|
Enumeration Type Documentation
Enumeration of the parameters types that it is possible to set/get.
set verbosity value for enabling messages to stderr, >= 0 makes sense (integer)
set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer)
add some flags (integer)
when value > 0, force output rate to that value (integer)
0=native rate, 1=half rate, 2=quarter rate (integer)
one of the RVA choices above (integer)
play a frame N times (integer)
play every Nth frame (integer)
start with this frame (skip frames before that, integer)
decode only this number of frames (integer)
Stream contains ICY metadata with this interval (integer). Make sure to set this before opening a stream.
the scale for output samples (amplitude - integer or float according to mpg123 output format, normally integer)
timeout for reading from a stream (not supported on win32, integer)
remove some flags (inverse of MPG123_ADD_FLAGS, integer)
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).
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.
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.
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)
Minimal size of one internal feeder buffer, again, the default value is subject to change. (integer)
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.
Flag bits for MPG123_FLAGS, use the usual binary or to combine.
0111 Force some mono mode: This is a test bitmask for seeing if any mono forcing is active.
0001 Force playback of left channel only.
0010 Force playback of right channel only.
0100 Force playback of mixed mono.
1000 Force stereo output.
00010000 Force 8bit formats.
00100000 Suppress any printouts (overrules verbose).
01000000 Enable gapless decoding (default on if libmpg123 has support).
10000000 Disable resync stream after error.
000100000000 Enable small buffer on non-seekable streams to allow some peek-ahead (for better MPEG sync).
001000000000 Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC)
010000000000 Force floating point output (32 or 64 bits depends on mpg123 internal precision).
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.
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
10 0000 0000 0000 Do not parse ID3v2 tags, just skip them.
100 0000 0000 0000 Do not parse the LAME/Xing info frame, treat it as normal MPEG data.
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.
17th bit: Enable storage of pictures from tags (ID3v2 APIC).
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.
19th bit: Force the stream to be seekable.
store raw ID3 data (even if skipping)
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.
Choose big endian instead of little.
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.
Feature set available for query with mpg123_feature.
|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.
- MPG123_OK if successful, otherwise an error number.
|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.
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.
decoder optional choice of decoder variant (NULL for default) error optional address to store error codes
- Non-NULL pointer to fresh handle when successful.
Delete handle, mh is either a valid mpg123 handle or NULL.
|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.
|MPG123_EXPORT int mpg123_param||(||mpg123_handle *||mh,|
Set a specific parameter, for a specific mpg123_handle, using a parameter type key chosen from the mpg123_parms enumeration, to the specified value.
mh handle type parameter choice value integer value fvalue floating point value
- MPG123_OK on success
|MPG123_EXPORT int mpg123_getparam||(||mpg123_handle *||mh,|
Get a specific parameter, for a specific mpg123_handle. See the mpg123_parms enumeration for a list of available parameters.
mh handle type parameter choice value integer value return address fvalue floating point value return address
- MPG123_OK on success