From c5c40f22608fedfb523672f20a7cf4b9d16ca4bc Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 13 Feb 2021 11:33:03 -0600 Subject: [PATCH] winegstreamer: Move filter initialization out of GST_Connect(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/winegstreamer/gstdemux.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 40c5e7ae017..8b63aa57702 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1134,25 +1134,18 @@ static LONGLONG query_duration(GstPad *pad) return 0; } -static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin) +static HRESULT GST_Connect(struct wg_parser *parser, LONGLONG file_size) { - struct wg_parser *parser = This->wg_parser; unsigned int i; - LONGLONG avail; GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( "quartz_src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); - IAsyncReader_Length(This->reader, &This->file_size, &avail); - parser->file_size = This->file_size; - - This->sink_connected = true; + parser->file_size = file_size; parser->sink_connected = true; - This->read_thread = CreateThread(NULL, 0, read_thread, This, 0, NULL); - if (!parser->bus) { parser->bus = gst_bus_new(); @@ -1170,7 +1163,6 @@ static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin) gst_pad_set_element_private(parser->my_src, parser); parser->start_offset = parser->next_offset = parser->stop_offset = 0; - This->next_pull_offset = 0; if (!parser->init_gst(parser)) return E_FAIL; @@ -1194,7 +1186,6 @@ static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin) pthread_mutex_unlock(&parser->mutex); parser->next_offset = 0; - This->next_pull_offset = 0; return S_OK; } @@ -1357,6 +1348,7 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons { struct parser *filter = impl_from_strmbase_sink(iface); HRESULT hr = S_OK; + LONGLONG unused; unsigned int i; mark_wine_thread(); @@ -1365,7 +1357,13 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons if (FAILED(hr = IPin_QueryInterface(peer, &IID_IAsyncReader, (void **)&filter->reader))) return hr; - if (FAILED(hr = GST_Connect(filter, peer))) + IAsyncReader_Length(filter->reader, &filter->file_size, &unused); + + filter->sink_connected = true; + filter->read_thread = CreateThread(NULL, 0, read_thread, filter, 0, NULL); + filter->next_pull_offset = 0; + + if (FAILED(hr = GST_Connect(filter->wg_parser, filter->file_size))) goto err; if (!filter->init_gst(filter)) -- 2.11.4.GIT