Changeset 1171979d73a6ddd4da292e772aa8d29d0e581996
- Timestamp:
- 12/03/03 00:56:54 (6 years ago)
- git-parent:
- Files:
-
- include/input_ext-plugins.h (modified) (2 diffs)
- include/variables.h (modified) (3 diffs)
- modules/access/dvd/access.c (modified) (9 diffs)
- modules/access/dvdplay/access.c (modified) (12 diffs)
- modules/access/dvdread/input.c (modified) (8 diffs)
- modules/access/satellite/access.c (modified) (2 diffs)
- modules/access/vcd/vcd.c (modified) (7 diffs)
- modules/gui/wxwindows/popup.cpp (modified) (8 diffs)
- src/input/input.c (modified) (2 diffs)
- src/input/input_ext-intf.c (modified) (3 diffs)
- src/input/input_programs.c (modified) (16 diffs)
- src/misc/variables.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/input_ext-plugins.h
r47e65c0 r1171979 4 4 ***************************************************************************** 5 5 * Copyright (C) 1999-2002 VideoLAN 6 * $Id: input_ext-plugins.h,v 1.4 0 2003/03/04 13:21:19 massiotExp $6 * $Id: input_ext-plugins.h,v 1.41 2003/03/11 23:56:53 gbazin Exp $ 7 7 * 8 8 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 45 45 VLC_EXPORT( void, input_DelProgram,( input_thread_t *, pgrm_descriptor_t * ) ); 46 46 VLC_EXPORT( int, input_SetProgram,( input_thread_t *, pgrm_descriptor_t * ) ); 47 VLC_EXPORT( input_area_t *, input_AddArea,( input_thread_t * ) );47 VLC_EXPORT( input_area_t *, input_AddArea,( input_thread_t *, uint16_t, uint16_t ) ); 48 48 VLC_EXPORT( void, input_DelArea, ( input_thread_t *, input_area_t * ) ); 49 49 VLC_EXPORT( es_descriptor_t *, input_FindES,( input_thread_t *, uint16_t ) ); include/variables.h
r215c1a8 r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.h,v 1.1 1 2002/12/14 19:34:07gbazin Exp $5 * $Id: variables.h,v 1.12 2003/03/11 23:56:53 gbazin Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 76 76 #define VLC_VAR_FILE 0x0042 77 77 #define VLC_VAR_DIRECTORY 0x0043 78 #define VLC_VAR_VARIABLE 0x0044 78 79 #define VLC_VAR_FLOAT 0x0050 79 80 #define VLC_VAR_TIME 0x0060 … … 98 99 #define VLC_VAR_SETSTEP 0x0012 99 100 101 #define VLC_VAR_SETVALUE 0x0013 102 100 103 #define VLC_VAR_ADDCHOICE 0x0020 101 104 #define VLC_VAR_DELCHOICE 0x0021 102 #define VLC_VAR_SETDEFAULT 0x0022 103 #define VLC_VAR_GETLIST 0x0023 104 #define VLC_VAR_FREELIST 0x0024 105 #define VLC_VAR_CLEARCHOICES 0x0022 106 #define VLC_VAR_SETDEFAULT 0x0023 107 #define VLC_VAR_GETLIST 0x0024 108 #define VLC_VAR_FREELIST 0x0025 105 109 106 110 /***************************************************************************** modules/access/dvd/access.c
r461358e r1171979 9 9 ***************************************************************************** 10 10 * Copyright (C) 1998-2001 VideoLAN 11 * $Id: access.c,v 1.1 0 2003/02/08 22:20:28 massiotExp $11 * $Id: access.c,v 1.11 2003/03/11 23:56:53 gbazin Exp $ 12 12 * 13 13 * Author: St�ane Borel <stef@via.ecp.fr> … … 207 207 for( i = 1 ; i <= title_inf.i_title_nb ; i++ ) 208 208 { 209 input_AddArea( p_input );210 211 209 /* Titles are Program Chains */ 212 area[i]->i_id = i;210 input_AddArea( p_input, i, title_inf.p_attr[i-1].i_chapter_nb ); 213 211 214 212 /* Absolute start offset and size … … 218 216 area[i]->i_size = 0; 219 217 220 /* Number of chapters */ 221 area[i]->i_part_nb = title_inf.p_attr[i-1].i_chapter_nb; 218 /* Default Chapter */ 222 219 area[i]->i_part = 1; 223 220 … … 292 289 thread_dvd_data_t * p_dvd; 293 290 int i_angle; 291 vlc_value_t val; 294 292 295 293 p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); … … 326 324 #undef title 327 325 msg_Dbg( p_input, "angle %d selected", p_dvd->i_angle ); 326 327 /* Update the navigation variables without triggering a callback */ 328 val.i_int = p_program->i_number; 329 var_Change( p_input, "program", VLC_VAR_SETVALUE, &val ); 328 330 } 329 331 … … 391 393 { 392 394 thread_dvd_data_t * p_dvd; 395 vlc_value_t val; 393 396 394 397 p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); … … 402 405 u32 i_first; 403 406 u32 i_last; 407 unsigned int i; 404 408 405 409 /* Reset the Chapter position of the old title */ … … 496 500 } 497 501 502 /* Update the navigation variables without triggering a callback */ 503 val.i_int = p_area->i_id; 504 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val ); 505 var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL ); 506 for( i = 1; i <= p_area->i_part_nb; i++ ) 507 { 508 val.i_int = i; 509 var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val ); 510 } 511 498 512 } /* i_title >= 0 */ 499 513 else … … 510 524 p_input->stream.b_seekable = 1; 511 525 p_input->stream.b_changed = 1; 526 527 /* Update the navigation variables without triggering a callback */ 528 val.i_int = p_area->i_part; 529 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val ); 512 530 513 531 return 0; modules/access/dvdplay/access.c
rec22d73 r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: access.c,v 1.1 2 2003/03/09 19:25:09gbazin Exp $5 * $Id: access.c,v 1.13 2003/03/11 23:56:53 gbazin Exp $ 6 6 * 7 7 * Author: St�ane Borel <stef@via.ecp.fr> … … 46 46 #endif 47 47 48 #if defined( WIN32 )49 # include <io.h> /* read() */50 #endif51 52 48 #include "dvd.h" 53 49 #include "es.h" … … 148 144 /* Area 0 for menu */ 149 145 area[0]->i_plugin_data = 0; 146 input_DelArea( p_input, p_input->stream.pp_areas[0] ); 147 input_AddArea( p_input, 0, 1 ); 150 148 151 149 for( i = 1 ; i <= i_title_nr ; i++ ) 152 150 { 153 input_AddArea( p_input ); 154 155 /* Titles id */ 156 area[i]->i_id = i; 157 158 /* Number of chapters */ 159 area[i]->i_part_nb = dvdplay_chapter_nr( p_dvd->vmg, i ); 160 151 input_AddArea( p_input, i, dvdplay_chapter_nr( p_dvd->vmg, i ) ); 161 152 area[i]->i_plugin_data = 0; 162 153 } … … 245 236 dvd_data_t * p_dvd; 246 237 int i_angle; 238 vlc_value_t val; 247 239 248 240 p_dvd = (dvd_data_t*)(p_input->p_access_data); … … 258 250 msg_Dbg( p_input, "angle %d selected", i_angle ); 259 251 } 252 253 /* Update the navigation variables without triggering a callback */ 254 val.i_int = p_program->i_number; 255 var_Change( p_input, "program", VLC_VAR_SETVALUE, &val ); 260 256 } 261 257 … … 273 269 { 274 270 dvd_data_t * p_dvd; 271 vlc_value_t val; 275 272 276 273 p_dvd = (dvd_data_t*)p_input->p_access_data; … … 323 320 p_input->stream.b_changed = 1; 324 321 322 /* Update the navigation variables without triggering a callback */ 323 val.i_int = p_area->i_part; 324 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val ); 325 325 326 return 0; 326 327 } … … 396 397 break; 397 398 case NEW_FILE: 398 399 399 break; 400 400 case NEW_PGC: … … 429 429 /* warn interface that something has changed */ 430 430 p_input->stream.b_changed = 1; 431 432 /* Update the navigation variables without triggering a callback */ 433 val.i_int = p_input->stream.p_selected_area->i_part; 434 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val ); 431 435 break; 432 436 case NEW_CELL: … … 498 502 dvd_data_t * p_dvd; 499 503 int i_angle_nb, i_angle; 504 vlc_value_t val; 500 505 int i; 501 506 … … 526 531 /* No PSM to read in DVD mode, we already have all information */ 527 532 p_input->stream.p_selected_program->b_is_ok = 1; 533 534 /* Update the navigation variables without triggering a callback */ 535 val.i_int = p_area->i_id; 536 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val ); 537 var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL ); 538 for( i = 1; (unsigned int)i <= p_area->i_part_nb; i++ ) 539 { 540 val.i_int = i; 541 var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val ); 542 } 543 544 /* Update the navigation variables without triggering a callback */ 545 val.i_int = p_area->i_part; 546 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val ); 528 547 529 548 return 0; … … 569 588 return 0; 570 589 } 571 modules/access/dvdread/input.c
r9722e20 r1171979 7 7 ***************************************************************************** 8 8 * Copyright (C) 2001, 2003 VideoLAN 9 * $Id: input.c,v 1.1 6 2003/02/02 00:49:40 massiotExp $9 * $Id: input.c,v 1.17 2003/03/11 23:56:53 gbazin Exp $ 10 10 * 11 11 * Author: St�ane Borel <stef@via.ecp.fr> … … 384 384 for( i = 1 ; i <= tt_srpt->nr_of_srpts ; i++ ) 385 385 { 386 input_AddArea( p_input );387 388 386 /* Titles are Program Chains */ 389 area[i]->i_id = i;387 input_AddArea( p_input, i, tt_srpt->title[i-1].nr_of_ptts ); 390 388 391 389 /* Absolute start offset and size … … 395 393 area[i]->i_size = 0; 396 394 397 /* Number of chapters */ 398 area[i]->i_part_nb = tt_srpt->title[i-1].nr_of_ptts; 395 /* Default Chapter */ 399 396 area[i]->i_part = 1; 400 397 … … 466 463 { 467 464 thread_dvd_data_t * p_dvd; 465 vlc_value_t val; 468 466 469 467 p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); … … 476 474 477 475 msg_Dbg( p_input, "angle %d selected", p_dvd->i_angle ); 476 477 /* Update the navigation variables without triggering a callback */ 478 val.i_int = p_program->i_number; 479 var_Change( p_input, "program", VLC_VAR_SETVALUE, &val ); 478 480 } 479 481 … … 495 497 int pgc_id = 0; 496 498 int pgn = 0; 499 vlc_value_t val; 497 500 498 501 p_dvd = (thread_dvd_data_t*)p_input->p_access_data; … … 795 798 } 796 799 800 /* Update the navigation variables without triggering a callback */ 801 val.i_int = p_area->i_id; 802 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val ); 803 var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL ); 804 for( i = 1; i <= p_area->i_part_nb; i++ ) 805 { 806 val.i_int = i; 807 var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val ); 808 } 809 797 810 } /* i_title >= 0 */ 798 811 else … … 838 851 p_input->stream.b_seekable = VLC_TRUE; 839 852 p_input->stream.b_changed = VLC_TRUE; 853 854 /* Update the navigation variables without triggering a callback */ 855 val.i_int = p_area->i_part; 856 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val ); 840 857 841 858 return VLC_SUCCESS; modules/access/satellite/access.c
ra793be3 r1171979 383 383 { 384 384 unsigned int i_es_index; 385 vlc_value_t val; 385 386 386 387 if ( p_input->stream.p_selected_program ) … … 435 436 p_input->stream.p_selected_program = p_new_prg; 436 437 438 /* Update the navigation variables without triggering a callback */ 439 val.i_int = p_new_prg->i_number; 440 var_Change( p_input, "program", VLC_VAR_SETVALUE, &val ); 441 437 442 return 0; 438 443 } modules/access/vcd/vcd.c
r56b7cbf r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 2000 VideoLAN 5 * $Id: vcd.c,v 1.1 5 2003/02/12 17:13:33 jobiExp $5 * $Id: vcd.c,v 1.16 2003/03/11 23:56:54 gbazin Exp $ 6 6 * 7 7 * Author: Johan Bilien <jobi@via.ecp.fr> … … 225 225 for( i = 1 ; i <= p_vcd->i_nb_tracks - 1 ; i++ ) 226 226 { 227 input_AddArea( p_input );228 229 227 /* Titles are Program Chains */ 230 area[i]->i_id = i;228 input_AddArea( p_input, i, 1 ); 231 229 232 230 /* Absolute start offset and size */ … … 235 233 * (off_t)VCD_DATA_SIZE; 236 234 237 /* Number of chapters */ 238 area[i]->i_part_nb = 1; /* will be the entry points */ 235 /* Default Chapter */ 239 236 area[i]->i_part = 1; 240 237 … … 389 386 { 390 387 thread_vcd_data_t * p_vcd; 388 vlc_value_t val; 391 389 392 390 p_vcd = (thread_vcd_data_t*)p_input->p_access_data; … … 397 395 if( p_area != p_input->stream.p_selected_area ) 398 396 { 397 unsigned int i; 398 399 399 /* Reset the Chapter position of the current title */ 400 400 p_input->stream.p_selected_area->i_part = 1; … … 408 408 p_vcd->i_track = p_area->i_id; 409 409 p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track]; 410 411 /* Update the navigation variables without triggering a callback */ 412 val.i_int = p_area->i_id; 413 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val ); 414 var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL ); 415 for( i = 1; i <= p_area->i_part_nb; i++ ) 416 { 417 val.i_int = i; 418 var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val ); 419 } 410 420 } 411 421 … … 427 437 p_input->stream.b_seekable = 1; 428 438 p_input->stream.b_changed = 1; 439 440 /* Update the navigation variables without triggering a callback */ 441 val.i_int = p_area->i_part; 442 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val ); 429 443 430 444 return 0; modules/gui/wxwindows/popup.cpp
r437957a r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 2000-2001 VideoLAN 5 * $Id: popup.cpp,v 1. 3 2003/01/26 10:36:10gbazin Exp $5 * $Id: popup.cpp,v 1.4 2003/03/11 23:56:54 gbazin Exp $ 6 6 * 7 7 * Authors: Gildas Bazin <gbazin@netcourrier.com> … … 119 119 CreateMenuEntry( "title", p_object ); 120 120 CreateMenuEntry( "chapter", p_object ); 121 CreateMenuEntry( "navigation", p_object ); 121 122 122 123 vlc_object_release( p_object ); … … 208 209 wxMenu *menu = new wxMenu; 209 210 vlc_value_t val; 210 char *psz_value;211 vlc_value_t val_list; 211 212 int i_type, i; 212 213 … … 214 215 i_type = var_Type( p_object, psz_var ); 215 216 216 switch( i_type )217 {218 case VLC_VAR_VOID:219 case VLC_VAR_STRING:220 break;221 222 default:223 break;224 }225 226 217 if( var_Get( p_object, psz_var, &val ) < 0 ) 227 218 { 228 219 return NULL; 229 220 } 230 psz_value = val.psz_string; 231 232 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val ) < 0 ) 221 222 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list ) < 0 ) 233 223 { 234 224 return NULL; 235 225 } 236 226 237 for( i = 0; i < val .p_list->i_count; i++ )227 for( i = 0; i < val_list.p_list->i_count; i++ ) 238 228 { 239 229 vlc_value_t another_val; … … 242 232 switch( i_type & VLC_VAR_TYPE ) 243 233 { 234 case VLC_VAR_VARIABLE: 235 menu->Append( MenuDummy_Event, 236 val_list.p_list->p_values[i].psz_string, 237 CreateSubMenu( val_list.p_list->p_values[i].psz_string, 238 p_object ), 239 "YEAAAARRRGGGHHH HEEELLPPPPPP" ); 240 break; 241 244 242 case VLC_VAR_STRING: 245 243 another_val.psz_string = 246 strdup(val .p_list->p_values[i].psz_string);244 strdup(val_list.p_list->p_values[i].psz_string); 247 245 menuitem = 248 246 new wxMenuItemExt( this, i_item_id++, another_val.psz_string, … … 253 251 menu->Append( menuitem ); 254 252 255 if( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) ) 253 if( !strcmp( val.psz_string, 254 val_list.p_list->p_values[i].psz_string ) ) 256 255 menu->Check( i_item_id - 1, TRUE ); 257 256 break; … … 261 260 new wxMenuItemExt( this, i_item_id++, 262 261 wxString::Format(_("%d"), 263 val .p_list->p_values[i].i_int),262 val_list.p_list->p_values[i].i_int), 264 263 "", wxITEM_RADIO, strdup(psz_var), 265 264 p_object->i_object_id, 266 val .p_list->p_values[i] );265 val_list.p_list->p_values[i] ); 267 266 268 267 menu->Append( menuitem ); 268 269 if( !((i_type & VLC_VAR_FLAGS) & VLC_VAR_ISCOMMAND) && 270 val_list.p_list->p_values[i].i_int == val.i_int ) 271 menu->Check( i_item_id - 1, TRUE ); 269 272 break; 270 273 … … 274 277 } 275 278 276 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val );279 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list ); 277 280 278 281 return menu; src/input/input.c
r65a1532 r1171979 5 5 ***************************************************************************** 6 6 * Copyright (C) 1998-2002 VideoLAN 7 * $Id: input.c,v 1.22 3 2003/02/08 22:43:02 massiotExp $7 * $Id: input.c,v 1.224 2003/03/11 23:56:54 gbazin Exp $ 8 8 * 9 9 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 127 127 128 128 /* By default there is one area in a stream */ 129 input_AddArea( p_input );129 input_AddArea( p_input, 0, 1 ); 130 130 p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; 131 131 src/input/input_ext-intf.c
rfca9baf r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 1998-2001 VideoLAN 5 * $Id: input_ext-intf.c,v 1.4 7 2003/01/21 14:15:05 hartman Exp $5 * $Id: input_ext-intf.c,v 1.48 2003/03/11 23:56:54 gbazin Exp $ 6 6 * 7 7 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 367 367 { 368 368 pgrm_descriptor_t * p_program; 369 vlc_value_t val; 369 370 370 371 vlc_mutex_lock( &p_input->stream.stream_lock ); … … 381 382 382 383 vlc_mutex_unlock( &p_input->stream.stream_lock ); 384 385 /* Update the navigation variables without triggering a callback */ 386 val.i_int = i_program_number; 387 var_Change( p_input, "program", VLC_VAR_SETVALUE, &val ); 383 388 384 389 return 0; src/input/input_programs.c
ra4495b8 r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 1999-2002 VideoLAN 5 * $Id: input_programs.c,v 1.10 1 2003/01/31 11:23:37 massiotExp $5 * $Id: input_programs.c,v 1.102 2003/03/11 23:56:54 gbazin Exp $ 6 6 * 7 7 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 40 40 */ 41 41 42 /* Navigation callbacks */ 43 static int ProgramCallback( vlc_object_t *, char const *, 44 vlc_value_t, vlc_value_t, void * ); 45 static int TitleCallback( vlc_object_t *, char const *, 46 vlc_value_t, vlc_value_t, void * ); 47 static int ChapterCallback( vlc_object_t *, char const *, 48 vlc_value_t, vlc_value_t, void * ); 49 static int NavigationCallback( vlc_object_t *, char const *, 50 vlc_value_t, vlc_value_t, void * ); 51 42 52 /***************************************************************************** 43 53 * input_InitStream: init the stream descriptor of the given input … … 73 83 } 74 84 85 /* Create a few object variables used for navigation in the interfaces */ 86 var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); 87 var_Create( p_input, "title", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); 88 var_Create( p_input, "chapter", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); 89 var_Create( p_input, "navigation", VLC_VAR_VARIABLE | VLC_VAR_HASCHOICE ); 90 var_AddCallback( p_input, "program", ProgramCallback, NULL ); 91 var_AddCallback( p_input, "title", TitleCallback, NULL ); 92 var_AddCallback( p_input, "chapter", ChapterCallback, NULL ); 93 75 94 return 0; 76 95 } … … 81 100 void input_EndStream( input_thread_t * p_input ) 82 101 { 102 /* Free navigation variables */ 103 var_Destroy( p_input, "program" ); 104 var_Destroy( p_input, "title" ); 105 var_Destroy( p_input, "chapter" ); 106 83 107 /* Free all programs and associated ES, and associated decoders. */ 84 108 while( p_input->stream.i_pgrm_number ) … … 140 164 /* Where to add the pgrm */ 141 165 pgrm_descriptor_t * p_pgrm = malloc( sizeof(pgrm_descriptor_t) ); 166 vlc_value_t val; 142 167 143 168 if( p_pgrm == NULL ) … … 180 205 p_pgrm ); 181 206 207 val.i_int = i_pgrm_id; 208 var_Change( p_input, "program", VLC_VAR_ADDCHOICE, &val ); 209 182 210 return p_pgrm; 183 211 } … … 191 219 { 192 220 unsigned int i_pgrm_index; 221 vlc_value_t val; 193 222 194 223 /* Find the program in the programs table */ … … 206 235 return; 207 236 } 237 238 val.i_int = i_pgrm_index; 239 var_Change( p_input, "program", VLC_VAR_DELCHOICE, &val ); 208 240 209 241 /* Free the structures that describe the es that belongs to that program */ … … 233 265 * This area descriptor will be referenced in the given stream descriptor 234 266 *****************************************************************************/ 235 input_area_t * input_AddArea( input_thread_t * p_input ) 267 input_area_t * input_AddArea( input_thread_t * p_input, 268 uint16_t i_area_id, uint16_t i_part_nb ) 236 269 { 237 270 /* Where to add the pgrm */ 238 271 input_area_t * p_area = malloc( sizeof(input_area_t) ); 272 vlc_value_t val; 273 int i; 239 274 240 275 if( p_area == NULL ) … … 245 280 246 281 /* Init this entry */ 247 p_area->i_id = 0; 282 p_area->i_id = i_area_id; 283 p_area->i_part_nb = i_part_nb; 284 p_area->i_part= 0; 248 285 p_area->i_start = 0; 249 286 p_area->i_size = 0; 250 287 p_area->i_tell = 0; 251 288 p_area->i_seek = NO_SEEK; 252 p_area->i_part_nb = 1;253 p_area->i_part= 0;254 289 255 290 /* Add an entry to the list of program associated with the stream */ … … 259 294 p_area ); 260 295 296 /* Don't add empty areas */ 297 if( i_part_nb == 0 ) 298 return NULL; 299 300 /* Take care of the navigation variables */ 301 val.i_int = i_area_id; 302 var_Change( p_input, "title", VLC_VAR_ADDCHOICE, &val ); 303 304 val.psz_string = malloc( sizeof("title ") + 5 ); 305 if( val.psz_string ) 306 { 307 vlc_value_t val2; 308 309 sprintf( val.psz_string, "title %2i", i_area_id ); 310 var_Destroy( p_input, val.psz_string ); 311 var_Create( p_input, val.psz_string, VLC_VAR_INTEGER | 312 VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); 313 var_AddCallback( p_input, val.psz_string, NavigationCallback, 314 (void *)(int)i_area_id ); 315 316 var_Change( p_input, "navigation", VLC_VAR_ADDCHOICE, &val ); 317 318 for( i = 1; i <= i_part_nb; i++ ) 319 { 320 val2.i_int = i; 321 var_Change( p_input, val.psz_string, VLC_VAR_ADDCHOICE, &val2 ); 322 } 323 } 324 261 325 return p_area; 262 326 } … … 272 336 int i_audio_es = 0; 273 337 int i_spu_es = 0; 338 vlc_value_t val; 274 339 275 340 if ( p_input->stream.p_selected_program ) … … 357 422 p_input->stream.p_selected_program = p_new_prg; 358 423 424 /* Update the navigation variables without triggering a callback */ 425 val.i_int = p_new_prg->i_number; 426 var_Change( p_input, "program", VLC_VAR_SETVALUE, &val ); 427 359 428 return( 0 ); 360 429 } 361 362 430 363 431 /***************************************************************************** … … 369 437 { 370 438 unsigned int i_area_index; 439 vlc_value_t val; 371 440 372 441 /* Find the area in the areas table */ … … 383 452 msg_Err( p_input, "area does not belong to this input" ); 384 453 return; 454 } 455 456 /* Take care of the navigation variables */ 457 val.psz_string = malloc( sizeof("title ") + 5 ); 458 if( val.psz_string ) 459 { 460 sprintf( val.psz_string, "title %i", p_area->i_id ); 461 var_Change( p_input, "navigation", VLC_VAR_DELCHOICE, &val ); 462 var_Destroy( p_input, val.psz_string ); 385 463 } 386 464 … … 659 737 return 0; 660 738 } 739 740 /***************************************************************************** 741 * Navigation callback: a bunch of navigation variables are used as an 742 * alternative to the navigation API. 743 *****************************************************************************/ 744 static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd, 745 vlc_value_t oldval, vlc_value_t newval, void *p_data ) 746 { 747 input_thread_t *p_input = (input_thread_t *)p_this; 748 749 if( oldval.i_int == newval.i_int ) 750 return VLC_SUCCESS; 751 752 vlc_mutex_lock( &p_input->stream.stream_lock ); 753 if( ( newval.i_int > 0 ) ) 754 { 755 vlc_mutex_unlock( &p_input->stream.stream_lock ); 756 input_ChangeProgram( p_input, newval.i_int ); 757 input_SetStatus( p_input, INPUT_STATUS_PLAY ); 758 vlc_mutex_lock( &p_input->stream.stream_lock ); 759 } 760 vlc_mutex_unlock( &p_input->stream.stream_lock ); 761 762 return VLC_SUCCESS; 763 } 764 765 static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd, 766 vlc_value_t oldval, vlc_value_t newval, void *p_data ) 767 { 768 input_thread_t *p_input = (input_thread_t *)p_this; 769 input_area_t *p_area; 770 771 if( oldval.i_int == newval.i_int ) 772 return VLC_SUCCESS; 773 774 /* Sanity check should have already be done by var_Set(). */ 775 vlc_mutex_lock( &p_input->stream.stream_lock ); 776 p_area = p_input->stream.pp_areas[newval.i_int]; 777 p_area->i_part = 1; 778 vlc_mutex_unlock( &p_input->stream.stream_lock ); 779 input_ChangeArea( p_input, p_area ); 780 input_SetStatus( p_input, INPUT_STATUS_PLAY ); 781 782 return VLC_SUCCESS; 783 } 784 785 static int ChapterCallback( vlc_object_t *p_this, char const *psz_cmd, 786 vlc_value_t oldval, vlc_value_t newval, void *p_data ) 787 { 788 input_thread_t *p_input = (input_thread_t *)p_this; 789 input_area_t *p_area; 790 791 if( oldval.i_int == newval.i_int ) 792 return VLC_SUCCESS; 793 794 /* Sanity check will have already be done by var_Set(). */ 795 vlc_mutex_lock( &p_input->stream.stream_lock ); 796 p_area = p_input->stream.p_selected_area; 797 p_input->stream.p_selected_area->i_part = newval.i_int; 798 vlc_mutex_unlock( &p_input->stream.stream_lock ); 799 800 input_ChangeArea( p_input, p_area ); 801 input_SetStatus( p_input, INPUT_STATUS_PLAY ); 802 803 return VLC_SUCCESS; 804 } 805 806 static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd, 807 vlc_value_t oldval, vlc_value_t newval, void *p_data ) 808 { 809 input_thread_t *p_input = (input_thread_t *)p_this; 810 uint16_t i_area_id = (int)p_data; 811 812 vlc_mutex_lock( &p_input->stream.stream_lock ); 813 814 if( p_input->stream.p_selected_area->i_id == i_area_id && 815 oldval.i_int == newval.i_int ) 816 { 817 /* Nothing to do */ 818 vlc_mutex_unlock( &p_input->stream.stream_lock ); 819 return VLC_SUCCESS; 820 } 821 822 if( ( i_area_id < p_input->stream.i_area_nb ) && ( newval.i_int > 0 ) && 823 ( (uint16_t)newval.i_int <= 824 p_input->stream.pp_areas[i_area_id]->i_part_nb ) ) 825 { 826 input_area_t *p_area = p_input->stream.pp_areas[i_area_id]; 827 p_input->stream.p_selected_area->i_part = newval.i_int; 828 vlc_mutex_unlock( &p_input->stream.stream_lock ); 829 input_ChangeArea( p_input, p_area ); 830 input_SetStatus( p_input, INPUT_STATUS_PLAY ); 831 vlc_mutex_lock( &p_input->stream.stream_lock ); 832 } 833 vlc_mutex_unlock( &p_input->stream.stream_lock ); 834 835 return VLC_SUCCESS; 836 } src/misc/variables.c
rec22d73 r1171979 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.c,v 1.2 0 2003/03/09 19:25:08gbazin Exp $5 * $Id: variables.c,v 1.21 2003/03/11 23:56:54 gbazin Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 156 156 case VLC_VAR_MODULE: 157 157 case VLC_VAR_FILE: 158 case VLC_VAR_DIRECTORY: 159 case VLC_VAR_VARIABLE: 158 160 p_var->pf_cmp = CmpString; 159 161 p_var->pf_dup = DupString; … … 265 267 int i_var, i; 266 268 variable_t *p_var; 269 vlc_value_t oldval; 267 270 268 271 vlc_mutex_lock( &p_this->var_lock ); … … 365 368 CheckValue( p_var, &p_var->val ); 366 369 break; 370 case VLC_VAR_CLEARCHOICES: 371 for( i = 0 ; i < p_var->choices.i_count ; i++ ) 372 { 373 p_var->pf_free( &p_var->choices.p_values[i] ); 374 } 375 if( p_var->choices.i_count ) 376 free( p_var->choices.p_values ); 377 378 p_var->choices.i_count = 0; 379 p_var->choices.p_values = NULL; 380 p_var->i_default = -1; 381 break; 367 382 case VLC_VAR_SETDEFAULT: 368 383 /* FIXME: the list is sorted, dude. Use something cleverer. */ … … 384 399 CheckValue( p_var, &p_var->val ); 385 400 break; 386 401 case VLC_VAR_SETVALUE: 402 /* Duplicate data if needed */ 403 p_var->pf_dup( p_val ); 404 /* Backup needed stuff */ 405 oldval = p_var->val; 406 /* Check boundaries and list */ 407 CheckValue( p_var, p_val ); 408 /* Set the variable */ 409 p_var->val = *p_val; 410 /* Free data if needed */ 411 p_var->pf_free( &oldval ); 412 break; 387 413 case VLC_VAR_GETLIST: 388 414 p_val->p_list = malloc( sizeof(vlc_list_t) );
