dshowdecwrapper: add support for VC1 and fix plugins ranks

This commit is contained in:
Andoni Morales Alastruey 2012-05-29 10:48:54 -07:00 committed by Sebastian Dröge
parent 1bcb49bcce
commit c924929de2
3 changed files with 25 additions and 10 deletions

View file

@ -583,7 +583,7 @@ gst_dshowaudiodec_chain (GstPad * pad, GstBuffer * buffer)
goto beach;
}
if (adec->last_ret < GST_FLOW_UNEXPECTED) {
if (GST_FLOW_IS_FATAL (adec->last_ret)) {
GST_DEBUG_OBJECT (adec, "last decoding iteration generated a fatal error "
"%s", gst_flow_get_name (adec->last_ret));
goto beach;
@ -1171,7 +1171,7 @@ dshow_adec_register (GstPlugin * plugin)
audio_dec_codecs[i].element_name, &info, (GTypeFlags)0);
g_type_set_qdata (type, DSHOW_CODEC_QDATA, (gpointer) (audio_dec_codecs + i));
if (!gst_element_register (plugin, audio_dec_codecs[i].element_name,
GST_RANK_SECONDARY, type)) {
GST_RANK_MARGINAL, type)) {
return FALSE;
}
GST_CAT_DEBUG (dshowaudiodec_debug, "Registered %s",

View file

@ -1,4 +1,5 @@
/* GStreamer
* Copyright <2006, 2007, 2008, 2009, 2010> Fluendo <support@fluendo.com>
* Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
*
* gstdshowfakesrc.cpp:
@ -129,6 +130,9 @@ STDMETHODIMP FakeOutputPin::PushBuffer(byte *buffer,
hres = Deliver(pSample);
pSample->Release();
}
else {
GST_WARNING ("unable to obtain a delivery buffer");
}
return S_OK;
}

View file

@ -88,6 +88,7 @@ static gboolean gst_dshowvideodec_get_filter_output_format (GstDshowVideoDec *
#define GUID_MEDIASUBTYPE_WMVV3 {0x33564d57, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
#define GUID_MEDIASUBTYPE_WMVP {0x50564d57, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
#define GUID_MEDIASUBTYPE_WMVA {0x41564d57, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
#define GUID_MEDIASUBTYPE_WVC1 {0x31435657, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
#define GUID_MEDIASUBTYPE_CVID {0x64697663, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
#define GUID_MEDIASUBTYPE_MP4S {0x5334504d, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
#define GUID_MEDIASUBTYPE_MP42 {0x3234504d, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }}
@ -168,7 +169,7 @@ static const VideoCodecEntry video_dec_codecs[] = {
{"dshowvdec_wmvp", "Windows Media Video 9 Image",
GST_MAKE_FOURCC ('W', 'M', 'V', 'P'),
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WMVP,
"video/x-wmv, wmvversion = (int) 3, " "format = (fourcc) WMVP",
"video/x-wmv, wmvversion = (int) 3, " "format = (fourcc) { WMVP, MSS1 }",
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
"video/x-raw-yuv, format=(fourcc)YUY2",
preferred_wmv_filters},
@ -181,6 +182,14 @@ static const VideoCodecEntry video_dec_codecs[] = {
"video/x-raw-yuv, format=(fourcc)YUY2",
preferred_wmv_filters},
{"dshowvdec_wvc1", "Windows Media VC1 video",
GST_MAKE_FOURCC ('W', 'V', 'C', '1'),
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WVC1,
"video/x-wmv, wmvversion = (int) 3, " "format = (fourcc) WVC1",
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
"video/x-raw-yuv, format=(fourcc)YUY2",
preferred_wmv_filters},
{"dshowvdec_cinepak", "Cinepack",
0x64697663,
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_CVID,
@ -266,7 +275,7 @@ static const VideoCodecEntry video_dec_codecs[] = {
{"dshowvdec_divx3", "DIVX 3.0 Video",
GST_MAKE_FOURCC ('D', 'I', 'V', '3'),
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_DIV3,
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MP43,
"video/x-divx, divxversion=(int)3",
GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
"video/x-raw-yuv, format=(fourcc)YUY2"}
@ -857,7 +866,7 @@ gst_dshowvideodec_chain (GstPad * pad, GstBuffer * buffer)
goto beach;
}
if (vdec->last_ret < GST_FLOW_UNEXPECTED) {
if (GST_FLOW_IS_FATAL (vdec->last_ret)) {
GST_DEBUG_OBJECT (vdec, "last decoding iteration generated a fatal error "
"%s", gst_flow_get_name (vdec->last_ret));
goto beach;
@ -988,8 +997,6 @@ gst_dshowvideodec_flush (GstDshowVideoDec * vdec)
/* flush dshow decoder and reset timestamp */
vdec->fakesrc->GetOutputPin()->Flush();
/* Reset the flow return state tracker */
vdec->last_ret = GST_FLOW_OK;
return TRUE;
@ -1246,6 +1253,7 @@ dshow_vdec_register (GstPlugin * plugin)
for (i = 0; i < sizeof (video_dec_codecs) / sizeof (VideoCodecEntry); i++) {
GType type;
CComPtr<IBaseFilter> filter;
guint rank = GST_RANK_MARGINAL;
filter = gst_dshow_find_filter (
video_dec_codecs[i].input_majortype,
@ -1255,13 +1263,16 @@ dshow_vdec_register (GstPlugin * plugin)
video_dec_codecs[i].preferred_filters);
if (filter != NULL) {
GST_DEBUG ("Registering %s", video_dec_codecs[i].element_name);
if (video_dec_codecs[i].format == GST_MAKE_FOURCC ('W', 'V', 'C', '1')) {
/* FFMPEG WVC1 decoder sucks, get higher priority for ours */
rank = GST_RANK_MARGINAL + 2;
}
GST_DEBUG ("Registering %s with rank %u", video_dec_codecs[i].element_name, rank);
type = g_type_register_static (GST_TYPE_ELEMENT,
video_dec_codecs[i].element_name, &info, (GTypeFlags)0);
g_type_set_qdata (type, DSHOW_CODEC_QDATA, (gpointer) (video_dec_codecs + i));
if (!gst_element_register (plugin, video_dec_codecs[i].element_name,
GST_RANK_PRIMARY, type)) {
if (!gst_element_register (plugin, video_dec_codecs[i].element_name, rank, type)) {
return FALSE;
}
GST_DEBUG ("Registered %s", video_dec_codecs[i].element_name);