[FFmpeg-devel,V2,2/5] fftools/ffprobe: fix max_bit_rate dump.

Submitted by Jun Zhao on Nov. 21, 2018, 1:01 a.m.

Details

Message ID 1542762104-15897-3-git-send-email-mypopydev@gmail.com
State Superseded
Headers show

Commit Message

Jun Zhao Nov. 21, 2018, 1:01 a.m.
‘codec’ is deprecated in AVStream, so used the dec_ctx to dump
max_bit_rate in ffprobe. Clean the warning like:
"warning: ‘codec’ is deprecated [-Wdeprecated-declarations]"

Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 fftools/ffprobe.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Nov. 21, 2018, 9:10 p.m.
On Wed, Nov 21, 2018 at 09:01:41AM +0800, Jun Zhao wrote:
> ‘codec’ is deprecated in AVStream, so used the dec_ctx to dump
> max_bit_rate in ffprobe. Clean the warning like:
> "warning: ‘codec’ is deprecated [-Wdeprecated-declarations]"
> 
> Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> ---
>  fftools/ffprobe.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)

this looses the max_bit_rate from:
./ffprobe tickets/4012/IMG_4596.MOV -of compact -show_streams -of json 

file should be at https://s.natalian.org/2014-10-07/IMG_4596.MOV

thx
[...]
mypopy@gmail.com Nov. 22, 2018, 6:09 a.m.
On Thu, Nov 22, 2018 at 5:11 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Wed, Nov 21, 2018 at 09:01:41AM +0800, Jun Zhao wrote:
> > ‘codec’ is deprecated in AVStream, so used the dec_ctx to dump
> > max_bit_rate in ffprobe. Clean the warning like:
> > "warning: ‘codec’ is deprecated [-Wdeprecated-declarations]"
> >
> > Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
> > Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> > ---
> >  fftools/ffprobe.c |    6 ++----
> >  1 files changed, 2 insertions(+), 4 deletions(-)
>
> this looses the max_bit_rate from:
> ./ffprobe tickets/4012/IMG_4596.MOV -of compact -show_streams -of json
>
> file should be at https://s.natalian.org/2014-10-07/IMG_4596.MOV
>
> thx
> [...]

Will check this clip, tks, Micheal.

Patch hide | download patch | download mbox

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 544786e..ab0dbff 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2622,10 +2622,8 @@  static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
     print_time("duration",    stream->duration, &stream->time_base);
     if (par->bit_rate > 0)     print_val    ("bit_rate", par->bit_rate, unit_bit_per_second_str);
     else                       print_str_opt("bit_rate", "N/A");
-#if FF_API_LAVF_AVCTX
-    if (stream->codec->rc_max_rate > 0) print_val ("max_bit_rate", stream->codec->rc_max_rate, unit_bit_per_second_str);
-    else                                print_str_opt("max_bit_rate", "N/A");
-#endif
+    if (dec_ctx && dec_ctx->rc_max_rate > 0) print_val ("max_bit_rate", dec_ctx->rc_max_rate, unit_bit_per_second_str);
+    else                                     print_str_opt("max_bit_rate", "N/A");
     if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
     else                                             print_str_opt("bits_per_raw_sample", "N/A");
     if (stream->nb_frames) print_fmt    ("nb_frames", "%"PRId64, stream->nb_frames);