diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2011-10-07 11:50:20 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-01-16 11:40:51 +0100 |
commit | 6ae97634cf8d8c5f0978a52202e29a5cbdd5c062 (patch) | |
tree | 02f8b6cacdc3af4be4d40db834c1f50f186db6a0 /gst-libs/gst | |
parent | 7b1d7841977bdf416567f1e4ba934407ed11aa67 (diff) |
vc1: fix codec-data decoding for WMV3 format.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_vc1.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c index 35fc75b4..55d0f0b8 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c @@ -1163,17 +1163,55 @@ decode_buffer(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer) static GstVaapiDecoderStatus decode_codec_data(GstVaapiDecoderVC1 *decoder, GstBuffer *buffer) { + GstVaapiDecoderVC1Private * const priv = decoder->priv; + GstVC1SeqHdr * const seq_hdr = &priv->seq_hdr; GstVaapiDecoderStatus status; GstVC1ParserResult result; GstVC1BDU ebdu; + GstCaps *caps; + GstStructure *structure; guchar *buf; guint buf_size, ofs; + gint width, height; + guint32 format; buf = GST_BUFFER_DATA(buffer); buf_size = GST_BUFFER_SIZE(buffer); if (!buf || buf_size == 0) return GST_VAAPI_DECODER_STATUS_SUCCESS; + caps = GST_VAAPI_DECODER_CAST(decoder)->priv->caps; + structure = gst_caps_get_structure(caps, 0); + + if (!gst_structure_get_int(structure, "width", &width) || + !gst_structure_get_int(structure, "height", &height)) { + GST_DEBUG("failed to parse size from codec-data"); + return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; + } + + if (!gst_structure_get_fourcc(structure, "format", &format)) { + GST_DEBUG("failed to parse profile from codec-data"); + return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC; + } + + /* WMV3 -- expecting sequence header */ + if (format == GST_MAKE_FOURCC('W','M','V','3')) { + seq_hdr->struct_c.coded_width = width; + seq_hdr->struct_c.coded_height = height; + ebdu.type = GST_VC1_SEQUENCE; + ebdu.size = buf_size; + ebdu.sc_offset = 0; + ebdu.offset = 0; + ebdu.data = buf; + return decode_ebdu(decoder, &ebdu); + } + + /* WVC1 -- expecting bitstream data units */ + if (format != GST_MAKE_FOURCC('W','V','C','1')) + return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE; + seq_hdr->advanced.max_coded_width = width; + seq_hdr->advanced.max_coded_height = height; + ofs = 0; do { result = gst_vc1_identify_next_bdu( |