[FFmpeg-devel] lavfi/vf_scale_vaapi: set output SAR

Submitted by Rodger Combs on Jan. 13, 2018, 1:08 a.m.

Details

Message ID 1515805711-8637-1-git-send-email-rodger.combs@gmail.com
State Accepted
Commit 381a4820c64ba2d1b3ddc3a50147961f1d8c5848
Headers show

Commit Message

Rodger Combs Jan. 13, 2018, 1:08 a.m.
---
 libavfilter/vf_scale_vaapi.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Mark Thompson Jan. 19, 2018, 1:18 a.m.
On 13/01/18 01:08, Rodger Combs wrote:
> ---
>  libavfilter/vf_scale_vaapi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
> index 22e928c..4bead5a 100644
> --- a/libavfilter/vf_scale_vaapi.c
> +++ b/libavfilter/vf_scale_vaapi.c
> @@ -240,6 +240,11 @@ static int scale_vaapi_config_output(AVFilterLink *outlink)
>          goto fail;
>      }
>  
> +    if (inlink->sample_aspect_ratio.num)
> +        outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio);
> +    else
> +        outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
> +
>      av_freep(&hwconfig);
>      av_hwframe_constraints_free(&constraints);
>      return 0;
> 

Tested, LGTM.

Thanks,

- Mark

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 22e928c..4bead5a 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -240,6 +240,11 @@  static int scale_vaapi_config_output(AVFilterLink *outlink)
         goto fail;
     }
 
+    if (inlink->sample_aspect_ratio.num)
+        outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio);
+    else
+        outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
+
     av_freep(&hwconfig);
     av_hwframe_constraints_free(&constraints);
     return 0;