[FFmpeg-devel] [RFC] Error code fixes before the Big Bump

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Apr 18 13:35:48 CEST 2011


[adding libav-devel to recipients, as this concerns API/ABI compatibility]

On date Saturday 2011-04-16 19:12:34 +0200, Nicolas George encoded:
> Le septidi 27 germinal, an CCXIX, Stefano Sabatini a écrit :
> > * implement AVERROR_EOF as a libav* specific error code, rather than
> >   mask the EPIPE POSIX error code which has a different semantics
> > 
> > * implement AVERROR_INVALIDDATA as a libav* specific error code (already
> >   implemented but it was controversial), and fix the
> >   AVERROR(EINVAL)/AVERROR_INVALIDDATA conflict
> 
> Seems reasonable.
> 
> > * drop AVERROR_NUMEXPECTED (not very important, but I believe it is a
> >   too much specific error code, so I'd prefer to replace it with
> >   AVERROR(EINVAL)
> 
> A more generic AVERROR_SYNTAX could be possible too.
> 
> > |bumping it to 51 will changes the codes returned by all libs using libavutil
> > |all of them would need to bump major.
> > |i dont think this is reasonable, thus we should undo all error redefinitions
> > |before they become real and debian burns you at the stake
> > 
> > but I don't think this is a real issue (assuming that all the libav*
> > major versions are bumped at the same time), and this is my argument:
> 
> I think the point is precisely in your parentheses: changing the error codes
> requires bumping the major version for all the libraries, not just
> libavutil.
> 

> One thought in passing: If the error codes get changed, it may be a good
> idea to adapt the definition of AVERROR(errno) to something like:
> 
> #define AVERROR(e) (-(e) - 1)
> 
> This would have the benefit that when some old piece of code returns -1
> instead of a meaningful error code, it would not displayed as "Permission
> denied" or whatever errno code is 1 on this particular platform.

I'd prefer to just return the negated POSIX error code, and avoid
other weird mapping.

Possibly we could introduce an AVERROR_GENERIC code and replace -1
with it, not that I like the idea too much.

In attachment an updated patchset.
-- 
FFmpeg = Friendly and Fast Mere Ponderous Emblematic Genius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-error-add-error-code-AVERROR_OPTION_NOT_FOUND-and-us.patch
Type: text/x-diff
Size: 3274 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/f4ea5642/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-error-remove-AVERROR_NUMEXPECTED-at-the-next-major-b.patch
Type: text/x-diff
Size: 2966 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/f4ea5642/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-error-change-AVERROR_EOF-value-at-the-next-major-bum.patch
Type: text/x-diff
Size: 1620 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/f4ea5642/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-error-introduce-a-table-for-mapping-error-codes-and-.patch
Type: text/x-diff
Size: 5995 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/f4ea5642/attachment-0003.bin>


More information about the ffmpeg-devel mailing list