mirror of https://github.com/mpv-player/mpv
vd_lavc: fix a hw decoding fallback case
On hw decoder reinit failure we did not actually always return a sw format, because the first format (fmt[0]) is not always a sw format. This broke some cases of fallback. We must go through the trouble to determine the first actual sw format.
This commit is contained in:
parent
6a5cbe7802
commit
9fe6a8c5f5
|
@ -538,7 +538,12 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
|
|||
}
|
||||
|
||||
ctx->hwdec_failed = true;
|
||||
return fmt[0];
|
||||
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))
|
||||
return fmt[i];
|
||||
}
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
static void free_mpi(void *opaque, uint8_t *data)
|
||||
|
|
Loading…
Reference in New Issue