Zebediah Figura : winegstreamer: Factor out more of the init_gst callback into wg_parser_connect().
Alexandre Julliard
julliard at winehq.org
Thu Sep 16 15:34:30 CDT 2021
Module: wine
Branch: master
Commit: 830efe873a967dbbb0c9a65be6a66b124a5fa826
URL: https://source.winehq.org/git/wine.git/?a=commit;h=830efe873a967dbbb0c9a65be6a66b124a5fa826
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Wed Sep 15 18:00:06 2021 -0500
winegstreamer: Factor out more of the init_gst callback into wg_parser_connect().
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winegstreamer/wg_parser.c | 78 +++++++++++++-----------------------------
1 file changed, 24 insertions(+), 54 deletions(-)
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index cd12a23d0c8..bf5a51aeaf4 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -1494,6 +1494,7 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE("quartz_src",
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
unsigned int i;
+ int ret;
parser->file_size = file_size;
parser->sink_connected = true;
@@ -1516,12 +1517,29 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
parser->start_offset = parser->next_offset = parser->stop_offset = 0;
parser->next_pull_offset = 0;
+ parser->error = false;
if (!parser->init_gst(parser))
return E_FAIL;
+ gst_element_set_state(parser->container, GST_STATE_PAUSED);
+ ret = gst_element_get_state(parser->container, NULL, NULL, -1);
+ if (ret == GST_STATE_CHANGE_FAILURE)
+ {
+ GST_ERROR("Failed to play stream.\n");
+ return E_FAIL;
+ }
+
pthread_mutex_lock(&parser->mutex);
+ while (!parser->no_more_pads && !parser->error)
+ pthread_cond_wait(&parser->init_cond, &parser->mutex);
+ if (parser->error)
+ {
+ pthread_mutex_unlock(&parser->mutex);
+ return E_FAIL;
+ }
+
for (i = 0; i < parser->stream_count; ++i)
{
struct wg_parser_stream *stream = parser->streams[i];
@@ -1677,7 +1695,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser)
parser->their_sink = gst_element_get_static_pad(element, "sink");
pthread_mutex_lock(&parser->mutex);
- parser->no_more_pads = parser->error = false;
+ parser->no_more_pads = false;
pthread_mutex_unlock(&parser->mutex);
if ((ret = gst_pad_link(parser->my_src, parser->their_sink)) < 0)
@@ -1686,24 +1704,6 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser)
return FALSE;
}
- gst_element_set_state(parser->container, GST_STATE_PAUSED);
- ret = gst_element_get_state(parser->container, NULL, NULL, -1);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- GST_ERROR("Failed to play stream.\n");
- return FALSE;
- }
-
- pthread_mutex_lock(&parser->mutex);
- while (!parser->no_more_pads && !parser->error)
- pthread_cond_wait(&parser->init_cond, &parser->mutex);
- if (parser->error)
- {
- pthread_mutex_unlock(&parser->mutex);
- return FALSE;
- }
- pthread_mutex_unlock(&parser->mutex);
-
return TRUE;
}
@@ -1724,7 +1724,7 @@ static BOOL avi_parser_init_gst(struct wg_parser *parser)
parser->their_sink = gst_element_get_static_pad(element, "sink");
pthread_mutex_lock(&parser->mutex);
- parser->no_more_pads = parser->error = false;
+ parser->no_more_pads = false;
pthread_mutex_unlock(&parser->mutex);
if ((ret = gst_pad_link(parser->my_src, parser->their_sink)) < 0)
@@ -1733,24 +1733,6 @@ static BOOL avi_parser_init_gst(struct wg_parser *parser)
return FALSE;
}
- gst_element_set_state(parser->container, GST_STATE_PAUSED);
- ret = gst_element_get_state(parser->container, NULL, NULL, -1);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- GST_ERROR("Failed to play stream.\n");
- return FALSE;
- }
-
- pthread_mutex_lock(&parser->mutex);
- while (!parser->no_more_pads && !parser->error)
- pthread_cond_wait(&parser->init_cond, &parser->mutex);
- if (parser->error)
- {
- pthread_mutex_unlock(&parser->mutex);
- return FALSE;
- }
- pthread_mutex_unlock(&parser->mutex);
-
return TRUE;
}
@@ -1781,15 +1763,9 @@ static BOOL mpeg_audio_parser_init_gst(struct wg_parser *parser)
GST_ERROR("Failed to link source pads, error %d.\n", ret);
return FALSE;
}
-
gst_pad_set_active(stream->my_sink, 1);
- gst_element_set_state(parser->container, GST_STATE_PAUSED);
- ret = gst_element_get_state(parser->container, NULL, NULL, -1);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- GST_ERROR("Failed to play stream.\n");
- return FALSE;
- }
+
+ parser->no_more_pads = true;
return TRUE;
}
@@ -1822,15 +1798,9 @@ static BOOL wave_parser_init_gst(struct wg_parser *parser)
GST_ERROR("Failed to link source pads, error %d.\n", ret);
return FALSE;
}
-
gst_pad_set_active(stream->my_sink, 1);
- gst_element_set_state(parser->container, GST_STATE_PAUSED);
- ret = gst_element_get_state(parser->container, NULL, NULL, -1);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- GST_ERROR("Failed to play stream.\n");
- return FALSE;
- }
+
+ parser->no_more_pads = true;
return TRUE;
}
More information about the wine-cvs
mailing list