1 /*****************************************************************************
2 * var.c: object variables for input thread
3 *****************************************************************************
4 * Copyright (C) 2004 VideoLAN
5 * $Id: input.c 7955 2004-06-07 22:21:33Z fenrir $
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
29 #include <vlc/input.h>
31 #include "input_internal.h"
33 /*****************************************************************************
35 *****************************************************************************/
36 void input_ControlVarInit ( input_thread_t * );
37 void input_ControlVarClean( input_thread_t * );
38 void input_ControlVarNavigation( input_thread_t * );
39 void input_ControlVarTitle( input_thread_t *p_input, int i_title );
41 void input_ConfigVarInit ( input_thread_t *p_input );
44 /*****************************************************************************
46 *****************************************************************************/
47 static int StateCallback ( vlc_object_t *p_this, char const *psz_cmd,
48 vlc_value_t oldval, vlc_value_t newval, void * );
49 static int RateCallback ( vlc_object_t *p_this, char const *psz_cmd,
50 vlc_value_t oldval, vlc_value_t newval, void * );
51 static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
52 vlc_value_t oldval, vlc_value_t newval, void * );
53 static int TimeCallback ( vlc_object_t *p_this, char const *psz_cmd,
54 vlc_value_t oldval, vlc_value_t newval, void * );
55 static int ProgramCallback ( vlc_object_t *p_this, char const *psz_cmd,
56 vlc_value_t oldval, vlc_value_t newval, void * );
57 static int TitleCallback ( vlc_object_t *p_this, char const *psz_cmd,
58 vlc_value_t oldval, vlc_value_t newval, void * );
59 static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd,
60 vlc_value_t oldval, vlc_value_t newval, void * );
61 static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
62 vlc_value_t oldval, vlc_value_t newval, void * );
63 static int ESCallback ( vlc_object_t *p_this, char const *psz_cmd,
64 vlc_value_t oldval, vlc_value_t newval, void * );
65 static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
66 vlc_value_t oldval, vlc_value_t newval, void * );
68 static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd,
69 vlc_value_t oldval, vlc_value_t newval, void * );
71 /*****************************************************************************
72 * input_ControlVarInit:
73 * Create all control object variables with their callbacks
74 *****************************************************************************/
75 void input_ControlVarInit ( input_thread_t *p_input )
77 vlc_value_t val, text;
80 var_Create( p_input, "state", VLC_VAR_INTEGER );
81 val.i_int = p_input->i_state;
82 var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
83 var_AddCallback( p_input, "state", StateCallback, NULL );
86 var_Create( p_input, "rate", VLC_VAR_INTEGER );
87 val.i_int = p_input->i_rate;
88 var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
89 var_AddCallback( p_input, "rate", RateCallback, NULL );
91 var_Create( p_input, "rate-slower", VLC_VAR_VOID );
92 var_AddCallback( p_input, "rate-slower", RateCallback, NULL );
94 var_Create( p_input, "rate-faster", VLC_VAR_VOID );
95 var_AddCallback( p_input, "rate-faster", RateCallback, NULL );
99 var_Create( p_input, "position", VLC_VAR_FLOAT );
100 var_Create( p_input, "position-offset", VLC_VAR_FLOAT );
102 var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
103 var_AddCallback( p_input, "position", PositionCallback, NULL );
104 var_AddCallback( p_input, "position-offset", PositionCallback, NULL );
107 var_Create( p_input, "time", VLC_VAR_TIME );
108 var_Create( p_input, "time-offset", VLC_VAR_TIME ); /* relative */
110 var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
111 var_AddCallback( p_input, "time", TimeCallback, NULL );
112 var_AddCallback( p_input, "time-offset", TimeCallback, NULL );
116 var_Create( p_input, "bookmark", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE |
118 val.psz_string = _("Bookmark");
119 var_Change( p_input, "bookmark", VLC_VAR_SETTEXT, &val, NULL );
120 var_AddCallback( p_input, "bookmark", BookmarkCallback, NULL );
124 var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE |
126 var_Get( p_input, "program", &val );
128 var_Change( p_input, "program", VLC_VAR_DELCHOICE, &val, NULL );
129 text.psz_string = _("Program");
130 var_Change( p_input, "program", VLC_VAR_SETTEXT, &text, NULL );
131 var_AddCallback( p_input, "program", ProgramCallback, NULL );
134 var_Create( p_input, "title", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
135 text.psz_string = _("Title");
136 var_Change( p_input, "title", VLC_VAR_SETTEXT, &text, NULL );
137 var_AddCallback( p_input, "title", TitleCallback, NULL );
140 var_Create( p_input, "chapter", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
141 text.psz_string = _("Chapter");
142 var_Change( p_input, "chapter", VLC_VAR_SETTEXT, &text, NULL );
143 var_AddCallback( p_input, "chapter", SeekpointCallback, NULL );
145 /* Navigation The callback is added after */
146 var_Create( p_input, "navigation", VLC_VAR_VARIABLE | VLC_VAR_HASCHOICE );
147 text.psz_string = _("Navigation");
148 var_Change( p_input, "navigation", VLC_VAR_SETTEXT, &text, NULL );
151 var_Create( p_input, "audio-delay", VLC_VAR_TIME );
153 var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL );
154 var_AddCallback( p_input, "audio-delay", EsDelayCallback, NULL );
155 var_Create( p_input, "spu-delay", VLC_VAR_TIME );
157 var_Change( p_input, "spu-delay", VLC_VAR_SETVALUE, &val, NULL );
158 var_AddCallback( p_input, "spu-delay", EsDelayCallback, NULL );
162 var_Create( p_input, "video-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
163 text.psz_string = _("Video Track");
164 var_Change( p_input, "video-es", VLC_VAR_SETTEXT, &text, NULL );
165 var_AddCallback( p_input, "video-es", ESCallback, NULL );
168 var_Create( p_input, "audio-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
169 text.psz_string = _("Audio Track");
170 var_Change( p_input, "audio-es", VLC_VAR_SETTEXT, &text, NULL );
171 var_AddCallback( p_input, "audio-es", ESCallback, NULL );
174 var_Create( p_input, "spu-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
175 text.psz_string = _("Subtitles Track");
176 var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
177 var_AddCallback( p_input, "spu-es", ESCallback, NULL );
180 /* Special read only objects variables for intf */
181 var_Create( p_input, "bookmarks", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
183 var_Create( p_input, "length", VLC_VAR_TIME );
185 var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
189 /* Special "intf-change" variable, it allows intf to set up a callback
190 * to be notified of some changes.
191 * TODO list all changes warn by this callbacks */
192 var_Create( p_input, "intf-change", VLC_VAR_BOOL );
193 var_SetBool( p_input, "intf-change", VLC_TRUE );
196 /*****************************************************************************
197 * input_ControlVarClean:
198 *****************************************************************************/
199 void input_ControlVarClean( input_thread_t *p_input )
201 var_Destroy( p_input, "state" );
202 var_Destroy( p_input, "rate" );
203 var_Destroy( p_input, "rate-slower" );
204 var_Destroy( p_input, "rate-faster" );
205 var_Destroy( p_input, "position" );
206 var_Destroy( p_input, "position-offset" );
207 var_Destroy( p_input, "time" );
208 var_Destroy( p_input, "time-offset" );
210 var_Destroy( p_input, "audio-delay" );
211 var_Destroy( p_input, "spu-delay" );
213 var_Destroy( p_input, "bookmark" );
215 var_Destroy( p_input, "program" );
216 if( p_input->i_title > 1 )
218 /* TODO Destroy sub navigation var ? */
220 var_Destroy( p_input, "next-title" );
221 var_Destroy( p_input, "prev-title" );
223 if( p_input->i_title > 0 )
225 /* FIXME title > 0 doesn't mean current title has more than 1 seekpoint */
226 var_Destroy( p_input, "next-chapter" );
227 var_Destroy( p_input, "prev-chapter" );
229 var_Destroy( p_input, "title" );
230 var_Destroy( p_input, "chapter" );
231 var_Destroy( p_input, "navigation" );
233 var_Destroy( p_input, "video-es" );
234 var_Destroy( p_input, "audio-es" );
235 var_Destroy( p_input, "spu-es" );
237 var_Destroy( p_input, "bookmarks" );
238 var_Destroy( p_input, "length" );
240 var_Destroy( p_input, "intf-change" );
243 /*****************************************************************************
244 * input_ControlVarNavigation:
245 * Create all remaining control object variables
246 *****************************************************************************/
247 void input_ControlVarNavigation( input_thread_t *p_input )
249 vlc_value_t val, text;
252 /* Create more command variables */
253 if( p_input->i_title > 1 )
255 var_Create( p_input, "next-title", VLC_VAR_VOID );
256 text.psz_string = _("Next title");
257 var_Change( p_input, "next-title", VLC_VAR_SETTEXT, &text, NULL );
258 var_AddCallback( p_input, "next-title", TitleCallback, NULL );
260 var_Create( p_input, "prev-title", VLC_VAR_VOID );
261 text.psz_string = _("Previous title");
262 var_Change( p_input, "prev-title", VLC_VAR_SETTEXT, &text, NULL );
263 var_AddCallback( p_input, "prev-title", TitleCallback, NULL );
266 /* Create title and navigation */
267 val.psz_string = malloc( sizeof("title ") + 5 );
268 for( i = 0; i < p_input->i_title; i++ )
270 vlc_value_t val2, text, text2;
273 /* Add Navigation entries */
274 sprintf( val.psz_string, "title %2i", i );
275 var_Destroy( p_input, val.psz_string );
276 var_Create( p_input, val.psz_string,
277 VLC_VAR_INTEGER|VLC_VAR_HASCHOICE|VLC_VAR_ISCOMMAND );
278 var_AddCallback( p_input, val.psz_string,
279 NavigationCallback, (void *)i );
281 if( p_input->title[i]->psz_name == NULL ||
282 *p_input->title[i]->psz_name == '\0' )
284 text.psz_string = malloc( strlen( _("Title %i") ) + 20 );
285 sprintf( text.psz_string, _("Title %i"), i );
289 text.psz_string = strdup( p_input->title[i]->psz_name );
291 var_Change( p_input, "navigation", VLC_VAR_ADDCHOICE, &val, &text );
293 /* Add title choice */
295 var_Change( p_input, "title", VLC_VAR_ADDCHOICE, &val2, &text );
297 free( text.psz_string );
299 for( j = 0; j < p_input->title[i]->i_seekpoint; j++ )
303 if( p_input->title[i]->seekpoint[j]->psz_name == NULL ||
304 *p_input->title[i]->seekpoint[j]->psz_name == '\0' )
307 text2.psz_string = malloc( strlen( _("Chapter %i") ) + 20 );
308 sprintf( text2.psz_string, _("Chapter %i"), j );
313 strdup( p_input->title[i]->seekpoint[j]->psz_name );
316 var_Change( p_input, val.psz_string, VLC_VAR_ADDCHOICE,
318 if( text2.psz_string ) free( text2.psz_string );
322 free( val.psz_string );
325 /*****************************************************************************
326 * input_ControlVarTitle:
327 * Create all variables for a title
328 *****************************************************************************/
329 void input_ControlVarTitle( input_thread_t *p_input, int i_title )
331 input_title_t *t = p_input->title[i_title];
335 /* Create/Destroy command variables */
336 if( t->i_seekpoint > 1 )
340 var_Create( p_input, "next-chapter", VLC_VAR_VOID );
341 text.psz_string = _("Next chapter");
342 var_Change( p_input, "next-chapter", VLC_VAR_SETTEXT, &text, NULL );
343 var_AddCallback( p_input, "next-chapter", SeekpointCallback, NULL );
345 var_Create( p_input, "prev-chapter", VLC_VAR_VOID );
346 text.psz_string = _("Previous chapter");
347 var_Change( p_input, "prev-chapter", VLC_VAR_SETTEXT, &text, NULL );
348 var_AddCallback( p_input, "prev-chapter", SeekpointCallback, NULL );
352 var_Destroy( p_input, "next-chapter" );
353 var_Destroy( p_input, "prev-chapter" );
356 /* Build chapter list */
357 var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
358 for( i = 0; i < t->i_seekpoint; i++ )
363 if( t->seekpoint[i]->psz_name == NULL ||
364 *t->seekpoint[i]->psz_name == '\0' )
367 text.psz_string = malloc( strlen( _("Chapter %i") ) + 20 );
368 sprintf( text.psz_string, _("Chapter %i"), i );
372 text.psz_string = strdup( t->seekpoint[i]->psz_name );
375 var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, &text );
376 if( text.psz_string ) free( text.psz_string );
381 /*****************************************************************************
382 * input_ConfigVarInit:
383 * Create all config object variables
384 *****************************************************************************/
385 void input_ConfigVarInit ( input_thread_t *p_input )
389 /* Create Object Variables for private use only */
390 var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
391 var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
393 var_Create( p_input, "audio-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
394 var_Create( p_input, "spu-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
396 var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
397 var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
399 var_Create( p_input, "sub-autodetect-path", VLC_VAR_STRING |
401 var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER |
404 var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
405 var_Create( p_input, "sout-all", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
406 var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
407 var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
408 var_Create( p_input, "sout-keep", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
410 var_Create( p_input, "input-repeat", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
412 var_Create( p_input, "start-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
413 var_Create( p_input, "stop-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
415 var_Create( p_input, "minimize-threads", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
417 var_Create( p_input, "demuxed-id3", VLC_VAR_BOOL ); /* FIXME beurk */
418 val.b_bool = VLC_FALSE;
419 var_Change( p_input, "demuxed-id3", VLC_VAR_SETVALUE, &val, NULL );
421 var_Create( p_input, "audio-desync", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
423 var_Create( p_input, "cr-average", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
425 var_Create( p_input, "seekable", VLC_VAR_BOOL );
426 val.b_bool = VLC_TRUE; /* Fixed later*/
427 var_Change( p_input, "seekable", VLC_VAR_SETVALUE, &val, NULL );
431 /*****************************************************************************
433 *****************************************************************************/
434 static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
435 vlc_value_t oldval, vlc_value_t newval,
438 input_thread_t *p_input = (input_thread_t*)p_this;
441 if( newval.i_int == PLAYING_S || newval.i_int == PAUSE_S )
443 input_ControlPush( p_input, INPUT_CONTROL_SET_STATE, &newval );
449 static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
450 vlc_value_t oldval, vlc_value_t newval, void *p_data )
452 input_thread_t *p_input = (input_thread_t*)p_this;
456 /* Problem with this way: the "rate" variable is update after the input thread do the change */
457 if( !strcmp( psz_cmd, "rate-slower" ) )
459 input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_SLOWER, NULL );
461 /* Fix "rate" value */
462 i_rate = var_GetInteger( p_input, "rate" ) * 2;
463 if( i_rate < INPUT_RATE_MIN ) i_rate = INPUT_RATE_MIN;
465 var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
467 else if( !strcmp( psz_cmd, "rate-faster" ) )
469 input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_FASTER, NULL );
470 i_rate = var_GetInteger( p_input, "rate" ) / 2;
472 if( i_rate > INPUT_RATE_MAX ) i_rate = INPUT_RATE_MAX;
474 var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
478 input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &newval );
484 static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
485 vlc_value_t oldval, vlc_value_t newval,
488 input_thread_t *p_input = (input_thread_t*)p_this;
489 vlc_value_t val, length;
491 if( !strcmp( psz_cmd, "position-offset" ) )
493 input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION_OFFSET, &newval );
495 val.f_float = var_GetFloat( p_input, "position" ) + newval.f_float;
496 if( val.f_float < 0.0 ) val.f_float = 0.0;
497 if( val.f_float > 1.0 ) val.f_float = 1.0;
498 var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
502 val.f_float = newval.f_float;
503 input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval );
506 /* Update "position" for better intf behavour */
507 var_Get( p_input, "length", &length );
508 if( length.i_time > 0 && val.f_float >= 0.0 && val.f_float <= 1.0 )
510 val.i_time = length.i_time * val.f_float;
511 var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
518 static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
519 vlc_value_t oldval, vlc_value_t newval, void *p_data )
521 input_thread_t *p_input = (input_thread_t*)p_this;
522 vlc_value_t val, length;
524 if( !strcmp( psz_cmd, "time-offset" ) )
526 input_ControlPush( p_input, INPUT_CONTROL_SET_TIME_OFFSET, &newval );
528 val.i_time = var_GetTime( p_input, "time" ) + newval.i_time;
529 if( val.i_time < 0 ) val.i_time = 0;
530 /* TODO maybe test against i_length ? */
531 var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
535 val.i_time = newval.i_time;
536 input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval );
539 /* Update "position" for better intf behavour */
540 var_Get( p_input, "length", &length );
541 if( length.i_time > 0 && val.i_time >= 0 && val.i_time <= length.i_time )
543 val.f_float = (double)val.i_time/(double)length.i_time;
544 var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
550 static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
551 vlc_value_t oldval, vlc_value_t newval,
554 input_thread_t *p_input = (input_thread_t*)p_this;
556 input_ControlPush( p_input, INPUT_CONTROL_SET_PROGRAM, &newval );
561 static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
562 vlc_value_t oldval, vlc_value_t newval,
565 input_thread_t *p_input = (input_thread_t*)p_this;
566 vlc_value_t val, count;
568 if( !strcmp( psz_cmd, "next-title" ) )
570 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE_NEXT, NULL );
572 val.i_int = var_GetInteger( p_input, "title" ) + 1;
573 var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &count, NULL );
574 if( val.i_int < count.i_int )
575 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
577 else if( !strcmp( psz_cmd, "prev-title" ) )
579 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE_PREV, NULL );
581 val.i_int = var_GetInteger( p_input, "title" ) - 1;
583 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
587 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &newval );
593 static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd,
594 vlc_value_t oldval, vlc_value_t newval,
597 input_thread_t *p_input = (input_thread_t*)p_this;
598 vlc_value_t val, count;
600 if( !strcmp( psz_cmd, "next-chapter" ) )
602 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT_NEXT, NULL );
604 val.i_int = var_GetInteger( p_input, "chapter" ) + 1;
605 var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &count, NULL );
606 if( val.i_int < count.i_int )
607 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
609 else if( !strcmp( psz_cmd, "prev-chapter" ) )
611 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT_PREV, NULL );
613 val.i_int = var_GetInteger( p_input, "chapter" ) - 1;
615 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
619 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval );
625 static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
626 vlc_value_t oldval, vlc_value_t newval,
629 input_thread_t *p_input = (input_thread_t*)p_this;
632 /* Issue a title change */
633 val.i_int = (int)p_data;
634 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &val );
636 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
638 /* And a chapter change */
639 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval );
641 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &newval, NULL );
646 static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
647 vlc_value_t oldval, vlc_value_t newval, void *p_data )
649 input_thread_t *p_input = (input_thread_t*)p_this;
651 if( newval.i_int < 0 )
655 if( !strcmp( psz_cmd, "audio-es" ) )
657 else if( !strcmp( psz_cmd, "video-es" ) )
659 else if( !strcmp( psz_cmd, "spu-es" ) )
664 input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &v );
668 input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &newval );
674 static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
675 vlc_value_t oldval, vlc_value_t newval, void *p )
677 input_thread_t *p_input = (input_thread_t*)p_this;
679 if( !strcmp( psz_cmd, "audio-delay" ) )
680 input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
681 else if( !strcmp( psz_cmd, "spu-delay" ) )
682 input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval );
686 static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd,
687 vlc_value_t oldval, vlc_value_t newval,
690 input_thread_t *p_input = (input_thread_t*)p_this;
692 input_ControlPush( p_input, INPUT_CONTROL_SET_BOOKMARK, &newval );