Unverified Commit 51f6ebd3 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Implement ope_strerror()

parent 4f76493c
......@@ -333,6 +333,13 @@ OPE_EXPORT int ope_encoder_flush_header(OggOpusEnc *enc);
*/
OPE_EXPORT int ope_encoder_ctl(OggOpusEnc *enc, int request, ...);
/** Converts an opusenc error code into a human readable string.
*
* @param error Error number
* @returns Error string
*/
OPE_EXPORT const char *ope_strerror(int error);
/** Returns a string representing the version of libopusenc being used at run time.
\return A string describing the version of this library */
OPE_EXPORT const char *ope_get_version_string(void);
......
......@@ -805,6 +805,19 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
return ret;
}
const char *ope_strerror(int error) {
static const char * const ope_error_strings[5] = {
"cannot open file",
"call cannot be made at this point",
"unrecoverable error",
"invalid picture file",
"invalid icon file (pictures of type 1 MUST be 32x32 PNGs)"
};
if (error > -30) return opus_strerror(error+10);
else if (error >= OPE_INVALID_ICON) return ope_error_strings[-error-30];
else return "unknown error";
}
const char *ope_get_version_string(void)
{
return "libopusenc " PACKAGE_VERSION;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment