Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gst_private.h | 22 +++++++++---------- dlls/winegstreamer/main.c | 34 +++++++++++++++++++---------- dlls/winegstreamer/media_source.c | 6 ++--- dlls/winegstreamer/quartz_parser.c | 6 ++--- dlls/winegstreamer/unixlib.h | 28 ++++++++++++++++-------- dlls/winegstreamer/wg_parser.c | 35 +++++++++++++++++++++--------- dlls/winegstreamer/wm_reader.c | 2 +- 7 files changed, 84 insertions(+), 49 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 340712eefe1..6e3128f9a0b 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -77,23 +77,23 @@ bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32 void wg_parser_push_data(wg_parser_t parser, const void *data, uint32_t size) 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; +wg_parser_stream_t 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; -void wg_parser_stream_disable(struct wg_parser_stream *stream) DECLSPEC_HIDDEN; +void wg_parser_stream_get_preferred_format(wg_parser_stream_t stream, struct wg_format *format) DECLSPEC_HIDDEN; +void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format) DECLSPEC_HIDDEN; +void wg_parser_stream_disable(wg_parser_stream_t stream) DECLSPEC_HIDDEN;
-bool wg_parser_stream_get_event(struct wg_parser_stream *stream, struct wg_parser_event *event) DECLSPEC_HIDDEN; -bool wg_parser_stream_copy_buffer(struct wg_parser_stream *stream, +bool wg_parser_stream_get_event(wg_parser_stream_t stream, struct wg_parser_event *event) DECLSPEC_HIDDEN; +bool wg_parser_stream_copy_buffer(wg_parser_stream_t stream, void *data, uint32_t offset, uint32_t size) DECLSPEC_HIDDEN; -void wg_parser_stream_release_buffer(struct wg_parser_stream *stream) DECLSPEC_HIDDEN; -void wg_parser_stream_notify_qos(struct wg_parser_stream *stream, +void wg_parser_stream_release_buffer(wg_parser_stream_t stream) DECLSPEC_HIDDEN; +void wg_parser_stream_notify_qos(wg_parser_stream_t stream, bool underflow, double proportion, int64_t diff, uint64_t timestamp) DECLSPEC_HIDDEN;
/* Returns the duration in 100-nanosecond units. */ -uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream) DECLSPEC_HIDDEN; +uint64_t wg_parser_stream_get_duration(wg_parser_stream_t stream) DECLSPEC_HIDDEN; /* start_pos and stop_pos are in 100-nanosecond units. */ -void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate, +void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags) DECLSPEC_HIDDEN;
unsigned int wg_format_get_max_size(const struct wg_format *format); @@ -121,7 +121,7 @@ HRESULT audio_converter_create(REFIID riid, void **ret) DECLSPEC_HIDDEN; struct wm_stream { struct wm_reader *reader; - struct wg_parser_stream *wg_stream; + wg_parser_stream_t wg_stream; struct wg_format format; WMT_STREAM_SELECTION selection; WORD index; diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 23c11d883c9..fd73f79d365 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -161,7 +161,7 @@ uint32_t wg_parser_get_stream_count(wg_parser_t parser) return params.count; }
-struct wg_parser_stream *wg_parser_get_stream(wg_parser_t parser, uint32_t index) +wg_parser_stream_t wg_parser_get_stream(wg_parser_t parser, uint32_t index) { struct wg_parser_get_stream_params params = { @@ -173,7 +173,7 @@ struct wg_parser_stream *wg_parser_get_stream(wg_parser_t parser, uint32_t index return params.stream; }
-void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format) +void wg_parser_stream_get_preferred_format(wg_parser_stream_t stream, struct wg_format *format) { struct wg_parser_stream_get_preferred_format_params params = { @@ -184,7 +184,7 @@ void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, stru __wine_unix_call(unix_handle, unix_wg_parser_stream_get_preferred_format, ¶ms); }
-void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format) +void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format) { struct wg_parser_stream_enable_params params = { @@ -195,12 +195,17 @@ void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_fo __wine_unix_call(unix_handle, unix_wg_parser_stream_enable, ¶ms); }
-void wg_parser_stream_disable(struct wg_parser_stream *stream) +void wg_parser_stream_disable(wg_parser_stream_t stream) { - __wine_unix_call(unix_handle, unix_wg_parser_stream_disable, stream); + struct wg_parser_stream_disable_params params = + { + .stream = stream, + }; + + __wine_unix_call(unix_handle, unix_wg_parser_stream_disable, ¶ms); }
-bool wg_parser_stream_get_event(struct wg_parser_stream *stream, struct wg_parser_event *event) +bool wg_parser_stream_get_event(wg_parser_stream_t stream, struct wg_parser_event *event) { struct wg_parser_stream_get_event_params params = { @@ -211,7 +216,7 @@ bool wg_parser_stream_get_event(struct wg_parser_stream *stream, struct wg_parse return !__wine_unix_call(unix_handle, unix_wg_parser_stream_get_event, ¶ms); }
-bool wg_parser_stream_copy_buffer(struct wg_parser_stream *stream, +bool wg_parser_stream_copy_buffer(wg_parser_stream_t stream, void *data, uint32_t offset, uint32_t size) { struct wg_parser_stream_copy_buffer_params params = @@ -225,12 +230,17 @@ bool wg_parser_stream_copy_buffer(struct wg_parser_stream *stream, return !__wine_unix_call(unix_handle, unix_wg_parser_stream_copy_buffer, ¶ms); }
-void wg_parser_stream_release_buffer(struct wg_parser_stream *stream) +void wg_parser_stream_release_buffer(wg_parser_stream_t stream) { - __wine_unix_call(unix_handle, unix_wg_parser_stream_release_buffer, stream); + struct wg_parser_stream_release_buffer_params params = + { + .stream = stream, + }; + + __wine_unix_call(unix_handle, unix_wg_parser_stream_release_buffer, ¶ms); }
-void wg_parser_stream_notify_qos(struct wg_parser_stream *stream, +void wg_parser_stream_notify_qos(wg_parser_stream_t stream, bool underflow, double proportion, int64_t diff, uint64_t timestamp) { struct wg_parser_stream_notify_qos_params params = @@ -245,7 +255,7 @@ void wg_parser_stream_notify_qos(struct wg_parser_stream *stream, __wine_unix_call(unix_handle, unix_wg_parser_stream_notify_qos, ¶ms); }
-uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream) +uint64_t wg_parser_stream_get_duration(wg_parser_stream_t stream) { struct wg_parser_stream_get_duration_params params = { @@ -256,7 +266,7 @@ uint64_t wg_parser_stream_get_duration(struct wg_parser_stream *stream) return params.duration; }
-void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate, +void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags) { struct wg_parser_stream_seek_params params = diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index c31c573b381..e3092690f1c 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -35,7 +35,7 @@ struct media_stream IMFMediaEventQueue *event_queue; IMFStreamDescriptor *descriptor;
- struct wg_parser_stream *wg_stream; + wg_parser_stream_t wg_stream;
IUnknown **token_queue; LONG token_queue_count; @@ -838,12 +838,12 @@ static const IMFMediaStreamVtbl media_stream_vtbl = };
static HRESULT new_media_stream(struct media_source *source, - struct wg_parser_stream *wg_stream, DWORD stream_id, struct media_stream **out_stream) + wg_parser_stream_t wg_stream, DWORD stream_id, struct media_stream **out_stream) { struct media_stream *object = calloc(1, sizeof(*object)); HRESULT hr;
- TRACE("source %p, wg_stream %p, stream_id %u.\n", source, wg_stream, stream_id); + TRACE("source %p, wg_stream %#I64x, stream_id %u.\n", source, wg_stream, stream_id);
object->IMFMediaStream_iface.lpVtbl = &media_stream_vtbl; object->ref = 1; diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 29adece3a38..78969860f2b 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -69,7 +69,7 @@ struct parser_source struct strmbase_source pin; IQualityControl IQualityControl_iface;
- struct wg_parser_stream *wg_stream; + wg_parser_stream_t wg_stream;
SourceSeeking seek;
@@ -86,7 +86,7 @@ static const IMediaSeekingVtbl GST_Seeking_Vtbl; static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
static struct parser_source *create_pin(struct parser *filter, - struct wg_parser_stream *stream, const WCHAR *name); + wg_parser_stream_t stream, const WCHAR *name); static HRESULT GST_RemoveOutputPins(struct parser *This); static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface); static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface); @@ -1574,7 +1574,7 @@ static const struct strmbase_source_ops source_ops = };
static struct parser_source *create_pin(struct parser *filter, - struct wg_parser_stream *stream, const WCHAR *name) + wg_parser_stream_t stream, const WCHAR *name) { struct parser_source *pin, **new_array;
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index b6fcfc26d6a..aa2e3c820a5 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -30,7 +30,7 @@
#include "wine/unixlib.h"
-typedef UINT64 wg_parser_t; +typedef UINT64 wg_parser_t, wg_parser_stream_t;
struct wg_format { @@ -187,38 +187,48 @@ struct wg_parser_get_stream_params { wg_parser_t parser; UINT32 index; - struct wg_parser_stream *stream; + wg_parser_stream_t stream; };
struct wg_parser_stream_get_preferred_format_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; struct wg_format *format; };
struct wg_parser_stream_enable_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; const struct wg_format *format; };
+struct wg_parser_stream_disable_params +{ + wg_parser_stream_t stream; +}; + struct wg_parser_stream_get_event_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; struct wg_parser_event *event; };
struct wg_parser_stream_copy_buffer_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; void *data; UINT32 offset; UINT32 size; };
+struct wg_parser_stream_release_buffer_params +{ + wg_parser_stream_t stream; +}; + struct wg_parser_stream_notify_qos_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; bool underflow; DOUBLE proportion; INT64 diff; @@ -227,13 +237,13 @@ struct wg_parser_stream_notify_qos_params
struct wg_parser_stream_get_duration_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; UINT64 duration; };
struct wg_parser_stream_seek_params { - struct wg_parser_stream *stream; + wg_parser_stream_t stream; DOUBLE rate; UINT64 start_pos, stop_pos; DWORD start_flags, stop_flags; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 9c0bfd0a8d2..7c9ba652125 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -123,6 +123,16 @@ static wg_parser_t wg_parser_get_handle(struct wg_parser *parser) return (uintptr_t)parser; }
+static struct wg_parser_stream *get_wg_parser_stream(wg_parser_stream_t handle) +{ + return (struct wg_parser_stream *)(uintptr_t)handle; +} + +static wg_parser_stream_t wg_parser_stream_get_handle(struct wg_parser_stream *stream) +{ + return (uintptr_t)stream; +} + static enum wg_audio_format wg_audio_format_from_gst(GstAudioFormat format) { switch (format) @@ -530,7 +540,7 @@ 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 = parser->streams[params->index]; + params->stream = wg_parser_stream_get_handle(parser->streams[params->index]); return S_OK; }
@@ -611,15 +621,16 @@ static NTSTATUS wg_parser_push_data(void *args) static NTSTATUS wg_parser_stream_get_preferred_format(void *args) { const struct wg_parser_stream_get_preferred_format_params *params = args; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream);
- *params->format = params->stream->preferred_format; + *params->format = stream->preferred_format; return S_OK; }
static NTSTATUS wg_parser_stream_enable(void *args) { const struct wg_parser_stream_enable_params *params = args; - struct wg_parser_stream *stream = params->stream; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream); const struct wg_format *format = params->format;
stream->current_format = *format; @@ -657,7 +668,8 @@ static NTSTATUS wg_parser_stream_enable(void *args)
static NTSTATUS wg_parser_stream_disable(void *args) { - struct wg_parser_stream *stream = args; + const struct wg_parser_stream_disable_params *params = args; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream);
stream->enabled = false; return S_OK; @@ -666,7 +678,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) static NTSTATUS wg_parser_stream_get_event(void *args) { const struct wg_parser_stream_get_event_params *params = args; - struct wg_parser_stream *stream = params->stream; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream); struct wg_parser *parser = stream->parser;
pthread_mutex_lock(&parser->mutex); @@ -696,7 +708,7 @@ static NTSTATUS wg_parser_stream_get_event(void *args) static NTSTATUS wg_parser_stream_copy_buffer(void *args) { const struct wg_parser_stream_copy_buffer_params *params = args; - struct wg_parser_stream *stream = params->stream; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream); struct wg_parser *parser = stream->parser; uint32_t offset = params->offset; uint32_t size = params->size; @@ -720,7 +732,8 @@ static NTSTATUS wg_parser_stream_copy_buffer(void *args)
static NTSTATUS wg_parser_stream_release_buffer(void *args) { - struct wg_parser_stream *stream = args; + struct wg_parser_stream_release_buffer_params *params = args; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream); struct wg_parser *parser = stream->parser;
pthread_mutex_lock(&parser->mutex); @@ -741,8 +754,9 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) static NTSTATUS wg_parser_stream_get_duration(void *args) { struct wg_parser_stream_get_duration_params *params = args; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream);
- params->duration = params->stream->duration; + params->duration = stream->duration; return S_OK; }
@@ -750,6 +764,7 @@ static NTSTATUS wg_parser_stream_seek(void *args) { GstSeekType start_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET; const struct wg_parser_stream_seek_params *params = args; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream); DWORD start_flags = params->start_flags; DWORD stop_flags = params->stop_flags; GstSeekFlags flags = 0; @@ -766,7 +781,7 @@ static NTSTATUS wg_parser_stream_seek(void *args) if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) stop_type = GST_SEEK_TYPE_NONE;
- if (!gst_pad_push_event(params->stream->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME, + if (!gst_pad_push_event(stream->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME, flags, start_type, params->start_pos * 100, stop_type, params->stop_pos * 100))) GST_ERROR("Failed to seek.\n");
@@ -776,7 +791,7 @@ static NTSTATUS wg_parser_stream_seek(void *args) static NTSTATUS wg_parser_stream_notify_qos(void *args) { const struct wg_parser_stream_notify_qos_params *params = args; - struct wg_parser_stream *stream = params->stream; + struct wg_parser_stream *stream = get_wg_parser_stream(params->stream); GstClockTime stream_time; GstEvent *event;
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index d5649f4ba9a..134b519867c 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1815,7 +1815,7 @@ HRESULT wm_reader_get_stream_sample(struct wm_stream *stream, INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags) { IWMReaderCallbackAdvanced *callback_advanced = stream->reader->callback_advanced; - struct wg_parser_stream *wg_stream = stream->wg_stream; + wg_parser_stream_t wg_stream = stream->wg_stream; struct wg_parser_event event;
if (stream->selection == WMT_OFF)