From 54340b165e2d31f822a106ea6b9a3fd5a0b2542b Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Sun, 13 Apr 2003 16:08:26 +0000 Subject: Input plugin api change (second part): old open() function replaced by : *_class_get_instance() : return an instance if the plugin handles the mrl *_plugin_open() : open the stream CVS patchset: 4599 CVS date: 2003/04/13 16:08:26 --- src/xine-engine/load_plugins.c | 16 ++++++++-------- src/xine-engine/xine.c | 29 ++++++++++++++++++----------- 2 files changed, 26 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index c9f877f02..67832359b 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.145 2003/04/06 01:17:11 guenter Exp $ + * $Id: load_plugins.c,v 1.146 2003/04/13 16:08:26 tmattern Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -109,7 +109,7 @@ static int _get_decoder_priority (xine_t *this, int default_priority, static plugin_info_t *_get_cached_plugin ( xine_list_t *list, - char *filename, struct stat *statbuffer, + char *filename, struct stat *statbuffer, plugin_info_t *previous_info){ plugin_node_t *node; @@ -578,7 +578,7 @@ static void load_plugin_list(FILE *fp, xine_list_t *plugins) { while (fgets (line, 1023, fp)) { if (line[0] == '#') continue; - + if (line[0] == '[' && version_ok) { if((value = strchr (line, ']'))) *value = (char) 0; @@ -988,7 +988,7 @@ input_plugin_t *find_input_plugin (xine_stream_t *stream, const char *mrl) { while (node) { input_plugin_t *plugin; - if ((plugin = ((input_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, mrl))) { + if ((plugin = ((input_class_t *)node->plugin_class)->get_instance(node->plugin_class, stream, mrl))) { pthread_mutex_unlock (&catalog->lock); return plugin; } @@ -1095,7 +1095,7 @@ demux_plugin_t *find_demux_plugin_by_name(xine_stream_t *stream, const char *nam } node = xine_list_next_content(catalog->demux); } - + pthread_mutex_unlock(&catalog->lock); return NULL; } @@ -1105,7 +1105,7 @@ demux_plugin_t *find_demux_plugin_by_name(xine_stream_t *stream, const char *nam * by content and extension except last_demux_name which is tested after * every other demuxer. * - * this way we can make sure no demuxer will interfere on probing of a + * this way we can make sure no demuxer will interfere on probing of a * known stream. */ @@ -1163,7 +1163,7 @@ demux_plugin_t *find_demux_plugin_last_probe(xine_stream_t *stream, const char * printf ("load_plugins: using demuxer '%s'\n", last_demux_name); return plugin; } - + return NULL; } @@ -1667,8 +1667,8 @@ void free_video_decoder (xine_stream_t *stream, video_decoder_t *vd) { pthread_mutex_lock (&catalog->lock); + vd->dispose (vd); - node->ref--; /* FIXME: unload plugin if no-longer used */ diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index c927eb162..95933546f 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.240 2003/03/30 15:19:46 tmattern Exp $ + * $Id: xine.c,v 1.241 2003/04/13 16:08:26 tmattern Exp $ * * top-level xine functions * @@ -67,7 +67,7 @@ void xine_handle_stream_end (xine_stream_t *stream, int non_user) { if (stream->status == XINE_STATUS_QUIT) return; stream->status = XINE_STATUS_STOP; - + /* join thread if needed to fix resource leaks */ xine_demux_stop_thread( stream ); @@ -225,7 +225,7 @@ void xine_stop (xine_stream_t *stream) { /* redundant? (xine_stop_internal calls xine_demux_flush_engine) if (stream->audio_out) stream->audio_out->flush(stream->audio_out); - + if (stream->video_out) stream->video_out->flush(stream->video_out); */ @@ -396,7 +396,7 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->header_count_audio = 0; stream->header_count_video = 0; stream->finished_count_audio = 0; - stream->finished_count_video = 0; + stream->finished_count_video = 0; stream->err = 0; stream->next_audio_port = NULL; stream->next_video_port = NULL; @@ -520,7 +520,7 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) { char *input_source = (char *)malloc(stream_setup - mrl + 1); memcpy(input_source, mrl, stream_setup - mrl); input_source[stream_setup - mrl] = '\0'; - + /* * find an input plugin */ @@ -551,9 +551,16 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) { stream->meta_info[XINE_META_INFO_INPUT_PLUGIN] = strdup (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class)); } - + + if (!stream->input_plugin->open(stream->input_plugin)) { + stream->input_plugin->dispose(stream->input_plugin); + stream->input_plugin = NULL; + stream->err = XINE_ERROR_INPUT_FAILED; + return 0; + } + if (*stream_setup) { - + while (stream_setup && *stream_setup && *(++stream_setup)) { if (strncasecmp(stream_setup, "demux", 5) == 0) { if (*(stream_setup += 5) == ':') { @@ -941,6 +948,9 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t demux_status = stream->demux_plugin->seek (stream->demux_plugin, pos, start_time); stream->demux_action_pending = 0; + pthread_mutex_lock (&stream->first_frame_lock); + stream->first_frame_flag = 1; + pthread_mutex_unlock (&stream->first_frame_lock); pthread_mutex_unlock( &stream->demux_lock ); if (demux_status != DEMUX_OK) { @@ -948,7 +958,7 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t _("xine_play: demux failed to start\n")); stream->err = XINE_ERROR_DEMUX_FAILED; - + stream->first_frame_flag = 0; return 0; } else { @@ -956,9 +966,6 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t stream->status = XINE_STATUS_PLAY; } - pthread_mutex_lock (&stream->first_frame_lock); - stream->first_frame_flag = 1; - pthread_mutex_unlock (&stream->first_frame_lock); pthread_mutex_lock( &stream->current_extra_info_lock ); extra_info_reset( stream->current_extra_info ); pthread_mutex_unlock( &stream->current_extra_info_lock ); -- cgit v1.2.3