Commit 442c9d43 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Retrieve the preferred format through a Unix library function.

parent a9c8196e
......@@ -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;
......
......@@ -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;
}
......
......@@ -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)
......
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