vc1: fix decoding of WMV3 videos in AVI format.
authorWind Yuan <feng.yuan@intel.com>
Fri, 11 Jan 2013 09:08:00 +0000 (17:08 +0800)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 22 Jan 2013 15:10:07 +0000 (16:10 +0100)
The AVI demuxer (avidemux) does not set a proper "format" attribute
to the generated caps. So, try to recover the video codec format from
the "wmvversion" property instead.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
gst-libs/gst/vaapi/gstvaapidecoder_vc1.c

index 9baf388c002feeeb48b81f7666ec7c7ef71826e9..1fe3883ba7733b975f05de9c453437edc1a2f9cf 100644 (file)
@@ -1042,6 +1042,7 @@ decode_codec_data(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer)
     guint buf_size, ofs;
     gint width, height;
     guint32 format;
+    gint version;
 
     buf      = GST_BUFFER_DATA(buffer);
     buf_size = GST_BUFFER_SIZE(buffer);
@@ -1058,6 +1059,12 @@ decode_codec_data(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer)
     caps = GST_VAAPI_DECODER_CODEC_STATE(decoder)->caps;
     structure = gst_caps_get_structure(caps, 0);
     if (!gst_structure_get_fourcc(structure, "format", &format)) {
+        /* Try to determine format from "wmvversion" property */
+        if (gst_structure_get_int(structure, "wmvversion", &version))
+            format = (version >= 1 && version <= 3) ?
+                GST_MAKE_FOURCC('W','M','V',('0'+version)) : 0;
+    }
+    if (!format) {
         GST_ERROR("failed to parse profile from codec-data");
         return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC;
     }