1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-18 17:40:30 +00:00

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.
This commit is contained in:
wm4 2018-05-16 20:54:46 +02:00 committed by sfan5
parent 3101cb3847
commit 25525cee62

View File

@ -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);