[FFmpeg-devel] [FFmpeg-cvslog] ffserver: get time_base from AVStream in print_stream_params()

James Almer jamrial at gmail.com
Tue Nov 8 16:29:39 EET 2016


> ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com> | Tue Nov  8 00:51:28 2016 -0800| [1323349befd3f55bef2f9e46168f17a53f8f6d4a] | committer: Michael Niedermayer
>
> ffserver: get time_base from AVStream in print_stream_params()
>
> AVStream.codec is deprecated
>
> Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com>
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
>
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1323349befd3f55bef2f9e46168f17a53f8f6d4a
> ---
>
>  ffserver.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ffserver.c b/ffserver.c
> index ed8cb2f..65280d2 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -1895,7 +1895,7 @@ static inline void print_stream_params(AVIOContext *pb, FFServerStream *stream)
>              snprintf(parameters, sizeof(parameters),
>                       "%dx%d, q=%d-%d, fps=%d", st->codecpar->width,
>                       st->codecpar->height, st->codec->qmin, st->codec->qmax,
> -                     st->codec->time_base.den / st->codec->time_base.num);
> +                     st->time_base.den / st->time_base.num);

In this case it's not important since it's just for printing, but if you need the actual
codec timebase and not the stream timebase for any kind of calculation, then you
can use av_stream_get_codec_timebase();

Right now it just returns st->codec->time_base, but after st->codec is deprecated
it will be adapted to use st->internal->avctx->time_base.

>              break;
>          default:
>              abort();
> @@ -1903,7 +1903,7 @@ static inline void print_stream_params(AVIOContext *pb, FFServerStream *stream)
>  
>          avio_printf(pb, "<tr><td align=right>%d<td>%s<td align=right>%"PRId64
>                          "<td>%s<td>%s\n",
> -                    i, type, (int64_t)st->codec->bit_rate/1000,
> +                    i, type, (int64_t)st->codecpar->bit_rate/1000,
>                      codec ? codec->name : "", parameters);
>       }


More information about the ffmpeg-devel mailing list