Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/winegstreamer/gst_private.h | 22 ++++++-------
dlls/winegstreamer/main.c | 50 +++++++++++++++++++++---------
dlls/winegstreamer/media_source.c | 4 +--
dlls/winegstreamer/quartz_parser.c | 10 +++---
dlls/winegstreamer/unixlib.h | 34 ++++++++++++++++----
dlls/winegstreamer/wg_parser.c | 38 +++++++++++++++++------
dlls/winegstreamer/wm_reader.c | 6 ++--
7 files changed, 112 insertions(+), 52 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 9e1d67417d4..340712eefe1 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -64,20 +64,20 @@ static inline const char *debugstr_time(REFERENCE_TIME time)
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
-struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buffering) DECLSPEC_HIDDEN;
-void wg_parser_destroy(struct wg_parser *parser) DECLSPEC_HIDDEN;
+wg_parser_t wg_parser_create(enum wg_parser_type type, bool unlimited_buffering) DECLSPEC_HIDDEN;
+void wg_parser_destroy(wg_parser_t parser) DECLSPEC_HIDDEN;
-HRESULT wg_parser_connect(struct wg_parser *parser, uint64_t file_size) DECLSPEC_HIDDEN;
-void wg_parser_disconnect(struct wg_parser *parser) DECLSPEC_HIDDEN;
+HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size) DECLSPEC_HIDDEN;
+void wg_parser_disconnect(wg_parser_t parser) DECLSPEC_HIDDEN;
-void wg_parser_begin_flush(struct wg_parser *parser) DECLSPEC_HIDDEN;
-void wg_parser_end_flush(struct wg_parser *parser) DECLSPEC_HIDDEN;
+void wg_parser_begin_flush(wg_parser_t parser) DECLSPEC_HIDDEN;
+void wg_parser_end_flush(wg_parser_t parser) DECLSPEC_HIDDEN;
-bool wg_parser_get_next_read_offset(struct wg_parser *parser, uint64_t *offset, uint32_t *size) DECLSPEC_HIDDEN;
-void wg_parser_push_data(struct wg_parser *parser, const void *data, uint32_t size) DECLSPEC_HIDDEN;
+bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size) DECLSPEC_HIDDEN;
+void wg_parser_push_data(wg_parser_t parser, const void *data, uint32_t size) DECLSPEC_HIDDEN;
-uint32_t wg_parser_get_stream_count(struct wg_parser *parser) DECLSPEC_HIDDEN;
-struct wg_parser_stream *wg_parser_get_stream(struct wg_parser *parser, uint32_t index) DECLSPEC_HIDDEN;
+uint32_t wg_parser_get_stream_count(wg_parser_t parser) DECLSPEC_HIDDEN;
+struct wg_parser_stream *wg_parser_get_stream(wg_parser_t parser, uint32_t index) DECLSPEC_HIDDEN;
void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format) DECLSPEC_HIDDEN;
void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format) DECLSPEC_HIDDEN;
@@ -152,7 +152,7 @@ struct wm_reader
HANDLE file;
HANDLE read_thread;
bool read_thread_shutdown;
- struct wg_parser *wg_parser;
+ wg_parser_t wg_parser;
struct wm_stream *streams;
WORD stream_count;
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
index ac9a3201792..23c11d883c9 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -60,7 +60,7 @@ bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
return TRUE;
}
-struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buffering)
+wg_parser_t wg_parser_create(enum wg_parser_type type, bool unlimited_buffering)
{
struct wg_parser_create_params params =
{
@@ -69,16 +69,21 @@ struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buff
};
if (__wine_unix_call(unix_handle, unix_wg_parser_create, ¶ms))
- return NULL;
+ return 0;
return params.parser;
}
-void wg_parser_destroy(struct wg_parser *parser)
+void wg_parser_destroy(wg_parser_t parser)
{
- __wine_unix_call(unix_handle, unix_wg_parser_destroy, parser);
+ struct wg_parser_destroy_params params =
+ {
+ .parser = parser,
+ };
+
+ __wine_unix_call(unix_handle, unix_wg_parser_destroy, ¶ms);
}
-HRESULT wg_parser_connect(struct wg_parser *parser, uint64_t file_size)
+HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size)
{
struct wg_parser_connect_params params =
{
@@ -89,22 +94,37 @@ HRESULT wg_parser_connect(struct wg_parser *parser, uint64_t file_size)
return __wine_unix_call(unix_handle, unix_wg_parser_connect, ¶ms);
}
-void wg_parser_disconnect(struct wg_parser *parser)
+void wg_parser_disconnect(wg_parser_t parser)
{
- __wine_unix_call(unix_handle, unix_wg_parser_disconnect, parser);
+ struct wg_parser_disconnect_params params =
+ {
+ .parser = parser,
+ };
+
+ __wine_unix_call(unix_handle, unix_wg_parser_disconnect, ¶ms);
}
-void wg_parser_begin_flush(struct wg_parser *parser)
+void wg_parser_begin_flush(wg_parser_t parser)
{
- __wine_unix_call(unix_handle, unix_wg_parser_begin_flush, parser);
+ struct wg_parser_begin_flush_params params =
+ {
+ .parser = parser,
+ };
+
+ __wine_unix_call(unix_handle, unix_wg_parser_begin_flush, ¶ms);
}
-void wg_parser_end_flush(struct wg_parser *parser)
+void wg_parser_end_flush(wg_parser_t parser)
{
- __wine_unix_call(unix_handle, unix_wg_parser_end_flush, parser);
+ struct wg_parser_end_flush_params params =
+ {
+ .parser = parser,
+ };
+
+ __wine_unix_call(unix_handle, unix_wg_parser_end_flush, ¶ms);
}
-bool wg_parser_get_next_read_offset(struct wg_parser *parser, uint64_t *offset, uint32_t *size)
+bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size)
{
struct wg_parser_get_next_read_offset_params params =
{
@@ -118,7 +138,7 @@ bool wg_parser_get_next_read_offset(struct wg_parser *parser, uint64_t *offset,
return true;
}
-void wg_parser_push_data(struct wg_parser *parser, const void *data, uint32_t size)
+void wg_parser_push_data(wg_parser_t parser, const void *data, uint32_t size)
{
struct wg_parser_push_data_params params =
{
@@ -130,7 +150,7 @@ void wg_parser_push_data(struct wg_parser *parser, const void *data, uint32_t si
__wine_unix_call(unix_handle, unix_wg_parser_push_data, ¶ms);
}
-uint32_t wg_parser_get_stream_count(struct wg_parser *parser)
+uint32_t wg_parser_get_stream_count(wg_parser_t parser)
{
struct wg_parser_get_stream_count_params params =
{
@@ -141,7 +161,7 @@ uint32_t wg_parser_get_stream_count(struct wg_parser *parser)
return params.count;
}
-struct wg_parser_stream *wg_parser_get_stream(struct wg_parser *parser, uint32_t index)
+struct wg_parser_stream *wg_parser_get_stream(wg_parser_t parser, uint32_t index)
{
struct wg_parser_get_stream_params params =
{
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 6ecd345cb73..c31c573b381 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -92,7 +92,7 @@ struct media_source
IMFMediaEventQueue *event_queue;
IMFByteStream *byte_stream;
- struct wg_parser *wg_parser;
+ wg_parser_t wg_parser;
struct media_stream **streams;
ULONG stream_count;
@@ -1393,8 +1393,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
unsigned int stream_count = UINT_MAX;
struct media_source *object;
UINT64 total_pres_time = 0;
- struct wg_parser *parser;
DWORD bytestream_caps;
+ wg_parser_t parser;
uint64_t file_size;
unsigned int i;
HRESULT hr;
diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c
index cf284cda668..29adece3a38 100644
--- a/dlls/winegstreamer/quartz_parser.c
+++ b/dlls/winegstreamer/quartz_parser.c
@@ -50,7 +50,7 @@ struct parser
unsigned int source_count;
BOOL enum_sink_first;
- struct wg_parser *wg_parser;
+ wg_parser_t wg_parser;
/* FIXME: It would be nice to avoid duplicating these with strmbase.
* However, synchronization is tricky; we need access to be protected by a
@@ -1086,7 +1086,7 @@ static const struct strmbase_sink_ops sink_ops =
static BOOL decodebin_parser_filter_init_gst(struct parser *filter)
{
- struct wg_parser *parser = filter->wg_parser;
+ wg_parser_t parser = filter->wg_parser;
unsigned int i, stream_count;
WCHAR source_name[20];
@@ -1659,7 +1659,7 @@ static const struct strmbase_sink_ops wave_parser_sink_ops =
static BOOL wave_parser_filter_init_gst(struct parser *filter)
{
- struct wg_parser *parser = filter->wg_parser;
+ wg_parser_t parser = filter->wg_parser;
if (!create_pin(filter, wg_parser_get_stream(parser, 0), L"output"))
return FALSE;
@@ -1738,7 +1738,7 @@ static const struct strmbase_sink_ops avi_splitter_sink_ops =
static BOOL avi_splitter_filter_init_gst(struct parser *filter)
{
- struct wg_parser *parser = filter->wg_parser;
+ wg_parser_t parser = filter->wg_parser;
uint32_t i, stream_count;
WCHAR source_name[20];
@@ -1829,7 +1829,7 @@ static const struct strmbase_sink_ops mpeg_splitter_sink_ops =
static BOOL mpeg_splitter_filter_init_gst(struct parser *filter)
{
- struct wg_parser *parser = filter->wg_parser;
+ wg_parser_t parser = filter->wg_parser;
if (!create_pin(filter, wg_parser_get_stream(parser, 0), L"Audio"))
return FALSE;
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h
index 90101893541..b6fcfc26d6a 100644
--- a/dlls/winegstreamer/unixlib.h
+++ b/dlls/winegstreamer/unixlib.h
@@ -30,6 +30,8 @@
#include "wine/unixlib.h"
+typedef UINT64 wg_parser_t;
+
struct wg_format
{
enum wg_major_type
@@ -130,40 +132,60 @@ enum wg_parser_type
struct wg_parser_create_params
{
- struct wg_parser *parser;
+ wg_parser_t parser;
enum wg_parser_type type;
bool unlimited_buffering;
};
+struct wg_parser_destroy_params
+{
+ wg_parser_t parser;
+};
+
struct wg_parser_connect_params
{
- struct wg_parser *parser;
+ wg_parser_t parser;
UINT64 file_size;
};
+struct wg_parser_disconnect_params
+{
+ wg_parser_t parser;
+};
+
+struct wg_parser_begin_flush_params
+{
+ wg_parser_t parser;
+};
+
+struct wg_parser_end_flush_params
+{
+ wg_parser_t parser;
+};
+
struct wg_parser_get_next_read_offset_params
{
- struct wg_parser *parser;
+ wg_parser_t parser;
UINT32 size;
UINT64 offset;
};
struct wg_parser_push_data_params
{
- struct wg_parser *parser;
+ wg_parser_t parser;
const void *data;
UINT32 size;
};
struct wg_parser_get_stream_count_params
{
- struct wg_parser *parser;
+ wg_parser_t parser;
UINT32 count;
};
struct wg_parser_get_stream_params
{
- struct wg_parser *parser;
+ wg_parser_t parser;
UINT32 index;
struct wg_parser_stream *stream;
};
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index c3c9051a174..9c0bfd0a8d2 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -54,6 +54,8 @@ typedef enum
GST_DEBUG_CATEGORY_STATIC(wine);
#define GST_CAT_DEFAULT wine
+struct wg_parser;
+
typedef BOOL (*init_gst_cb)(struct wg_parser *parser);
struct wg_parser
@@ -111,6 +113,16 @@ struct wg_parser_stream
uint64_t duration;
};
+static struct wg_parser *get_wg_parser(wg_parser_t handle)
+{
+ return (struct wg_parser *)(uintptr_t)handle;
+}
+
+static wg_parser_t wg_parser_get_handle(struct wg_parser *parser)
+{
+ return (uintptr_t)parser;
+}
+
static enum wg_audio_format wg_audio_format_from_gst(GstAudioFormat format)
{
switch (format)
@@ -507,22 +519,25 @@ static bool wg_format_compare(const struct wg_format *a, const struct wg_format
static NTSTATUS wg_parser_get_stream_count(void *args)
{
struct wg_parser_get_stream_count_params *params = args;
+ struct wg_parser *parser = get_wg_parser(params->parser);
- params->count = params->parser->stream_count;
+ params->count = parser->stream_count;
return S_OK;
}
static NTSTATUS wg_parser_get_stream(void *args)
{
struct wg_parser_get_stream_params *params = args;
+ struct wg_parser *parser = get_wg_parser(params->parser);
- params->stream = params->parser->streams[params->index];
+ params->stream = parser->streams[params->index];
return S_OK;
}
static NTSTATUS wg_parser_begin_flush(void *args)
{
- struct wg_parser *parser = args;
+ const struct wg_parser_begin_flush_params *params = args;
+ struct wg_parser *parser = get_wg_parser(params->parser);
unsigned int i;
pthread_mutex_lock(&parser->mutex);
@@ -540,7 +555,8 @@ static NTSTATUS wg_parser_begin_flush(void *args)
static NTSTATUS wg_parser_end_flush(void *args)
{
- struct wg_parser *parser = args;
+ const struct wg_parser_end_flush_params *params = args;
+ struct wg_parser *parser = get_wg_parser(params->parser);
pthread_mutex_lock(&parser->mutex);
parser->flushing = false;
@@ -552,7 +568,7 @@ static NTSTATUS wg_parser_end_flush(void *args)
static NTSTATUS wg_parser_get_next_read_offset(void *args)
{
struct wg_parser_get_next_read_offset_params *params = args;
- struct wg_parser *parser = params->parser;
+ struct wg_parser *parser = get_wg_parser(params->parser);
pthread_mutex_lock(&parser->mutex);
@@ -575,7 +591,7 @@ static NTSTATUS wg_parser_get_next_read_offset(void *args)
static NTSTATUS wg_parser_push_data(void *args)
{
const struct wg_parser_push_data_params *params = args;
- struct wg_parser *parser = params->parser;
+ struct wg_parser *parser = get_wg_parser(params->parser);
const void *data = params->data;
uint32_t size = params->size;
@@ -1598,7 +1614,7 @@ static NTSTATUS wg_parser_connect(void *args)
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE("quartz_src",
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
const struct wg_parser_connect_params *params = args;
- struct wg_parser *parser = params->parser;
+ struct wg_parser *parser = get_wg_parser(params->parser);
unsigned int i;
int ret;
@@ -1754,7 +1770,8 @@ out:
static NTSTATUS wg_parser_disconnect(void *args)
{
- struct wg_parser *parser = args;
+ const struct wg_parser_disconnect_params *params = args;
+ struct wg_parser *parser = get_wg_parser(params->parser);
unsigned int i;
/* Unblock all of our streams. */
@@ -1978,13 +1995,14 @@ static NTSTATUS wg_parser_create(void *args)
parser->unlimited_buffering = params->unlimited_buffering;
GST_DEBUG("Created winegstreamer parser %p.\n", parser);
- params->parser = parser;
+ params->parser = wg_parser_get_handle(parser);
return S_OK;
}
static NTSTATUS wg_parser_destroy(void *args)
{
- struct wg_parser *parser = args;
+ const struct wg_parser_destroy_params *params = args;
+ struct wg_parser *parser = get_wg_parser(params->parser);
if (parser->bus)
{
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c
index 3a1f1684fdc..d5649f4ba9a 100644
--- a/dlls/winegstreamer/wm_reader.c
+++ b/dlls/winegstreamer/wm_reader.c
@@ -1451,7 +1451,7 @@ static const IWMReaderTimecodeVtbl timecode_vtbl =
static HRESULT init_stream(struct wm_reader *reader, QWORD file_size)
{
- struct wg_parser *wg_parser;
+ wg_parser_t wg_parser;
HRESULT hr;
WORD i;
@@ -1529,7 +1529,7 @@ out_shutdown_thread:
out_destroy_parser:
wg_parser_destroy(reader->wg_parser);
- reader->wg_parser = NULL;
+ reader->wg_parser = 0;
return hr;
}
@@ -1611,7 +1611,7 @@ HRESULT wm_reader_close(struct wm_reader *reader)
reader->callback_advanced = NULL;
wg_parser_destroy(reader->wg_parser);
- reader->wg_parser = NULL;
+ reader->wg_parser = 0;
if (reader->source_stream)
IStream_Release(reader->source_stream);
--
2.34.1