summaryrefslogtreecommitdiff
path: root/src/xine-engine/xine.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@users.sourceforge.net>2004-04-16 16:34:22 +0000
committerBastien Nocera <hadess@users.sourceforge.net>2004-04-16 16:34:22 +0000
commitc2657bde789251c0b8e120861edb3f4f9989fc89 (patch)
tree9ad4058f123c0c0194ad4078dd8115a87354aadc /src/xine-engine/xine.c
parent44c0a772dc78cd298fd9c64db496179b6e2efdb6 (diff)
downloadxine-lib-c2657bde789251c0b8e120861edb3f4f9989fc89.tar.gz
xine-lib-c2657bde789251c0b8e120861edb3f4f9989fc89.tar.bz2
- flush the events queue before returning from an open() so that the front-ends
can receive error events before the end of xine_open() CVS patchset: 6410 CVS date: 2004/04/16 16:34:22
Diffstat (limited to 'src/xine-engine/xine.c')
-rw-r--r--src/xine-engine/xine.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index ccc06b9de..625915008 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.289 2004/04/09 11:26:10 f1rmb Exp $
+ * $Id: xine.c,v 1.290 2004/04/16 16:34:22 hadess Exp $
*/
/*
@@ -623,6 +623,29 @@ static void __mrl_unescape(char *mrl) {
mrl[len] = 0;
}
+void _x_flush_events_queues (xine_stream_t *stream) {
+
+ xine_event_queue_t *queue;
+
+ pthread_mutex_lock (&stream->event_queues_lock);
+
+ /* No events queue? */
+ for (queue = xine_list_first_content (stream->event_queues);
+ queue; queue = xine_list_next_content (stream->event_queues)) {
+ pthread_mutex_lock (&queue->lock);
+ pthread_mutex_unlock (&stream->event_queues_lock);
+
+ while (!xine_list_is_empty (queue->events)) {
+ pthread_cond_wait (&queue->events_processed, &queue->lock);
+ }
+
+ pthread_mutex_unlock (&queue->lock);
+ pthread_mutex_lock (&stream->event_queues_lock);
+ }
+
+ pthread_mutex_unlock (&stream->event_queues_lock);
+}
+
static int __open_internal (xine_stream_t *stream, const char *mrl) {
const char *stream_setup;
@@ -689,6 +712,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) {
if (!stream->input_plugin) {
xine_log (stream->xine, XINE_LOG_MSG, _("xine: cannot find input plugin for MRL [%s]\n"),mrl);
stream->err = XINE_ERROR_NO_INPUT_PLUGIN;
+ _x_flush_events_queues (stream);
return 0;
}