Commit 939638b0 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Reimplement the WAVE parser ontop of the wavparse plugin.

parent 41fc4564
...@@ -23,8 +23,7 @@ C_SRCS = \ ...@@ -23,8 +23,7 @@ C_SRCS = \
regsvr.c \ regsvr.c \
systemclock.c \ systemclock.c \
videorenderer.c \ videorenderer.c \
vmr9.c \ vmr9.c
waveparser.c
RC_SRCS = quartz.rc RC_SRCS = quartz.rc
......
...@@ -80,7 +80,6 @@ static const struct object_creation_info object_creation[] = ...@@ -80,7 +80,6 @@ static const struct object_creation_info object_creation[] =
{ &CLSID_AVIDec, AVIDec_create }, { &CLSID_AVIDec, AVIDec_create },
{ &CLSID_SystemClock, QUARTZ_CreateSystemClock }, { &CLSID_SystemClock, QUARTZ_CreateSystemClock },
{ &CLSID_ACMWrapper, ACMWrapper_create }, { &CLSID_ACMWrapper, ACMWrapper_create },
{ &CLSID_WAVEParser, WAVEParser_create }
}; };
static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj) static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
......
...@@ -63,7 +63,6 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN ...@@ -63,7 +63,6 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN
HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT VMR7Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT VMR7Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN;
HRESULT VMR9Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT VMR9Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN;
......
...@@ -141,13 +141,6 @@ coclass VideoRendererDefault { interface IBaseFilter; } ...@@ -141,13 +141,6 @@ coclass VideoRendererDefault { interface IBaseFilter; }
coclass ACMWrapper { interface IBaseFilter; } coclass ACMWrapper { interface IBaseFilter; }
[ [
helpstring("Wave Parser"),
threading(both),
uuid(d51bd5a1-7548-11cf-a520-0080c77ef58a)
]
coclass WAVEParser { interface IBaseFilter; }
[
helpstring("Video Mixing Renderer"), helpstring("Video Mixing Renderer"),
threading(both), threading(both),
uuid(b87beb7b-8d29-423f-ae4d-6582c10175ac) uuid(b87beb7b-8d29-423f-ae4d-6582c10175ac)
......
...@@ -354,25 +354,6 @@ static struct regsvr_filter const filter_list[] = { ...@@ -354,25 +354,6 @@ static struct regsvr_filter const filter_list[] = {
{ 0xFFFFFFFF }, { 0xFFFFFFFF },
} }
}, },
{ &CLSID_WAVEParser,
&CLSID_LegacyAmFilterCategory,
{'W','a','v','e',' ','P','a','r','s','e','r',0},
0x400000,
{ { 0,
{ { &MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE },
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_AU },
{ &MEDIATYPE_Stream, &MEDIASUBTYPE_AIFF },
{ NULL }
},
},
{ REG_PINFLAG_B_OUTPUT,
{ { &MEDIATYPE_Audio, &GUID_NULL },
{ NULL }
},
},
{ 0xFFFFFFFF },
}
},
{ NULL } /* list terminator */ { NULL } /* list terminator */
}; };
......
...@@ -148,7 +148,7 @@ static void test_interfaces(void) ...@@ -148,7 +148,7 @@ static void test_interfaces(void)
check_interface(pin, &IID_IKsPropertySet, FALSE); check_interface(pin, &IID_IKsPropertySet, FALSE);
check_interface(pin, &IID_IMemInputPin, FALSE); check_interface(pin, &IID_IMemInputPin, FALSE);
check_interface(pin, &IID_IMediaPosition, FALSE); check_interface(pin, &IID_IMediaPosition, FALSE);
todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); check_interface(pin, &IID_IMediaSeeking, FALSE);
IPin_Release(pin); IPin_Release(pin);
...@@ -157,6 +157,7 @@ static void test_interfaces(void) ...@@ -157,6 +157,7 @@ static void test_interfaces(void)
todo_wine check_interface(pin, &IID_IMediaPosition, TRUE); todo_wine check_interface(pin, &IID_IMediaPosition, TRUE);
check_interface(pin, &IID_IMediaSeeking, TRUE); check_interface(pin, &IID_IMediaSeeking, TRUE);
check_interface(pin, &IID_IPin, TRUE); check_interface(pin, &IID_IPin, TRUE);
check_interface(pin, &IID_IQualityControl, TRUE);
check_interface(pin, &IID_IUnknown, TRUE); check_interface(pin, &IID_IUnknown, TRUE);
check_interface(pin, &IID_IAsyncReader, FALSE); check_interface(pin, &IID_IAsyncReader, FALSE);
...@@ -762,8 +763,18 @@ static void test_enum_media_types(void) ...@@ -762,8 +763,18 @@ static void test_enum_media_types(void)
START_TEST(waveparser) START_TEST(waveparser)
{ {
IBaseFilter *filter;
CoInitialize(NULL); CoInitialize(NULL);
if (FAILED(CoCreateInstance(&CLSID_WAVEParser, NULL, CLSCTX_INPROC_SERVER,
&IID_IBaseFilter, (void **)&filter)))
{
skip("Failed to create WAVE parser.\n");
return;
}
IBaseFilter_Release(filter);
test_interfaces(); test_interfaces();
test_aggregation(); test_aggregation();
test_enum_pins(); test_enum_pins();
......
...@@ -43,6 +43,7 @@ IUnknown * CALLBACK Gstreamer_Mp3_create(IUnknown *pUnkOuter, HRESULT *phr); ...@@ -43,6 +43,7 @@ IUnknown * CALLBACK Gstreamer_Mp3_create(IUnknown *pUnkOuter, HRESULT *phr);
IUnknown * CALLBACK Gstreamer_YUV2RGB_create(IUnknown *pUnkOuter, HRESULT *phr); IUnknown * CALLBACK Gstreamer_YUV2RGB_create(IUnknown *pUnkOuter, HRESULT *phr);
IUnknown * CALLBACK Gstreamer_YUV2ARGB_create(IUnknown *pUnkOuter, HRESULT *phr); IUnknown * CALLBACK Gstreamer_YUV2ARGB_create(IUnknown *pUnkOuter, HRESULT *phr);
IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr); IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr);
IUnknown * CALLBACK wave_parser_create(IUnknown *outer, HRESULT *phr) DECLSPEC_HIDDEN;
BOOL init_gstreamer(void) DECLSPEC_HIDDEN; BOOL init_gstreamer(void) DECLSPEC_HIDDEN;
......
...@@ -2172,3 +2172,112 @@ void start_dispatch_thread(void) ...@@ -2172,3 +2172,112 @@ void start_dispatch_thread(void)
pthread_key_create(&wine_gst_key, NULL); pthread_key_create(&wine_gst_key, NULL);
CloseHandle(CreateThread(NULL, 0, &dispatch_thread, NULL, 0, NULL)); CloseHandle(CreateThread(NULL, 0, &dispatch_thread, NULL, 0, NULL));
} }
static HRESULT WINAPI wave_parser_sink_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE *mt)
{
if (!IsEqualGUID(&mt->majortype, &MEDIATYPE_Stream))
return S_FALSE;
if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WAVE))
return S_OK;
if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_AU) || IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_AIFF))
FIXME("AU and AIFF files are not yet supported.\n");
return S_FALSE;
}
static const BasePinFuncTable wave_parser_sink_ops =
{
.pfnCheckMediaType = wave_parser_sink_CheckMediaType,
.pfnGetMediaType = BasePinImpl_GetMediaType,
};
static BOOL wave_parser_init_gst(struct gstdemux *filter)
{
static const WCHAR source_name[] = {'o','u','t','p','u','t',0};
struct gstdemux_source *pin;
GstElement *element;
LONGLONG duration;
int ret;
if (!(element = gst_element_factory_make("wavparse", NULL)))
{
ERR("Failed to create wavparse; are %u-bit GStreamer \"good\" plugins installed?\n",
8 * (int)sizeof(void*));
return FALSE;
}
gst_bin_add(GST_BIN(filter->container), element);
filter->their_sink = gst_element_get_static_pad(element, "sink");
if ((ret = gst_pad_link(filter->my_src, filter->their_sink)) < 0)
{
ERR("Failed to link sink pads, error %d.\n", ret);
return FALSE;
}
if (!(pin = create_pin(filter, source_name)))
return FALSE;
pin->their_src = gst_element_get_static_pad(element, "src");
gst_object_ref(pin->their_src);
if ((ret = gst_pad_link(pin->their_src, pin->my_sink)) < 0)
{
ERR("Failed to link source pads, error %d.\n", ret);
return FALSE;
}
gst_pad_set_active(pin->my_sink, 1);
gst_element_set_state(filter->container, GST_STATE_PAUSED);
ret = gst_element_get_state(filter->container, NULL, NULL, -1);
if (ret == GST_STATE_CHANGE_FAILURE)
{
ERR("Failed to play stream.\n");
return FALSE;
}
gst_pad_query_duration(pin->their_src, GST_FORMAT_TIME, &duration);
pin->seek.llDuration = pin->seek.llStop = duration / 100;
pin->seek.llCurrent = 0;
if (!pin->seek.llDuration)
pin->seek.dwCapabilities = 0;
WaitForSingleObject(pin->caps_event, INFINITE);
filter->ignore_flush = TRUE;
gst_element_set_state(filter->container, GST_STATE_READY);
gst_element_get_state(filter->container, NULL, NULL, -1);
filter->ignore_flush = FALSE;
return TRUE;
}
IUnknown * CALLBACK wave_parser_create(IUnknown *outer, HRESULT *phr)
{
static const WCHAR sink_name[] = {'i','n','p','u','t',' ','p','i','n',0};
struct gstdemux *object;
if (!init_gstreamer())
{
*phr = E_FAIL;
return NULL;
}
mark_wine_thread();
if (!(object = heap_alloc_zero(sizeof(*object))))
{
*phr = E_OUTOFMEMORY;
return NULL;
}
strmbase_filter_init(&object->filter, &GST_Vtbl, outer, &CLSID_WAVEParser, &filter_ops);
object->sink.dir = PINDIR_INPUT;
object->sink.filter = &object->filter;
lstrcpynW(object->sink.name, sink_name, ARRAY_SIZE(object->sink.name));
object->sink.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
object->sink.pFuncsTable = &wave_parser_sink_ops;
object->init_gst = wave_parser_init_gst;
*phr = S_OK;
TRACE("Created WAVE parser %p.\n", object);
return &object->filter.IUnknown_inner;
}
...@@ -46,6 +46,8 @@ static const WCHAR wGstreamer_Mp3[] = ...@@ -46,6 +46,8 @@ static const WCHAR wGstreamer_Mp3[] =
{'G','S','t','r','e','a','m','e','r',' ','M','p','3',' ','f','i','l','t','e','r',0}; {'G','S','t','r','e','a','m','e','r',' ','M','p','3',' ','f','i','l','t','e','r',0};
static const WCHAR wGstreamer_AudioConvert[] = static const WCHAR wGstreamer_AudioConvert[] =
{'G','S','t','r','e','a','m','e','r',' ','A','u','d','i','o','C','o','n','v','e','r','t',' ','f','i','l','t','e','r',0}; {'G','S','t','r','e','a','m','e','r',' ','A','u','d','i','o','C','o','n','v','e','r','t',' ','f','i','l','t','e','r',0};
static const WCHAR wave_parserW[] =
{'W','a','v','e',' ','P','a','r','s','e','r',0};
static WCHAR wNull[] = {'\0'}; static WCHAR wNull[] = {'\0'};
...@@ -180,6 +182,47 @@ AMOVIESETUP_FILTER const amfAudioConvert = ...@@ -180,6 +182,47 @@ AMOVIESETUP_FILTER const amfAudioConvert =
amfAudioConvertPin amfAudioConvertPin
}; };
static const AMOVIESETUP_MEDIATYPE wave_parser_sink_type_data[] =
{
{&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
{&MEDIATYPE_Stream, &MEDIASUBTYPE_AU},
{&MEDIATYPE_Stream, &MEDIASUBTYPE_AIFF},
};
static const AMOVIESETUP_MEDIATYPE wave_parser_source_type_data[] =
{
{&MEDIATYPE_Audio, &GUID_NULL},
};
static const AMOVIESETUP_PIN wave_parser_pin_data[] =
{
{
NULL,
FALSE, FALSE, FALSE, FALSE,
&GUID_NULL,
NULL,
ARRAY_SIZE(wave_parser_sink_type_data),
wave_parser_sink_type_data,
},
{
NULL,
FALSE, FALSE, FALSE, FALSE,
&GUID_NULL,
NULL,
ARRAY_SIZE(wave_parser_source_type_data),
wave_parser_source_type_data,
},
};
static const AMOVIESETUP_FILTER wave_parser_filter_data =
{
&CLSID_WAVEParser,
wave_parserW,
MERIT_UNLIKELY,
ARRAY_SIZE(wave_parser_pin_data),
wave_parser_pin_data,
};
FactoryTemplate const g_Templates[] = { FactoryTemplate const g_Templates[] = {
{ {
wGstreamer_Splitter, wGstreamer_Splitter,
...@@ -216,6 +259,13 @@ FactoryTemplate const g_Templates[] = { ...@@ -216,6 +259,13 @@ FactoryTemplate const g_Templates[] = {
NULL, NULL,
&amfAudioConvert, &amfAudioConvert,
}, },
{
wave_parserW,
&CLSID_WAVEParser,
wave_parser_create,
NULL,
&wave_parser_filter_data,
},
}; };
const int g_cTemplates = ARRAY_SIZE(g_Templates); const int g_cTemplates = ARRAY_SIZE(g_Templates);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment