From 549e07167100fc654422dbaa0b9056162ceac606 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Sat, 26 Oct 2002 22:08:08 +0000 Subject: handle demuxers that fail to start CVS patchset: 3028 CVS date: 2002/10/26 22:08:08 --- src/xine-engine/xine.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 9838a9294..90afd3f0a 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.175 2002/10/26 03:56:32 storri Exp $ + * $Id: xine.c,v 1.176 2002/10/26 22:08:08 guenter Exp $ * * top-level xine functions * @@ -397,6 +397,30 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) { stream->demux_plugin->send_headers (stream->demux_plugin); + if (stream->demux_plugin->get_status(stream->demux_plugin) != DEMUX_OK) { + xine_log (stream->xine, XINE_LOG_MSG, + _("xine: demuxer failed to start\n")); + + stream->demux_plugin->dispose (stream->demux_plugin); + stream->demux_plugin = NULL; + + printf ("xine: demux disposed\n"); + + stream->input_plugin->dispose (stream->input_plugin); + stream->input_plugin = NULL; + stream->err = XINE_ERROR_NO_DEMUX_PLUGIN; + + /* remove buffered samples from the sound device driver */ + if (stream->audio_out) + stream->audio_out->control (stream->audio_out, AO_CTRL_FLUSH_BUFFERS); + + stream->status = XINE_STATUS_STOP; + + printf ("xine: return from xine_open_internal\n"); + + return 0; + } + pthread_mutex_lock (&stream->counter_lock); while ((stream->header_count_audioheader_count_video