]> git.sesse.net Git - vlc/blobdiff - modules/access/dvdnav.c
PulseAudio: print context infos as debug messages
[vlc] / modules / access / dvdnav.c
index c85378bc6c7d2d7ff4487ae02fd24ffae969f62f..b51ee7ef962f03e4099fa2330a5728c268e7135a 100644 (file)
@@ -52,6 +52,7 @@
 #ifdef HAVE_FCNTL_H
 #   include <fcntl.h>
 #endif
+#include <errno.h>
 
 #include <vlc_keys.h>
 #include <vlc_iso_lang.h>
@@ -189,11 +190,16 @@ static int Open( vlc_object_t *p_this )
     int         i_angle;
     char        *psz_file;
     char        *psz_code;
+    bool forced = false;
+
+    if( p_demux->psz_access != NULL
+     && !strncmp(p_demux->psz_access, "dvd", 3) )
+        forced = true;
 
     if( !p_demux->psz_file || !*p_demux->psz_file )
     {
         /* Only when selected */
-        if( !p_demux->psz_access || !*p_demux->psz_access )
+        if( !forced )
             return VLC_EGENERIC;
 
         psz_file = var_InheritString( p_this, "dvd" );
@@ -216,7 +222,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* Try some simple probing to avoid going through dvdnav_open too often */
-    if( ProbeDVD( psz_file ) != VLC_SUCCESS )
+    if( !forced && ProbeDVD( psz_file ) != VLC_SUCCESS )
     {
         free( psz_file );
         return VLC_EGENERIC;
@@ -1475,6 +1481,14 @@ static int ProbeDVD( const char *psz_name )
         goto bailout;
     }
 #endif
+    /* Match extension as the anchor exhibits too many false positives */
+    const char *ext = strrchr( psz_name, '.' );
+    if( ext == NULL )
+        goto bailout;
+    ext++;
+    if( strcasecmp( ext, "iso" ) && strcasecmp( ext, "img" ) )
+        goto bailout;
+
     /* Try to find the anchor (2 bytes at LBA 256) */
     uint16_t anchor;