diff mbox series

[FFmpeg-devel] avcodec/videotoolbox: make FFmpeg-to-VT mapping error more informative

Message ID 20210102125758.28047-1-jeebjp@gmail.com
State Accepted
Commit ed524136e0d0ae26c9f11df42baf72689499f99f
Headers show
Series [FFmpeg-devel] avcodec/videotoolbox: make FFmpeg-to-VT mapping error more informative
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Jan Ekström Jan. 2, 2021, 12:57 p.m. UTC
Now logs the actual failed-to-map pixel format as well as range.
---
 libavcodec/videotoolbox.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Aman Karmani Jan. 2, 2021, 5:22 p.m. UTC | #1
On Sat, Jan 2, 2021 at 5:05 AM Jan Ekström <jeebjp@gmail.com> wrote:

> Now logs the actual failed-to-map pixel format as well as range.
> ---
>  libavcodec/videotoolbox.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 8773de3393..49e726a75f 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -1088,7 +1088,13 @@ static int videotoolbox_common_init(AVCodecContext
> *avctx)
>      vtctx->vt_ctx->cv_pix_fmt_type =
>          av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format,
> full_range);
>      if (!vtctx->vt_ctx->cv_pix_fmt_type) {
> -        av_log(avctx, AV_LOG_ERROR, "Unknown sw_format.\n");
> +        const AVPixFmtDescriptor *attempted_format =
> +            av_pix_fmt_desc_get(hw_frames->sw_format);
> +        av_log(avctx, AV_LOG_ERROR,
> +               "Failed to map underlying FFmpeg pixel format %s (%s
> range) to "
> +               "a VideoToolbox format!\n",
> +               attempted_format ? attempted_format->name : "<unknown>",
> +               av_color_range_name(avctx->color_range));
>          err = AVERROR(EINVAL);
>          goto fail;
>      }


LGTM


> --
> 2.29.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Jan Ekström Jan. 2, 2021, 7:02 p.m. UTC | #2
On Sat, Jan 2, 2021 at 7:22 PM Aman Karmani <ffmpeg@tmm1.net> wrote:
>
> On Sat, Jan 2, 2021 at 5:05 AM Jan Ekström <jeebjp@gmail.com> wrote:
>
> > Now logs the actual failed-to-map pixel format as well as range.
> > ---
> >  libavcodec/videotoolbox.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index 8773de3393..49e726a75f 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -1088,7 +1088,13 @@ static int videotoolbox_common_init(AVCodecContext
> > *avctx)
> >      vtctx->vt_ctx->cv_pix_fmt_type =
> >          av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format,
> > full_range);
> >      if (!vtctx->vt_ctx->cv_pix_fmt_type) {
> > -        av_log(avctx, AV_LOG_ERROR, "Unknown sw_format.\n");
> > +        const AVPixFmtDescriptor *attempted_format =
> > +            av_pix_fmt_desc_get(hw_frames->sw_format);
> > +        av_log(avctx, AV_LOG_ERROR,
> > +               "Failed to map underlying FFmpeg pixel format %s (%s
> > range) to "
> > +               "a VideoToolbox format!\n",
> > +               attempted_format ? attempted_format->name : "<unknown>",
> > +               av_color_range_name(avctx->color_range));
> >          err = AVERROR(EINVAL);
> >          goto fail;
> >      }
>
>
> LGTM
>

Thanks, applied as ed524136e0d0ae26c9f11df42baf72689499f99f .

Jan
diff mbox series

Patch

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 8773de3393..49e726a75f 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1088,7 +1088,13 @@  static int videotoolbox_common_init(AVCodecContext *avctx)
     vtctx->vt_ctx->cv_pix_fmt_type =
         av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format, full_range);
     if (!vtctx->vt_ctx->cv_pix_fmt_type) {
-        av_log(avctx, AV_LOG_ERROR, "Unknown sw_format.\n");
+        const AVPixFmtDescriptor *attempted_format =
+            av_pix_fmt_desc_get(hw_frames->sw_format);
+        av_log(avctx, AV_LOG_ERROR,
+               "Failed to map underlying FFmpeg pixel format %s (%s range) to "
+               "a VideoToolbox format!\n",
+               attempted_format ? attempted_format->name : "<unknown>",
+               av_color_range_name(avctx->color_range));
         err = AVERROR(EINVAL);
         goto fail;
     }