diff mbox series

[FFmpeg-devel] lavc/qsvenc: add return check for ff_qsv_map_pixfmt

Message ID 1582596153-1442-1-git-send-email-linjie.fu@intel.com
State Accepted
Commit c39b6e1425f041622a4e58d1c7c215c75a04a845
Headers show
Series [FFmpeg-devel] lavc/qsvenc: add return check for ff_qsv_map_pixfmt | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Fu, Linjie Feb. 25, 2020, 2:02 a.m. UTC
Return an error directly if pixfmt is not supported for encoding, otherwise
it may be hidden until query/check in MSDK.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/qsvenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Xiang, Haihao Jan. 7, 2022, 7:55 a.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Linjie
> Fu
> Sent: Tuesday, February 25, 2020 10:03
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie <linjie.fu@intel.com>
> Subject: [FFmpeg-devel] [PATCH] lavc/qsvenc: add return check for
> ff_qsv_map_pixfmt
> 
> Return an error directly if pixfmt is not supported for encoding, otherwise
> it may be hidden until query/check in MSDK.
> 
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> ---
>  libavcodec/qsvenc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 571a711..40ff17c 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -436,7 +436,9 @@ static int init_video_param_jpeg(AVCodecContext
> *avctx, QSVEncContext *q)
>      if (!desc)
>          return AVERROR_BUG;
> 
> -    ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> +    ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> +    if (ret < 0)
> +        return AVERROR_BUG;
> 
>      q->param.mfx.FrameInfo.CropX          = 0;
>      q->param.mfx.FrameInfo.CropY          = 0;
> @@ -537,7 +539,9 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>      if (!desc)
>          return AVERROR_BUG;
> 
> -    ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> +    ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> +    if (ret < 0)
> +        return AVERROR_BUG;
> 
>      q->param.mfx.FrameInfo.CropX          = 0;
>      q->param.mfx.FrameInfo.CropY          = 0;
> --
> 2.7.4

LGTM, and I will apply it if no objection.

Thanks
Haihao
Xiang, Haihao Jan. 10, 2022, 7:07 a.m. UTC | #2
On Fri, 2022-01-07 at 07:55 +0000, Xiang, Haihao wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Linjie
> > Fu
> > Sent: Tuesday, February 25, 2020 10:03
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Fu, Linjie <linjie.fu@intel.com>
> > Subject: [FFmpeg-devel] [PATCH] lavc/qsvenc: add return check for
> > ff_qsv_map_pixfmt
> > 
> > Return an error directly if pixfmt is not supported for encoding, otherwise
> > it may be hidden until query/check in MSDK.
> > 
> > Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> > ---
> >  libavcodec/qsvenc.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > index 571a711..40ff17c 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -436,7 +436,9 @@ static int init_video_param_jpeg(AVCodecContext
> > *avctx, QSVEncContext *q)
> >      if (!desc)
> >          return AVERROR_BUG;
> > 
> > -    ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> > +    ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> > +    if (ret < 0)
> > +        return AVERROR_BUG;
> > 
> >      q->param.mfx.FrameInfo.CropX          = 0;
> >      q->param.mfx.FrameInfo.CropY          = 0;
> > @@ -537,7 +539,9 @@ static int init_video_param(AVCodecContext *avctx,
> > QSVEncContext *q)
> >      if (!desc)
> >          return AVERROR_BUG;
> > 
> > -    ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> > +    ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
> > +    if (ret < 0)
> > +        return AVERROR_BUG;
> > 
> >      q->param.mfx.FrameInfo.CropX          = 0;
> >      q->param.mfx.FrameInfo.CropY          = 0;
> > --
> > 2.7.4
> 
> LGTM, and I will apply it if no objection.
> 
Applied, thx!

-Haihao
diff mbox series

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 571a711..40ff17c 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -436,7 +436,9 @@  static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q)
     if (!desc)
         return AVERROR_BUG;
 
-    ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
+    ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
+    if (ret < 0)
+        return AVERROR_BUG;
 
     q->param.mfx.FrameInfo.CropX          = 0;
     q->param.mfx.FrameInfo.CropY          = 0;
@@ -537,7 +539,9 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
     if (!desc)
         return AVERROR_BUG;
 
-    ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
+    ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
+    if (ret < 0)
+        return AVERROR_BUG;
 
     q->param.mfx.FrameInfo.CropX          = 0;
     q->param.mfx.FrameInfo.CropY          = 0;