This mail is about a project I have to make FFmpeg's API and infrastructure more convenient. For a common introduction, see this thread: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/274167.html
The way we currently report errors is fine for command-line tools running in
a terminal, but it does not suit GUI applications at all: they will get a
generic error, translated into a vague string like "invalid argument", while
a more precise error message that tells which argument is invalid and how
will go to the log, and disappear in a black-hole like ~/.xsession-errors or
even /dev/null; at best, the application will have registered a log callback
and display the whole log to the user.
I want to add a new API to return an error all at once, something like this:
if (... failure condition...)
return av_error_set(ctx, AVERROR_INVALIDDATA,
"Syntax error in file ${file} line ${line}",
"file", finename,
"line", av_d2str(line),
NULL);
The complete error message will be stored into a pre-allocated AVErrorStatus
structure in the context, and can be then retrieved by the application
using:
av_error_get(ctx, buf);
and displayed to the user in any convenient way (dialog box, HTTP response,
etc.).
For compatibility, av_log(ctx, ...) will not only print to stderr, but also
keep the last line(s) of log in the AVErrorStatus buffer in ctx, so that
code that still does the good old:
av_log(ctx, AV_LOG_ERROR, "Syntax error in file %s line %d\n",
filename, line);
return AVERROR_INVALIDDATA;
will now work ok with av_error_get().
Regards,
--
Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
