diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2007-12-18 23:10:46 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2007-12-18 23:10:46 +0000 |
commit | a1a49aa27686e8d81d3a2f7b179b6c428153126c (patch) | |
tree | 33fc0203ca916ed6c8b4c06e97af87758bbd8fb0 /src/xine-engine | |
parent | 4ccb69e98ecdca80bad9e656d686b0086ca3149a (diff) | |
parent | 90d290b7abac28a57c4abee41556e5f48064f60d (diff) | |
download | xine-lib-a1a49aa27686e8d81d3a2f7b179b6c428153126c.tar.gz xine-lib-a1a49aa27686e8d81d3a2f7b179b6c428153126c.tar.bz2 |
Merge from 1.1.
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/xine.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 5ad642202..6d6e05b19 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -35,6 +35,7 @@ #include <pthread.h> #include <stdarg.h> #include <stdio.h> +#include <ctype.h> #if defined (__linux__) || defined (__GLIBC__) #include <endian.h> #elif defined (__FreeBSD__) @@ -819,9 +820,9 @@ void _x_flush_events_queues (xine_stream_t *stream) { pthread_mutex_unlock (&stream->event_queues_lock); } -static int open_internal (xine_stream_t *stream, const char *mrl) { +/*static*/ int open_internal (xine_stream_t *stream, const char *mrl) { - const char *stream_setup; + const char *stream_setup = NULL; int no_cache = 0; if (!mrl) { @@ -846,13 +847,19 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { * look for a stream_setup in MRL and try finding an input plugin */ - stream_setup = mrl; - /* look for the next '#' or try the whole MRL, if none is found */ - while (*stream_setup && - (stream_setup = (strchr(stream_setup, '#') ? strchr(stream_setup, '#') : strlen(mrl) + mrl))) { - char input_source[stream_setup - mrl + 1]; - memcpy(input_source, mrl, stream_setup - mrl); - input_source[stream_setup - mrl] = '\0'; + if (isalpha (*mrl)) + { + stream_setup = mrl + 1; + while (isalnum (*stream_setup) || *stream_setup == '+' || *stream_setup == '-' || *stream_setup == '.') + ++stream_setup; + if (stream_setup[0] == ':' && stream_setup[1] == '/') + stream_setup = strchr (mrl, '#'); + else + stream_setup = NULL; + } + + { + char *input_source = strndup (mrl, stream_setup ? stream_setup - mrl : strlen (mrl)); /* * find an input plugin @@ -874,6 +881,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { case 1: /* Open successfull */ break; case -1: /* Open unsuccessfull, but correct plugin */ + free(input_source); stream->err = XINE_ERROR_INPUT_FAILED; _x_flush_events_queues (stream); return 0; @@ -883,13 +891,9 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { stream->input_plugin = NULL; stream->err = XINE_ERROR_INPUT_FAILED; } - if ( res ) break; } - /* if we fail when passing up to the first '#' to the input plugins, - * maybe the user stated a (invalid) MRL, with a '#' belonging to the - * input source -> look for the next '#' and try again */ - if (*stream_setup) stream_setup++; + free(input_source); } if (!stream->input_plugin) { @@ -899,7 +903,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { return 0; } - if (*stream_setup) { + if (stream_setup) { while (stream_setup && *stream_setup && *(++stream_setup)) { if (strncasecmp(stream_setup, "demux", 5) == 0) { |