diff mbox series

[FFmpeg-devel,3/4] lavfi/qsvvpp: provide a default framerate if needed

Message ID 20221124091930.558046-3-haihao.xiang@intel.com
State New
Headers show
Series [FFmpeg-devel,1/4] lavfi/qsvvpp: change the output frame's width and height | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Xiang, Haihao Nov. 24, 2022, 9:19 a.m. UTC
From: Haihao Xiang <haihao.xiang@intel.com>

VPP in the SDK requires the frame rate to be set to a valid value,
otherwise init will fail, so always set a default framerate when the
input link doesn't have a valid framerate.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavfilter/qsvvpp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Soft Works Nov. 24, 2022, 7:04 p.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Xiang, Haihao
> Sent: Thursday, November 24, 2022 10:19 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Haihao Xiang <haihao.xiang@intel.com>
> Subject: [FFmpeg-devel] [PATCH 3/4] lavfi/qsvvpp: provide a default
> framerate if needed
> 
> From: Haihao Xiang <haihao.xiang@intel.com>
> 
> VPP in the SDK requires the frame rate to be set to a valid value,
> otherwise init will fail, so always set a default framerate when the
> input link doesn't have a valid framerate.
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>  libavfilter/qsvvpp.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index a088f6b61f..a588a37610 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -324,6 +324,14 @@ static int fill_frameinfo_by_link(mfxFrameInfo
> *frameinfo, AVFilterLink *link)
>      frameinfo->CropH          = link->h;
>      frameinfo->FrameRateExtN  = link->frame_rate.num;
>      frameinfo->FrameRateExtD  = link->frame_rate.den;
> +
> +    /* Apparently VPP in the SDK requires the frame rate to be set
> to some value, otherwise
> +     * init will fail */
> +    if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN ==
> 0) {
> +        frameinfo->FrameRateExtN = 25;
> +        frameinfo->FrameRateExtD = 1;
> +    }
> +
>      frameinfo->AspectRatioW   = link->sample_aspect_ratio.num ?
> link->sample_aspect_ratio.num : 1;
>      frameinfo->AspectRatioH   = link->sample_aspect_ratio.den ?
> link->sample_aspect_ratio.den : 1;
> 
> --

LGTM. I have this in place for about a year.

softworkz
diff mbox series

Patch

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index a088f6b61f..a588a37610 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -324,6 +324,14 @@  static int fill_frameinfo_by_link(mfxFrameInfo *frameinfo, AVFilterLink *link)
     frameinfo->CropH          = link->h;
     frameinfo->FrameRateExtN  = link->frame_rate.num;
     frameinfo->FrameRateExtD  = link->frame_rate.den;
+
+    /* Apparently VPP in the SDK requires the frame rate to be set to some value, otherwise
+     * init will fail */
+    if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN == 0) {
+        frameinfo->FrameRateExtN = 25;
+        frameinfo->FrameRateExtD = 1;
+    }
+
     frameinfo->AspectRatioW   = link->sample_aspect_ratio.num ? link->sample_aspect_ratio.num : 1;
     frameinfo->AspectRatioH   = link->sample_aspect_ratio.den ? link->sample_aspect_ratio.den : 1;