summaryrefslogtreecommitdiffstats
path: root/video/fmt-conversion.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-05 21:59:26 +0100
committerwm4 <wm4@nowhere>2013-11-05 22:05:23 +0100
commitd6de87d1d3aa4ecddf5a4e523c0410be2ab517aa (patch)
tree771d7e243ae3bfd064bbd2a10a4e907ff81a3e84 /video/fmt-conversion.c
parent890d8ea19466b41a88c63c61a4cfd735c3de668f (diff)
downloadmpv-d6de87d1d3aa4ecddf5a4e523c0410be2ab517aa.tar.bz2
mpv-d6de87d1d3aa4ecddf5a4e523c0410be2ab517aa.tar.xz
video: make IMGFMT_RGB0 etc. exist even if libavutil doesn't support it
These formats are helpful for distinguishing surfaces with and without alpha. Unfortunately, Libav and older version of FFmpeg don't support them, so code will break. Fix this by treating these formats specially on the mpv side, mapping them to RGBA on Libav, and unseting the alpha bit in the mp_imgfmt_desc struct.
Diffstat (limited to 'video/fmt-conversion.c')
-rw-r--r--video/fmt-conversion.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c
index 7d37e8ca87..b908837547 100644
--- a/video/fmt-conversion.c
+++ b/video/fmt-conversion.c
@@ -159,16 +159,22 @@ static const struct {
{IMGFMT_GBRP14_BE, PIX_FMT_GBRP14BE},
{IMGFMT_GBRP14_LE, PIX_FMT_GBRP14LE},
+ {IMGFMT_RGBA64_BE, PIX_FMT_RGBA64BE},
+ {IMGFMT_RGBA64_LE, PIX_FMT_RGBA64LE},
+ {IMGFMT_BGRA64_BE, PIX_FMT_BGRA64BE},
+ {IMGFMT_BGRA64_LE, PIX_FMT_BGRA64LE},
+
{IMGFMT_BGR0, PIX_FMT_BGR0},
{IMGFMT_0RGB, PIX_FMT_0RGB},
{IMGFMT_RGB0, PIX_FMT_RGB0},
{IMGFMT_0BGR, PIX_FMT_0BGR},
{IMGFMT_BGR0, PIX_FMT_BGR0},
-
- {IMGFMT_RGBA64_BE, PIX_FMT_RGBA64BE},
- {IMGFMT_RGBA64_LE, PIX_FMT_RGBA64LE},
- {IMGFMT_BGRA64_BE, PIX_FMT_BGRA64BE},
- {IMGFMT_BGRA64_LE, PIX_FMT_BGRA64LE},
+#else
+ {IMGFMT_BGR0, PIX_FMT_BGRA},
+ {IMGFMT_0RGB, PIX_FMT_ARGB},
+ {IMGFMT_RGB0, PIX_FMT_RGBA},
+ {IMGFMT_0BGR, PIX_FMT_ABGR},
+ {IMGFMT_BGR0, PIX_FMT_BGRA},
#endif
#if HAVE_AVCODEC_NEW_VDPAU_API