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;-).
|MPG123_EXPORT const char *
|mpg123_plain_strerror (int errcode)
|MPG123_EXPORT const char *
|mpg123_strerror (mpg123_handle *mh)
|mpg123_errcode (mpg123_handle *mh)
Functions to get text version of the error numbers and an enumeration of the error codes returned by libmpg123.
Most functions operating on a mpg123_handle simply return MPG123_OK (0) on success and MPG123_ERR (-1) on failure, setting the internal error variable of the handle to the specific error code. If there was not a valid (non-NULL) handle provided to a function operating on one, MPG123_BAD_HANDLE may be returned if this can not be confused with a valid positive return value. Meaning: A function expected to return positive integers on success will always indicate error or a special condition by returning a negative one.
Decoding/seek functions may also return message codes MPG123_DONE, MPG123_NEW_FORMAT and MPG123_NEED_MORE (all negative, see below on how to react). Note that calls to those can be nested, so generally watch out for these codes after initial handle setup. Especially any function that needs information about the current stream to work will try to at least parse the beginning if that did not happen yet.
On a function that is supposed to return MPG123_OK on success and MPG123_ERR on failure, make sure you check for != MPG123_OK, not == MPG123_ERR, as the error code could get more specific in future, or there is just a special message from a decoding routine as indicated above.
Enumeration Type Documentation
Enumeration of the message and error codes and returned by libmpg123 functions.
Message: Track ended. Stop decoding.
Message: Output format will be different on next call. Note that some libmpg123 versions between 1.4.3 and 1.8.0 insist on you calling mpg123_getformat() after getting this message code. Newer verisons behave like advertised: You have the chance to call mpg123_getformat(), but you can also just continue decoding and get your data.
Unable to set up output format!
Invalid channel number specified.
Invalid sample rate specified.
Unable to allocate memory for 16 to 8 converter table!
Bad parameter id!
Bad buffer given – invalid pointer or too small size.
Out of memory – some malloc() failed.
You didn't initialize the library!
Invalid decoder choice.
Invalid mpg123 handle.
Unable to initialize frame buffers (out of memory?).
Invalid RVA mode.
This build doesn't support gapless decoding.
Not enough buffer space.
Incompatible numeric data types.
Bad equalizer band.
Null pointer given where valid storage address needed.
Error reading the stream.
Cannot seek from end (end is not known).
Invalid 'whence' for seek function.
Build does not support stream timeouts.
File access error.
Seek not supported by stream.
No stream opened or no reader callback setup.
Bad parameter handle.
Lost track in bytestream and did not try to resync.
Resync failed to find valid MPEG data.
No 8bit encoding possible.
Stack aligmnent error
NULL input buffer with non-zero size...
Relative seek not possible (screwed up file offset)
You gave a null pointer somewhere where you shouldn't have.
Bad key value given.
No frame index in this build.
Something with frame index went wrong.
Something prevents a proper decoder setup
This feature has not been built into libmpg123.
A bad value has been given, somewhere.
Low-level seek failed.
Custom I/O not prepared.
Offset value overflow during translation of large file API calls – your client program cannot handle that large file.
Some integer overflow.
Floating-point computations work not as expected.
|MPG123_EXPORT const char* mpg123_plain_strerror
Look up error strings given integer code.
errcode integer error code
- string describing what that error error code means
Give string describing what error has occured in the context of handle mh. When a function operating on an mpg123 handle returns MPG123_ERR, you should check for the actual reason via char *errmsg = mpg123_strerror(mh) This function will catch mh == NULL and return the message for MPG123_BAD_HANDLE.
- error message