Changeset 46e872e431f01dcdd98c018553574fbee8a7ca8b
- Timestamp:
- 27/11/03 05:11:40 (5 years ago)
- git-parent:
- Files:
-
- include/ninput.h (modified) (4 diffs)
- modules/demux/avi/avi.c (modified) (3 diffs)
- modules/demux/mkv.cpp (modified) (2 diffs)
- modules/demux/ogg.c (modified) (2 diffs)
- modules/demux/rawdv.c (modified) (2 diffs)
- modules/demux/util/sub.c (modified) (2 diffs)
- src/input/es_out.c (modified) (14 diffs)
- src/input/input.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/ninput.h
r231d047 r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 1999-2001 VideoLAN 5 * $Id: ninput.h,v 1.1 8 2003/11/21 00:38:01 gbazinExp $5 * $Id: ninput.h,v 1.19 2003/11/27 04:11:40 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 27 27 #include "vlc_es.h" 28 28 29 enum es_out_mode_e 30 { 31 ES_OUT_MODE_NONE, /* don't select anything */ 32 ES_OUT_MODE_ALL, /* eg for stream output */ 33 ES_OUT_MODE_AUTO /* best audio/video or for input follow audio-channel, spu-channel */ 34 }; 35 29 36 enum es_out_query_e 30 37 { 31 ES_OUT_SET_SELECT, /* arg1= es_out_id_t* arg2=vlc_bool_t */ 32 ES_OUT_GET_SELECT /* arg1= es_out_id_t* arg2=vlc_bool_t* */ 38 /* activate apply of mode */ 39 ES_OUT_SET_ACTIVE, /* arg1= vlc_bool_t */ 40 /* see if mode is currently aplied or not */ 41 ES_OUT_GET_ACTIVE, /* arg1= vlc_bool_t* */ 42 43 /* set/get mode */ 44 ES_OUT_SET_MODE, /* arg1= int */ 45 ES_OUT_GET_MODE, /* arg2= int* */ 46 47 /* set es selected for the es category(audio/video/spu) */ 48 ES_OUT_SET_ES, /* arg1= es_out_id_t* */ 49 50 /* force selection/unselection of the ES (bypass current mode)*/ 51 ES_OUT_SET_ES_STATE,/* arg1= es_out_id_t* arg2=vlc_bool_t */ 52 ES_OUT_GET_ES_STATE,/* arg1= es_out_id_t* arg2=vlc_bool_t* */ 33 53 }; 34 54 … … 37 57 es_out_id_t *(*pf_add) ( es_out_t *, es_format_t * ); 38 58 int (*pf_send) ( es_out_t *, es_out_id_t *, block_t * ); 39 int (*pf_send_pes)( es_out_t *, es_out_id_t *, pes_packet_t * );40 59 void (*pf_del) ( es_out_t *, es_out_id_t * ); 41 60 int (*pf_control)( es_out_t *, int i_query, va_list ); … … 53 72 } 54 73 static inline int es_out_Send( es_out_t *out, es_out_id_t *id, 55 block_t *p_block )74 block_t *p_block ) 56 75 { 57 76 return out->pf_send( out, id, p_block ); 58 77 } 59 static inline int es_out_SendPES( es_out_t *out, es_out_id_t *id, 60 pes_packet_t *p_pes ) 61 { 62 return out->pf_send_pes( out, id, p_pes ); 63 } 78 64 79 static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args ) 65 80 { modules/demux/avi/avi.c
r380edba r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: avi.c,v 1.7 7 2003/11/26 08:18:09 gbazinExp $5 * $Id: avi.c,v 1.78 2003/11/27 04:11:40 fenrir Exp $ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 470 470 vlc_bool_t b; 471 471 472 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT, tk->p_es, &b );472 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); 473 473 if( b && !tk->b_activated ) 474 474 { … … 795 795 vlc_bool_t b; 796 796 797 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT, tk->p_es, &b );797 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); 798 798 799 799 if( b && tk->i_cat == VIDEO_ES ) modules/demux/mkv.cpp
r9c37455 r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: mkv.cpp,v 1.4 4 2003/11/23 13:15:27 gbazinExp $5 * $Id: mkv.cpp,v 1.45 2003/11/27 04:11:40 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 1402 1402 } 1403 1403 1404 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT, tk.p_es, &b );1404 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, tk.p_es, &b ); 1405 1405 if( !b ) 1406 1406 { modules/demux/ogg.c
r380edba r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001-2003 VideoLAN 5 * $Id: ogg.c,v 1.4 7 2003/11/26 08:18:09 gbazinExp $5 * $Id: ogg.c,v 1.48 2003/11/27 04:11:40 fenrir Exp $ 6 6 * 7 7 * Authors: Gildas Bazin <gbazin@netcourrier.com> … … 360 360 361 361 /* Check the ES is selected */ 362 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT,362 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, 363 363 p_stream->p_es, &b_selected ); 364 364 modules/demux/rawdv.c
r3106fa7 r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: rawdv.c,v 1.1 2 2003/11/24 19:19:02fenrir Exp $5 * $Id: rawdv.c,v 1.13 2003/11/27 04:11:40 fenrir Exp $ 6 6 * 7 7 * Authors: Gildas Bazin <gbazin@netcourrier.com> … … 298 298 } 299 299 300 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT,300 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, 301 301 p_sys->p_es_audio, &b_audio ); 302 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT,302 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, 303 303 p_sys->p_es_video, &b_video ); 304 304 modules/demux/util/sub.c
r231d047 r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 1999-2003 VideoLAN 5 * $Id: sub.c,v 1.3 8 2003/11/21 00:38:01 gbazinExp $5 * $Id: sub.c,v 1.39 2003/11/27 04:11:40 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 503 503 vlc_bool_t b; 504 504 505 es_out_Control( p_input->p_es_out, ES_OUT_GET_ SELECT, p_sub->p_es, &b );505 es_out_Control( p_input->p_es_out, ES_OUT_GET_ES_STATE, p_sub->p_es, &b ); 506 506 if( b && !p_sub->i_previously_selected ) 507 507 { src/input/es_out.c
r3adaad5 r46e872e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003 VideoLAN 5 * $Id: es_out.c,v 1. 1 2003/11/24 20:50:45fenrir Exp $5 * $Id: es_out.c,v 1.2 2003/11/27 04:11:40 fenrir Exp $ 6 6 * 7 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> … … 36 36 * Local prototypes 37 37 *****************************************************************************/ 38 struct es_out_sys_t39 {40 input_thread_t *p_input;41 42 int i_id;43 es_out_id_t **id;44 45 vlc_bool_t i_audio;46 vlc_bool_t i_video;47 };48 49 38 struct es_out_id_t 50 39 { 40 int i_channel; 51 41 es_descriptor_t *p_es; 52 42 }; 53 43 44 struct es_out_sys_t 45 { 46 input_thread_t *p_input; 47 48 /* all es */ 49 int i_id; 50 51 int i_es; 52 es_out_id_t **es; 53 54 /* mode gestion */ 55 vlc_bool_t b_active; 56 int i_mode; 57 58 /* es count */ 59 int i_audio; 60 int i_video; 61 int i_sub; 62 63 /* es to select */ 64 int i_audio_last; 65 int i_sub_last; 66 67 /* current main es */ 68 es_out_id_t *p_es_audio; 69 es_out_id_t *p_es_video; 70 es_out_id_t *p_es_sub; 71 }; 72 54 73 static es_out_id_t *EsOutAdd ( es_out_t *, es_format_t * ); 55 74 static int EsOutSend ( es_out_t *, es_out_id_t *, block_t * ); 56 static int EsOutSendPES( es_out_t *, es_out_id_t *, pes_packet_t * );57 75 static void EsOutDel ( es_out_t *, es_out_id_t * ); 58 76 static int EsOutControl( es_out_t *, int i_query, va_list ); … … 64 82 es_out_t *input_EsOutNew( input_thread_t *p_input ) 65 83 { 66 es_out_t *out = malloc( sizeof( es_out_t ) ); 84 es_out_t *out = malloc( sizeof( es_out_t ) ); 85 es_out_sys_t *p_sys = malloc( sizeof( es_out_sys_t ) ); 86 vlc_value_t val; 67 87 68 88 out->pf_add = EsOutAdd; 69 89 out->pf_send = EsOutSend; 70 out->pf_send_pes= EsOutSendPES;71 90 out->pf_del = EsOutDel; 72 91 out->pf_control = EsOutControl; 73 74 out->p_sys = malloc( sizeof( es_out_sys_t ) ); 75 out->p_sys->p_input = p_input; 76 out->p_sys->i_id = 0; 77 out->p_sys->id = NULL; 78 out->p_sys->i_audio = -1; 79 out->p_sys->i_video = -1; 92 out->p_sys = p_sys; 93 94 p_sys->p_input = p_input; 95 96 p_sys->b_active = VLC_FALSE; 97 p_sys->i_mode = ES_OUT_MODE_AUTO; 98 99 p_sys->i_id = 1; 100 101 p_sys->i_es = 0; 102 p_sys->es = NULL; 103 104 p_sys->i_audio = 0; 105 p_sys->i_video = 0; 106 p_sys->i_sub = 0; 107 108 var_Get( p_input, "audio-channel", &val ); 109 p_sys->i_audio_last = val.i_int; 110 111 var_Get( p_input, "spu-channel", &val ); 112 p_sys->i_sub_last = val.i_int; 113 114 p_sys->p_es_audio = NULL; 115 p_sys->p_es_video = NULL; 116 p_sys->p_es_sub = NULL; 117 80 118 return out; 81 119 } … … 89 127 int i; 90 128 91 for( i = 0; i < p_sys->i_ id; i++ )92 { 93 free( p_sys-> id[i] );94 } 95 if( p_sys-> id)96 { 97 free( p_sys-> id);129 for( i = 0; i < p_sys->i_es; i++ ) 130 { 131 free( p_sys->es[i] ); 132 } 133 if( p_sys->es ) 134 { 135 free( p_sys->es ); 98 136 } 99 137 free( p_sys ); … … 102 140 103 141 /***************************************************************************** 104 * EsOutAdd: 105 *****************************************************************************/ 106 static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt ) 142 * EsOutSelect: Select an ES given the current mode 143 * XXX: you need to take a the lock before (stream.stream_lock) 144 *****************************************************************************/ 145 static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force ) 107 146 { 108 147 es_out_sys_t *p_sys = out->p_sys; 109 148 input_thread_t *p_input = p_sys->p_input; 110 es_out_id_t *id = malloc( sizeof( es_out_id_t ) ); 149 150 int i_cat = es->p_es->i_cat; 151 152 if( !p_sys->b_active || ( !b_force && es->p_es->fmt.i_priority < 0 ) ) 153 { 154 return; 155 } 156 157 if( p_sys->i_mode == ES_OUT_MODE_ALL || b_force ) 158 { 159 input_SelectES( p_input, es->p_es ); 160 } 161 else if( p_sys->i_mode == ES_OUT_MODE_AUTO ) 162 { 163 int i_wanted = -1; 164 165 if( i_cat == AUDIO_ES ) 166 { 167 if( p_sys->p_es_audio && p_sys->p_es_audio->p_es->fmt.i_priority >= es->p_es->fmt.i_priority ) 168 { 169 return; 170 } 171 i_wanted = p_sys->i_audio_last >= 0 ? p_sys->i_audio_last : es->i_channel; 172 } 173 else if( i_cat == SPU_ES ) 174 { 175 if( p_sys->p_es_sub && p_sys->p_es_sub->p_es->fmt.i_priority >= es->p_es->fmt.i_priority ) 176 { 177 return; 178 } 179 i_wanted = p_sys->i_sub_last; 180 } 181 else if( i_cat == VIDEO_ES ) 182 { 183 i_wanted = es->i_channel; 184 } 185 186 if( i_wanted == es->i_channel ) 187 { 188 input_SelectES( p_input, es->p_es ); 189 } 190 } 191 192 /* FIXME TODO handle priority here */ 193 if( es->p_es->p_dec ) 194 { 195 if( i_cat == AUDIO_ES ) 196 { 197 if( p_sys->i_mode == ES_OUT_MODE_AUTO && 198 p_sys->p_es_audio && p_sys->p_es_audio->p_es->p_dec ) 199 { 200 input_UnselectES( p_input, p_sys->p_es_audio->p_es ); 201 } 202 p_sys->p_es_audio = es; 203 } 204 else if( i_cat == SPU_ES ) 205 { 206 if( p_sys->i_mode == ES_OUT_MODE_AUTO && 207 p_sys->p_es_sub && p_sys->p_es_sub->p_es->p_dec ) 208 { 209 input_UnselectES( p_input, p_sys->p_es_sub->p_es ); 210 } 211 p_sys->p_es_sub = es; 212 } 213 else if( i_cat == VIDEO_ES ) 214 { 215 p_sys->p_es_video = es; 216 } 217 } 218 } 219 220 /***************************************************************************** 221 * EsOutAdd: 222 *****************************************************************************/ 223 static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt ) 224 { 225 es_out_sys_t *p_sys = out->p_sys; 226 input_thread_t *p_input = p_sys->p_input; 227 es_out_id_t *es = malloc( sizeof( es_out_id_t ) ); 111 228 pgrm_descriptor_t *p_prgm = NULL; 112 229 char psz_cat[strlen( "Stream " ) + 10]; … … 132 249 } 133 250 134 id->p_es = input_AddES( p_input,251 es->p_es = input_AddES( p_input, 135 252 p_prgm, 136 1 +out->p_sys->i_id,253 out->p_sys->i_id, 137 254 fmt->i_cat, 138 255 fmt->psz_description, 0 ); 139 id->p_es->i_stream_id = 1 +out->p_sys->i_id;140 id->p_es->i_fourcc = fmt->i_codec;256 es->p_es->i_stream_id = out->p_sys->i_id; 257 es->p_es->i_fourcc = fmt->i_codec; 141 258 142 259 switch( fmt->i_cat ) … … 158 275 memcpy( &p_wf[1], fmt->p_extra, fmt->i_extra ); 159 276 } 160 id->p_es->p_waveformatex = p_wf; 277 es->p_es->p_waveformatex = p_wf; 278 279 es->i_channel = p_sys->i_audio; 161 280 break; 162 281 } … … 182 301 memcpy( &p_bih[1], fmt->p_extra, fmt->i_extra ); 183 302 } 184 id->p_es->p_bitmapinfoheader = p_bih; 303 es->p_es->p_bitmapinfoheader = p_bih; 304 305 es->i_channel = p_sys->i_video; 185 306 break; 186 307 } … … 191 312 if( fmt->i_extra > 0 ) 192 313 { 193 p_sub->psz_header = malloc( fmt->i_extra );314 p_sub->psz_header = malloc( fmt->i_extra + 1 ); 194 315 memcpy( p_sub->psz_header, fmt->p_extra , fmt->i_extra ); 316 /* just to be sure */ 317 ((uint8_t*)fmt->p_extra)[fmt->i_extra] = '\0'; 195 318 } 196 319 /* FIXME beuuuuuurk */ 197 id->p_es->p_demux_data = p_sub; 198 break; 199 } 320 es->p_es->p_demux_data = p_sub; 321 322 es->i_channel = p_sys->i_sub; 323 break; 324 } 325 200 326 default: 201 break; 202 } 203 204 if( fmt->i_cat == AUDIO_ES && fmt->i_priority > out->p_sys->i_audio ) 205 { 206 if( out->p_sys->i_audio >= 0 ) 207 { 208 msg_Err( p_input, "FIXME unselect es in es_out_Add" ); 209 } 210 input_SelectES( p_input, id->p_es ); 211 if( id->p_es->p_dec ) 212 { 213 out->p_sys->i_audio = fmt->i_priority; 214 } 215 } 216 else if( fmt->i_cat == VIDEO_ES && fmt->i_priority > out->p_sys->i_video ) 217 { 218 if( out->p_sys->i_video >= 0 ) 219 { 220 msg_Err( p_input, "FIXME unselect es in es_out_Add" ); 221 } 222 input_SelectES( p_input, id->p_es ); 223 if( id->p_es->p_dec ) 224 { 225 out->p_sys->i_video = fmt->i_priority; 226 } 227 } 228 229 sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id ); 327 es->i_channel = 0; 328 break; 329 } 330 331 sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id - 1 ); 230 332 if( ( p_cat = input_InfoCategory( p_input, psz_cat ) ) ) 231 333 { … … 285 387 } 286 388 } 389 390 391 /* Apply mode 392 * XXX change that when we do group too */ 393 if( 1 ) 394 { 395 EsOutSelect( out, es, VLC_FALSE ); 396 } 397 287 398 vlc_mutex_unlock( &p_input->stream.stream_lock ); 288 399 289 id->p_es->fmt = *fmt; 290 291 TAB_APPEND( out->p_sys->i_id, out->p_sys->id, id ); 292 return id; 400 es->p_es->fmt = *fmt; 401 402 TAB_APPEND( out->p_sys->i_es, out->p_sys->es, es ); 403 p_sys->i_id++; /* always incremented */ 404 switch( fmt->i_cat ) 405 { 406 case AUDIO_ES: 407 p_sys->i_audio++; 408 break; 409 case SPU_ES: 410 p_sys->i_sub++; 411 break; 412 case VIDEO_ES: 413 p_sys->i_video++; 414 break; 415 } 416 417 return es; 293 418 } 294 419 … … 296 421 * EsOutSend: 297 422 *****************************************************************************/ 298 static int EsOutSend( es_out_t *out, es_out_id_t *id, block_t *p_block ) 299 { 300 if( id->p_es->p_dec ) 301 { 302 input_DecodeBlock( id->p_es->p_dec, p_block ); 423 static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block ) 424 { 425 vlc_mutex_lock( &out->p_sys->p_input->stream.stream_lock ); 426 if( es->p_es->p_dec ) 427 { 428 input_DecodeBlock( es->p_es->p_dec, p_block ); 303 429 } 304 430 else … … 306 432 block_Release( p_block ); 307 433 } 434 vlc_mutex_unlock( &out->p_sys->p_input->stream.stream_lock ); 308 435 return VLC_SUCCESS; 309 436 } 310 437 311 438 /***************************************************************************** 312 * EsOutSendPES:313 *****************************************************************************/314 static int EsOutSendPES( es_out_t *out, es_out_id_t *id, pes_packet_t *p_pes )315 {316 if( id->p_es->p_dec )317 {318 input_DecodePES( id->p_es->p_dec, p_pes );319 }320 else321 {322 input_DeletePES( out->p_sys->p_input->p_method_data, p_pes );323 }324 return VLC_SUCCESS;325 }326 327 /*****************************************************************************328 439 * EsOutDel: 329 440 *****************************************************************************/ 330 static void EsOutDel( es_out_t *out, es_out_id_t * id)441 static void EsOutDel( es_out_t *out, es_out_id_t *es ) 331 442 { 332 443 es_out_sys_t *p_sys = out->p_sys; 333 444 334 TAB_REMOVE( p_sys->i_id, p_sys->id, id ); 335 445 TAB_REMOVE( p_sys->i_es, p_sys->es, es ); 446 447 switch( es->p_es->i_cat ) 448 { 449 case AUDIO_ES: 450 p_sys->i_audio--; 451 break; 452 case SPU_ES: 453 p_sys->i_sub--; 454 break; 455 case VIDEO_ES: 456 p_sys->i_video--; 457 break; 458 } 459 460 /* We don't try to reselect */ 336 461 vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 337 if( id->p_es->p_dec ) 338 { 339 input_UnselectES( p_sys->p_input, id->p_es ); 340 } 341 if( id->p_es->p_waveformatex ) 342 { 343 free( id->p_es->p_waveformatex ); 344 id->p_es->p_waveformatex = NULL; 345 } 346 if( id->p_es->p_bitmapinfoheader ) 347 { 348 free( id->p_es->p_bitmapinfoheader ); 349 id->p_es->p_bitmapinfoheader = NULL; 350 } 351 input_DelES( p_sys->p_input, id->p_es ); 462 if( es->p_es->p_dec ) 463 { 464 input_UnselectES( p_sys->p_input, es->p_es ); 465 } 466 467 if( es->p_es->p_waveformatex ) 468 { 469 free( es->p_es->p_waveformatex ); 470 es->p_es->p_waveformatex = NULL; 471 } 472 if( es->p_es->p_bitmapinfoheader ) 473 { 474 free( es->p_es->p_bitmapinfoheader ); 475 es->p_es->p_bitmapinfoheader = NULL; 476 } 477 input_DelES( p_sys->p_input, es->p_es ); 478 352 479 vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 353 480 354 free( id);481 free( es ); 355 482 } 356 483 … … 362 489 es_out_sys_t *p_sys = out->p_sys; 363 490 vlc_bool_t b, *pb; 364 es_out_id_t *id; 491 int i, *pi; 492 493 es_out_id_t *es; 494 365 495 switch( i_query ) 366 496 { 367 case ES_OUT_SET_ SELECT:497 case ES_OUT_SET_ES_STATE: 368 498 vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 369 id= (es_out_id_t*) va_arg( args, es_out_id_t * );499 es = (es_out_id_t*) va_arg( args, es_out_id_t * ); 370 500 b = (vlc_bool_t) va_arg( args, vlc_bool_t ); 371 if( b && id->p_es->p_dec == NULL )372 { 373 input_SelectES( p_sys->p_input, id->p_es );501 if( b && es->p_es->p_dec == NULL ) 502 { 503 input_SelectES( p_sys->p_input, es->p_es ); 374 504 vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 375 return id->p_es->p_dec ? VLC_SUCCESS : VLC_EGENERIC;376 } 377 else if( !b && id->p_es->p_dec )378 { 379 input_UnselectES( p_sys->p_input, id->p_es );505 return es->p_es->p_dec ? VLC_SUCCESS : VLC_EGENERIC; 506 } 507 else if( !b && es->p_es->p_dec ) 508 { 509 input_UnselectES( p_sys->p_input, es->p_es ); 380 510 vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 381 511 return VLC_SUCCESS; 382 512 } 383 case ES_OUT_GET_ SELECT:384 id= (es_out_id_t*) va_arg( args, es_out_id_t * );513 case ES_OUT_GET_ES_STATE: 514 es = (es_out_id_t*) va_arg( args, es_out_id_t * ); 385 515 pb = (vlc_bool_t*) va_arg( args, vlc_bool_t * ); 386 516 387 *pb = id->p_es->p_dec ? VLC_TRUE : VLC_FALSE; 517 *pb = es->p_es->p_dec ? VLC_TRUE : VLC_FALSE; 518 return VLC_SUCCESS; 519 520 case ES_OUT_SET_ACTIVE: 521 b = (vlc_bool_t) va_arg( args, vlc_bool_t ); 522 p_sys->b_active = b; 523 return VLC_SUCCESS; 524 525 case ES_OUT_GET_ACTIVE: 526 pb = (vlc_bool_t*) va_arg( args, vlc_bool_t * ); 527 *pb = p_sys->b_active; 528 return VLC_SUCCESS; 529 530 case ES_OUT_SET_MODE: 531 i = (int) va_arg( args, int ); 532 if( i == ES_OUT_MODE_NONE || i == ES_OUT_MODE_ALL || i == ES_OUT_MODE_AUTO ) 533 { 534 p_sys->i_mode = i; 535 536 /* Reapply policy mode */ 537 vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 538 for( i = 0; i < p_sys->i_es; i++ ) 539 { 540 if( p_sys->es[i]->p_es->p_dec ) 541 { 542 input_UnselectES( p_sys->p_input, p_sys->es[i]->p_es ); 543 } 544 } 545 for( i = 0; i < p_sys->i_es; i++ ) 546 { 547 EsOutSelect( out, p_sys->es[i], VLC_FALSE ); 548 } 549 vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 550 return VLC_SUCCESS; 551 } 552 return VLC_EGENERIC; 553 554 case ES_OUT_GET_MODE: 555 pi = (int*) va_arg( args, int* ); 556 *pi = p_sys->i_mode; 557 return VLC_SUCCESS; 558 559 case ES_OUT_SET_ES: 560 es = (es_out_id_t*) va_arg( args, es_out_id_t * ); 561 if( es == NULL ) 562 { 563 for( i = 0; i < p_sys->i_es; i++ ) 564 { 565 vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 566 if( p_sys->es[i]->p_es->p_dec ) 567 { 568 input_UnselectES( p_sys->p_input, p_sys->es[i]->p_es ); 569 } 570 vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 571 } 572 } 573 else 574 { 575 vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 576 EsOutSelect( out, es, VLC_TRUE ); 577 vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 578 } 388 579 return VLC_SUCCESS; 389 580 … … 394 585 } 395 586 587 588 589 src/input/input.c
rf78aa8e r46e872e 5 5 ***************************************************************************** 6 6 * Copyright (C) 1998-2002 VideoLAN 7 * $Id: input.c,v 1.26 4 2003/11/26 18:48:24 gbazinExp $7 * $Id: input.c,v 1.265 2003/11/27 04:11:40 fenrir Exp $ 8 8 * 9 9 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 623 623 624 624 p_input->p_es_out = input_EsOutNew( p_input ); 625 es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_FALSE ); 626 es_out_Control( p_input->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE ); 625 627 626 628 /* Find and open appropriate access module */ … … 745 747 { 746 748 /* Select this ES by default */ 747 es_out_Control( p_input->p_es_out, ES_OUT_SET_ SELECT, p_sub->p_es, VLC_TRUE );749 es_out_Control( p_input->p_es_out, ES_OUT_SET_ES_STATE, p_sub->p_es, VLC_TRUE ); 748 750 749 751 TAB_APPEND( p_input->p_sys->i_sub, p_input->p_sys->sub, p_sub ); … … 767 769 free(tmp); 768 770 } 771 772 es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_TRUE ); 773 es_out_Control( p_input->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_AUTO ); 769 774 770 775 return VLC_SUCCESS;
