diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-04-17 19:01:23 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-04-17 19:01:23 +0000 |
commit | 8f47c8446881b116b86721abb36af3bcb8159def (patch) | |
tree | a3a6977baa5a2bd810f13ba47bca8a9fe54f3167 /src/xine-engine | |
parent | 05e985d004bc397174a62d6f060b9742e9914087 (diff) | |
download | xine-lib-8f47c8446881b116b86721abb36af3bcb8159def.tar.gz xine-lib-8f47c8446881b116b86721abb36af3bcb8159def.tar.bz2 |
cleanup patch by Marco Z|hlke <M.Zuehlke@freenet.de>
CVS patchset: 4632
CVS date: 2003/04/17 19:01:23
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/demux.c | 46 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 5 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 6 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 4 |
4 files changed, 56 insertions, 5 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index c1b78dcd8..8cafe9f78 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -149,7 +149,7 @@ void xine_demux_control_headers_done (xine_stream_t *stream) { void xine_demux_control_start( xine_stream_t *stream ) { buf_element_t *buf; - + buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_START; stream->video_fifo->put (stream->video_fifo, buf); @@ -332,6 +332,50 @@ int xine_demux_stop_thread (xine_stream_t *stream) { return 0; } +int xine_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t size){ + int read_size; + unsigned char *buf; + + if (!input || !size || size > MAX_PREVIEW_SIZE) + return 0; + + if (input->get_capabilities(input) & INPUT_CAP_SEEKABLE) { + input->seek(input, 0, SEEK_SET); + read_size = input->read(input, buffer, size); + if (read_size != size) + return 0; + input->seek(input, 0, SEEK_SET); + } else if (input->get_capabilities(input) & INPUT_CAP_PREVIEW) { + buf = xine_xmalloc(MAX_PREVIEW_SIZE); + read_size = input->get_optional_data(input, buf, INPUT_OPTIONAL_DATA_PREVIEW); + memcpy(buffer, buf, size); + free(buf); + } else { + return 0; + } + return read_size; +} + +int xine_demux_check_extension (char *mrl, char *extensions){ + char *last_dot, *e, *ext_copy, *ext_work; + + ext_copy = strdup(extensions); + ext_work = ext_copy; + + last_dot = strrchr (mrl, '.'); + if (last_dot) { + last_dot++; + while ( ( e = xine_strsep(&ext_work, " ")) != NULL ) { + if (strcasecmp (last_dot, e) == 0) { + free(ext_copy); + return 1; + } + } + } + free(ext_copy); + return 0; +} + /* * read from socket/file descriptor checking demux_action_pending diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 67832359b..cd96eb4b0 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.146 2003/04/13 16:08:26 tmattern Exp $ + * $Id: load_plugins.c,v 1.147 2003/04/17 19:01:23 miguelfreitas Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -1157,6 +1157,9 @@ demux_plugin_t *find_demux_plugin_last_probe(xine_stream_t *stream, const char * i++; } + if( !last_demux ) + return NULL; + stream->content_detection_method = METHOD_BY_CONTENT; if ((plugin = ((demux_class_t *)last_demux->plugin_class)->open_plugin(last_demux->plugin_class, stream, input))) { diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 5281556b6..811a53888 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.242 2003/04/16 22:38:44 miguelfreitas Exp $ + * $Id: xine.c,v 1.243 2003/04/17 19:01:24 miguelfreitas Exp $ * * top-level xine functions * @@ -531,7 +531,7 @@ static int xine_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 this MRL\n")); + _("xine: cannot find input plugin for MRL [%s]\n"),mrl); stream->err = XINE_ERROR_NO_INPUT_PLUGIN; return 0; } else { @@ -545,6 +545,8 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) { } if (!stream->input_plugin->open(stream->input_plugin)) { + xine_log (stream->xine, XINE_LOG_MSG, + _("xine: input plugin cannot open MRL [%s]\n"),mrl); stream->input_plugin->dispose(stream->input_plugin); stream->input_plugin = NULL; stream->err = XINE_ERROR_INPUT_FAILED; diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 45291cea4..31bca19fa 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.134 2003/04/13 16:28:48 miguelfreitas Exp $ + * $Id: xine_internal.h,v 1.135 2003/04/17 19:01:25 miguelfreitas Exp $ * */ @@ -306,6 +306,8 @@ void xine_demux_control_start (xine_stream_t *stream); void xine_demux_control_end (xine_stream_t *stream, uint32_t flags); int xine_demux_start_thread (xine_stream_t *stream); int xine_demux_stop_thread (xine_stream_t *stream); +int xine_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size); +int xine_demux_check_extension (char *mrl, char *extensions); off_t xine_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo); |