[FFmpeg-devel] [RFC] Advanced Error Codes
Michael Niedermayer
michael at niedermayer.cc
Wed Jul 2 20:16:41 EEST 2025
Hi Nicolas
On Wed, Jul 02, 2025 at 04:52:58PM +0200, Nicolas George wrote:
> Michael Niedermayer (HE12025-07-02):
> > People are asking for better error codes
>
> I have little time just now, but I think it is important to clarify:
>
> - Error CODES are for when the program must react specifically to a
> certain kind of error condition:
>
> if (ret == AVERROR(EAGAIN)) …
>
> - Error MESSAGES are to say to the user what went wrong.
>
> There is a confusion because error codes also serve as stock error
> messages.
its a bit fuzzy, for example
AVERROR(EAGAIN) is for the program
but AVERROR_PATCHWELCOME is for the developer
while AVERROR_PROTOCOL_NOT_FOUND is for the one building the lib
and a EOF is for the one supplying the input file
>
> I think what we need is better error messages and accompanying
> reporting. I have a lot of thoughts about this, I will comment when I
> have more time. (Spoiler: it depends on AVWriter.)
The av_log() messages work for a specific use case, that is
command line tools and for advanced users and developers who are not
intimidated by going through log files.
AND have the time to go through the log files
They do not work that well in many cases
Consider this:
* You want to make a list of all "failure to decode" reasons of h264 files
- The current error codes are useless (always INVALIDDATA), the messages
come without synchronization from multiple threads, its not possible
to reliably pick the root failure reason out of these for a decode()
caller
+ With what i suggested, this is solved, you get a int64 code, you can look
it up and you know what the cause of the failure was, in what source file and
location it was and so on
* A GUI Player or Transcoder hits an error
- The current error codes are useless (maybe INVALIDDATA again)
maybe the GUI can present the user with a log window, but the last 3 might not
be the relevant error messages
+ With what i suggested, you get a int64 code, you can look
it up and you know what the cause of the failure was, in what source file and
location it was, what URL caused it maybe and so on and the GUI can
take this and cleanly present it to the user in a error message box
[will send 2nd mail to keep this clearer]
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250702/6e755a5a/attachment.sig>
More information about the ffmpeg-devel
mailing list