#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
+#include <errno.h>
#include <vlc_keys.h>
#include <vlc_iso_lang.h>
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" );
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;
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;