[FFmpeg-devel] [PATCH] tiff: Return more meaningful error codes

Nicolas George george at nsup.org
Sat Mar 28 19:18:29 CET 2015


L'octidi 8 germinal, an CCXXIII, Carl Eugen Hoyos a écrit :
> -1 seems more correct to me.

-1 is never correct. On Linux (and apparently BSD too), -1 is
AVERROR(EPERM), definitely not what you want.

One libav guy suggested AVERROR_UNKNOWN; in FFmpeg we have AVERROR_EXTERNAL
"Generic error in an external library".

libz has a small list of error codes that can be mapped in a helper
function:

#define Z_STREAM_END    1 -> is this an error?
#define Z_NEED_DICT     2 -> is this an error?
#define Z_ERRNO        (-1) -> AVERROR(errno)
#define Z_STREAM_ERROR (-2) -> AVERROR_INVALIDDATA?
#define Z_DATA_ERROR   (-3) -> AVERROR_INVALIDDATA?
#define Z_MEM_ERROR    (-4) -> AVERROR(ENOMEM)?
#define Z_BUF_ERROR    (-5) -> AVERROR_BUFFER_TOO_SMALL?
#define Z_VERSION_ERROR (-6) -> AVERROR_BUG?

> Can this be reached?
> If yes, please print an error, if not, replace the 
> return with an assert.

I second that.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150328/bd9d32aa/attachment.asc>


More information about the ffmpeg-devel mailing list