Commit 9e1f5f6d authored by Brendan McGrath's avatar Brendan McGrath Committed by Alexandre Julliard

winegstreamer: Pass uri to wg_parser when available.

This is a partial cherry-pick of eda34f74c6ad from Proton.
parent bb779688
...@@ -52,7 +52,7 @@ void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all); ...@@ -52,7 +52,7 @@ void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all);
wg_parser_t wg_parser_create(bool output_compressed); wg_parser_t wg_parser_create(bool output_compressed);
void wg_parser_destroy(wg_parser_t parser); void wg_parser_destroy(wg_parser_t parser);
HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size); HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size, const WCHAR *uri);
void wg_parser_disconnect(wg_parser_t parser); void wg_parser_disconnect(wg_parser_t parser);
bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size); bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size);
......
...@@ -94,12 +94,13 @@ void wg_parser_destroy(wg_parser_t parser) ...@@ -94,12 +94,13 @@ void wg_parser_destroy(wg_parser_t parser)
WINE_UNIX_CALL(unix_wg_parser_destroy, &parser); WINE_UNIX_CALL(unix_wg_parser_destroy, &parser);
} }
HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size) HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size, const WCHAR *uri)
{ {
struct wg_parser_connect_params params = struct wg_parser_connect_params params =
{ {
.parser = parser, .parser = parser,
.file_size = file_size, .file_size = file_size,
.uri = uri,
}; };
TRACE("parser %#I64x, file_size %I64u.\n", parser, file_size); TRACE("parser %#I64x, file_size %I64u.\n", parser, file_size);
......
...@@ -1654,7 +1654,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc ...@@ -1654,7 +1654,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc
object->state = SOURCE_OPENING; object->state = SOURCE_OPENING;
if (FAILED(hr = wg_parser_connect(parser, object->file_size))) if (FAILED(hr = wg_parser_connect(parser, object->file_size, context->url)))
goto fail; goto fail;
stream_count = wg_parser_get_stream_count(parser); stream_count = wg_parser_get_stream_count(parser);
......
...@@ -1529,7 +1529,7 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons ...@@ -1529,7 +1529,7 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons
filter->sink_connected = true; filter->sink_connected = true;
filter->read_thread = CreateThread(NULL, 0, read_thread, filter, 0, NULL); filter->read_thread = CreateThread(NULL, 0, read_thread, filter, 0, NULL);
if (FAILED(hr = wg_parser_connect(filter->wg_parser, file_size))) if (FAILED(hr = wg_parser_connect(filter->wg_parser, file_size, NULL)))
goto err; goto err;
if (!filter->init_gst(filter)) if (!filter->init_gst(filter))
......
...@@ -194,6 +194,7 @@ struct wg_parser_create_params ...@@ -194,6 +194,7 @@ struct wg_parser_create_params
struct wg_parser_connect_params struct wg_parser_connect_params
{ {
wg_parser_t parser; wg_parser_t parser;
const WCHAR *uri;
UINT64 file_size; UINT64 file_size;
}; };
......
...@@ -70,6 +70,7 @@ struct wg_parser ...@@ -70,6 +70,7 @@ struct wg_parser
guint64 file_size, start_offset, next_offset, stop_offset; guint64 file_size, start_offset, next_offset, stop_offset;
guint64 next_pull_offset; guint64 next_pull_offset;
gchar *uri;
pthread_t push_thread; pthread_t push_thread;
...@@ -1548,11 +1549,21 @@ static NTSTATUS wg_parser_connect(void *args) ...@@ -1548,11 +1549,21 @@ static NTSTATUS wg_parser_connect(void *args)
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
const struct wg_parser_connect_params *params = args; const struct wg_parser_connect_params *params = args;
struct wg_parser *parser = get_parser(params->parser); struct wg_parser *parser = get_parser(params->parser);
const WCHAR *uri = params->uri;
unsigned int i; unsigned int i;
int ret; int ret;
parser->file_size = params->file_size; parser->file_size = params->file_size;
parser->sink_connected = true; parser->sink_connected = true;
if (uri)
{
parser->uri = malloc(wcslen(uri) * 3 + 1);
ntdll_wcstoumbs(uri, wcslen(uri) + 1, parser->uri, wcslen(uri) * 3 + 1, FALSE);
}
else
{
parser->uri = NULL;
}
if (!parser->bus) if (!parser->bus)
{ {
...@@ -1818,6 +1829,7 @@ static NTSTATUS wg_parser_destroy(void *args) ...@@ -1818,6 +1829,7 @@ static NTSTATUS wg_parser_destroy(void *args)
pthread_cond_destroy(&parser->read_cond); pthread_cond_destroy(&parser->read_cond);
pthread_cond_destroy(&parser->read_done_cond); pthread_cond_destroy(&parser->read_done_cond);
free(parser->uri);
free(parser); free(parser);
return S_OK; return S_OK;
} }
......
...@@ -1464,7 +1464,7 @@ static HRESULT init_stream(struct wm_reader *reader) ...@@ -1464,7 +1464,7 @@ static HRESULT init_stream(struct wm_reader *reader)
goto out_destroy_parser; goto out_destroy_parser;
} }
if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size))) if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size, NULL)))
{ {
ERR("Failed to connect parser, hr %#lx.\n", hr); ERR("Failed to connect parser, hr %#lx.\n", hr);
goto out_shutdown_thread; goto out_shutdown_thread;
...@@ -1569,7 +1569,7 @@ static HRESULT reinit_stream(struct wm_reader *reader, bool read_compressed) ...@@ -1569,7 +1569,7 @@ static HRESULT reinit_stream(struct wm_reader *reader, bool read_compressed)
goto out_destroy_parser; goto out_destroy_parser;
} }
if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size))) if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size, NULL)))
{ {
ERR("Failed to connect parser, hr %#lx.\n", hr); ERR("Failed to connect parser, hr %#lx.\n", hr);
goto out_shutdown_thread; goto out_shutdown_thread;
......
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