Index: parser-mpcmd.c =================================================================== RCS file: /cvsroot/mplayer/main/parser-mpcmd.c,v retrieving revision 1.17 diff --unified -B -b -r1.17 parser-mpcmd.c --- parser-mpcmd.c 14 Jul 2004 09:25:47 -0000 1.17 +++ parser-mpcmd.c 22 Oct 2004 14:45:05 -0000 @@ -197,10 +197,30 @@ else /* filename */ { play_tree_t* entry = play_tree_new(); + mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Adding file %s\n",argv[i]); - // if required expand DVD filename entries like dvd://1-3 into component titles + +#define DVD_PREFIX_LENGTH 6 // 'dvd://' + if ( strstr(argv[i],"dvd://") != NULL ) { + + /* + * Forward unchanged argv[i] if in extended mode + * (has : or @ in it) + */ + if(strchr(argv[i] + DVD_PREFIX_LENGTH,':') || + strchr(argv[i] + DVD_PREFIX_LENGTH,'@')) + play_tree_add_file(entry,argv[i]); + + /* + * FIXME Legacy mode, as Richard Felker said: + * "i suppose it could, but imo the dvd://M-N notation should be + * considered legacy. it's a very bad hack in the command parser to begin + * with, since each url on the command line should correspond to exactly + * one playtree entry." + */ + else { splitpos=strstr(argv[i]+6,"-"); if(splitpos != NULL) { @@ -230,6 +250,7 @@ } else { // dvd:// or dvd://x entry play_tree_add_file(entry,argv[i]); } + } } else { play_tree_add_file(entry,argv[i]); } Index: libmpdemux/open.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v retrieving revision 1.99 diff --unified -B -b -r1.99 open.c --- libmpdemux/open.c 22 Aug 2004 18:47:48 -0000 1.99 +++ libmpdemux/open.c 22 Oct 2004 14:45:05 -0000 @@ -180,8 +180,10 @@ } #endif #ifdef USE_DVDREAD + + if(strncmp("dvd://",filename,6) == 0){ -// int ret,ret2; + dvd_priv_t *d; int ttn,pgc_id,pgn; dvd_reader_t *dvd; @@ -189,11 +191,49 @@ ifo_handle_t *vmg_file; tt_srpt_t *tt_srpt; ifo_handle_t *vts_file; - dvd_title = filename[6] == '\0' ? 1 : strtol(filename + 6,NULL,0); + +#define DVD_PREFIX_LENGTH 6 // 'dvd://' +#define DEFAULT_DVD_TITLE 1 +#define DEFAULT_DVD_CHAPTER 1 +#define DEFAULT_DVD_LAST_CHAPTER 0 +#define DEFAULT_DVD_ANGLE 1 + + /** + * dvd://title:chapter-last_chapter:angle@dvd-device + * dvd://1:1-4:1@/dev/dvd + */ + char * tail; + const char * dlim_main = ":"; + const char * dlim_sub = "-"; + char * main_t; + char * sub_t; + + if(strchr(filename,'@')) + dvd_device = strdup(strchr(filename,'@') + 1); + else + dvd_device = strdup(DEFAULT_DVD_DEVICE); + + tail = (char *)strndup(filename + DVD_PREFIX_LENGTH, strlen(filename) - strlen(dvd_device) - 1 - DVD_PREFIX_LENGTH); + main_t = strsep(&tail, dlim_main); + dvd_title = main_t == '\0' ? DEFAULT_DVD_TITLE : strtol(main_t, NULL, 0); + + main_t = strsep(&tail, dlim_main); + sub_t = strsep(&main_t, dlim_sub); + dvd_chapter = sub_t == '\0' ? DEFAULT_DVD_CHAPTER : strtol(sub_t, NULL, 0); + + sub_t = strsep(&main_t, dlim_sub); + dvd_last_chapter = sub_t == '\0' ? DEFAULT_DVD_LAST_CHAPTER : strtol(sub_t, NULL, 0); + + main_t = strsep(&tail, dlim_main); + dvd_angle = main_t == '\0' ? DEFAULT_DVD_ANGLE : strtol(main_t, NULL, 0); + + if(tail != '\0') { + mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Ambigious information (%s) in '%s'\n",tail,filename); + return 0; + } /** * Open the disc. */ - if(!dvd_device) dvd_device=strdup(DEFAULT_DVD_DEVICE); #ifdef SYS_DARWIN /* Dynamic DVD drive selection on Darwin */ if (!strcmp(dvd_device, "/dev/rdiskN")) {