Commit 13188bb1 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Implement wg_parser_stream_get_codec_format.

parent 32cabd1b
......@@ -82,6 +82,7 @@ uint32_t wg_parser_get_stream_count(struct wg_parser *parser);
struct wg_parser_stream *wg_parser_get_stream(struct wg_parser *parser, uint32_t index);
void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, struct wg_format *format);
void wg_parser_stream_get_codec_format(struct wg_parser_stream *stream, struct wg_format *format);
void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format);
void wg_parser_stream_disable(struct wg_parser_stream *stream);
......
......@@ -185,6 +185,19 @@ void wg_parser_stream_get_preferred_format(struct wg_parser_stream *stream, stru
WINE_UNIX_CALL(unix_wg_parser_stream_get_preferred_format, &params);
}
void wg_parser_stream_get_codec_format(struct wg_parser_stream *stream, struct wg_format *format)
{
struct wg_parser_stream_get_codec_format_params params =
{
.stream = stream,
.format = format,
};
TRACE("stream %p, format %p.\n", stream, format);
WINE_UNIX_CALL(unix_wg_parser_stream_get_codec_format, &params);
}
void wg_parser_stream_enable(struct wg_parser_stream *stream, const struct wg_format *format)
{
struct wg_parser_stream_enable_params params =
......
......@@ -240,6 +240,12 @@ struct wg_parser_stream_get_preferred_format_params
struct wg_format *format;
};
struct wg_parser_stream_get_codec_format_params
{
struct wg_parser_stream *stream;
struct wg_format *format;
};
struct wg_parser_stream_enable_params
{
struct wg_parser_stream *stream;
......@@ -350,6 +356,7 @@ enum unix_funcs
unix_wg_parser_get_stream,
unix_wg_parser_stream_get_preferred_format,
unix_wg_parser_stream_get_codec_format,
unix_wg_parser_stream_enable,
unix_wg_parser_stream_disable,
......
......@@ -107,7 +107,7 @@ struct wg_parser_stream
GstPad *their_src, *my_sink;
GstElement *flip, *decodebin;
GstSegment segment;
struct wg_format preferred_format, current_format, stream_format;
struct wg_format preferred_format, current_format, codec_format;
pthread_cond_t event_cond, event_empty_cond;
GstBuffer *buffer;
......@@ -216,6 +216,16 @@ static NTSTATUS wg_parser_stream_get_preferred_format(void *args)
return S_OK;
}
static NTSTATUS wg_parser_stream_get_codec_format(void *args)
{
struct wg_parser_stream_get_codec_format_params *params = args;
*params->format = format_is_compressed(&params->stream->codec_format) ?
params->stream->codec_format :
params->stream->preferred_format;
return S_OK;
}
static NTSTATUS wg_parser_stream_enable(void *args)
{
const struct wg_parser_stream_enable_params *params = args;
......@@ -950,11 +960,11 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user)
return;
caps = gst_pad_query_caps(pad, NULL);
wg_format_from_caps(&stream->stream_format, caps);
wg_format_from_caps(&stream->codec_format, caps);
gst_caps_unref(caps);
/* For compressed stream, create an extra decodebin to decode it. */
if (format_is_compressed(&stream->stream_format))
if (format_is_compressed(&stream->codec_format))
{
if (!stream_decodebin_create(stream))
{
......@@ -1945,6 +1955,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
X(wg_parser_get_stream),
X(wg_parser_stream_get_preferred_format),
X(wg_parser_stream_get_codec_format),
X(wg_parser_stream_enable),
X(wg_parser_stream_disable),
......
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