diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2002-05-05 20:20:10 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2002-05-05 20:20:10 +0000 |
commit | 259a762d997a3fc55839d291ead7858784f7931f (patch) | |
tree | 18512578d8588ea0743c3c4cbc70b564e960dcc9 | |
parent | 55458a1d4e415713a605c1f0e863e7b22c195422 (diff) | |
download | xine-lib-259a762d997a3fc55839d291ead7858784f7931f.tar.gz xine-lib-259a762d997a3fc55839d291ead7858784f7931f.tar.bz2 |
Fixed mrl checking (mrl:// wasn't respected).
CVS patchset: 1853
CVS date: 2002/05/05 20:20:10
-rw-r--r-- | src/input/input_file.c | 6 | ||||
-rw-r--r-- | src/input/input_net.c | 20 | ||||
-rw-r--r-- | src/input/input_rtp.c | 22 | ||||
-rw-r--r-- | src/input/input_stdin_fifo.c | 15 |
4 files changed, 33 insertions, 30 deletions
diff --git a/src/input/input_file.c b/src/input/input_file.c index 5ebe7dda5..ada3f2b10 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.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: input_file.c,v 1.47 2002/04/24 08:12:13 f1rmb Exp $ + * $Id: input_file.c,v 1.48 2002/05/05 20:20:10 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -282,8 +282,8 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) { this->mrl = strdup(mrl); - if (!strncasecmp (this->mrl, "file:",5)) - filename = &this->mrl[5]; + if (!strncasecmp (this->mrl, "file://", 7)) + filename = &this->mrl[7]; else filename = this->mrl; diff --git a/src/input/input_net.c b/src/input/input_net.c index 6fa8a04f0..cd6c76262 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -60,12 +60,12 @@ extern int errno; #ifdef __GNUC__ #define LOG_MSG(xine, message, args...) { \ - xine_log(xine, XINE_LOG_MSG, message, ##args); \ + xine_log(xine, XINE_LOG_MSG, message, ##args); \ printf(message, ##args); \ } #else #define LOG_MSG(xine, ...) { \ - xine_log(xine, XINE_LOG_MSG, __VA_ARGS__); \ + xine_log(xine, XINE_LOG_MSG, __VA_ARGS__); \ printf(__VA_ARGS__); \ } #endif @@ -147,18 +147,20 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) { this->mrl = strdup(mrl); /* FIXME: small memory leak */ - if (!strncasecmp (mrl, "tcp:",4)) - filename = (char *) &this->mrl[4]; + if (!strncasecmp (mrl, "tcp://", 6)) { + filename = (char *) &this->mrl[6]; + + if((!filename) || (strlen(filename) == 0)) + return 0; + + } else return 0; - if(strncmp(filename, "//", 2)==0) - filename+=2; - pptr=strrchr(filename, ':'); if(pptr) { - *pptr++=0; - sscanf(pptr,"%d", &port); + *pptr++ = 0; + sscanf(pptr,"%d", &port); } this->fh = host_connect(filename, port, this->xine); diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index 3ae00d017..879709138 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -298,27 +298,27 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) { this->mrl = mrl; - if (!strncmp (mrl, "rtp:",4)) { - filename = &mrl[4]; - } else if (!strncmp (mrl, "udp:",4)) { - filename = &mrl[4]; - } else - return 0; + if ((!strncmp (mrl, "rtp://", 6)) || (!strncmp (mrl, "udp://", 6))) { + filename = &mrl[6]; + + if((!filename) || (strlen(filename) == 0)) + return 0; - if(strncmp(filename, "//", 2)==0) - filename+=2; + } + else + return 0; LOG_MSG(this->xine, _("Opening >%s<\n"), filename); pptr=strrchr(filename, ':'); - if(pptr) - { - *pptr++=0; + if(pptr) { + *pptr++ = 0; sscanf(pptr,"%d", &port); } if (this->fh != -1) close(this->fh); + this->fh = host_connect(filename, port, this->xine); if (this->fh == -1) { diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index ce2e9acdb..c766fab50 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.25 2002/04/24 08:12:13 f1rmb Exp $ + * $Id: input_stdin_fifo.c,v 1.26 2002/05/05 20:20:11 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -87,7 +87,7 @@ static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) { this->mrl = mrl; - if (!strncasecmp(mrl, "stdin:", 6) + if (!strncasecmp(mrl, "stdin://", 8) || !strncmp(mrl, "-", 1)) { #if defined(CONFIG_DEVFS_FS) filename = "/dev/vc/stdin"; @@ -95,26 +95,27 @@ static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) { filename = "/dev/stdin"; #endif - } else if(!strncasecmp(mrl, "fifo:", 5)) { + } else if(!strncasecmp(mrl, "fifo://", 7)) { - if ((pfn = strrchr((mrl+5), ':')) != NULL) { + if ((pfn = strrchr((mrl + 7), ':')) != NULL) { filename = ++pfn; } else { - if (!(strncasecmp(mrl+5, "//mpeg1", 7)) - || (!(strncasecmp(mrl+5, "//mpeg2", 7)))) { + if (!(strncasecmp(mrl + 7, "mpeg1", 5)) + || (!(strncasecmp(mrl + 7, "mpeg2", 5)))) { filename = (char *) &mrl[12]; } else { - filename = (char *) &mrl[5]; + filename = (char *) &mrl[7]; } } } else { return 0; } + printf("input_stdin_fifo: filename '%s'\n", filename); this->fh = open (filename, O_RDONLY); if(this->fh == -1) { |