/*****************************************************************************
* 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
*****************************************************************************/
#endif
#include <assert.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_fs.h>
#include <vlc_url.h>
#include <vlc_vout.h>
-
#include <vlc_dialog.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#include <sys/types.h>
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-#include <errno.h>
-
#include <vlc_keys.h>
#include <vlc_iso_lang.h>
if( dvdnav_current_title_info( p_sys->dvdnav, &i_title,
&i_part ) == DVDNAV_STATUS_OK )
{
- if( i_title >= 0 && i_title < p_sys->i_title &&
- i_part >= 1 && i_part <= p_sys->title[i_title]->i_seekpoint &&
- p_demux->info.i_seekpoint != i_part - 1 )
+ if( i_title >= 0 && i_title < p_sys->i_title )
{
- p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
- p_demux->info.i_seekpoint = i_part - 1;
+ p_demux->info.i_update |= INPUT_UPDATE_TITLE;
+ p_demux->info.i_title = i_title;
+
+ if( i_part >= 1 && i_part <= p_sys->title[i_title]->i_seekpoint &&
+ p_demux->info.i_seekpoint != i_part - 1 )
+ {
+ p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
+ p_demux->info.i_seekpoint = i_part - 1;
+ }
}
}
break;
if( *psz_lang == '\0' )
continue;
if( !strcasecmp( pl->psz_eng_name, psz_lang ) ||
- !strcasecmp( pl->psz_native_name, psz_lang ) ||
!strcasecmp( pl->psz_iso639_1, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2T, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2B, psz_lang ) )
#endif
int ret = VLC_EGENERIC;
-
-#ifdef HAVE_SYS_STAT_H
struct stat stat_info;
if( fstat( fd, &stat_info ) == -1 )
goto bailout;
-
if( !S_ISREG( stat_info.st_mode ) )
{
if( S_ISDIR( stat_info.st_mode ) || S_ISBLK( stat_info.st_mode ) )
ret = VLC_SUCCESS; /* Let dvdnav_open() do the probing */
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" ) &&
- strcasecmp( ext, "mdf" ) && strcasecmp( ext, "dvd" ) )
+
+ /* 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) */
&& read( fd, &anchor, 2 ) == 2
&& GetWLE( &anchor ) == 2 )
ret = VLC_SUCCESS; /* Found a potential anchor */
-
bailout:
close( fd );
return ret;