]> git.sesse.net Git - vlc/blobdiff - modules/access/dvdnav.c
LGPL
[vlc] / modules / access / dvdnav.c
index e808f0e5bec3c686fc2ae055a7a95136a385dd1b..d89d2e54780953771936bbf44a118f27c44c8591 100644 (file)
@@ -1,26 +1,34 @@
 /*****************************************************************************
  * dvdnav.c: DVD module using the dvdnav library.
  *****************************************************************************
- * Copyright (C) 2004-2009 the VideoLAN team
+ * Copyright (C) 2004-2009 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+/*****************************************************************************
+ * NOTA BENE: this module requires the linking against a library which is
+ * known to require licensing under the GNU General Public License version 2
+ * (or later). Therefore, the result of compiling this module will normally
+ * be subject to the terms of that later license.
+ *****************************************************************************/
+
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
@@ -1465,14 +1473,11 @@ static int ProbeDVD( const char *psz_name )
         goto bailout;
     }
 
-    /* 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" ) &&
-        strcasecmp( ext, "mdf" ) && strcasecmp( ext, "dvd" ) &&
-        strcasecmp( ext, "bin" ) && strcasecmp( ext, "nrg" ) )
+    /* ISO 9660 volume descriptor */
+    char iso_dsc[6];
+    if( lseek( fd, 0x8000 + 1, SEEK_SET ) == -1
+     || read( fd, iso_dsc, sizeof (iso_dsc) ) < sizeof (iso_dsc)
+     || memcmp( iso_dsc, "CD001\x01", 6 ) )
         goto bailout;
 
     /* Try to find the anchor (2 bytes at LBA 256) */
@@ -1482,7 +1487,6 @@ static int ProbeDVD( const char *psz_name )
      && read( fd, &anchor, 2 ) == 2
      && GetWLE( &anchor ) == 2 )
         ret = VLC_SUCCESS; /* Found a potential anchor */
-
 bailout:
     close( fd );
     return ret;