winegstreamer: Reimplement the AVI splitter on top of the avidemux plugin.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bf46266099
commit
5de712b5d8
|
@ -7,7 +7,6 @@ EXTRADLLFLAGS = -mno-cygwin
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
acmwrapper.c \
|
acmwrapper.c \
|
||||||
avidec.c \
|
avidec.c \
|
||||||
avisplit.c \
|
|
||||||
dsoundrender.c \
|
dsoundrender.c \
|
||||||
enummedia.c \
|
enummedia.c \
|
||||||
enummoniker.c \
|
enummoniker.c \
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -69,7 +69,6 @@ static const struct object_creation_info object_creation[] =
|
||||||
{ &CLSID_FilterMapper2, FilterMapper2_create },
|
{ &CLSID_FilterMapper2, FilterMapper2_create },
|
||||||
{ &CLSID_AsyncReader, AsyncReader_create },
|
{ &CLSID_AsyncReader, AsyncReader_create },
|
||||||
{ &CLSID_MemoryAllocator, StdMemAllocator_create },
|
{ &CLSID_MemoryAllocator, StdMemAllocator_create },
|
||||||
{ &CLSID_AviSplitter, AVISplitter_create },
|
|
||||||
{ &CLSID_MPEG1Splitter, MPEGSplitter_create },
|
{ &CLSID_MPEG1Splitter, MPEGSplitter_create },
|
||||||
{ &CLSID_VideoRenderer, VideoRenderer_create },
|
{ &CLSID_VideoRenderer, VideoRenderer_create },
|
||||||
{ &CLSID_VideoMixingRenderer, VMR7Impl_create },
|
{ &CLSID_VideoMixingRenderer, VMR7Impl_create },
|
||||||
|
|
|
@ -55,7 +55,6 @@ HRESULT FilterMapper2_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN
|
||||||
HRESULT FilterMapper_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
HRESULT FilterMapper_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||||
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||||
HRESULT StdMemAllocator_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
HRESULT StdMemAllocator_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||||
HRESULT AVISplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
|
||||||
HRESULT MPEGSplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
HRESULT MPEGSplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||||
HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||||
HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -84,13 +84,6 @@ coclass SeekingPassThru { interface ISeekingPassThru; }
|
||||||
]
|
]
|
||||||
coclass AsyncReader { interface IBaseFilter; }
|
coclass AsyncReader { interface IBaseFilter; }
|
||||||
|
|
||||||
[
|
|
||||||
helpstring("AVI Splitter"),
|
|
||||||
threading(both),
|
|
||||||
uuid(1b544c20-fd0b-11ce-8c63-00aa0044b51e)
|
|
||||||
]
|
|
||||||
coclass AviSplitter { interface IBaseFilter; }
|
|
||||||
|
|
||||||
[
|
[
|
||||||
helpstring("MPEG-I Stream Splitter"),
|
helpstring("MPEG-I Stream Splitter"),
|
||||||
threading(both),
|
threading(both),
|
||||||
|
|
|
@ -178,23 +178,6 @@ static HRESULT unregister_filters(struct regsvr_filter const *list)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct regsvr_filter const filter_list[] = {
|
static struct regsvr_filter const filter_list[] = {
|
||||||
{ &CLSID_AviSplitter,
|
|
||||||
&CLSID_LegacyAmFilterCategory,
|
|
||||||
{'A','V','I',' ','S','p','l','i','t','t','e','r',0},
|
|
||||||
0x5ffff0,
|
|
||||||
{ { 0,
|
|
||||||
{ { &MEDIATYPE_Stream, &MEDIASUBTYPE_Avi },
|
|
||||||
{ NULL }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ REG_PINFLAG_B_OUTPUT,
|
|
||||||
{ { &MEDIATYPE_Video, &GUID_NULL },
|
|
||||||
{ NULL }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 0xFFFFFFFF },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ &CLSID_MPEG1Splitter,
|
{ &CLSID_MPEG1Splitter,
|
||||||
&CLSID_LegacyAmFilterCategory,
|
&CLSID_LegacyAmFilterCategory,
|
||||||
{'M','P','E','G','-','I',' ','S','t','r','e','a','m',' ','S','p','l','i','t','t','e','r',0},
|
{'M','P','E','G','-','I',' ','S','t','r','e','a','m',' ','S','p','l','i','t','t','e','r',0},
|
||||||
|
|
|
@ -151,7 +151,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);
|
||||||
|
|
||||||
|
@ -160,6 +160,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);
|
||||||
|
@ -1016,8 +1017,18 @@ fail:
|
||||||
|
|
||||||
START_TEST(avisplit)
|
START_TEST(avisplit)
|
||||||
{
|
{
|
||||||
|
IBaseFilter *filter;
|
||||||
|
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
if (FAILED(CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IBaseFilter, (void **)&filter)))
|
||||||
|
{
|
||||||
|
skip("Failed to create AVI splitter.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IBaseFilter_Release(filter);
|
||||||
|
|
||||||
test_interfaces();
|
test_interfaces();
|
||||||
test_aggregation();
|
test_aggregation();
|
||||||
test_enum_pins();
|
test_enum_pins();
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
/* enum media */
|
/* enum media */
|
||||||
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt);
|
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt);
|
||||||
|
|
||||||
|
IUnknown * CALLBACK avi_splitter_create(IUnknown *outer, HRESULT *phr) DECLSPEC_HIDDEN;
|
||||||
IUnknown * CALLBACK Gstreamer_AudioConvert_create(IUnknown *pUnkOuter, HRESULT *phr);
|
IUnknown * CALLBACK Gstreamer_AudioConvert_create(IUnknown *pUnkOuter, HRESULT *phr);
|
||||||
IUnknown * CALLBACK Gstreamer_Mp3_create(IUnknown *pUnkOuter, HRESULT *phr);
|
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);
|
||||||
|
|
|
@ -769,6 +769,7 @@ out:
|
||||||
|
|
||||||
static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux *This)
|
static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux *This)
|
||||||
{
|
{
|
||||||
|
static const WCHAR formatW[] = {'S','t','r','e','a','m',' ','%','0','2','u',0};
|
||||||
const char *typename;
|
const char *typename;
|
||||||
char *name;
|
char *name;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
@ -779,9 +780,9 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux *
|
||||||
|
|
||||||
TRACE("%p %p %p\n", This, bin, pad);
|
TRACE("%p %p %p\n", This, bin, pad);
|
||||||
|
|
||||||
|
sprintfW(nameW, formatW, This->cStreams);
|
||||||
|
|
||||||
name = gst_pad_get_name(pad);
|
name = gst_pad_get_name(pad);
|
||||||
MultiByteToWideChar(CP_UNIXCP, 0, name, -1, nameW, ARRAY_SIZE(nameW) - 1);
|
|
||||||
nameW[ARRAY_SIZE(nameW) - 1] = 0;
|
|
||||||
TRACE("Name: %s\n", name);
|
TRACE("Name: %s\n", name);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
|
|
||||||
|
@ -2277,3 +2278,110 @@ IUnknown * CALLBACK wave_parser_create(IUnknown *outer, HRESULT *phr)
|
||||||
TRACE("Created WAVE parser %p.\n", object);
|
TRACE("Created WAVE parser %p.\n", object);
|
||||||
return &object->filter.IUnknown_inner;
|
return &object->filter.IUnknown_inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI avi_splitter_sink_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE *mt)
|
||||||
|
{
|
||||||
|
if (IsEqualGUID(&mt->majortype, &MEDIATYPE_Stream)
|
||||||
|
&& IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_Avi))
|
||||||
|
return S_OK;
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const BasePinFuncTable avi_splitter_sink_ops =
|
||||||
|
{
|
||||||
|
.pfnCheckMediaType = avi_splitter_sink_CheckMediaType,
|
||||||
|
.pfnGetMediaType = BasePinImpl_GetMediaType,
|
||||||
|
};
|
||||||
|
|
||||||
|
static BOOL avi_splitter_init_gst(struct gstdemux *filter)
|
||||||
|
{
|
||||||
|
GstElement *element = gst_element_factory_make("avidemux", NULL);
|
||||||
|
LONGLONG duration;
|
||||||
|
unsigned int i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!element)
|
||||||
|
{
|
||||||
|
ERR("Failed to create avidemux; are %u-bit GStreamer \"good\" plugins installed?\n",
|
||||||
|
8 * (int)sizeof(void*));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_bin_add(GST_BIN(filter->container), element);
|
||||||
|
|
||||||
|
g_signal_connect(element, "pad-added", G_CALLBACK(existing_new_pad_wrapper), filter);
|
||||||
|
g_signal_connect(element, "pad-removed", G_CALLBACK(removed_decoded_pad_wrapper), filter);
|
||||||
|
g_signal_connect(element, "no-more-pads", G_CALLBACK(no_more_pads_wrapper), filter);
|
||||||
|
|
||||||
|
filter->their_sink = gst_element_get_static_pad(element, "sink");
|
||||||
|
ResetEvent(filter->no_more_pads_event);
|
||||||
|
|
||||||
|
if ((ret = gst_pad_link(filter->my_src, filter->their_sink)) < 0)
|
||||||
|
{
|
||||||
|
ERR("Failed to link pads, error %d.\n", ret);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_element_set_state(filter->container, GST_STATE_PLAYING);
|
||||||
|
ret = gst_element_get_state(filter->container, NULL, NULL, -1);
|
||||||
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||||
|
{
|
||||||
|
ERR("Failed to play stream.\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
WaitForSingleObject(filter->no_more_pads_event, INFINITE);
|
||||||
|
|
||||||
|
gst_pad_query_duration(filter->ppPins[0]->their_src, GST_FORMAT_TIME, &duration);
|
||||||
|
for (i = 0; i < filter->cStreams; ++i)
|
||||||
|
{
|
||||||
|
struct gstdemux_source *pin = filter->ppPins[i];
|
||||||
|
|
||||||
|
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 avi_splitter_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_AviSplitter, &filter_ops);
|
||||||
|
|
||||||
|
object->no_more_pads_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
|
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 = &avi_splitter_sink_ops;
|
||||||
|
object->init_gst = avi_splitter_init_gst;
|
||||||
|
*phr = S_OK;
|
||||||
|
|
||||||
|
TRACE("Created AVI splitter %p.\n", object);
|
||||||
|
return &object->filter.IUnknown_inner;
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ 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[] =
|
static const WCHAR wave_parserW[] =
|
||||||
{'W','a','v','e',' ','P','a','r','s','e','r',0};
|
{'W','a','v','e',' ','P','a','r','s','e','r',0};
|
||||||
|
static const WCHAR avi_splitterW[] =
|
||||||
|
{'A','V','I',' ','S','p','l','i','t','t','e','r',0};
|
||||||
|
|
||||||
static WCHAR wNull[] = {'\0'};
|
static WCHAR wNull[] = {'\0'};
|
||||||
|
|
||||||
|
@ -223,6 +225,40 @@ static const AMOVIESETUP_FILTER wave_parser_filter_data =
|
||||||
wave_parser_pin_data,
|
wave_parser_pin_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const AMOVIESETUP_MEDIATYPE avi_splitter_sink_type_data[] =
|
||||||
|
{
|
||||||
|
{&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const AMOVIESETUP_PIN avi_splitter_pin_data[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
NULL,
|
||||||
|
FALSE, FALSE, FALSE, FALSE,
|
||||||
|
&GUID_NULL,
|
||||||
|
NULL,
|
||||||
|
ARRAY_SIZE(avi_splitter_sink_type_data),
|
||||||
|
avi_splitter_sink_type_data,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
NULL,
|
||||||
|
FALSE, TRUE, FALSE, FALSE,
|
||||||
|
&GUID_NULL,
|
||||||
|
NULL,
|
||||||
|
ARRAY_SIZE(amfMTvideo),
|
||||||
|
amfMTvideo,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const AMOVIESETUP_FILTER avi_splitter_filter_data =
|
||||||
|
{
|
||||||
|
&CLSID_AviSplitter,
|
||||||
|
avi_splitterW,
|
||||||
|
0x5ffff0,
|
||||||
|
ARRAY_SIZE(avi_splitter_pin_data),
|
||||||
|
avi_splitter_pin_data,
|
||||||
|
};
|
||||||
|
|
||||||
FactoryTemplate const g_Templates[] = {
|
FactoryTemplate const g_Templates[] = {
|
||||||
{
|
{
|
||||||
wGstreamer_Splitter,
|
wGstreamer_Splitter,
|
||||||
|
@ -266,6 +302,13 @@ FactoryTemplate const g_Templates[] = {
|
||||||
NULL,
|
NULL,
|
||||||
&wave_parser_filter_data,
|
&wave_parser_filter_data,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
avi_splitterW,
|
||||||
|
&CLSID_AviSplitter,
|
||||||
|
avi_splitter_create,
|
||||||
|
NULL,
|
||||||
|
&avi_splitter_filter_data,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const int g_cTemplates = ARRAY_SIZE(g_Templates);
|
const int g_cTemplates = ARRAY_SIZE(g_Templates);
|
||||||
|
|
Loading…
Reference in New Issue