Commit 1171979d authored by Gildas Bazin's avatar Gildas Bazin

* ALL: experimental code for stream (dvd) navigation through object variables.
parent cfcd2ca2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* but exported to plug-ins * but exported to plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * Copyright (C) 1999-2002 VideoLAN
* $Id: input_ext-plugins.h,v 1.40 2003/03/04 13:21:19 massiot Exp $ * $Id: input_ext-plugins.h,v 1.41 2003/03/11 23:56:53 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -44,7 +44,7 @@ VLC_EXPORT( pgrm_descriptor_t *, input_FindProgram,( input_thread_t *, uint16_t ...@@ -44,7 +44,7 @@ VLC_EXPORT( pgrm_descriptor_t *, input_FindProgram,( input_thread_t *, uint16_t
VLC_EXPORT( pgrm_descriptor_t *, input_AddProgram, ( input_thread_t *, uint16_t, size_t ) ); VLC_EXPORT( pgrm_descriptor_t *, input_AddProgram, ( input_thread_t *, uint16_t, size_t ) );
VLC_EXPORT( void, input_DelProgram,( input_thread_t *, pgrm_descriptor_t * ) ); VLC_EXPORT( void, input_DelProgram,( input_thread_t *, pgrm_descriptor_t * ) );
VLC_EXPORT( int, input_SetProgram,( input_thread_t *, pgrm_descriptor_t * ) ); VLC_EXPORT( int, input_SetProgram,( input_thread_t *, pgrm_descriptor_t * ) );
VLC_EXPORT( input_area_t *, input_AddArea,( input_thread_t * ) ); VLC_EXPORT( input_area_t *, input_AddArea,( input_thread_t *, uint16_t, uint16_t ) );
VLC_EXPORT( void, input_DelArea, ( input_thread_t *, input_area_t * ) ); VLC_EXPORT( void, input_DelArea, ( input_thread_t *, input_area_t * ) );
VLC_EXPORT( es_descriptor_t *, input_FindES,( input_thread_t *, uint16_t ) ); VLC_EXPORT( es_descriptor_t *, input_FindES,( input_thread_t *, uint16_t ) );
VLC_EXPORT( es_descriptor_t *, input_AddES, ( input_thread_t *, pgrm_descriptor_t *, uint16_t, size_t ) ); VLC_EXPORT( es_descriptor_t *, input_AddES, ( input_thread_t *, pgrm_descriptor_t *, uint16_t, size_t ) );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.h: variables handling * variables.h: variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: variables.h,v 1.11 2002/12/14 19:34:07 gbazin Exp $ * $Id: variables.h,v 1.12 2003/03/11 23:56:53 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -75,6 +75,7 @@ struct variable_t ...@@ -75,6 +75,7 @@ struct variable_t
#define VLC_VAR_MODULE 0x0041 #define VLC_VAR_MODULE 0x0041
#define VLC_VAR_FILE 0x0042 #define VLC_VAR_FILE 0x0042
#define VLC_VAR_DIRECTORY 0x0043 #define VLC_VAR_DIRECTORY 0x0043
#define VLC_VAR_VARIABLE 0x0044
#define VLC_VAR_FLOAT 0x0050 #define VLC_VAR_FLOAT 0x0050
#define VLC_VAR_TIME 0x0060 #define VLC_VAR_TIME 0x0060
#define VLC_VAR_ADDRESS 0x0070 #define VLC_VAR_ADDRESS 0x0070
...@@ -97,11 +98,14 @@ struct variable_t ...@@ -97,11 +98,14 @@ struct variable_t
#define VLC_VAR_SETMAX 0x0011 #define VLC_VAR_SETMAX 0x0011
#define VLC_VAR_SETSTEP 0x0012 #define VLC_VAR_SETSTEP 0x0012
#define VLC_VAR_SETVALUE 0x0013
#define VLC_VAR_ADDCHOICE 0x0020 #define VLC_VAR_ADDCHOICE 0x0020
#define VLC_VAR_DELCHOICE 0x0021 #define VLC_VAR_DELCHOICE 0x0021
#define VLC_VAR_SETDEFAULT 0x0022 #define VLC_VAR_CLEARCHOICES 0x0022
#define VLC_VAR_GETLIST 0x0023 #define VLC_VAR_SETDEFAULT 0x0023
#define VLC_VAR_FREELIST 0x0024 #define VLC_VAR_GETLIST 0x0024
#define VLC_VAR_FREELIST 0x0025
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* -udf.* to find files * -udf.* to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: access.c,v 1.10 2003/02/08 22:20:28 massiot Exp $ * $Id: access.c,v 1.11 2003/03/11 23:56:53 gbazin Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -206,10 +206,8 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) ...@@ -206,10 +206,8 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
* is reserved for video_ts.vob */ * is reserved for video_ts.vob */
for( i = 1 ; i <= title_inf.i_title_nb ; i++ ) for( i = 1 ; i <= title_inf.i_title_nb ; i++ )
{ {
input_AddArea( p_input );
/* Titles are Program Chains */ /* 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 /* Absolute start offset and size
* We can only set that with vts ifo, so we do it during the * We can only set that with vts ifo, so we do it during the
...@@ -217,8 +215,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) ...@@ -217,8 +215,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
area[i]->i_start = 0; area[i]->i_start = 0;
area[i]->i_size = 0; area[i]->i_size = 0;
/* Number of chapters */ /* Default Chapter */
area[i]->i_part_nb = title_inf.p_attr[i-1].i_chapter_nb;
area[i]->i_part = 1; area[i]->i_part = 1;
/* Offset to vts_i_0.ifo */ /* Offset to vts_i_0.ifo */
...@@ -291,6 +288,7 @@ static int DVDSetProgram( input_thread_t * p_input, ...@@ -291,6 +288,7 @@ static int DVDSetProgram( input_thread_t * p_input,
{ {
thread_dvd_data_t * p_dvd; thread_dvd_data_t * p_dvd;
int i_angle; int i_angle;
vlc_value_t val;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number; i_angle = p_program->i_number;
...@@ -325,6 +323,10 @@ static int DVDSetProgram( input_thread_t * p_input, ...@@ -325,6 +323,10 @@ static int DVDSetProgram( input_thread_t * p_input,
} }
#undef title #undef title
msg_Dbg( p_input, "angle %d selected", p_dvd->i_angle ); 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 );
} }
return 0; return 0;
...@@ -390,6 +392,7 @@ static int DVDReadAngle( input_thread_t * p_input ) ...@@ -390,6 +392,7 @@ static int DVDReadAngle( input_thread_t * p_input )
static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
thread_dvd_data_t * p_dvd; thread_dvd_data_t * p_dvd;
vlc_value_t val;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
...@@ -401,6 +404,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -401,6 +404,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
int i_vts_title; int i_vts_title;
u32 i_first; u32 i_first;
u32 i_last; u32 i_last;
unsigned int i;
/* Reset the Chapter position of the old title */ /* Reset the Chapter position of the old title */
p_input->stream.p_selected_area->i_part = 1; p_input->stream.p_selected_area->i_part = 1;
...@@ -495,6 +499,16 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -495,6 +499,16 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
DVDLaunchDecoders( p_input ); 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 );
var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL );
for( i = 1; i <= p_area->i_part_nb; i++ )
{
val.i_int = i;
var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val );
}
} /* i_title >= 0 */ } /* i_title >= 0 */
else else
{ {
...@@ -510,6 +524,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -510,6 +524,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 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 );
return 0; return 0;
} }
#undef vts #undef vts
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* access.c: access capabilities for dvdplay plugin. * access.c: access capabilities for dvdplay plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: access.c,v 1.12 2003/03/09 19:25:09 gbazin Exp $ * $Id: access.c,v 1.13 2003/03/11 23:56:53 gbazin Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -45,10 +45,6 @@ ...@@ -45,10 +45,6 @@
# include <strings.h> # include <strings.h>
#endif #endif
#if defined( WIN32 )
# include <io.h> /* read() */
#endif
#include "dvd.h" #include "dvd.h"
#include "es.h" #include "es.h"
#include "tools.h" #include "tools.h"
...@@ -147,17 +143,12 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) ...@@ -147,17 +143,12 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
/* Area 0 for menu */ /* Area 0 for menu */
area[0]->i_plugin_data = 0; area[0]->i_plugin_data = 0;
input_DelArea( p_input, p_input->stream.pp_areas[0] );
input_AddArea( p_input, 0, 1 );
for( i = 1 ; i <= i_title_nr ; i++ ) for( i = 1 ; i <= i_title_nr ; i++ )
{ {
input_AddArea( p_input ); input_AddArea( p_input, i, dvdplay_chapter_nr( p_dvd->vmg, i ) );
/* Titles id */
area[i]->i_id = i;
/* Number of chapters */
area[i]->i_part_nb = dvdplay_chapter_nr( p_dvd->vmg, i );
area[i]->i_plugin_data = 0; area[i]->i_plugin_data = 0;
} }
#undef area #undef area
...@@ -244,6 +235,7 @@ static int dvdplay_SetProgram( input_thread_t * p_input, ...@@ -244,6 +235,7 @@ static int dvdplay_SetProgram( input_thread_t * p_input,
{ {
dvd_data_t * p_dvd; dvd_data_t * p_dvd;
int i_angle; int i_angle;
vlc_value_t val;
p_dvd = (dvd_data_t*)(p_input->p_access_data); p_dvd = (dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number; i_angle = p_program->i_number;
...@@ -257,6 +249,10 @@ static int dvdplay_SetProgram( input_thread_t * p_input, ...@@ -257,6 +249,10 @@ static int dvdplay_SetProgram( input_thread_t * p_input,
msg_Dbg( p_input, "angle %d selected", i_angle ); msg_Dbg( p_input, "angle %d selected", 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 );
} }
return 0; return 0;
...@@ -272,6 +268,7 @@ static int dvdplay_SetProgram( input_thread_t * p_input, ...@@ -272,6 +268,7 @@ static int dvdplay_SetProgram( input_thread_t * p_input,
static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area ) static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
dvd_data_t * p_dvd; dvd_data_t * p_dvd;
vlc_value_t val;
p_dvd = (dvd_data_t*)p_input->p_access_data; p_dvd = (dvd_data_t*)p_input->p_access_data;
...@@ -322,6 +319,10 @@ static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -322,6 +319,10 @@ static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area )
LB2OFF( dvdplay_position( p_dvd->vmg ) ) - p_area->i_start; LB2OFF( dvdplay_position( p_dvd->vmg ) ) - p_area->i_start;
p_input->stream.b_changed = 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 );
return 0; return 0;
} }
...@@ -395,7 +396,6 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) ...@@ -395,7 +396,6 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
case NEW_VTS: case NEW_VTS:
break; break;
case NEW_FILE: case NEW_FILE:
break; break;
case NEW_PGC: case NEW_PGC:
/* prevent intf to try to seek by default */ /* prevent intf to try to seek by default */
...@@ -428,6 +428,10 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) ...@@ -428,6 +428,10 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
/* warn interface that something has changed */ /* warn interface that something has changed */
p_input->stream.b_changed = 1; p_input->stream.b_changed = 1;
/* Update the navigation variables without triggering a callback */
val.i_int = p_input->stream.p_selected_area->i_part;
var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val );
break; break;
case NEW_CELL: case NEW_CELL:
p_dvd->b_end_of_cell = 0; p_dvd->b_end_of_cell = 0;
...@@ -497,6 +501,7 @@ static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -497,6 +501,7 @@ static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area )
{ {
dvd_data_t * p_dvd; dvd_data_t * p_dvd;
int i_angle_nb, i_angle; int i_angle_nb, i_angle;
vlc_value_t val;
int i; int i;
p_dvd = (dvd_data_t*)p_input->p_access_data; p_dvd = (dvd_data_t*)p_input->p_access_data;
...@@ -526,6 +531,20 @@ static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -526,6 +531,20 @@ 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 */ /* No PSM to read in DVD mode, we already have all information */
p_input->stream.p_selected_program->b_is_ok = 1; p_input->stream.p_selected_program->b_is_ok = 1;
/* Update the navigation variables without triggering a callback */
val.i_int = p_area->i_id;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val );
var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL );
for( i = 1; (unsigned int)i <= p_area->i_part_nb; i++ )
{
val.i_int = i;
var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val );
}
/* Update the navigation variables without triggering a callback */
val.i_int = p_area->i_part;
var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val );
return 0; return 0;
} }
...@@ -568,4 +587,3 @@ static int dvdNewPGC( input_thread_t * p_input ) ...@@ -568,4 +587,3 @@ static int dvdNewPGC( input_thread_t * p_input )
return 0; return 0;
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading. * It depends on: libdvdread for ifo files and block reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2003 VideoLAN * Copyright (C) 2001, 2003 VideoLAN
* $Id: input.c,v 1.16 2003/02/02 00:49:40 massiot Exp $ * $Id: input.c,v 1.17 2003/03/11 23:56:53 gbazin Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -383,10 +383,8 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) ...@@ -383,10 +383,8 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
* is reserved for video_ts.vob */ * is reserved for video_ts.vob */
for( i = 1 ; i <= tt_srpt->nr_of_srpts ; i++ ) for( i = 1 ; i <= tt_srpt->nr_of_srpts ; i++ )
{ {
input_AddArea( p_input );
/* Titles are Program Chains */ /* Titles are Program Chains */
area[i]->i_id = i; input_AddArea( p_input, i, tt_srpt->title[i-1].nr_of_ptts );
/* Absolute start offset and size /* Absolute start offset and size
* We can only set that with vts ifo, so we do it during the * We can only set that with vts ifo, so we do it during the
...@@ -394,8 +392,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) ...@@ -394,8 +392,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
area[i]->i_start = 0; area[i]->i_start = 0;
area[i]->i_size = 0; area[i]->i_size = 0;
/* Number of chapters */ /* Default Chapter */
area[i]->i_part_nb = tt_srpt->title[i-1].nr_of_ptts;
area[i]->i_part = 1; area[i]->i_part = 1;
area[i]->i_plugin_data = tt_srpt->title[i-1].title_set_nr; area[i]->i_plugin_data = tt_srpt->title[i-1].title_set_nr;
...@@ -465,6 +462,7 @@ static int DvdReadSetProgram( input_thread_t * p_input, ...@@ -465,6 +462,7 @@ static int DvdReadSetProgram( input_thread_t * p_input,
if( p_input->stream.p_selected_program != p_program ) if( p_input->stream.p_selected_program != p_program )
{ {
thread_dvd_data_t * p_dvd; thread_dvd_data_t * p_dvd;
vlc_value_t val;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
p_dvd->i_angle = p_program->i_number; p_dvd->i_angle = p_program->i_number;
...@@ -475,6 +473,10 @@ static int DvdReadSetProgram( input_thread_t * p_input, ...@@ -475,6 +473,10 @@ static int DvdReadSetProgram( input_thread_t * p_input,
p_input->stream.p_selected_program = p_program; p_input->stream.p_selected_program = p_program;
msg_Dbg( p_input, "angle %d selected", p_dvd->i_angle ); 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 );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -494,6 +496,7 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -494,6 +496,7 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
thread_dvd_data_t * p_dvd; thread_dvd_data_t * p_dvd;
int pgc_id = 0; int pgc_id = 0;
int pgn = 0; int pgn = 0;
vlc_value_t val;
p_dvd = (thread_dvd_data_t*)p_input->p_access_data; p_dvd = (thread_dvd_data_t*)p_input->p_access_data;
...@@ -794,6 +797,16 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -794,6 +797,16 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
DvdReadLauchDecoders( p_input ); DvdReadLauchDecoders( 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 );
var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL );
for( i = 1; i <= p_area->i_part_nb; i++ )
{
val.i_int = i;
var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val );
}
} /* i_title >= 0 */ } /* i_title >= 0 */
else else
{ {
...@@ -838,6 +851,10 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -838,6 +851,10 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.b_seekable = VLC_TRUE; p_input->stream.b_seekable = VLC_TRUE;
p_input->stream.b_changed = VLC_TRUE; p_input->stream.b_changed = VLC_TRUE;
/* Update the navigation variables without triggering a callback */
val.i_int = p_area->i_part;
var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -382,6 +382,7 @@ int SatelliteSetProgram( input_thread_t * p_input, ...@@ -382,6 +382,7 @@ int SatelliteSetProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_new_prg ) pgrm_descriptor_t * p_new_prg )
{ {
unsigned int i_es_index; unsigned int i_es_index;
vlc_value_t val;
if ( p_input->stream.p_selected_program ) if ( p_input->stream.p_selected_program )
{ {
...@@ -434,6 +435,10 @@ int SatelliteSetProgram( input_thread_t * p_input, ...@@ -434,6 +435,10 @@ int SatelliteSetProgram( input_thread_t * p_input,
p_input->stream.p_selected_program = p_new_prg; p_input->stream.p_selected_program = p_new_prg;
/* Update the navigation variables without triggering a callback */
val.i_int = p_new_prg->i_number;
var_Change( p_input, "program", VLC_VAR_SETVALUE, &val );
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vcd.c : VCD input module for vlc * vcd.c : VCD input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: vcd.c,v 1.15 2003/02/12 17:13:33 jobi Exp $ * $Id: vcd.c,v 1.16 2003/03/11 23:56:54 gbazin Exp $
* *
* Author: Johan Bilien <jobi@via.ecp.fr> * Author: Johan Bilien <jobi@via.ecp.fr>
* *
...@@ -224,18 +224,15 @@ static int VCDOpen( vlc_object_t *p_this ) ...@@ -224,18 +224,15 @@ static int VCDOpen( vlc_object_t *p_this )
#define area p_input->stream.pp_areas #define area p_input->stream.pp_areas
for( i = 1 ; i <= p_vcd->i_nb_tracks - 1 ; i++ ) for( i = 1 ; i <= p_vcd->i_nb_tracks - 1 ; i++ )
{ {
input_AddArea( p_input );
/* Titles are Program Chains */ /* Titles are Program Chains */
area[i]->i_id = i; input_AddArea( p_input, i, 1 );
/* Absolute start offset and size */ /* Absolute start offset and size */
area[i]->i_start = (off_t)p_vcd->p_sectors[i] * (off_t)VCD_DATA_SIZE; area[i]->i_start = (off_t)p_vcd->p_sectors[i] * (off_t)VCD_DATA_SIZE;
area[i]->i_size = (off_t)(p_vcd->p_sectors[i+1] - p_vcd->p_sectors[i]) area[i]->i_size = (off_t)(p_vcd->p_sectors[i+1] - p_vcd->p_sectors[i])
* (off_t)VCD_DATA_SIZE; * (off_t)VCD_DATA_SIZE;
/* Number of chapters */ /* Default Chapter */
area[i]->i_part_nb = 1; /* will be the entry points */
area[i]->i_part = 1; area[i]->i_part = 1;
/* i_plugin_data is used to store which entry point is the first /* i_plugin_data is used to store which entry point is the first
...@@ -388,6 +385,7 @@ static int VCDSetProgram( input_thread_t * p_input, ...@@ -388,6 +385,7 @@ static int VCDSetProgram( input_thread_t * p_input,
static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
thread_vcd_data_t * p_vcd; thread_vcd_data_t * p_vcd;
vlc_value_t val;
p_vcd = (thread_vcd_data_t*)p_input->p_access_data; p_vcd = (thread_vcd_data_t*)p_input->p_access_data;
...@@ -396,6 +394,8 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -396,6 +394,8 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
if( p_area != p_input->stream.p_selected_area ) if( p_area != p_input->stream.p_selected_area )
{ {
unsigned int i;
/* Reset the Chapter position of the current title */ /* Reset the Chapter position of the current title */
p_input->stream.p_selected_area->i_part = 1; p_input->stream.p_selected_area->i_part = 1;
p_input->stream.p_selected_area->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
...@@ -407,6 +407,16 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -407,6 +407,16 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
/* The first track is not a valid one */ /* The first track is not a valid one */
p_vcd->i_track = p_area->i_id; p_vcd->i_track = p_area->i_id;
p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track]; p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track];
/* Update the navigation variables without triggering a callback */
val.i_int = p_area->i_id;
var_Change( p_input, "title", VLC_VAR_SETVALUE, &val );
var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL );
for( i = 1; i <= p_area->i_part_nb; i++ )
{
val.i_int = i;
var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val );
}
} }
if( p_vcd->b_valid_ep ) if( p_vcd->b_valid_ep )
...@@ -427,6 +437,10 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -427,6 +437,10 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 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 );
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* popup.cpp : wxWindows plugin for vlc * popup.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: popup.cpp,v 1.3 2003/01/26 10:36:10 gbazin Exp $ * $Id: popup.cpp,v 1.4 2003/03/11 23:56:54 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -118,6 +118,7 @@ PopupMenu::PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -118,6 +118,7 @@ PopupMenu::PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ):
CreateMenuEntry( "title", p_object ); CreateMenuEntry( "title", p_object );
CreateMenuEntry( "chapter", p_object ); CreateMenuEntry( "chapter", p_object );
CreateMenuEntry( "navigation", p_object );
vlc_object_release( p_object ); vlc_object_release( p_object );
...@@ -207,43 +208,40 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -207,43 +208,40 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object )
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
vlc_value_t val; vlc_value_t val;
char *psz_value; vlc_value_t val_list;
int i_type, i; int i_type, i;
/* Check the type of the object variable */ /* Check the type of the object variable */
i_type = var_Type( p_object, psz_var ); i_type = var_Type( p_object, psz_var );
switch( i_type )
{
case VLC_VAR_VOID:
case VLC_VAR_STRING:
break;
default:
break;
}
if( var_Get( p_object, psz_var, &val ) < 0 ) if( var_Get( p_object, psz_var, &val ) < 0 )
{ {
return NULL; return NULL;
} }
psz_value = val.psz_string;
if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val ) < 0 ) if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list ) < 0 )
{ {
return NULL; return NULL;
} }
for( i = 0; i < val.p_list->i_count; i++ ) for( i = 0; i < val_list.p_list->i_count; i++ )
{ {
vlc_value_t another_val; vlc_value_t another_val;
wxMenuItemExt *menuitem; wxMenuItemExt *menuitem;
switch( i_type & VLC_VAR_TYPE ) switch( i_type & VLC_VAR_TYPE )
{ {
case VLC_VAR_VARIABLE:
menu->Append( MenuDummy_Event,
val_list.p_list->p_values[i].psz_string,
CreateSubMenu( val_list.p_list->p_values[i].psz_string,
p_object ),
"YEAAAARRRGGGHHH HEEELLPPPPPP" );
break;
case VLC_VAR_STRING: case VLC_VAR_STRING:
another_val.psz_string = another_val.psz_string =
strdup(val.p_list->p_values[i].psz_string); strdup(val_list.p_list->p_values[i].psz_string);
menuitem = menuitem =
new wxMenuItemExt( this, i_item_id++, another_val.psz_string, new wxMenuItemExt( this, i_item_id++, another_val.psz_string,
"", wxITEM_RADIO, strdup(psz_var), "", wxITEM_RADIO, strdup(psz_var),
...@@ -252,7 +250,8 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -252,7 +250,8 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object )
menu->Append( menuitem ); menu->Append( menuitem );
if( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) ) if( !strcmp( val.psz_string,
val_list.p_list->p_values[i].psz_string ) )
menu->Check( i_item_id - 1, TRUE ); menu->Check( i_item_id - 1, TRUE );
break; break;
...@@ -260,12 +259,16 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -260,12 +259,16 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object )
menuitem = menuitem =
new wxMenuItemExt( this, i_item_id++, new wxMenuItemExt( this, i_item_id++,
wxString::Format(_("%d"), wxString::Format(_("%d"),
val.p_list->p_values[i].i_int), val_list.p_list->p_values[i].i_int),
"", wxITEM_RADIO, strdup(psz_var), "", wxITEM_RADIO, strdup(psz_var),
p_object->i_object_id, p_object->i_object_id,
val.p_list->p_values[i] ); val_list.p_list->p_values[i] );
menu->Append( menuitem ); menu->Append( menuitem );
if( !((i_type & VLC_VAR_FLAGS) & VLC_VAR_ISCOMMAND) &&
val_list.p_list->p_values[i].i_int == val.i_int )
menu->Check( i_item_id - 1, TRUE );
break; break;
default: default:
...@@ -273,7 +276,7 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -273,7 +276,7 @@ wxMenu *PopupMenu::CreateSubMenu( char *psz_var, vlc_object_t *p_object )
} }
} }
var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val ); var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list );
return menu; return menu;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.223 2003/02/08 22:43:02 massiot Exp $ * $Id: input.c,v 1.224 2003/03/11 23:56:54 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -126,7 +126,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, ...@@ -126,7 +126,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
p_input->stream.p_newly_selected_es = NULL; p_input->stream.p_newly_selected_es = NULL;
/* By default there is one area in a stream */ /* By default there is one area in a stream */
input_AddArea( p_input ); input_AddArea( p_input, 0, 1 );
p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
/* Initialize stream control properties. */ /* Initialize stream control properties. */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface * input_ext-intf.c: services to the interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_ext-intf.c,v 1.47 2003/01/21 14:15:05 hartman Exp $ * $Id: input_ext-intf.c,v 1.48 2003/03/11 23:56:54 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -366,6 +366,7 @@ int input_ChangeArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -366,6 +366,7 @@ int input_ChangeArea( input_thread_t * p_input, input_area_t * p_area )
int input_ChangeProgram( input_thread_t * p_input, uint16_t i_program_number ) int input_ChangeProgram( input_thread_t * p_input, uint16_t i_program_number )
{ {
pgrm_descriptor_t * p_program; pgrm_descriptor_t * p_program;
vlc_value_t val;
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
...@@ -381,6 +382,10 @@ int input_ChangeProgram( input_thread_t * p_input, uint16_t i_program_number ) ...@@ -381,6 +382,10 @@ int input_ChangeProgram( input_thread_t * p_input, uint16_t i_program_number )
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
/* Update the navigation variables without triggering a callback */
val.i_int = i_program_number;
var_Change( p_input, "program", VLC_VAR_SETVALUE, &val );
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling * variables.c: routines for object variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: variables.c,v 1.20 2003/03/09 19:25:08 gbazin Exp $ * $Id: variables.c,v 1.21 2003/03/11 23:56:54 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -155,6 +155,8 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type ) ...@@ -155,6 +155,8 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
case VLC_VAR_STRING: case VLC_VAR_STRING:
case VLC_VAR_MODULE: case VLC_VAR_MODULE:
case VLC_VAR_FILE: case VLC_VAR_FILE:
case VLC_VAR_DIRECTORY:
case VLC_VAR_VARIABLE:
p_var->pf_cmp = CmpString; p_var->pf_cmp = CmpString;
p_var->pf_dup = DupString; p_var->pf_dup = DupString;
p_var->pf_free = FreeString; p_var->pf_free = FreeString;
...@@ -264,6 +266,7 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -264,6 +266,7 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
{ {
int i_var, i; int i_var, i;
variable_t *p_var; variable_t *p_var;
vlc_value_t oldval;
vlc_mutex_lock( &p_this->var_lock ); vlc_mutex_lock( &p_this->var_lock );
...@@ -364,6 +367,18 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -364,6 +367,18 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
CheckValue( p_var, &p_var->val ); CheckValue( p_var, &p_var->val );
break; break;
case VLC_VAR_CLEARCHOICES:
for( i = 0 ; i < p_var->choices.i_count ; i++ )
{
p_var->pf_free( &p_var->choices.p_values[i] );
}
if( p_var->choices.i_count )
free( p_var->choices.p_values );
p_var->choices.i_count = 0;
p_var->choices.p_values = NULL;
p_var->i_default = -1;
break;
case VLC_VAR_SETDEFAULT: case VLC_VAR_SETDEFAULT:
/* FIXME: the list is sorted, dude. Use something cleverer. */ /* FIXME: the list is sorted, dude. Use something cleverer. */
for( i = 0 ; i < p_var->choices.i_count ; i++ ) for( i = 0 ; i < p_var->choices.i_count ; i++ )
...@@ -383,7 +398,18 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -383,7 +398,18 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
p_var->i_default = i; p_var->i_default = i;
CheckValue( p_var, &p_var->val ); CheckValue( p_var, &p_var->val );
break; break;
case VLC_VAR_SETVALUE:
/* Duplicate data if needed */
p_var->pf_dup( p_val );
/* Backup needed stuff */
oldval = p_var->val;
/* Check boundaries and list */
CheckValue( p_var, p_val );
/* Set the variable */
p_var->val = *p_val;
/* Free data if needed */
p_var->pf_free( &oldval );
break;
case VLC_VAR_GETLIST: case VLC_VAR_GETLIST:
p_val->p_list = malloc( sizeof(vlc_list_t) ); p_val->p_list = malloc( sizeof(vlc_list_t) );
if( p_var->choices.i_count ) if( p_var->choices.i_count )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment