[7/7] openh264: Use the framerate information

Message ID 20180216170209.52876-8-lu_zero@gentoo.org
State New
Headers show
Series
  • [1/7] avcodec: Always fill the encoder target framerate
Related show

Commit Message

Luca Barbato Feb. 16, 2018, 5:02 p.m.
And not the often misleading timebase one.
---
 libavcodec/libopenh264enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vittorio Giovara Feb. 17, 2018, 3:55 a.m. | #1
On Fri, Feb 16, 2018 at 12:02 PM, Luca Barbato <lu_zero@gentoo.org> wrote:

> And not the often misleading timebase one.
> ---
>  libavcodec/libopenh264enc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index d075cb0854..f779c46196 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -129,7 +129,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
>  FF_ENABLE_DEPRECATION_WARNINGS
>  #endif
>
> -    param.fMaxFrameRate              = avctx->time_base.den /
> avctx->time_base.num;
> +    param.fMaxFrameRate              = avctx->framerate.num /
> avctx->framerate.den;
>

why not av_q2d while at it?
Luca Barbato Feb. 17, 2018, 2:03 p.m. | #2
On 17/02/2018 04:55, Vittorio Giovara wrote:
> On Fri, Feb 16, 2018 at 12:02 PM, Luca Barbato <lu_zero@gentoo.org> wrote:
> 
>> And not the often misleading timebase one.
>> ---
>>   libavcodec/libopenh264enc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
>> index d075cb0854..f779c46196 100644
>> --- a/libavcodec/libopenh264enc.c
>> +++ b/libavcodec/libopenh264enc.c
>> @@ -129,7 +129,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
>>   FF_ENABLE_DEPRECATION_WARNINGS
>>   #endif
>>
>> -    param.fMaxFrameRate              = avctx->time_base.den /
>> avctx->time_base.num;
>> +    param.fMaxFrameRate              = avctx->framerate.num /
>> avctx->framerate.den;
>>
> 
> why not av_q2d while at it?
> 

Now it can be done, indeed. Thanks for reminding me :)

Patch

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index d075cb0854..f779c46196 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -129,7 +129,7 @@  FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
-    param.fMaxFrameRate              = avctx->time_base.den / avctx->time_base.num;
+    param.fMaxFrameRate              = avctx->framerate.num / avctx->framerate.den;
     param.iPicWidth                  = avctx->width;
     param.iPicHeight                 = avctx->height;
     param.iTargetBitrate             = avctx->bit_rate;