From fa7505c0c57979d75dd748fd15b962a6c326c751 Mon Sep 17 00:00:00 2001 From: gb Date: Mon, 3 May 2010 14:53:18 +0000 Subject: [PATCH] Improve WMV3 detection yet further. --- gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c | 5 +++++ gst-libs/gst/vaapi/gstvaapiprofile.c | 21 ++++++++++++++++----- gst-libs/gst/vaapi/gstvaapiprofile.h | 6 ++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c b/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c index 2e120321d2..03b5533c18 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c @@ -73,6 +73,7 @@ get_codec_id_from_codec(GstVaapiCodec codec) case GST_VAAPI_CODEC_MPEG4: return CODEC_ID_MPEG4; case GST_VAAPI_CODEC_H263: return CODEC_ID_H263; case GST_VAAPI_CODEC_H264: return CODEC_ID_H264; + case GST_VAAPI_CODEC_WMV3: return CODEC_ID_WMV3; case GST_VAAPI_CODEC_VC1: return CODEC_ID_VC1; } return CODEC_ID_NONE; @@ -340,6 +341,10 @@ gst_vaapi_decoder_ffmpeg_open(GstVaapiDecoderFfmpeg *ffdecoder, GstBuffer *buffe input encoded buffers represent the whole NAL unit */ parser_is_needed = priv->avctx->extradata_size == 0; break; + case CODEC_ID_WMV3: + /* There is no WMV3 parser in FFmpeg */ + parser_is_needed = FALSE; + break; default: parser_is_needed = TRUE; break; diff --git a/gst-libs/gst/vaapi/gstvaapiprofile.c b/gst-libs/gst/vaapi/gstvaapiprofile.c index 10d972fe2f..a76f261d26 100644 --- a/gst-libs/gst/vaapi/gstvaapiprofile.c +++ b/gst-libs/gst/vaapi/gstvaapiprofile.c @@ -30,9 +30,6 @@ #include "gstvaapicompat.h" #include "gstvaapiprofile.h" -#define GST_VAAPI_PROFILE_CODEC(profile) \ - ((GstVaapiCodec)(((guint32)profile) & GST_MAKE_FOURCC(0xff,0xff,0xff,0))) - typedef struct _GstVaapiProfileMap GstVaapiProfileMap; typedef struct _GstVaapiEntrypointMap GstVaapiEntrypointMap; @@ -244,7 +241,7 @@ gst_vaapi_profile_from_caps(GstCaps *caps) } if (!profile) profile = gst_vaapi_profile_from_codec_data( - GST_VAAPI_PROFILE_CODEC(m->profile), + gst_vaapi_profile_get_codec(m->profile), codec_data ); gst_caps_unref(caps_test); @@ -307,7 +304,21 @@ gst_vaapi_profile_get_caps(GstVaapiProfile profile) GstVaapiCodec gst_vaapi_profile_get_codec(GstVaapiProfile profile) { - return GST_VAAPI_PROFILE_CODEC(profile); + GstVaapiCodec codec; + + switch (profile) { + case GST_VAAPI_PROFILE_VC1_SIMPLE: + case GST_VAAPI_PROFILE_VC1_MAIN: + codec = GST_VAAPI_CODEC_WMV3; + break; + case GST_VAAPI_PROFILE_VC1_ADVANCED: + codec = GST_VAAPI_CODEC_VC1; + break; + default: + codec = (guint32)profile & GST_MAKE_FOURCC(0xff,0xff,0xff,0); + break; + } + return codec; } /** diff --git a/gst-libs/gst/vaapi/gstvaapiprofile.h b/gst-libs/gst/vaapi/gstvaapiprofile.h index 718ccffef2..7ab27ab8e2 100644 --- a/gst-libs/gst/vaapi/gstvaapiprofile.h +++ b/gst-libs/gst/vaapi/gstvaapiprofile.h @@ -37,7 +37,8 @@ typedef enum _GstVaapiEntrypoint GstVaapiEntrypoint; * @GST_VAAPI_CODEC_MPEG4: MPEG-4 Part 2 (ISO/IEC 14496-2) * @GST_VAAPI_CODEC_H263: H.263 * @GST_VAAPI_CODEC_H264: H.264 aka MPEG-4 Part 10 (ISO/IEC 14496-10) - * @GST_VAAPI_CODEC_VC1: VC-1 (SMPTE 421M) + * @GST_VAAPI_CODEC_WMV3: Windows Media Video 9. VC-1 Simple or Main profile (SMPTE 421M) + * @GST_VAAPI_CODEC_VC1: VC-1 Advanced profile (SMPTE 421M) * * The set of all codecs for #GstVaapiCodec. */ @@ -47,6 +48,7 @@ enum _GstVaapiCodec { GST_VAAPI_CODEC_MPEG4 = GST_MAKE_FOURCC('M','P','4',0), GST_VAAPI_CODEC_H263 = GST_MAKE_FOURCC('2','6','3',0), GST_VAAPI_CODEC_H264 = GST_MAKE_FOURCC('2','6','4',0), + GST_VAAPI_CODEC_WMV3 = GST_MAKE_FOURCC('W','M','V',0), GST_VAAPI_CODEC_VC1 = GST_MAKE_FOURCC('V','C','1',0), }; @@ -86,7 +88,7 @@ enum _GstVaapiCodec { * @GST_VAAPI_PROFILE_VC1_SIMPLE: * VC-1 simple profile * @GST_VAAPI_PROFILE_VC1_MAIN: - * VC-1 main profile (WMV3) + * VC-1 main profile * @GST_VAAPI_PROFILE_VC1_ADVANCED: * VC-1 advanced profile *