]> git.sesse.net Git - vlc/blobdiff - modules/access/dvd/access.c
* modules/gui/macosx/intf.m: fix
[vlc] / modules / access / dvd / access.c
index ab17a63a57d575e9a4099a5a1019ec56369847ea..69e93d6ee199cb0c217f0cbd488a4ef622afffb3 100644 (file)
@@ -8,7 +8,7 @@
  *  -udf.* to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: access.c,v 1.6 2002/12/06 16:34:04 sam 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;
@@ -205,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
@@ -216,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 */
@@ -268,6 +265,13 @@ void E_(DVDClose) ( vlc_object_t *p_this )
     input_thread_t * p_input = (input_thread_t *)p_this;
     thread_dvd_data_t *p_dvd = (thread_dvd_data_t*)p_input->p_access_data;
 
+    /* This is a very nasty side-effect in the DVD plug-in : language
+     * selection here influences language selection of other streams. So
+     * unset those variables (may not be what the user wants).
+     * FIXME FIXME FIXME FIXME FIXME FIXME FIXME --Meuuh */
+    config_PutInt( p_input, "audio-channel", -1 );
+    config_PutInt( p_input, "spu-channel", -1 );
+
     IfoDestroy( p_dvd->p_ifo );
     dvdcss_close( p_dvd->dvdhandle );
     free( p_dvd );
@@ -283,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;
@@ -317,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;
@@ -382,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);
 
@@ -390,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;
@@ -487,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
     {
@@ -502,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
@@ -808,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;
     }