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

Submitted by Jun Zhao on Nov. 18, 2018, 4:43 p.m.

Details

Message ID 1542559394-3305-3-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Nov. 18, 2018, 4:43 p.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]"

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

Comments

Moritz Barsnick Nov. 18, 2018, 10:03 p.m.
> +    if (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);

If the (now) second condition needs to check for validity of dec_ctx,
shouldn't the new first one also need to check?

Moritz
mypopy@gmail.com Nov. 19, 2018, 12:40 a.m.
On Mon, Nov 19, 2018 at 6:03 AM Moritz Barsnick <barsnick@gmx.net> wrote:
>
> > +    if (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);
>
> If the (now) second condition needs to check for validity of dec_ctx,
> shouldn't the new first one also need to check?
>
>
Ha, I guess I missed the check, will update, Thanks
Michael Niedermayer Nov. 19, 2018, 10:17 p.m.
On Mon, Nov 19, 2018 at 08:40:07AM +0800, mypopy@gmail.com wrote:
> On Mon, Nov 19, 2018 at 6:03 AM Moritz Barsnick <barsnick@gmx.net> wrote:
> >
> > > +    if (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);
> >
> > If the (now) second condition needs to check for validity of dec_ctx,
> > shouldn't the new first one also need to check?
> >
> >
> Ha, I guess I missed the check, will update, Thanks

this failure shows up in fate btw: (unless this was some other issue in this patch)
make: *** [fate-mpegts-probe-pmt-merge] Error 139
make: *** [fate-mxf-probe-dnxhd] Error 139

[...]
mypopy@gmail.com Nov. 21, 2018, 12:23 a.m.
On Tue, Nov 20, 2018 at 6:17 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Mon, Nov 19, 2018 at 08:40:07AM +0800, mypopy@gmail.com wrote:
> > On Mon, Nov 19, 2018 at 6:03 AM Moritz Barsnick <barsnick@gmx.net> wrote:
> > >
> > > > +    if (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);
> > >
> > > If the (now) second condition needs to check for validity of dec_ctx,
> > > shouldn't the new first one also need to check?
> > >
> > >
> > Ha, I guess I missed the check, will update, Thanks
>
> this failure shows up in fate btw: (unless this was some other issue in this patch)
> make: *** [fate-mpegts-probe-pmt-merge] Error 139
> make: *** [fate-mxf-probe-dnxhd] Error 139
>
> [...]
>
Yes, this patch will lead to a segment fail in
fate-mpegts-probe-pmt-merge/fate-mxf-probe-dnxhd  if didn't check
dec_ctx, I will update patch V2 to fix the break, Thanks.

Patch hide | download patch | download mbox

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 544786e..280db78 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->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);