[FFmpeg-devel] [PATCH] lavu/error: use a sorted table for storing error codes and strings, add test

Stefano Sabatini stefasab at gmail.com
Mon Feb 6 16:20:14 CET 2012

On date Monday 2012-02-06 14:57:05 +0100, Nicolas George encoded:
> L'octidi 18 pluviôse, an CCXX, Stefano Sabatini a écrit :
> > The table is mostly useful for enumerating the available AVERROR* in the
> > test output.
> The idea is interesting, but I find that keeping the table ordered by tag is
> rather bad for readability and maintainability. The table is quite small: a
> simple linear search could be efficient enough.

Updated, output is now:

-1179861752: [BSF_NOT_FOUND] Bitstream filter not found
-558323010: [BUG] Internal bug, should not have happened
-541545794: [BUG2] Internal bug, should not have happened
-1128613112: [DECODER_NOT_FOUND] Decoder not found
-1296385272: [DEMUXER_NOT_FOUND] Demuxer not found
-1129203192: [ENCODER_NOT_FOUND] Encoder not found
-541478725: [EOF] End of file
-1414092869: [EXIT] Immediate exit requested
-1279870712: [FILTER_NOT_FOUND] Filter not found
-1094995529: [INVALIDDATA] Invalid data found when processing input
-1481985528: [MUXER_NOT_FOUND] Muxer not found
-1414549496: [OPTION_NOT_FOUND] Option not found
-1163346256: [PATCHWELCOME] Not yet implemented in FFmpeg, patches welcome
-1330794744: [PROTOCOL_NOT_FOUND] Protocol not found
-1381258232: [STREAM_NOT_FOUND] Stream not found
0: Success
-1: Operation not permitted
-2: No such file or directory
-3: No such process
-4: Interrupted system call
-5: Input/output error

> Also, note that a good compiler can optimize a big switch/case with a
> statically optimized data structure. For example, I look at the assembly
> code for avcodec_get_name produced by gcc -O3, and it looks a lot like a
> binary search.
> As for enumerating all error values, we use a lot AVERROR(errno) codes, even
> that we generate ourselves (I mean: not only do we return AVERROR(errno) to
> forward a system error, but also we write AVERROR(EINVAL) or AVERROR(ENOMEM)
> instead of a custom error code), so the list would always be incomplete.
FFmpeg = Fast and Free Marvellous Political Everlasting Gigant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-error-use-a-table-for-storing-error-codes-and-s.patch
Type: text/x-diff
Size: 5475 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120206/c18ea1c4/attachment.bin>

More information about the ffmpeg-devel mailing list