]> git.sesse.net Git - vlc/commitdiff
We are now able to parse :
authorChristophe Massiot <massiot@videolan.org>
Tue, 28 Jan 2003 15:05:52 +0000 (15:05 +0000)
committerChristophe Massiot <massiot@videolan.org>
Tue, 28 Jan 2003 15:05:52 +0000 (15:05 +0000)
dvdread:/Volumes/to@to/VIDEO_TS@1,1
dvdplay:/Volumes/to@to/VIDEO_TS@1,1
Closes #77

modules/access/dvdplay/access.c
modules/access/dvdplay/tools.c
modules/access/dvdread/input.c

index 1d14b33f4adbfa94fcfa2d726827cc81fd252582..ef3fb14fe42deda22329d10b1481e21936053cae 100644 (file)
@@ -2,7 +2,7 @@
  * access.c: access capabilities for dvdplay plugin.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: access.c,v 1.9 2002/12/31 01:54:35 massiot Exp $
+ * $Id: access.c,v 1.10 2003/01/28 15:05:52 massiot Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -109,16 +109,17 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
     /* Open libdvdplay */
     p_dvd->vmg = dvdplay_open( psz_source, pf_vmg_callback, (void*)p_input );
 
-    /* free allocated strings */
-    free( psz_source );
-
     if( p_dvd->vmg == NULL )
     {
         msg_Err( p_input, "cannot open %s", psz_source );
+        free( psz_source );
         free( p_dvd );
         return -1;
     }
 
+    /* free allocated strings */
+    free( psz_source );
+
     p_dvd->p_intf = NULL;
 
     p_dvd->i_still_time = 0;
index 336ad71b8d9291cb2eb3a3aa8ddc7aeaf1c8d8fa..06f3cc9a85a1227ed9f40493bc4eda61797db9f1 100644 (file)
@@ -2,7 +2,7 @@
  * tools.c: tools for dvd plugin.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: tools.c,v 1.3 2002/10/28 16:26:44 sam Exp $
+ * $Id: tools.c,v 1.4 2003/01/28 15:05:52 massiot Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -52,22 +52,24 @@ char * dvdplay_ParseCL( input_thread_t * p_input,
     
     p_dvd = (dvd_data_t*)(p_input->p_access_data);
 
-    psz_parser = psz_source = strdup( p_input->psz_name );
-    if( !psz_parser )
+    psz_source = strdup( p_input->psz_name );
+    if( psz_source == NULL )
     {
         return NULL;
     }
 
-    while( *psz_parser && *psz_parser != '@' )
-    {
-        psz_parser++;
-    }
-
     *i_title = 0;
     *i_chapter = 1;
     *i_angle = 1;
     
-    if( *psz_parser == '@' )
+    /* Start with the end, because you could have :
+     * dvdplay:/Volumes/my@toto/VIDEO_TS@1,1
+     * (yes, this is kludgy). */
+    for ( psz_parser = psz_source + strlen(psz_source) - 1;
+          psz_parser >= psz_source && *psz_parser != '@';
+          psz_parser-- );
+
+    if( psz_parser >= psz_source && *psz_parser == '@' )
     {
         /* Found options */
         *psz_parser = '\0';
index c11d748c1254162f4df6e1218ec0969b81834e68..0bcca32e6c8427f996dbe5f934bfcea78d6719be 100644 (file)
@@ -6,7 +6,7 @@
  * It depends on: libdvdread for ifo files and block reading.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input.c,v 1.14 2003/01/23 15:50:15 sam Exp $
+ * $Id: input.c,v 1.15 2003/01/28 15:05:52 massiot Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -248,8 +248,8 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
     unsigned int            i_angle = 1;
     unsigned int            i;
 
-    psz_parser = psz_source = strdup( p_input->psz_name );
-    if( !psz_source )
+    psz_source = strdup( p_input->psz_name );
+    if( psz_source == NULL )
     {
         return VLC_ENOMEM;
     }
@@ -259,12 +259,14 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
     p_input->pf_set_area = DvdReadSetArea;
     p_input->pf_set_program = DvdReadSetProgram;
 
-    while( *psz_parser && *psz_parser != '@' )
-    {
-        psz_parser++;
-    }
+    /* Start with the end, because you could have :
+     * dvdread:/Volumes/my@toto/VIDEO_TS@1,1
+     * (yes, this is kludgy). */
+    for ( psz_parser = psz_source + strlen(psz_source) - 1;
+          psz_parser >= psz_source && *psz_parser != '@';
+          psz_parser-- );
 
-    if( *psz_parser == '@' )
+    if( psz_parser >= psz_source && *psz_parser == '@' )
     {
         /* Found options */
         *psz_parser = '\0';