diff mbox

[FFmpeg-devel] ffplay: Mention codec_name if decoder for codec_id could not be found.

Message ID CAB0OVGowSXGf3w6MDNzJJJbhM-pYSBjcpDrtuXYNvfn3K_jNgQ@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos May 28, 2018, 11:07 p.m. UTC
Hi!

Attached patch makes debugging a little easier imo.

Please comment, Carl Eugen

Comments

Marton Balint May 29, 2018, 7:54 a.m. UTC | #1
On Tue, 29 May 2018, Carl Eugen Hoyos wrote:

> Hi!
>
> Attached patch makes debugging a little easier imo.
>
> Please comment, Carl Eugen
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index dcca9c2..f9571d7 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -2578,7 +2578,7 @@ static int stream_component_open(VideoState *is, int stream_index)
>         if (forced_codec_name) av_log(NULL, AV_LOG_WARNING,
>                                       "No codec could be found with name '%s'\n", forced_codec_name);
>         else                   av_log(NULL, AV_LOG_WARNING,
> -                                      "No codec could be found with id %d\n", avctx->codec_id);
> +                                      "No codec could be found with id %d (%s)\n", avctx->codec_id, avcodec_get_name(avctx->codec_id));

Maybe go one step further, and change the error message to

"No decoder could be found for codec %s\n", avcodec_get_name(avctx->codec_id)

I don't see any use for dumping the codec_id, it has no usefulness to the 
end user IMHO.

Regards,
Marton
Carl Eugen Hoyos May 29, 2018, 11:11 p.m. UTC | #2
2018-05-29 9:54 GMT+02:00, Marton Balint <cus@passwd.hu>:
>
>
> On Tue, 29 May 2018, Carl Eugen Hoyos wrote:
>
>> Hi!
>>
>> Attached patch makes debugging a little easier imo.
>>
>> Please comment, Carl Eugen
>>
>> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
>> index dcca9c2..f9571d7 100644
>> --- a/fftools/ffplay.c
>> +++ b/fftools/ffplay.c
>> @@ -2578,7 +2578,7 @@ static int stream_component_open(VideoState *is, int
>> stream_index)
>>         if (forced_codec_name) av_log(NULL, AV_LOG_WARNING,
>>                                       "No codec could be found with name
>> '%s'\n", forced_codec_name);
>>         else                   av_log(NULL, AV_LOG_WARNING,
>> -                                      "No codec could be found with id
>> %d\n", avctx->codec_id);
>> +                                      "No codec could be found with id %d
>> (%s)\n", avctx->codec_id, avcodec_get_name(avctx->codec_id));
>
> Maybe go one step further, and change the error message to
>
> "No decoder could be found for codec %s\n",
> avcodec_get_name(avctx->codec_id)

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From 3fcc0904e3775ed2a7a797bce984f6c7393d5fd6 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Tue, 29 May 2018 00:26:17 +0200
Subject: [PATCH] ffplay: Mention codec_name if decoder for codec_id could not
 be found.

---
 fftools/ffplay.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index dcca9c2..f9571d7 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2578,7 +2578,7 @@  static int stream_component_open(VideoState *is, int stream_index)
         if (forced_codec_name) av_log(NULL, AV_LOG_WARNING,
                                       "No codec could be found with name '%s'\n", forced_codec_name);
         else                   av_log(NULL, AV_LOG_WARNING,
-                                      "No codec could be found with id %d\n", avctx->codec_id);
+                                      "No codec could be found with id %d (%s)\n", avctx->codec_id, avcodec_get_name(avctx->codec_id));
         ret = AVERROR(EINVAL);
         goto fail;
     }
-- 
1.7.10.4