diff mbox series

[FFmpeg-devel,2/2] lavf/mux: clarify log messages when choosing oformat fails

Message ID 20230330093809.22687-2-anton@khirnov.net
State Accepted
Commit 1d3f7178aee8a4aee8fcea8ba5d03db22e18ba20
Headers show
Series [FFmpeg-devel,1/2] lavf: fall back to a more meaningful log instance name | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov March 30, 2023, 9:38 a.m. UTC
Current log messages talk about 'suitable' output formats. This is
confusing, because it suggests that some formats are suitable, while
others are not, which is not the case.

Also, suggest possible user actions when format cannot be guessed from a
filename.
---
 libavformat/mux.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Stefano Sabatini April 2, 2023, 7:08 p.m. UTC | #1
On date Thursday 2023-03-30 11:38:08 +0200, Anton Khirnov wrote:
> Current log messages talk about 'suitable' output formats. This is
> confusing, because it suggests that some formats are suitable, while
> others are not, which is not the case.
> 
> Also, suggest possible user actions when format cannot be guessed from a
> filename.
> ---
>  libavformat/mux.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 0bc9b6b87d..415bd3948f 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -102,7 +102,7 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat
>          if (format) {
>              oformat = av_guess_format(format, NULL, NULL);
>              if (!oformat) {
> -                av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format);
> +                av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not known.\n", format);
>                  ret = AVERROR(EINVAL);
>                  goto error;
>              }
> @@ -110,8 +110,10 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat
>              oformat = av_guess_format(NULL, filename, NULL);
>              if (!oformat) {
>                  ret = AVERROR(EINVAL);
> -                av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n",
> -                       filename);
> +                av_log(s, AV_LOG_ERROR,
> +                       "Unable to choose an output format for '%s'; "
> +                       "use a standard extension for the filename or specify "
> +                       "the format manually.\n", filename);

LGTM.
diff mbox series

Patch

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 0bc9b6b87d..415bd3948f 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -102,7 +102,7 @@  int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat
         if (format) {
             oformat = av_guess_format(format, NULL, NULL);
             if (!oformat) {
-                av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format);
+                av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not known.\n", format);
                 ret = AVERROR(EINVAL);
                 goto error;
             }
@@ -110,8 +110,10 @@  int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat
             oformat = av_guess_format(NULL, filename, NULL);
             if (!oformat) {
                 ret = AVERROR(EINVAL);
-                av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n",
-                       filename);
+                av_log(s, AV_LOG_ERROR,
+                       "Unable to choose an output format for '%s'; "
+                       "use a standard extension for the filename or specify "
+                       "the format manually.\n", filename);
                 goto error;
             }
         }