00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <stdlib.h>
00028 #include <vlc/vlc.h>
00029 #include <vlc/input.h>
00030
00031 #include "input_internal.h"
00032
00033
00034
00035
00036 void input_ControlVarInit ( input_thread_t * );
00037 void input_ControlVarClean( input_thread_t * );
00038 void input_ControlVarNavigation( input_thread_t * );
00039 void input_ControlVarTitle( input_thread_t *p_input, int i_title );
00040
00041 void input_ConfigVarInit ( input_thread_t *p_input );
00042
00043
00044
00045
00046 static int StateCallback ( vlc_object_t *p_this, char const *psz_cmd,
00047 vlc_value_t oldval, vlc_value_t newval, void * );
00048 static int RateCallback ( vlc_object_t *p_this, char const *psz_cmd,
00049 vlc_value_t oldval, vlc_value_t newval, void * );
00050 static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
00051 vlc_value_t oldval, vlc_value_t newval, void * );
00052 static int TimeCallback ( vlc_object_t *p_this, char const *psz_cmd,
00053 vlc_value_t oldval, vlc_value_t newval, void * );
00054 static int ProgramCallback ( vlc_object_t *p_this, char const *psz_cmd,
00055 vlc_value_t oldval, vlc_value_t newval, void * );
00056 static int TitleCallback ( vlc_object_t *p_this, char const *psz_cmd,
00057 vlc_value_t oldval, vlc_value_t newval, void * );
00058 static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd,
00059 vlc_value_t oldval, vlc_value_t newval, void * );
00060 static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
00061 vlc_value_t oldval, vlc_value_t newval, void * );
00062 static int ESCallback ( vlc_object_t *p_this, char const *psz_cmd,
00063 vlc_value_t oldval, vlc_value_t newval, void * );
00064 static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
00065 vlc_value_t oldval, vlc_value_t newval, void * );
00066
00067 static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd,
00068 vlc_value_t oldval, vlc_value_t newval, void * );
00069
00070
00071
00072
00073
00074 void input_ControlVarInit ( input_thread_t *p_input )
00075 {
00076 vlc_value_t val, text;
00077
00078
00079 var_Create( p_input, "state", VLC_VAR_INTEGER );
00080 val.i_int = p_input->i_state;
00081 var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
00082 var_AddCallback( p_input, "state", StateCallback, NULL );
00083
00084
00085 var_Create( p_input, "rate", VLC_VAR_INTEGER );
00086 val.i_int = p_input->i_rate;
00087 var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
00088 var_AddCallback( p_input, "rate", RateCallback, NULL );
00089
00090 var_Create( p_input, "rate-slower", VLC_VAR_VOID );
00091 var_AddCallback( p_input, "rate-slower", RateCallback, NULL );
00092
00093 var_Create( p_input, "rate-faster", VLC_VAR_VOID );
00094 var_AddCallback( p_input, "rate-faster", RateCallback, NULL );
00095
00096
00097 var_Create( p_input, "position", VLC_VAR_FLOAT );
00098 var_Create( p_input, "position-offset", VLC_VAR_FLOAT );
00099 val.f_float = 0.0;
00100 var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
00101 var_AddCallback( p_input, "position", PositionCallback, NULL );
00102 var_AddCallback( p_input, "position-offset", PositionCallback, NULL );
00103
00104
00105 var_Create( p_input, "time", VLC_VAR_TIME );
00106 var_Create( p_input, "time-offset", VLC_VAR_TIME );
00107 val.i_time = 0;
00108 var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
00109 var_AddCallback( p_input, "time", TimeCallback, NULL );
00110 var_AddCallback( p_input, "time-offset", TimeCallback, NULL );
00111
00112
00113 var_Create( p_input, "bookmark", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE |
00114 VLC_VAR_ISCOMMAND );
00115 val.psz_string = _("Bookmark");
00116 var_Change( p_input, "bookmark", VLC_VAR_SETTEXT, &val, NULL );
00117 var_AddCallback( p_input, "bookmark", BookmarkCallback, NULL );
00118
00119
00120 var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE |
00121 VLC_VAR_DOINHERIT );
00122 var_Get( p_input, "program", &val );
00123 if( val.i_int <= 0 )
00124 var_Change( p_input, "program", VLC_VAR_DELCHOICE, &val, NULL );
00125 text.psz_string = _("Program");
00126 var_Change( p_input, "program", VLC_VAR_SETTEXT, &text, NULL );
00127 var_AddCallback( p_input, "program", ProgramCallback, NULL );
00128
00129
00130 var_Create( p_input, "programs", VLC_VAR_LIST | VLC_VAR_DOINHERIT );
00131 text.psz_string = _("Programs");
00132 var_Change( p_input, "programs", VLC_VAR_SETTEXT, &text, NULL );
00133
00134
00135 var_Create( p_input, "title", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
00136 text.psz_string = _("Title");
00137 var_Change( p_input, "title", VLC_VAR_SETTEXT, &text, NULL );
00138 var_AddCallback( p_input, "title", TitleCallback, NULL );
00139
00140
00141 var_Create( p_input, "chapter", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
00142 text.psz_string = _("Chapter");
00143 var_Change( p_input, "chapter", VLC_VAR_SETTEXT, &text, NULL );
00144 var_AddCallback( p_input, "chapter", SeekpointCallback, NULL );
00145
00146
00147 var_Create( p_input, "navigation", VLC_VAR_VARIABLE | VLC_VAR_HASCHOICE );
00148 text.psz_string = _("Navigation");
00149 var_Change( p_input, "navigation", VLC_VAR_SETTEXT, &text, NULL );
00150
00151
00152 var_Create( p_input, "audio-delay", VLC_VAR_TIME );
00153 val.i_time = 0;
00154 var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL );
00155 var_AddCallback( p_input, "audio-delay", EsDelayCallback, NULL );
00156 var_Create( p_input, "spu-delay", VLC_VAR_TIME );
00157 val.i_time = 0;
00158 var_Change( p_input, "spu-delay", VLC_VAR_SETVALUE, &val, NULL );
00159 var_AddCallback( p_input, "spu-delay", EsDelayCallback, NULL );
00160
00161
00162 var_Create( p_input, "video-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
00163 text.psz_string = _("Video Track");
00164 var_Change( p_input, "video-es", VLC_VAR_SETTEXT, &text, NULL );
00165 var_AddCallback( p_input, "video-es", ESCallback, NULL );
00166
00167
00168 var_Create( p_input, "audio-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
00169 text.psz_string = _("Audio Track");
00170 var_Change( p_input, "audio-es", VLC_VAR_SETTEXT, &text, NULL );
00171 var_AddCallback( p_input, "audio-es", ESCallback, NULL );
00172
00173
00174 var_Create( p_input, "spu-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
00175 text.psz_string = _("Subtitles Track");
00176 var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
00177 var_AddCallback( p_input, "spu-es", ESCallback, NULL );
00178
00179
00180 var_Create( p_input, "bookmarks", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00181
00182 var_Create( p_input, "length", VLC_VAR_TIME );
00183 val.i_time = 0;
00184 var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
00185
00186
00187
00188
00189 var_Create( p_input, "intf-change", VLC_VAR_BOOL );
00190 var_SetBool( p_input, "intf-change", VLC_TRUE );
00191
00192
00193 var_Create( p_input, "item-change", VLC_VAR_INTEGER );
00194 }
00195
00196
00197
00198
00199 void input_ControlVarClean( input_thread_t *p_input )
00200 {
00201 var_Destroy( p_input, "state" );
00202 var_Destroy( p_input, "rate" );
00203 var_Destroy( p_input, "rate-slower" );
00204 var_Destroy( p_input, "rate-faster" );
00205 var_Destroy( p_input, "position" );
00206 var_Destroy( p_input, "position-offset" );
00207 var_Destroy( p_input, "time" );
00208 var_Destroy( p_input, "time-offset" );
00209
00210 var_Destroy( p_input, "audio-delay" );
00211 var_Destroy( p_input, "spu-delay" );
00212
00213 var_Destroy( p_input, "bookmark" );
00214
00215 var_Destroy( p_input, "program" );
00216 if( p_input->i_title > 1 )
00217 {
00218
00219
00220 var_Destroy( p_input, "next-title" );
00221 var_Destroy( p_input, "prev-title" );
00222 }
00223 if( p_input->i_title > 0 )
00224 {
00225
00226 var_Destroy( p_input, "next-chapter" );
00227 var_Destroy( p_input, "prev-chapter" );
00228 }
00229 var_Destroy( p_input, "title" );
00230 var_Destroy( p_input, "chapter" );
00231 var_Destroy( p_input, "navigation" );
00232
00233 var_Destroy( p_input, "video-es" );
00234 var_Destroy( p_input, "audio-es" );
00235 var_Destroy( p_input, "spu-es" );
00236
00237 var_Destroy( p_input, "bookmarks" );
00238 var_Destroy( p_input, "length" );
00239
00240 var_Destroy( p_input, "intf-change" );
00241 }
00242
00243
00244
00245
00246
00247 void input_ControlVarNavigation( input_thread_t *p_input )
00248 {
00249 vlc_value_t val, text;
00250 int i;
00251
00252
00253 if( p_input->i_title > 1 )
00254 {
00255 var_Create( p_input, "next-title", VLC_VAR_VOID );
00256 text.psz_string = _("Next title");
00257 var_Change( p_input, "next-title", VLC_VAR_SETTEXT, &text, NULL );
00258 var_AddCallback( p_input, "next-title", TitleCallback, NULL );
00259
00260 var_Create( p_input, "prev-title", VLC_VAR_VOID );
00261 text.psz_string = _("Previous title");
00262 var_Change( p_input, "prev-title", VLC_VAR_SETTEXT, &text, NULL );
00263 var_AddCallback( p_input, "prev-title", TitleCallback, NULL );
00264 }
00265
00266
00267 val.psz_string = malloc( sizeof("title ") + 5 );
00268 for( i = 0; i < p_input->i_title; i++ )
00269 {
00270 vlc_value_t val2, text, text2;
00271 int j;
00272
00273
00274 sprintf( val.psz_string, "title %2i", i );
00275 var_Destroy( p_input, val.psz_string );
00276 var_Create( p_input, val.psz_string,
00277 VLC_VAR_INTEGER|VLC_VAR_HASCHOICE|VLC_VAR_ISCOMMAND );
00278 var_AddCallback( p_input, val.psz_string,
00279 NavigationCallback, (void *)i );
00280
00281 if( p_input->title[i]->psz_name == NULL ||
00282 *p_input->title[i]->psz_name == '\0' )
00283 {
00284 asprintf( &text.psz_string, _("Title %i"),
00285 i + p_input->i_title_offset );
00286 }
00287 else
00288 {
00289 text.psz_string = strdup( p_input->title[i]->psz_name );
00290 }
00291 var_Change( p_input, "navigation", VLC_VAR_ADDCHOICE, &val, &text );
00292
00293
00294 val2.i_int = i;
00295 var_Change( p_input, "title", VLC_VAR_ADDCHOICE, &val2, &text );
00296
00297 free( text.psz_string );
00298
00299 for( j = 0; j < p_input->title[i]->i_seekpoint; j++ )
00300 {
00301 val2.i_int = j;
00302
00303 if( p_input->title[i]->seekpoint[j]->psz_name == NULL ||
00304 *p_input->title[i]->seekpoint[j]->psz_name == '\0' )
00305 {
00306
00307 asprintf( &text2.psz_string, _("Chapter %i"),
00308 j + p_input->i_seekpoint_offset );
00309 }
00310 else
00311 {
00312 text2.psz_string =
00313 strdup( p_input->title[i]->seekpoint[j]->psz_name );
00314 }
00315
00316 var_Change( p_input, val.psz_string, VLC_VAR_ADDCHOICE,
00317 &val2, &text2 );
00318 if( text2.psz_string ) free( text2.psz_string );
00319 }
00320
00321 }
00322 free( val.psz_string );
00323 }
00324
00325
00326
00327
00328
00329 void input_ControlVarTitle( input_thread_t *p_input, int i_title )
00330 {
00331 input_title_t *t = p_input->title[i_title];
00332 vlc_value_t val;
00333 int i;
00334
00335
00336 if( t->i_seekpoint <= 1 )
00337 {
00338 var_Destroy( p_input, "next-chapter" );
00339 var_Destroy( p_input, "prev-chapter" );
00340 }
00341 else if( var_Get( p_input, "next-chapter", &val ) != VLC_SUCCESS )
00342 {
00343 vlc_value_t text;
00344
00345 var_Create( p_input, "next-chapter", VLC_VAR_VOID );
00346 text.psz_string = _("Next chapter");
00347 var_Change( p_input, "next-chapter", VLC_VAR_SETTEXT, &text, NULL );
00348 var_AddCallback( p_input, "next-chapter", SeekpointCallback, NULL );
00349
00350 var_Create( p_input, "prev-chapter", VLC_VAR_VOID );
00351 text.psz_string = _("Previous chapter");
00352 var_Change( p_input, "prev-chapter", VLC_VAR_SETTEXT, &text, NULL );
00353 var_AddCallback( p_input, "prev-chapter", SeekpointCallback, NULL );
00354 }
00355
00356
00357 var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
00358 for( i = 0; i < t->i_seekpoint; i++ )
00359 {
00360 vlc_value_t text;
00361 val.i_int = i;
00362
00363 if( t->seekpoint[i]->psz_name == NULL ||
00364 *t->seekpoint[i]->psz_name == '\0' )
00365 {
00366
00367 asprintf( &text.psz_string, _("Chapter %i"),
00368 i + p_input->i_seekpoint_offset );
00369 }
00370 else
00371 {
00372 text.psz_string = strdup( t->seekpoint[i]->psz_name );
00373 }
00374
00375 var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, &text );
00376 if( text.psz_string ) free( text.psz_string );
00377 }
00378 }
00379
00380
00381
00382
00383
00384 void input_ConfigVarInit ( input_thread_t *p_input )
00385 {
00386 vlc_value_t val;
00387
00388
00389 var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00390 var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00391
00392 var_Create( p_input, "audio-track", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
00393 var_Create( p_input, "sub-track", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
00394
00395 var_Create( p_input, "audio-language", VLC_VAR_STRING|VLC_VAR_DOINHERIT );
00396 var_Create( p_input, "sub-language", VLC_VAR_STRING|VLC_VAR_DOINHERIT );
00397
00398 var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
00399 var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
00400 VLC_VAR_DOINHERIT );
00401 var_Create( p_input, "sub-autodetect-path", VLC_VAR_STRING |
00402 VLC_VAR_DOINHERIT );
00403 var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER |
00404 VLC_VAR_DOINHERIT );
00405
00406 var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00407 var_Create( p_input, "sout-all", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00408 var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00409 var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00410 var_Create( p_input, "sout-keep", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
00411
00412 var_Create( p_input, "input-repeat", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
00413
00414 var_Create( p_input, "start-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
00415 var_Create( p_input, "stop-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
00416
00417 var_Create( p_input, "minimize-threads", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
00418
00419 var_Create( p_input, "demuxed-id3", VLC_VAR_BOOL );
00420 val.b_bool = VLC_FALSE;
00421 var_Change( p_input, "demuxed-id3", VLC_VAR_SETVALUE, &val, NULL );
00422
00423 var_Create( p_input, "audio-desync", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
00424
00425 var_Create( p_input, "cr-average", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
00426 var_Create( p_input, "clock-synchro", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
00427
00428 var_Create( p_input, "seekable", VLC_VAR_BOOL );
00429 val.b_bool = VLC_TRUE;
00430 var_Change( p_input, "seekable", VLC_VAR_SETVALUE, &val, NULL );
00431
00432 var_Create( p_input, "input-slave", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00433
00434
00435 var_Create( p_input, "access-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00436 var_Create( p_input, "access", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00437 var_Create( p_input, "demux", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00438
00439
00440 var_Create( p_input, "meta-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00441 var_Create( p_input, "meta-author", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00442 var_Create( p_input, "meta-artist", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00443 var_Create( p_input, "meta-genre", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00444 var_Create( p_input, "meta-copyright", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
00445 var_Create( p_input, "meta-description", VLC_VAR_STRING|VLC_VAR_DOINHERIT);
00446 var_Create( p_input, "meta-date", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00447 var_Create( p_input, "meta-url", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
00448 }
00449
00450
00451
00452
00453 static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
00454 vlc_value_t oldval, vlc_value_t newval,
00455 void *p_data )
00456 {
00457 input_thread_t *p_input = (input_thread_t*)p_this;
00458
00459
00460 if( newval.i_int == PLAYING_S || newval.i_int == PAUSE_S )
00461 {
00462 input_ControlPush( p_input, INPUT_CONTROL_SET_STATE, &newval );
00463 return VLC_SUCCESS;
00464 }
00465
00466 return VLC_EGENERIC;
00467 }
00468
00469 static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
00470 vlc_value_t oldval, vlc_value_t newval, void *p_data )
00471 {
00472 input_thread_t *p_input = (input_thread_t*)p_this;
00473
00474
00475 if( !strcmp( psz_cmd, "rate-slower" ) )
00476 {
00477 input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_SLOWER, NULL );
00478 }
00479 else if( !strcmp( psz_cmd, "rate-faster" ) )
00480 {
00481 input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_FASTER, NULL );
00482 }
00483 else
00484 {
00485 input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &newval );
00486 }
00487
00488 return VLC_SUCCESS;
00489 }
00490
00491 static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
00492 vlc_value_t oldval, vlc_value_t newval,
00493 void *p_data )
00494 {
00495 input_thread_t *p_input = (input_thread_t*)p_this;
00496 vlc_value_t val, length;
00497
00498 if( !strcmp( psz_cmd, "position-offset" ) )
00499 {
00500 input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION_OFFSET, &newval );
00501
00502 val.f_float = var_GetFloat( p_input, "position" ) + newval.f_float;
00503 if( val.f_float < 0.0 ) val.f_float = 0.0;
00504 if( val.f_float > 1.0 ) val.f_float = 1.0;
00505 var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
00506 }
00507 else
00508 {
00509 val.f_float = newval.f_float;
00510 input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval );
00511 }
00512
00513
00514 var_Get( p_input, "length", &length );
00515 if( length.i_time > 0 && val.f_float >= 0.0 && val.f_float <= 1.0 )
00516 {
00517 val.i_time = length.i_time * val.f_float;
00518 var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
00519 }
00520
00521 return VLC_SUCCESS;
00522 }
00523
00524 static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
00525 vlc_value_t oldval, vlc_value_t newval, void *p_data )
00526 {
00527 input_thread_t *p_input = (input_thread_t*)p_this;
00528 vlc_value_t val, length;
00529
00530 if( !strcmp( psz_cmd, "time-offset" ) )
00531 {
00532 input_ControlPush( p_input, INPUT_CONTROL_SET_TIME_OFFSET, &newval );
00533 val.i_time = var_GetTime( p_input, "time" ) + newval.i_time;
00534 if( val.i_time < 0 ) val.i_time = 0;
00535
00536 var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
00537 }
00538 else
00539 {
00540 val.i_time = newval.i_time;
00541 input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval );
00542 }
00543
00544
00545 var_Get( p_input, "length", &length );
00546 if( length.i_time > 0 && val.i_time >= 0 && val.i_time <= length.i_time )
00547 {
00548 val.f_float = (double)val.i_time/(double)length.i_time;
00549 var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
00550 }
00551
00552 return VLC_SUCCESS;
00553 }
00554
00555 static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
00556 vlc_value_t oldval, vlc_value_t newval,
00557 void *p_data )
00558 {
00559 input_thread_t *p_input = (input_thread_t*)p_this;
00560
00561 input_ControlPush( p_input, INPUT_CONTROL_SET_PROGRAM, &newval );
00562
00563 return VLC_SUCCESS;
00564 }
00565
00566 static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
00567 vlc_value_t oldval, vlc_value_t newval,
00568 void *p_data )
00569 {
00570 input_thread_t *p_input = (input_thread_t*)p_this;
00571 vlc_value_t val, count;
00572
00573 if( !strcmp( psz_cmd, "next-title" ) )
00574 {
00575 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE_NEXT, NULL );
00576
00577 val.i_int = var_GetInteger( p_input, "title" ) + 1;
00578 var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &count, NULL );
00579 if( val.i_int < count.i_int )
00580 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
00581 }
00582 else if( !strcmp( psz_cmd, "prev-title" ) )
00583 {
00584 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE_PREV, NULL );
00585
00586 val.i_int = var_GetInteger( p_input, "title" ) - 1;
00587 if( val.i_int >= 0 )
00588 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
00589 }
00590 else
00591 {
00592 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &newval );
00593 }
00594
00595 return VLC_SUCCESS;
00596 }
00597
00598 static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd,
00599 vlc_value_t oldval, vlc_value_t newval,
00600 void *p_data )
00601 {
00602 input_thread_t *p_input = (input_thread_t*)p_this;
00603 vlc_value_t val, count;
00604
00605 if( !strcmp( psz_cmd, "next-chapter" ) )
00606 {
00607 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT_NEXT, NULL );
00608
00609 val.i_int = var_GetInteger( p_input, "chapter" ) + 1;
00610 var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &count, NULL );
00611 if( val.i_int < count.i_int )
00612 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
00613 }
00614 else if( !strcmp( psz_cmd, "prev-chapter" ) )
00615 {
00616 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT_PREV, NULL );
00617
00618 val.i_int = var_GetInteger( p_input, "chapter" ) - 1;
00619 if( val.i_int >= 0 )
00620 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
00621 }
00622 else
00623 {
00624 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval );
00625 }
00626
00627 return VLC_SUCCESS;
00628 }
00629
00630 static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
00631 vlc_value_t oldval, vlc_value_t newval,
00632 void *p_data )
00633 {
00634 input_thread_t *p_input = (input_thread_t*)p_this;
00635 vlc_value_t val;
00636
00637
00638 val.i_int = (int)p_data;
00639 input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &val );
00640
00641 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
00642
00643
00644 input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval );
00645
00646 var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &newval, NULL );
00647
00648 return VLC_SUCCESS;
00649 }
00650
00651 static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
00652 vlc_value_t oldval, vlc_value_t newval, void *p_data )
00653 {
00654 input_thread_t *p_input = (input_thread_t*)p_this;
00655
00656 if( newval.i_int < 0 )
00657 {
00658 vlc_value_t v;
00659
00660 if( !strcmp( psz_cmd, "audio-es" ) )
00661 v.i_int = -AUDIO_ES;
00662 else if( !strcmp( psz_cmd, "video-es" ) )
00663 v.i_int = -VIDEO_ES;
00664 else if( !strcmp( psz_cmd, "spu-es" ) )
00665 v.i_int = -SPU_ES;
00666 else
00667 v.i_int = 0;
00668 if( v.i_int != 0 )
00669 input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &v );
00670 }
00671 else
00672 {
00673 input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &newval );
00674 }
00675
00676 return VLC_SUCCESS;
00677 }
00678
00679 static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
00680 vlc_value_t oldval, vlc_value_t newval, void *p )
00681 {
00682 input_thread_t *p_input = (input_thread_t*)p_this;
00683
00684
00685 if( !strcmp( psz_cmd, "audio-delay" ) )
00686 {
00687
00688 if (newval.i_int < 0 || oldval.i_int < 0 )
00689 {
00690 p_input->i_pts_delay -= newval.i_int - oldval.i_int;
00691 }
00692 input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
00693 }
00694 else if( !strcmp( psz_cmd, "spu-delay" ) )
00695 input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval );
00696 return VLC_SUCCESS;
00697 }
00698
00699 static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd,
00700 vlc_value_t oldval, vlc_value_t newval,
00701 void *p_data )
00702 {
00703 input_thread_t *p_input = (input_thread_t*)p_this;
00704
00705 input_ControlPush( p_input, INPUT_CONTROL_SET_BOOKMARK, &newval );
00706
00707 return VLC_SUCCESS;
00708 }