From 0dde90a99e67f5dfb0b04e04e8404dffa1fe1060 Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Thu, 31 Oct 2002 17:00:44 +0000 Subject: adapt input plugins to new MRL syntax (mostly turning :// into :/) CVS patchset: 3113 CVS date: 2002/10/31 17:00:44 --- src/input/input_cda.c | 12 +++++------ src/input/input_dvd.c | 51 ++++++++++++++++++++------------------------ src/input/input_file.c | 9 ++++---- src/input/input_stdin_fifo.c | 22 +++++-------------- src/input/input_vcd.c | 12 +++++------ 5 files changed, 45 insertions(+), 61 deletions(-) diff --git a/src/input/input_cda.c b/src/input/input_cda.c index 2ed6e7906..e7dca01dc 100644 --- a/src/input/input_cda.c +++ b/src/input/input_cda.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_cda.c,v 1.35 2002/10/23 21:19:42 guenter Exp $ + * $Id: input_cda.c,v 1.36 2002/10/31 17:00:44 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -1379,7 +1379,7 @@ static int cda_plugin_open (input_plugin_t *this_gen, const char *mrl) { free(this->mrl); this->mrl = strdup(mrl); - if(strncasecmp (this->mrl, "cda://", 6)) + if(strncasecmp (this->mrl, "cda:/", 5)) return 0; if(!_cda_open_cd(this->cda)) { @@ -1396,10 +1396,10 @@ static int cda_plugin_open (input_plugin_t *this_gen, const char *mrl) { _cda_cbbd_grab_infos(this); } - filename = (char *) &this->mrl[6]; + filename = (char *) &this->mrl[5]; if(sscanf(filename, "%d", &this->cda->cur_track) != 1) { - LOG_MSG_STDERR(this->xine, _("input_cda: malformed MRL. Use cda://\n")); + LOG_MSG_STDERR(this->xine, _("input_cda: malformed MRL. Use cda:/\n")); _cda_free_cda(this->cda); return 0; } @@ -1656,7 +1656,7 @@ static xine_mrl_t **cda_plugin_get_dir (input_plugin_t *this_gen, char mrl[1024]; memset(&mrl, 0, sizeof (mrl)); - sprintf(mrl, "cda://%d",i); + sprintf(mrl, "cda:/%d",i); if((i-1) >= this->mrls_allocated_entries) { ++this->mrls_allocated_entries; @@ -1735,7 +1735,7 @@ static char **cda_plugin_get_autoplay_list (input_plugin_t *this_gen, int *nFile if(this->filelist[i - 1] == NULL) this->filelist[i - 1] = (char *) realloc(this->filelist[i - 1], sizeof(char *) * 256); - sprintf (this->filelist[i - 1], "cda://%d",i); + sprintf (this->filelist[i - 1], "cda:/%d",i); } this->filelist[i - 1] = (char *) realloc(this->filelist[i - 1], sizeof(char *)); diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 59fb1c4ca..c185f8814 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,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_dvd.c,v 1.107 2002/10/27 20:07:39 mroi Exp $ + * $Id: input_dvd.c,v 1.108 2002/10/31 17:00:45 mroi Exp $ * */ @@ -370,7 +370,7 @@ static void dvd_build_mrl_list(dvd_input_plugin_t *this) { * - possible alignment of the mrl array * - an array of mrl structures sizeof(xine_mrl_t) * num_mrls * - enough chars for every filename sizeof(char)*25 * num_mrls - * - "dvd://:000000.000000\0" = 25 chars + * - "dvd:/000000.000000\0" = 25 chars */ if ((this->mrls = (xine_mrl_t **) malloc(sizeof(xine_mrl_t *) + num_mrls * (sizeof(xine_mrl_t*) + sizeof(xine_mrl_t) + 25*sizeof(char)) + @@ -392,9 +392,9 @@ static void dvd_build_mrl_list(dvd_input_plugin_t *this) { mrl->link = NULL; mrl->type = mrl_dvd; mrl->size = 0; - snprintf(name, 25, (j == 0) ? "dvd://" : - (j == 1) ? "dvd://:%d" : - "dvd://:%d.%d", i, j); + snprintf(name, 25, (j == 0) ? "dvd:/" : + (j == 1) ? "dvd:/%d" : + "dvd:/%d.%d", i, j); name = &name[25]; mrl++; } @@ -1172,19 +1172,18 @@ check_solaris_vold_device(dvd_input_class_t *this) /* * Opens the DVD plugin. The MRL takes the following form: * - * dvd://[dvd_path][:vts[.program]] + * dvd:/[vts[/program]] * * e.g. - * dvd:// - Play (navigate) /dev/dvd - * dvd:///dev/dvd2 - Play (navigate) /dev/dvd2 - * dvd:///dev/dvd2:1 - Play Title 1 from /dev/dvd2 - * dvd://:1.3 - Play Title 1, program 3 from /dev/dvd + * dvd:/ - Play (navigate) + * dvd:/1 - Play Title 1 + * dvd:/1.3 - Play Title 1, program 3 */ static input_plugin_t *open_plugin (input_class_t *class_gen, xine_stream_t *stream, const char *data) { dvd_input_plugin_t *this; dvd_input_class_t *class = (dvd_input_class_t*)class_gen; char *locator; - int colon_point; + int slash_point; dvdnav_status_t ret; char *intended_dvd_device; xine_cfg_entry_t region_entry, lang_entry, cache_entry; @@ -1238,34 +1237,26 @@ static input_plugin_t *open_plugin (input_class_t *class_gen, xine_stream_t *str this->dvd_name_length = 0; /* Check we can handle this MRL */ - if (!strncasecmp (this->mrl, "dvd://",6)) - locator = &this->mrl[6]; + if (!strncasecmp (this->mrl, "dvd:/",5)) + locator = &this->mrl[5]; else { return 0; } /* Attempt to parse MRL */ - colon_point=0; - while((locator[colon_point] != '\0') && (locator[colon_point] != ':')) { - colon_point++; + slash_point=0; + while((locator[slash_point] != '\0') && (locator[slash_point] != '/')) { + slash_point++; } - if(locator[colon_point] == ':') { + if(locator[slash_point] == '/') { this->mode = MODE_TITLE; } else { this->mode = MODE_NAVIGATE; } printf("input_dvd.c:open_plugin:dvd_device=%s\n",class->dvd_device); - locator[colon_point] = '\0'; - ret = DVDNAV_STATUS_OK; - if(colon_point == 0) { - /* Use default device */ - intended_dvd_device=class->dvd_device; - } else { - /* Use specified device */ - intended_dvd_device=locator; - } + intended_dvd_device=class->dvd_device; if(this->opened) { if ( intended_dvd_device==this->current_dvd_device ) { @@ -1372,7 +1363,7 @@ static input_plugin_t *open_plugin (input_class_t *class_gen, xine_stream_t *str int titles; /* A program and/or VTS was specified */ - locator += colon_point + 1; + locator += slash_point + 1; if(locator[0] == '\0') { /* Empty specifier */ @@ -1473,7 +1464,7 @@ static char ** dvd_class_get_autoplay_list (input_class_t *this_gen, #endif - this->filelist2[0] = "dvd://"; + this->filelist2[0] = "dvd:/"; this->filelist2[1] = NULL; *num_files = 1; @@ -1662,6 +1653,10 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.108 2002/10/31 17:00:45 mroi + * adapt input plugins to new MRL syntax + * (mostly turning :// into :/) + * * Revision 1.107 2002/10/27 20:07:39 mroi * less noise and register skip_behaviour (chapter skip keys work again) * diff --git a/src/input/input_file.c b/src/input/input_file.c index 7aea2fa75..30e44c2a2 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.65 2002/10/27 22:48:57 guenter Exp $ + * $Id: input_file.c,v 1.66 2002/10/31 17:00:49 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -271,12 +271,13 @@ static input_plugin_t *open_plugin (input_class_t *cls_gen, xine_stream_t *strea char *filename, *subtitle; int fh; - if (!strncasecmp (mrl, "file://", 7)) - filename = decode_uri (&mrl[7]); + if (!strncasecmp (mrl, "file:", 5)) + filename = decode_uri (&mrl[5]); else filename = mrl; - subtitle = strrchr (filename, '#'); + /* FIXME: find a better solution (multiple streams) for text subtitles */ + subtitle = strrchr (filename, '?'); if (subtitle) { *subtitle = 0; subtitle++; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index b3d088f7f..c7a7d05e9 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.33 2002/10/23 21:19:42 guenter Exp $ + * $Id: input_stdin_fifo.c,v 1.34 2002/10/31 17:00:52 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -88,7 +88,7 @@ static int stdin_plugin_open(input_plugin_t *this_gen, const char *mrl) { free(this->mrl); this->mrl = strdup(mrl); - if (!strncasecmp(this->mrl, "stdin://", 8) + if (!strncasecmp(this->mrl, "stdin:/", 7) || !strncmp(this->mrl, "-", 1)) { #if defined(CONFIG_DEVFS_FS) filename = "/dev/vc/stdin"; @@ -96,22 +96,10 @@ static int stdin_plugin_open(input_plugin_t *this_gen, const char *mrl) { filename = "/dev/stdin"; #endif - } else if(!strncasecmp(this->mrl, "fifo://", 7)) { + } else if(!strncasecmp(this->mrl, "fifo:/", 6)) { - if ((pfn = strrchr((this->mrl + 7), ':')) != NULL) { - - filename = ++pfn; - - } else { - - if (!(strncasecmp(this->mrl + 7, "mpeg1", 5)) - || (!(strncasecmp(this->mrl + 7, "mpeg2", 5)))) { - filename = (char *) &this->mrl[12]; - - } else { - filename = (char *) &this->mrl[7]; - } - } + filename = (char *) &this->mrl[6]; + } else { return 0; } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 4373d13de..153794773 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.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_vcd.c,v 1.53 2002/10/23 21:19:42 guenter Exp $ + * $Id: input_vcd.c,v 1.54 2002/10/31 17:00:53 mroi Exp $ * */ @@ -348,7 +348,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen, const char *mrl) { free(this->mrl); this->mrl = strdup(mrl); - if (strncasecmp (this->mrl, "vcd://",6)) + if (strncasecmp (this->mrl, "vcd:/",5)) return 0; this->fd = open (this->device, O_RDONLY); @@ -363,10 +363,10 @@ static int vcd_plugin_open (input_plugin_t *this_gen, const char *mrl) { return 0; } - filename = (char *) &this->mrl[6]; + filename = (char *) &this->mrl[5]; if (sscanf (filename, "%d", &this->cur_track) != 1) { - LOG_MSG_STDERR(this->xine, _("input_vcd: malformed MRL. Use vcd://\n")); + LOG_MSG_STDERR(this->xine, _("input_vcd: malformed MRL. Use vcd:/\n")); close (this->fd); this->fd = -1; return 0; @@ -1013,7 +1013,7 @@ static xine_mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen, char mrl[1024]; memset(&mrl, 0, sizeof (mrl)); - sprintf(mrl, "vcd://%d",i); + sprintf(mrl, "vcd:/%d",i); if((i-1) >= this->mrls_allocated_entries) { ++this->mrls_allocated_entries; @@ -1094,7 +1094,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen, if(this->filelist[i - 1] == NULL) this->filelist[i - 1] = (char *) realloc(this->filelist[i - 1], sizeof(char *) * 256); - sprintf (this->filelist[i - 1], "vcd://%d",i); + sprintf (this->filelist[i - 1], "vcd:/%d",i); /* printf ("list[%d] : %d %s\n", i, this->filelist[i-1], this->filelist[i-1]); */ } -- cgit v1.2.3