diff options
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/audio_decoder.c | 29 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 51 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 21 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 5 |
4 files changed, 63 insertions, 43 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 892fdbf8d..32fb031e0 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.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: audio_decoder.c,v 1.85 2002/10/14 15:47:23 guenter Exp $ + * $Id: audio_decoder.c,v 1.86 2002/10/18 04:04:10 miguelfreitas Exp $ * * * functions that implement audio decoding @@ -45,7 +45,6 @@ void *audio_decoder_loop (void *stream_gen) { buf_element_t *buf; xine_stream_t *stream = (xine_stream_t *) stream_gen; int running = 1; - audio_decoder_t *decoder; static int prof_audio_decode = -1; static uint32_t buftype_unknown = 0; @@ -237,23 +236,25 @@ void *audio_decoder_loop (void *stream_gen) { if (buf->type == audio_type) { int streamtype = (buf->type>>16) & 0xFF; - - decoder = get_audio_decoder (stream, streamtype); - + /* close old decoder of audio type has changed */ + + if( stream->audio_decoder_streamtype != streamtype || + !stream->audio_decoder_plugin ) { + + if (stream->audio_decoder_plugin) { + free_audio_decoder (stream, stream->audio_decoder_plugin); + } + + stream->audio_decoder_streamtype = streamtype; + stream->audio_decoder_plugin = get_audio_decoder (stream, streamtype); + } if (audio_type != stream->audio_type) { if (stream->audio_decoder_plugin) { - free_audio_decoder (stream, stream->audio_decoder_plugin); - stream->audio_decoder_plugin = NULL; - } - - if (decoder) { xine_event_t event; - stream->audio_decoder_plugin = decoder; - stream->audio_type = audio_type; event.type = XINE_EVENT_UI_CHANNELS_CHANGED; @@ -264,8 +265,8 @@ void *audio_decoder_loop (void *stream_gen) { /* finally - decode data */ - if (decoder) - decoder->decode_data (decoder, buf); + if (stream->audio_decoder_plugin) + stream->audio_decoder_plugin->decode_data (stream->audio_decoder_plugin, buf); else if( buf->type != buftype_unknown ) { xine_log (stream->xine, XINE_LOG_MSG, "audio_decoder: no plugin available to handle '%s'\n", diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 0464a9e69..7a65d26b1 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.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: video_decoder.c,v 1.100 2002/10/14 15:47:40 guenter Exp $ + * $Id: video_decoder.c,v 1.101 2002/10/18 04:04:10 miguelfreitas Exp $ * */ @@ -40,19 +40,23 @@ static spu_decoder_t* update_spu_decoder (xine_stream_t *this, int type) { int streamtype = (type>>16) & 0xFF; - spu_decoder_t *spu_decoder = get_spu_decoder (this, streamtype); - - if (spu_decoder && this->spu_decoder_plugin != spu_decoder) { - + + if( this->spu_decoder_streamtype != streamtype || + !this->spu_decoder_plugin ) { + if (this->spu_decoder_plugin) this->spu_decoder_plugin->close (this->spu_decoder_plugin); + + this->spu_decoder_streamtype = streamtype; + this->spu_decoder_plugin = get_spu_decoder (this, streamtype); - this->spu_decoder_plugin = spu_decoder; - - this->spu_decoder_plugin->init (this->spu_decoder_plugin, + /* obsolete? + if (this->spu_decoder_plugin ) + this->spu_decoder_plugin->init (this->spu_decoder_plugin, this->video_out); + */ } - return spu_decoder; + return this->spu_decoder_plugin; } void *video_decoder_loop (void *stream_gen) { @@ -61,7 +65,6 @@ void *video_decoder_loop (void *stream_gen) { xine_stream_t *stream = (xine_stream_t *) stream_gen; int running = 1; int streamtype; - video_decoder_t *decoder; spu_decoder_t *spu_decoder; static int prof_video_decode = -1; static int prof_spu_decode = -1; @@ -263,21 +266,21 @@ void *video_decoder_loop (void *stream_gen) { */ streamtype = (buf->type>>16) & 0xFF; + + if( stream->video_decoder_streamtype != streamtype || + !stream->video_decoder_plugin ) { + + if (stream->video_decoder_plugin) { + free_video_decoder (stream, stream->video_decoder_plugin); + } + + stream->video_decoder_streamtype = streamtype; + stream->video_decoder_plugin = get_video_decoder (stream, streamtype); + } - decoder = get_video_decoder (stream, streamtype); - - if (decoder) { - - if (stream->video_decoder_plugin != decoder) { - - if (stream->video_decoder_plugin) { - free_video_decoder (stream, stream->video_decoder_plugin); - } - - stream->video_decoder_plugin = decoder; - } - - decoder->decode_data (stream->video_decoder_plugin, buf); + if (stream->video_decoder_plugin) { + + stream->video_decoder_plugin->decode_data (stream->video_decoder_plugin, buf); } else if (buf->type != buftype_unknown) { xine_log (stream->xine, XINE_LOG_MSG, diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 0d3bb5d4d..847390768 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.168 2002/10/16 21:23:59 guenter Exp $ + * $Id: xine.c,v 1.169 2002/10/18 04:04:10 miguelfreitas Exp $ * * top-level xine functions * @@ -62,7 +62,8 @@ void xine_handle_stream_end (xine_stream_t *stream, int non_user) { if (stream->status == XINE_STATUS_QUIT) return; - + stream->status = XINE_STATUS_STOP; + if (non_user) { /* frontends will not be interested in receiving this event * if they have called xine_stop explicitly, so only send @@ -226,8 +227,11 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->input_time = 0; stream->spu_out = NULL; stream->spu_decoder_plugin = NULL; + stream->spu_decoder_streamtype = -1; stream->audio_channel_user = -1; stream->audio_channel_auto = 0; + stream->audio_decoder_plugin = NULL; + stream->audio_decoder_streamtype = -1; stream->spu_channel_auto = -1; stream->spu_channel_letterbox = -1; stream->spu_channel_pan_scan = -1; @@ -236,6 +240,8 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->video_driver = vo; stream->video_in_discontinuity = 0; stream->video_channel = 0; + stream->video_decoder_plugin = NULL; + stream->video_decoder_streamtype = -1; stream->header_count_audio = 0; stream->header_count_video = 0; stream->finished_count_audio = 0; @@ -316,7 +322,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) { /* * find a demux plugin */ - if (!find_demux_plugin (stream, stream->input_plugin)) { + if (!(stream->demux_plugin=find_demux_plugin (stream, stream->input_plugin))) { xine_log (stream->xine, XINE_LOG_MSG, _("xine: couldn't find demux for >%s<\n"), mrl); stream->input_plugin->dispose (stream->input_plugin); @@ -404,6 +410,14 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t } else pos = 0; + if (!stream->demux_plugin) { + xine_log (stream->xine, XINE_LOG_MSG, + _("xine_play: no demux available\n")); + stream->err = XINE_ERROR_NO_DEMUX_PLUGIN; + + return 0; + } + if (stream->status == XINE_STATUS_STOP) { demux_status = stream->demux_plugin->start (stream->demux_plugin, @@ -422,7 +436,6 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t if (stream->status == XINE_STATUS_STOP) stream->input_plugin->dispose(stream->input_plugin); - pthread_mutex_unlock (&stream->frontend_lock); return 0; } else { diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index a07916a9e..a7d468915 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -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_internal.h,v 1.104 2002/10/14 15:47:45 guenter Exp $ + * $Id: xine_internal.h,v 1.105 2002/10/18 04:04:10 miguelfreitas Exp $ * */ @@ -148,6 +148,7 @@ struct xine_stream_s { fifo_buffer_t *video_fifo; pthread_t video_thread; video_decoder_t *video_decoder_plugin; + int video_decoder_streamtype; int video_in_discontinuity; int video_channel; @@ -156,6 +157,7 @@ struct xine_stream_s { lrb_t *audio_temp; pthread_t audio_thread; audio_decoder_t *audio_decoder_plugin; + int audio_decoder_streamtype; uint32_t audio_track_map[50]; int audio_track_map_entries; uint32_t audio_type; @@ -169,6 +171,7 @@ struct xine_stream_s { spu_functions_t *spu_out; pthread_t spu_thread; spu_decoder_t *spu_decoder_plugin; + int spu_decoder_streamtype; int spu_channel_user; int spu_channel_auto; int spu_channel_letterbox; |