From c9fcd20959ef8d0463be0599e8596002ae68ffd2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 16 May 2018 20:54:46 +0200 Subject: vd_lavc: minor simplification for get_format fallback The default get_format does exactly do this, so we don't need to duplicate it. The only potential problem with this is that the logic doesn't entirely prevent that the avcodec_default_get_format hw_device_ctx path is triggered, which would probably work, but has unknown consequences and interactions. But the way the logic currently works it can't happen, provided the hwaccel metadata libavcodec provides is correct. --- video/decode/vd_lavc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index a2f1d7d494..25049aa341 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -818,13 +818,7 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx, if (select == AV_PIX_FMT_NONE) { ctx->hwdec_failed = true; - for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) { - const AVPixFmtDescriptor *d = av_pix_fmt_desc_get(fmt[i]); - if (d && !(d->flags & AV_PIX_FMT_FLAG_HWACCEL)) { - select = fmt[i]; - break; - } - } + select = avcodec_default_get_format(avctx, fmt); } const char *name = av_get_pix_fmt_name(select); -- cgit v1.2.3