diff mbox

[FFmpeg-devel] ffprobe: don't use AVStream.codec to set decoder framerate

Message ID 20160927015733.6820-1-jamrial@gmail.com
State Accepted
Commit 92de2c23a61e5a8d8ced28b4697cae395f35e46c
Headers show

Commit Message

James Almer Sept. 27, 2016, 1:57 a.m. UTC
Also don't set time_base. It's deprecated for decoding and avcodec_open2()
will overwrite it

Signed-off-by: James Almer <jamrial@gmail.com>
---
 ffprobe.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Josh Dekker Sept. 27, 2016, 10:20 p.m. UTC | #1
On 27/09/2016 02:57, James Almer wrote:
> Also don't set time_base. It's deprecated for decoding and avcodec_open2()
> will overwrite it
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  ffprobe.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/ffprobe.c b/ffprobe.c
> index b59f11e..bb3979c 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -2612,10 +2612,7 @@ static int open_input_file(InputFile *ifile, const char *filename)
>                  exit(1);
>
>              av_codec_set_pkt_timebase(ist->dec_ctx, stream->time_base);
> -#if FF_API_LAVF_AVCTX
> -            ist->dec_ctx->time_base = stream->codec->time_base;
> -            ist->dec_ctx->framerate = stream->codec->framerate;
> -#endif
> +            ist->dec_ctx->framerate = stream->avg_frame_rate;
>
>              if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
>                  av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
>

LGTM

--
Josh
James Almer Sept. 28, 2016, 12:24 a.m. UTC | #2
On 9/27/2016 7:20 PM, Josh de Kock wrote:
> On 27/09/2016 02:57, James Almer wrote:
>> Also don't set time_base. It's deprecated for decoding and avcodec_open2()
>> will overwrite it
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  ffprobe.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/ffprobe.c b/ffprobe.c
>> index b59f11e..bb3979c 100644
>> --- a/ffprobe.c
>> +++ b/ffprobe.c
>> @@ -2612,10 +2612,7 @@ static int open_input_file(InputFile *ifile, const char *filename)
>>                  exit(1);
>>
>>              av_codec_set_pkt_timebase(ist->dec_ctx, stream->time_base);
>> -#if FF_API_LAVF_AVCTX
>> -            ist->dec_ctx->time_base = stream->codec->time_base;
>> -            ist->dec_ctx->framerate = stream->codec->framerate;
>> -#endif
>> +            ist->dec_ctx->framerate = stream->avg_frame_rate;
>>
>>              if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
>>                  av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
>>
> 
> LGTM
> 
> -- 
> Josh

Pushed, thanks.
diff mbox

Patch

diff --git a/ffprobe.c b/ffprobe.c
index b59f11e..bb3979c 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2612,10 +2612,7 @@  static int open_input_file(InputFile *ifile, const char *filename)
                 exit(1);
 
             av_codec_set_pkt_timebase(ist->dec_ctx, stream->time_base);
-#if FF_API_LAVF_AVCTX
-            ist->dec_ctx->time_base = stream->codec->time_base;
-            ist->dec_ctx->framerate = stream->codec->framerate;
-#endif
+            ist->dec_ctx->framerate = stream->avg_frame_rate;
 
             if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
                 av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",