Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gst_private.h | 2 ++ dlls/winegstreamer/gstdemux.c | 35 +++++++++++++++++++------------- dlls/winegstreamer/wg_parser.c | 7 +++++++ 3 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 0a37e10c840..d95f58dc607 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -217,6 +217,8 @@ struct unix_funcs
uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser); struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index); + + void (CDECL *wg_parser_stream_get_preferred_format)(struct wg_parser_stream *stream, struct wg_format *format); };
extern const struct unix_funcs *unix_funcs; diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index be1c59453d5..95e55a55f22 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1064,8 +1064,7 @@ static HRESULT decodebin_parser_source_query_accept(struct parser_source *pin, c static HRESULT decodebin_parser_source_get_media_type(struct parser_source *pin, unsigned int index, AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; - struct wg_format format = stream->preferred_format; + struct wg_format format;
static const enum wg_video_format video_formats[] = { @@ -1086,6 +1085,8 @@ static HRESULT decodebin_parser_source_get_media_type(struct parser_source *pin, WG_VIDEO_FORMAT_RGB15, };
+ unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + memset(mt, 0, sizeof(AM_MEDIA_TYPE));
if (amt_from_wg_format(mt, &format)) @@ -1673,11 +1674,12 @@ static BOOL wave_parser_filter_init_gst(struct parser *filter)
static HRESULT wave_parser_source_query_accept(struct parser_source *pin, const AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; + struct wg_format format; AM_MEDIA_TYPE pad_mt; HRESULT hr;
- if (!amt_from_wg_format(&pad_mt, &stream->preferred_format)) + unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + if (!amt_from_wg_format(&pad_mt, &format)) return E_OUTOFMEMORY; hr = compare_media_types(mt, &pad_mt) ? S_OK : S_FALSE; FreeMediaType(&pad_mt); @@ -1687,11 +1689,12 @@ static HRESULT wave_parser_source_query_accept(struct parser_source *pin, const static HRESULT wave_parser_source_get_media_type(struct parser_source *pin, unsigned int index, AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; + struct wg_format format;
if (index > 0) return VFW_S_NO_MORE_ITEMS; - if (!amt_from_wg_format(mt, &stream->preferred_format)) + unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + if (!amt_from_wg_format(mt, &format)) return E_OUTOFMEMORY; return S_OK; } @@ -1761,11 +1764,12 @@ static BOOL avi_splitter_filter_init_gst(struct parser *filter)
static HRESULT avi_splitter_source_query_accept(struct parser_source *pin, const AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; + struct wg_format format; AM_MEDIA_TYPE pad_mt; HRESULT hr;
- if (!amt_from_wg_format(&pad_mt, &stream->preferred_format)) + unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + if (!amt_from_wg_format(&pad_mt, &format)) return E_OUTOFMEMORY; hr = compare_media_types(mt, &pad_mt) ? S_OK : S_FALSE; FreeMediaType(&pad_mt); @@ -1775,11 +1779,12 @@ static HRESULT avi_splitter_source_query_accept(struct parser_source *pin, const static HRESULT avi_splitter_source_get_media_type(struct parser_source *pin, unsigned int index, AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; + struct wg_format format;
if (index > 0) return VFW_S_NO_MORE_ITEMS; - if (!amt_from_wg_format(mt, &stream->preferred_format)) + unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + if (!amt_from_wg_format(mt, &format)) return E_OUTOFMEMORY; return S_OK; } @@ -1847,11 +1852,12 @@ static BOOL mpeg_splitter_filter_init_gst(struct parser *filter)
static HRESULT mpeg_splitter_source_query_accept(struct parser_source *pin, const AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; + struct wg_format format; AM_MEDIA_TYPE pad_mt; HRESULT hr;
- if (!amt_from_wg_format(&pad_mt, &stream->preferred_format)) + unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + if (!amt_from_wg_format(&pad_mt, &format)) return E_OUTOFMEMORY; hr = compare_media_types(mt, &pad_mt) ? S_OK : S_FALSE; FreeMediaType(&pad_mt); @@ -1861,11 +1867,12 @@ static HRESULT mpeg_splitter_source_query_accept(struct parser_source *pin, cons static HRESULT mpeg_splitter_source_get_media_type(struct parser_source *pin, unsigned int index, AM_MEDIA_TYPE *mt) { - struct wg_parser_stream *stream = pin->wg_stream; + struct wg_format format;
if (index > 0) return VFW_S_NO_MORE_ITEMS; - if (!amt_from_wg_format(mt, &stream->preferred_format)) + unix_funcs->wg_parser_stream_get_preferred_format(pin->wg_stream, &format); + if (!amt_from_wg_format(mt, &format)) return E_OUTOFMEMORY; return S_OK; } diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 1cbe123ca2f..208abc59a9b 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -327,6 +327,11 @@ static struct wg_parser_stream * CDECL wg_parser_get_stream(struct wg_parser *pa return parser->streams[index]; }
+static void CDECL wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format) +{ + *format = stream->preferred_format; +} + static GstAutoplugSelectResult autoplug_blacklist(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) { const char *name = gst_element_factory_get_longname(fact); @@ -1480,6 +1485,8 @@ static const struct unix_funcs funcs =
wg_parser_get_stream_count, wg_parser_get_stream, + + wg_parser_stream_get_preferred_format, };
NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)