[FFmpeg-devel] [PATCH 2/2] libvpxdec: report colorspace

James Zern jzern at google.com
Wed Jun 24 00:21:04 CEST 2015


---
 libavcodec/libvpxdec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index b31e7b9..0e3ed6f 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -62,6 +62,13 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 // returns 0 on success, AVERROR_INVALIDDATA otherwise
 static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
 {
+#if VPX_IMAGE_ABI_VERSION >= 3
+    static const enum AVColorSpace colorspaces[8] = {
+        AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M,
+        AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB,
+    };
+    avctx->colorspace = colorspaces[img->cs];
+#endif
     if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt != VPX_IMG_FMT_I420)
         return AVERROR_INVALIDDATA;
     switch (img->fmt) {
-- 
2.2.0.rc0.207.ga3a616c



More information about the ffmpeg-devel mailing list