]> git.sesse.net Git - vlc/blobdiff - modules/access/dvd/access.c
* modules/gui/macosx/intf.m: fix
[vlc] / modules / access / dvd / access.c
index da9643a63ade3015ac2af4e60c4cfe3d65106177..69e93d6ee199cb0c217f0cbd488a4ef622afffb3 100644 (file)
@@ -8,7 +8,7 @@
  *  -udf.* to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: access.c,v 1.8 2002/12/31 01:54:35 massiot Exp $
+ * $Id: access.c,v 1.15 2003/12/22 14:32:55 sam Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -124,7 +124,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
 
     /* override environment variable DVDCSS_METHOD with config option
      * (FIXME: this creates a small memory leak) */
-    psz_dvdcss_env = config_GetPsz( p_input, "dvd-css-method" );
+    psz_dvdcss_env = config_GetPsz( p_input, "dvdcss-method" );
     if( psz_dvdcss_env && *psz_dvdcss_env )
     {
         char *psz_env;
@@ -191,7 +191,6 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
     p_input->stream.i_method = INPUT_METHOD_DVD;
     p_input->stream.b_pace_control = 1;
     p_input->stream.b_seekable = 1;
-    p_input->stream.b_connected = 1;
     p_input->stream.p_selected_area->i_size = 0;
     p_input->stream.p_selected_area->i_tell = 0;
 
@@ -206,10 +205,8 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
      * is reserved for video_ts.vob */
     for( i = 1 ; i <= title_inf.i_title_nb ; i++ )
     {
-        input_AddArea( p_input );
-
         /* Titles are Program Chains */
-        area[i]->i_id = i;
+        input_AddArea( p_input, i, title_inf.p_attr[i-1].i_chapter_nb );
 
         /* Absolute start offset and size
          * We can only set that with vts ifo, so we do it during the
@@ -217,8 +214,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
         area[i]->i_start = 0;
         area[i]->i_size = 0;
 
-        /* Number of chapters */
-        area[i]->i_part_nb = title_inf.p_attr[i-1].i_chapter_nb;
+        /* Default Chapter */
         area[i]->i_part = 1;
 
         /* Offset to vts_i_0.ifo */
@@ -291,6 +287,7 @@ static int DVDSetProgram( input_thread_t    * p_input,
     {
         thread_dvd_data_t *  p_dvd;
         int                  i_angle;
+        vlc_value_t          val;
 
         p_dvd   = (thread_dvd_data_t*)(p_input->p_access_data);
         i_angle = p_program->i_number;
@@ -325,6 +322,10 @@ static int DVDSetProgram( input_thread_t    * p_input,
         }
 #undef title
         msg_Dbg( p_input, "angle %d selected", p_dvd->i_angle );
+
+        /* Update the navigation variables without triggering a callback */
+        val.i_int = p_program->i_number;
+        var_Change( p_input, "program", VLC_VAR_SETVALUE, &val, NULL );
     }
 
     return 0;
@@ -390,6 +391,7 @@ static int DVDReadAngle( input_thread_t * p_input )
 static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
 {
     thread_dvd_data_t *  p_dvd;
+    vlc_value_t          val;
 
     p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
 
@@ -398,9 +400,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
 
     if( p_area != p_input->stream.p_selected_area )
     {
-        int     i_vts_title;
-        u32     i_first;
-        u32     i_last;
+        int i_vts_title;
+        uint32_t i_first;
+        uint32_t i_last;
+        unsigned int i;
 
         /* Reset the Chapter position of the old title */
         p_input->stream.p_selected_area->i_part = 1;
@@ -495,6 +498,16 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
             DVDLaunchDecoders( p_input );
         }
 
+        /* Update the navigation variables without triggering a callback */
+        val.i_int = p_area->i_id;
+        var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
+        var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
+        for( i = 1; i <= p_area->i_part_nb; i++ )
+        {
+            val.i_int = i;
+            var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, NULL );
+        }
+
     } /* i_title >= 0 */
     else
     {
@@ -510,6 +523,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
     p_input->stream.b_seekable = 1;
     p_input->stream.b_changed  = 1;
 
+    /* Update the navigation variables without triggering a callback */
+    val.i_int = p_area->i_part;
+    var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
+
     return 0;
 }
 #undef vts
@@ -816,8 +833,8 @@ static char * DVDParse( input_thread_t * p_input )
     /* check block device */
     if( stat( psz_device, &stat_info ) == -1 )
     {
-        msg_Err( p_input, "cannot stat() device `%s' (%s)",
-                          psz_device, strerror(errno));
+        msg_Warn( p_input, "cannot stat() device `%s' (%s)",
+                  psz_device, strerror(errno));
         free( psz_device );
         return NULL;
     }