diff options
author | wm4 <wm4@nowhere> | 2015-05-29 14:17:51 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-29 14:17:51 +0200 |
commit | 9fe6a8c5f54ad89b962e3d88c641b352308beacd (patch) | |
tree | a8e5f0a377fa79447c0d8c4eca3093ab77ae0707 /video | |
parent | 6a5cbe7802ac21c979b32460a1aa57070a6130ac (diff) | |
download | mpv-9fe6a8c5f54ad89b962e3d88c641b352308beacd.tar.bz2 mpv-9fe6a8c5f54ad89b962e3d88c641b352308beacd.tar.xz |
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.
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/vd_lavc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index de917a7820..bbe6734c19 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -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) |