API documentation for libmpg123, libout123, and libsyn123
Let me emphasize that the policy for the lib*123 family is to always stay backwards compatible -- only additions are planned (and it's not yet planned to change the plans;-).
Classes | |
struct | mpg123_frameinfo |
struct | mpg123_frameinfo2 |
struct | mpg123_moreinfo |
Enumerations | |
enum | mpg123_vbr { MPG123_CBR =0 , MPG123_VBR , MPG123_ABR } |
enum | mpg123_version { MPG123_1_0 =0 , MPG123_2_0 , MPG123_2_5 } |
enum | mpg123_mode { MPG123_M_STEREO =0 , MPG123_M_JOINT , MPG123_M_DUAL , MPG123_M_MONO } |
enum | mpg123_flags { MPG123_CRC =0x1 , MPG123_COPYRIGHT =0x2 , MPG123_PRIVATE =0x4 , MPG123_ORIGINAL =0x8 } |
enum | mpg123_state { MPG123_ACCURATE = 1 , MPG123_BUFFERFILL , MPG123_FRANKENSTEIN , MPG123_FRESH_DECODER , MPG123_ENC_DELAY , MPG123_ENC_PADDING , MPG123_DEC_DELAY } |
Detailed Description
Enumeration Type Documentation
◆ mpg123_vbr
enum mpg123_vbr |
◆ mpg123_version
enum mpg123_version |
◆ mpg123_mode
enum mpg123_mode |
◆ mpg123_flags
enum mpg123_flags |
◆ mpg123_state
enum mpg123_state |
The key values for state information from mpg123_getstate().
Function Documentation
◆ mpg123_info()
MPG123_EXPORT int mpg123_info | ( | mpg123_handle * | mh, |
struct mpg123_frameinfo * | mi | ||
) |
Get frame information about the MPEG audio bitstream and store it in a mpg123_frameinfo structure.
Note that this name is mapped to mpg123_info2() instead unless MPG123_ENUM_API is defined.
- Parameters
-
mh handle mi address of existing frameinfo structure to write to
- Returns
- MPG123_OK on success
◆ mpg123_info2()
MPG123_EXPORT int mpg123_info2 | ( | mpg123_handle * | mh, |
struct mpg123_frameinfo2 * | mi | ||
) |
Get frame information about the MPEG audio bitstream and store it in a mpg123_frameinfo2 structure.
This is actually called instead of mpg123_info() unless MPG123_ENUM_API is defined.
- Parameters
-
mh handle mi address of existing frameinfo structure to write to
- Returns
- MPG123_OK on success
◆ mpg123_set_moreinfo()
MPG123_EXPORT int mpg123_set_moreinfo | ( | mpg123_handle * | mh, |
struct mpg123_moreinfo * | mi | ||
) |
Trigger collection of additional decoder information while decoding.
- Parameters
-
mh handle mi pointer to data storage (NULL to disable collection)
- Returns
- MPG123_OK if the collection was enabled/disabled as desired, MPG123_ERR otherwise (e.g. if the feature is disabled)
◆ mpg123_safe_buffer()
MPG123_EXPORT size_t mpg123_safe_buffer | ( | void | ) |
Get the safe output buffer size for all cases (when you want to replace the internal buffer)
- Returns
- safe buffer size
◆ mpg123_scan()
MPG123_EXPORT int mpg123_scan | ( | mpg123_handle * | mh | ) |
Make a full parsing scan of each frame in the file. ID3 tags are found. An accurate length value is stored. Seek index will be filled. A seek back to current position is performed. At all, this function refuses work when stream is not seekable.
- Parameters
-
mh handle
- Returns
- MPG123_OK on success
◆ mpg123_framelength()
MPG123_EXPORT off_t mpg123_framelength | ( | mpg123_handle * | mh | ) |
Return, if possible, the full (expected) length of current track in MPEG frames.
- Parameters
-
mh handle
- Returns
- length >= 0 or MPG123_ERR if there is no length guess possible.
◆ mpg123_length()
MPG123_EXPORT off_t mpg123_length | ( | mpg123_handle * | mh | ) |
Return, if possible, the full (expected) length of current track in samples (PCM frames).
This relies either on an Info frame at the beginning or a previous call to mpg123_scan() to get the real number of MPEG frames in a file. It will guess based on file size if neither Info frame nor scan data are present. In any case, there is no guarantee that the decoder will not give you more data, for example in case the open file gets appended to during decoding.
- Parameters
-
mh handle
- Returns
- length >= 0 or MPG123_ERR if there is no length guess possible.
◆ mpg123_set_filesize()
MPG123_EXPORT int mpg123_set_filesize | ( | mpg123_handle * | mh, |
off_t | size | ||
) |
Override the value for file size in bytes. Useful for getting sensible track length values in feed mode or for HTTP streams.
- Parameters
-
mh handle size file size in bytes
- Returns
- MPG123_OK on success
◆ mpg123_framelength64()
MPG123_EXPORT int64_t mpg123_framelength64 | ( | mpg123_handle * | mh | ) |
Return, if possible, the full (expected) length of current track in MPEG frames as 64 bit number.
- Parameters
-
mh handle
- Returns
- length >= 0 or MPG123_ERR if there is no length guess possible.
◆ mpg123_length64()
MPG123_EXPORT int64_t mpg123_length64 | ( | mpg123_handle * | mh | ) |
Return, if possible, the full (expected) length of current track in samples (PCM frames) as 64 bit value.
This relies either on an Info frame at the beginning or a previous call to mpg123_scan() to get the real number of MPEG frames in a file. It will guess based on file size if neither Info frame nor scan data are present. In any case, there is no guarantee that the decoder will not give you more data, for example in case the open file gets appended to during decoding.
- Parameters
-
mh handle
- Returns
- length >= 0 or MPG123_ERR if there is no length guess possible.
◆ mpg123_set_filesize64()
MPG123_EXPORT int mpg123_set_filesize64 | ( | mpg123_handle * | mh, |
int64_t | size | ||
) |
Override the 64 bit value for file size in bytes. Useful for getting sensible track length values in feed mode or for HTTP streams.
- Parameters
-
mh handle size file size in bytes
- Returns
- MPG123_OK on success
◆ mpg123_tpf()
MPG123_EXPORT double mpg123_tpf | ( | mpg123_handle * | mh | ) |
Get MPEG frame duration in seconds.
- Parameters
-
mh handle
- Returns
- frame duration in seconds, <0 on error
◆ mpg123_spf()
MPG123_EXPORT int mpg123_spf | ( | mpg123_handle * | mh | ) |
Get MPEG frame duration in samples.
- Parameters
-
mh handle
- Returns
- samples per frame for the most recently parsed frame; <0 on errors
◆ mpg123_clip()
MPG123_EXPORT long mpg123_clip | ( | mpg123_handle * | mh | ) |
Get and reset the clip count.
- Parameters
-
mh handle
- Returns
- count of clipped samples
◆ mpg123_getstate()
MPG123_EXPORT int mpg123_getstate | ( | mpg123_handle * | mh, |
enum mpg123_state | key, | ||
long * | val, | ||
double * | fval | ||
) |
Get various current decoder/stream state information.
Note that this name is mapped to mpg123_getstate2() instead unless MPG123_ENUM_API is defined.
- Parameters
-
mh handle key the key to identify the information to give. val the address to return (long) integer values to fval the address to return floating point values to
- Returns
- MPG123_OK on success
◆ mpg123_getstate2()
MPG123_EXPORT int mpg123_getstate2 | ( | mpg123_handle * | mh, |
int | key, | ||
long * | val, | ||
double * | fval | ||
) |
Get various current decoder/stream state information. No enums.
This is actually called instead of mpg123_getstate() unless MPG123_ENUM_API is defined.
- Parameters
-
mh handle key the key to identify the information to give (enum mpg123_state) val the address to return (long) integer values to fval the address to return floating point values to
- Returns
- MPG123_OK on success