]> git.sesse.net Git - vlc/commitdiff
* modules/access/dvdplay/*: support for dvd menus navigation ("dvd_menus" object...
authorGildas Bazin <gbazin@videolan.org>
Wed, 13 Aug 2003 01:45:13 +0000 (01:45 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 13 Aug 2003 01:45:13 +0000 (01:45 +0000)
* modules/gui/wxwindows/menus.cpp: support for dvd menus navigation.
* src/input/input_programs.c: programs object var was not reset correctly.

NEWS
modules/access/dvdplay/access.c
modules/access/dvdplay/intf.c
modules/access/dvdplay/intf.h
modules/gui/wxwindows/menus.cpp
src/input/input_programs.c

diff --git a/NEWS b/NEWS
index a41cd1118bad381c2e4b66a419b61f9ec03bddc4..659ad6b3e86bfa647f81f658e9cbf9a10fd9e4bd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-$Id: NEWS,v 1.63 2003/08/10 21:26:07 gbazin Exp $
+$Id: NEWS,v 1.64 2003/08/13 01:45:13 gbazin Exp $
 
 Changes between 0.6.1 and 0.6.2:
 ---------------------------------
@@ -14,6 +14,9 @@ Access input:
  * Support for DVB-S/C/T cards using v4l2 API for Linux 2.6.x kernels.
  * Few fixes to the VCD navigation.
 
+Interfaces:
+ * Support for DVD menus navigation added to the wxWindows interface.
+
 UNIX ports:
  * ALSA multi-channel support fixed and tested.
  * Fixed fullscreen with gnome metacity.
index 13b8ff13ee982d26bc694330ba3009c9e670e849..2e87a8f73d066b41f8536b06d9d096dcea3fdc0d 100644 (file)
@@ -2,7 +2,7 @@
  * access.c: access capabilities for dvdplay plugin.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: access.c,v 1.18 2003/05/08 19:06:44 titer Exp $
+ * $Id: access.c,v 1.19 2003/08/13 01:45:13 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -65,6 +65,10 @@ static void    pf_vmg_callback       ( void*, dvdplay_event_t );
 static int dvdNewArea( input_thread_t *, input_area_t * );
 static int dvdNewPGC ( input_thread_t * );
 
+
+static int MenusCallback( vlc_object_t *, char const *,
+                          vlc_value_t, vlc_value_t, void * );
+
 /*****************************************************************************
  * OpenDVD: open libdvdplay
  *****************************************************************************/
@@ -79,6 +83,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
     unsigned int            i_chapter;
     unsigned int            i_angle;
     unsigned int            i;
+    vlc_value_t             val, text;
 
     p_dvd = malloc( sizeof(dvd_data_t) );
     if( p_dvd == NULL )
@@ -191,6 +196,27 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
     var_Create( p_input, "highlight", VLC_VAR_BOOL );
     var_Create( p_input, "highlight-mutex", VLC_VAR_MUTEX );
 
+    /* Create a few object variables used for navigation in the interfaces */
+    var_Create( p_input, "dvd_menus",
+                VLC_VAR_INTEGER | VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND );
+    text.psz_string = _("DVD menus");
+    var_Change( p_input, "dvd_menus", VLC_VAR_SETTEXT, &text, NULL );
+    var_AddCallback( p_input, "dvd_menus", MenusCallback, NULL );
+    val.i_int = ROOT_MENU; text.psz_string = _("Root");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+    val.i_int = TITLE_MENU; text.psz_string = _("Title");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+    val.i_int = PART_MENU; text.psz_string = _("Chapter");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+    val.i_int = SUBPICTURE_MENU; text.psz_string = _("Subtitle");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+    val.i_int = AUDIO_MENU; text.psz_string = _("Audio");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+    val.i_int = ANGLE_MENU; text.psz_string = _("Angle");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+    val.i_int = 99; text.psz_string = _("Resume");
+    var_Change( p_input, "dvd_menus", VLC_VAR_ADDCHOICE, &val, &text );
+
     return 0;
 }
 
@@ -286,7 +312,6 @@ static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area )
 
         dvdNewArea( p_input, p_area );
 
-        /* Reinit ES */
         dvdNewPGC( p_input );
 
         dvdplay_start( p_dvd->vmg, p_area->i_id );
@@ -411,11 +436,15 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
         }
 
         /* new pgc in same title: reinit ES */
+        dvdplay_ES( p_input );
         dvdNewPGC( p_input );
 
         p_input->stream.b_changed = 1;
 
         break;
+    case JUMP:
+        dvdplay_ES( p_input );
+        dvdNewPGC( p_input );
     case NEW_PG:
         /* update current chapter */
         p_input->stream.p_selected_area->i_part =
@@ -438,9 +467,6 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
     case END_OF_CELL:
         p_dvd->b_end_of_cell = 1;
         break;
-    case JUMP:
-        dvdplay_ES( p_input );
-        break;
     case STILL_TIME:
         /* we must pause only from demux
          * when the data in cache has been decoded */
@@ -534,6 +560,9 @@ static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area )
     /* No PSM to read in DVD mode, we already have all information */
     p_input->stream.p_selected_program->b_is_ok = 1;
 
+    /* Reinit ES */
+    dvdplay_ES( 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 );
@@ -553,19 +582,8 @@ static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area )
 
 static int dvdNewPGC( input_thread_t * p_input )
 {
-    dvd_data_t *    p_dvd;
-//    int             i_audio_nr  = -1;
-//    int             i_audio     = -1;
-//    int             i_subp_nr   = -1;
-//    int             i_subp      = -1;
-//    int             i_sec;
-
-    p_dvd = (dvd_data_t*)p_input->p_access_data;
-
-//    dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
-//    dvdplay_subp_info( p_dvd->vmg, &i_subp_nr, &i_subp );
+    dvd_data_t * p_dvd = (dvd_data_t*)p_input->p_access_data;
 
-    dvdplay_ES( p_input );
     p_input->stream.p_selected_area->i_start =
         LB2OFF( dvdplay_title_first( p_dvd->vmg ) );
     p_input->stream.p_selected_area->i_size  =
@@ -582,11 +600,26 @@ static int dvdNewPGC( input_thread_t * p_input )
         p_input->stream.b_seekable = 0;
     }
 
-#if 0
-    i_sec = dvdplay_title_time( p_dvd->vmg );
-    msg_Dbg( p_input, "title time: %d:%02d:%02d (%d)",
-                     i_sec/3600, (i_sec%3600)/60, i_sec%60, i_sec );
-#endif
-
     return 0;
 }
+
+static int MenusCallback( vlc_object_t *p_this, char const *psz_name,
+                          vlc_value_t oldval, vlc_value_t newval, void *p_arg )
+{
+    input_thread_t *    p_input;
+    dvd_data_t *        p_dvd;
+
+    p_input = (input_thread_t*)p_this;
+    p_dvd   = (dvd_data_t*)p_input->p_access_data;
+
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    if( newval.i_int < 99 )
+        dvdplay_menu( p_dvd->vmg, newval.i_int, 0 );
+    else
+        dvdplay_resume( p_dvd->vmg );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    if( p_dvd->p_intf ) dvdIntfResetStillTime( p_dvd->p_intf );
+
+    return VLC_SUCCESS;
+}
index e5a5e0b7a5ee45c53d5404d2e3c3a5aa61ab0220..215c25b2c091c96c65bbe9ee407abc61d3ab3b8e 100644 (file)
@@ -2,7 +2,7 @@
  * intf.c: interface for DVD video manager
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.6 2003/01/29 15:55:44 sam Exp $
+ * $Id: intf.c,v 1.7 2003/08/13 01:45:13 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -424,3 +424,15 @@ int dvdIntfStillTime( intf_thread_t *p_intf, int i_sec )
     return VLC_SUCCESS;
 }
 
+/*****************************************************************************
+ * dvdIntfStillTime: function provided to reset still image
+ *****************************************************************************/
+int dvdIntfResetStillTime( intf_thread_t *p_intf )
+{
+    vlc_mutex_lock( &p_intf->change_lock );
+    p_intf->p_sys->m_still_time = 0;
+    input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
+    vlc_mutex_unlock( &p_intf->change_lock );
+
+    return VLC_SUCCESS;
+}
index f04a2d8fd05d8a2ef07e055878d1f2a4eefcb3aa..92762e0d7cfd4797634ac0fec1da2c1e2d9765b5 100644 (file)
@@ -2,7 +2,7 @@
  * intf.h: send info to intf.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf.h,v 1.1 2002/08/04 17:23:42 sam Exp $
+ * $Id: intf.h,v 1.2 2003/08/13 01:45:13 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -22,3 +22,4 @@
  *****************************************************************************/
 
 int dvdIntfStillTime( struct intf_thread_t *, int );
+int dvdIntfResetStillTime( intf_thread_t *p_intf );
index d306ca0f1f1b309f85dc92961722517f0af93b18..5a88dac004851229bbdf6271f5fec9c96e176a6c 100644 (file)
@@ -2,7 +2,7 @@
  * menus.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: menus.cpp,v 1.17 2003/07/20 10:38:49 gbazin Exp $
+ * $Id: menus.cpp,v 1.18 2003/08/13 01:45:13 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -169,9 +169,11 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
         pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "chapter";
         pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "program";
+        pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "navigation";
         pi_objects[i++] = p_object->i_object_id;
-        ppsz_varnames[i] = "program";
+        ppsz_varnames[i] = "dvd_menus";
         pi_objects[i++] = p_object->i_object_id;
 
         ppsz_varnames[i] = "video-es";
@@ -294,9 +296,11 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
         pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "chapter";
         pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "program";
+        pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "navigation";
         pi_objects[i++] = p_object->i_object_id;
-        ppsz_varnames[i] = "program";
+        ppsz_varnames[i] = "dvd_menus";
         pi_objects[i++] = p_object->i_object_id;
 
         ppsz_varnames[i] = "prev-title";
@@ -518,8 +522,10 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
               new wxMenuItemExt( menu, ++i_item_id,
                                  wxU(text_list.p_list->p_values[i].psz_string ?
                                  text_list.p_list->p_values[i].psz_string :
-                                 another_val.psz_string),
-                                 wxT(""), wxITEM_RADIO, strdup(psz_var),
+                                 another_val.psz_string), wxT(""),
+                                 i_type & VLC_VAR_ISCOMMAND ?
+                                   wxITEM_NORMAL : wxITEM_RADIO,
+                                 strdup(psz_var),
                                  p_object->i_object_id, another_val, i_type );
 
           menu->Append( menuitem );
@@ -536,8 +542,10 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
                                  (wxString)wxU(
                                    text_list.p_list->p_values[i].psz_string) :
                                  wxString::Format(wxT("%d"),
-                                 val_list.p_list->p_values[i].i_int),
-                                 wxT(""), wxITEM_RADIO, strdup(psz_var),
+                                 val_list.p_list->p_values[i].i_int), wxT(""),
+                                 i_type & VLC_VAR_ISCOMMAND ?
+                                   wxITEM_NORMAL : wxITEM_RADIO,
+                                 strdup(psz_var),
                                  p_object->i_object_id,
                                  val_list.p_list->p_values[i], i_type );
 
index b536aaf724b9b5dd9ffd5d71fd868ad2d9f4e476..f35b67ad57ea00ece413e4cf8642a10caa109691 100644 (file)
@@ -2,7 +2,7 @@
  * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
  *****************************************************************************
  * Copyright (C) 1999-2002 VideoLAN
- * $Id: input_programs.c,v 1.116 2003/07/30 21:09:06 gbazin Exp $
+ * $Id: input_programs.c,v 1.117 2003/08/13 01:45:13 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -271,7 +271,7 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
         return;
     }
 
-    val.i_int = i_pgrm_index;
+    val.i_int = p_input->stream.pp_programs[i_pgrm_index]->i_number;
     var_Change( p_input, "program", VLC_VAR_DELCHOICE, &val, NULL );
 
     /* Free the structures that describe the es that belongs to that program */