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 | |
parent | 4ccb69e98ecdca80bad9e656d686b0086ca3149a (diff) | |
parent | 90d290b7abac28a57c4abee41556e5f48064f60d (diff) | |
download | xine-lib-a1a49aa27686e8d81d3a2f7b179b6c428153126c.tar.gz xine-lib-a1a49aa27686e8d81d3a2f7b179b6c428153126c.tar.bz2 |
Merge from 1.1.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/demuxers/demux_flv.c | 29 | ||||
-rw-r--r-- | src/input/input_file.c | 44 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 34 |
4 files changed, 63 insertions, 46 deletions
@@ -83,6 +83,8 @@ xine-lib (1.1.9) (unreleased) * Enabled the WMV VC1 (ffmpeg) codec. * Fixed a crash that happened when a video output was closed * Made the Real demuxer recognise http references. + * Require correct URL encoding of '#'s which aren't separators. + * Don't decode %nn in raw filenames. [Bug 1784272] xine-lib (1.1.8) * Send a channel-changed event to the frontend when receiving the SYNC diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index f0b29532b..7f9dec5fe 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -870,6 +870,30 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } +static const char *get_description (demux_class_t *this_gen) { + return "Flash Video file demux plugin"; +} + +static const char *get_identifier (demux_class_t *this_gen) { + return "FLV"; +} + +static const char *get_extensions (demux_class_t *this_gen) { + return "flv"; +} + +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;"; +} + +static void class_dispose (demux_class_t *this_gen) { + demux_flv_class_t *this = (demux_flv_class_t *) this_gen; + + free (this); +} + static void *init_plugin (xine_t *xine, void *data) { demux_flv_class_t *this; @@ -878,7 +902,9 @@ static void *init_plugin (xine_t *xine, void *data) { this->demux_class.open_plugin = open_plugin; this->demux_class.description = N_("Flash Video file demux plugin"); this->demux_class.identifier = "FLV"; - this->demux_class.mimetypes = "video/x-flv: flv: Flash video;"; + this->demux_class.mimetypes = "video/x-flv: flv: Flash video;" + "video/flv: flv: Flash video;" + "application/x-flash-video: flv: Flash video;"; this->demux_class.extensions = "flv"; this->demux_class.dispose = default_demux_class_dispose; @@ -897,3 +923,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_DEMUX, 27, "flashvideo", XINE_VERSION_CODE, &demux_info_flv, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; + diff --git a/src/input/input_file.c b/src/input/input_file.c index 1916a71e4..1556afb09 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -337,7 +337,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])); @@ -347,43 +347,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 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) { |