* modules/access/dvdnav.c,dvdread.c: don't crash if the DVD can't be decrypted/read.
authorGildas Bazin <gbazin@videolan.org>
Sun, 5 Jun 2005 18:07:08 +0000 (18:07 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 5 Jun 2005 18:07:08 +0000 (18:07 +0000)
modules/access/dvdnav.c
modules/access/dvdread.c

index 475d2e6..e0e75dd 100644 (file)
@@ -292,7 +292,10 @@ static int Open( vlc_object_t *p_this )
 
         if( dvdnav_title_play( p_sys->dvdnav, 1 ) != DVDNAV_STATUS_OK )
         {
-            msg_Warn( p_demux, "cannot set title" );
+            msg_Err( p_demux, "cannot set title (can't decrypt DVD?)" );
+            dvdnav_close( p_sys->dvdnav );
+            free( p_sys );
+            return VLC_EGENERIC;
         }
 
         if( dvdnav_menu_call( p_sys->dvdnav, DVD_MENU_Title ) !=
index 50f57ec..3192ba8 100644 (file)
@@ -263,7 +263,13 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_angle = val.i_int > 0 ? val.i_int : 1;
 
     DemuxTitles( p_demux, &p_sys->i_angle );
-    DvdReadSetArea( p_demux, 0, 0, p_sys->i_angle );
+    if( DvdReadSetArea( p_demux, 0, 0, p_sys->i_angle ) != VLC_SUCCESS )
+    {
+        Close( p_this );
+        msg_Err( p_demux, "DvdReadSetArea(0,0,%i) failed (can't decrypt DVD?)",
+                 p_sys->i_angle );
+        return VLC_EGENERIC;
+    }
 
     /* Update default_pts to a suitable value for dvdread access */
     var_Create( p_demux, "dvdread-caching",