From 8a3706ba2814436bba1e164bf29cd02c6125083b Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 17 Dec 2007 22:00:34 +0100 Subject: add video/flv and application/x-flash-video MIME aliases as used by shared-mime --- src/demuxers/demux_flv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 39c34d91e..5669a4b2e 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -892,7 +892,9 @@ static const char *get_extensions (demux_class_t *this_gen) { } static const char *get_mimetypes (demux_class_t *this_gen) { - return "video/x-flv: flv: Flash video;"; + return "video/x-flv: flv: Flash video;" + "video/flv: flv: Flash video;" + "application/x-flash-video: flv: Flash video;" } static void class_dispose (demux_class_t *this_gen) { -- cgit v1.2.3 From eacdc6fc2e37f80cc03b022988112741979724e6 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 17 Dec 2007 22:16:52 +0100 Subject: compile --- src/demuxers/demux_flv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 5669a4b2e..bdb33d21d 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -894,7 +894,7 @@ static const char *get_extensions (demux_class_t *this_gen) { static const char *get_mimetypes (demux_class_t *this_gen) { return "video/x-flv: flv: Flash video;" "video/flv: flv: Flash video;" - "application/x-flash-video: flv: Flash video;" + "application/x-flash-video: flv: Flash video;"; } static void class_dispose (demux_class_t *this_gen) { -- cgit v1.2.3 From 90d290b7abac28a57c4abee41556e5f48064f60d Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Tue, 18 Dec 2007 23:06:30 +0000 Subject: Don't treat # in MRLs as literals or URI-decode raw filenames. [Bug 1784272] --- src/input/input_file.c | 44 ++++++++++++++------------------------------ src/xine-engine/xine.c | 33 +++++++++++++++++---------------- 2 files changed, 31 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/input/input_file.c b/src/input/input_file.c index abb689e39..f81103dcd 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -340,7 +340,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) { lprintf("file_plugin_open\n"); - if (strncasecmp (this->mrl, "file:", 5) == 0) + if (strncasecmp (this->mrl, "file:/", 6) == 0) { if (strncasecmp (this->mrl, "file://localhost/", 16) == 0) filename = decode_uri(&(this->mrl[16])); @@ -350,43 +350,27 @@ static int file_plugin_open (input_plugin_t *this_gen ) { filename = decode_uri(&(this->mrl[5])); } else - filename = decode_uri(this->mrl); + filename = strdup(this->mrl); /* NEVER unescape plain file names! */ this->fh = open (filename, O_RDONLY|O_BINARY); - - free(filename); if (this->fh == -1) { - /* try again without unescaping; such MRLs might be invalid, - * but we are a nice software */ - if (strncasecmp (this->mrl, "file:", 5) == 0) - { - if (strncasecmp (this->mrl, "file://localhost/", 16) == 0) - this->fh = open(&this->mrl[16], O_RDONLY|O_BINARY); - else if (strncasecmp (this->mrl, "file://127.0.0.1/", 16) == 0) - this->fh = open(&this->mrl[16], O_RDONLY|O_BINARY); - else - this->fh = open(&this->mrl[5], O_RDONLY|O_BINARY); + if (errno == EACCES) { + _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); + xine_log (this->stream->xine, XINE_LOG_MSG, + _("input_file: Permission denied: >%s<\n"), this->mrl); + } else if (errno == ENOENT) { + _x_message(this->stream, XINE_MSG_FILE_NOT_FOUND, this->mrl, NULL); + xine_log (this->stream->xine, XINE_LOG_MSG, + _("input_file: File not found: >%s<\n"), this->mrl); } - else - this->fh = open(this->mrl, O_RDONLY|O_BINARY); - - if (this->fh == -1) { - if (errno == EACCES) { - _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); - xine_log (this->stream->xine, XINE_LOG_MSG, - _("input_file: Permission denied: >%s<\n"), this->mrl); - return -1; - } else if (errno == ENOENT) { - _x_message(this->stream, XINE_MSG_FILE_NOT_FOUND, this->mrl, NULL); - xine_log (this->stream->xine, XINE_LOG_MSG, - _("input_file: File not found: >%s<\n"), this->mrl); - } - return -1; - } + free(filename); + return -1; } + free(filename); + #ifdef HAVE_MMAP this->mmap_on = 0; this->mmap_base = NULL; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 097ce99ef..f3b59942d 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -35,6 +35,7 @@ #include #include #include +#include #if defined (__linux__) || defined (__GLIBC__) #include #elif defined (__FreeBSD__) @@ -779,9 +780,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) { @@ -806,13 +807,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 = (char *)malloc(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 @@ -831,7 +838,6 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { res = (stream->input_plugin->open) (stream->input_plugin); switch(res) { case 1: /* Open successfull */ - free(input_source); break; case -1: /* Open unsuccessfull, but correct plugin */ free(input_source); @@ -844,14 +850,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; } free(input_source); - /* 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++; } if (!stream->input_plugin) { @@ -861,7 +862,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) { -- cgit v1.2.3