/*****************************************************************************
*
*****************************************************************************/
-static void EsOutESVarUpdate( es_out_t *out, es_out_id_t *es )
+static void EsOutESVarUpdate( es_out_t *out, es_out_id_t *es,
+ vlc_bool_t b_delete )
{
es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input;
else
return;
+ if( b_delete )
+ {
+ val.i_int = es->i_id;
+ var_Change( p_input, psz_var, VLC_VAR_DELCHOICE, &val, NULL );
+ var_SetBool( p_sys->p_input, "intf-change", VLC_TRUE );
+ return;
+ }
+
/* Get the number of ES already added */
var_Change( p_input, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 )
var_Change( p_input, "spu-es", VLC_VAR_CLEARCHOICES, NULL, NULL );
for( i = 0; i < p_sys->i_es; i++ )
{
- EsOutESVarUpdate( out, p_sys->es[i] );
+ EsOutESVarUpdate( out, p_sys->es[i], VLC_FALSE );
EsOutSelect( out, p_sys->es[i], VLC_FALSE );
}
es->p_dec = NULL;
if( es->p_pgrm == p_sys->p_pgrm )
- EsOutESVarUpdate( out, es );
+ EsOutESVarUpdate( out, es, VLC_FALSE );
#if 0
/* Add stream info */
if( es->fmt.i_cat == VIDEO_ES || es->fmt.i_cat == SPU_ES )
{
- if( !var_GetBool( p_input, "video" ) || ( p_input->p_sout && !var_GetBool( p_input, "sout-video" ) ) )
+ if( !var_GetBool( p_input, "video" ) ||
+ ( p_input->p_sout && !var_GetBool( p_input, "sout-video" ) ) )
{
- msg_Dbg( p_input, "video is disabled, not selecting ES 0x%x", es->i_id );
+ msg_Dbg( p_input, "video is disabled, not selecting ES 0x%x",
+ es->i_id );
return;
}
}
else if( es->fmt.i_cat == AUDIO_ES )
{
var_Get( p_input, "audio", &val );
- if( !var_GetBool( p_input, "audio" ) || ( p_input->p_sout && !var_GetBool( p_input, "sout-audio" ) ) )
+ if( !var_GetBool( p_input, "audio" ) ||
+ ( p_input->p_sout && !var_GetBool( p_input, "sout-audio" ) ) )
{
- msg_Dbg( p_input, "audio is disabled, not selecting ES 0x%x", es->i_id );
+ msg_Dbg( p_input, "audio is disabled, not selecting ES 0x%x",
+ es->i_id );
return;
}
}
if( es->p_dec )
EsUnselect( out, es, es->p_pgrm == p_sys->p_pgrm );
+ if( es->p_pgrm == p_sys->p_pgrm )
+ EsOutESVarUpdate( out, es, VLC_TRUE );
+
TAB_REMOVE( p_sys->i_es, p_sys->es, es );
es->p_pgrm->i_es--;
if( es->p_pgrm->i_es == 0 )
{
- msg_Err( p_sys->p_input, "Program doesn't have es anymore, clenaing TODO ?" );
+ msg_Err( p_sys->p_input, "Program doesn't contain anymore ES, "
+ "TODO cleaning ?" );
}
if( p_sys->p_es_audio == es ) p_sys->p_es_audio = NULL;
{
if( p_sys->es[i]->p_dec )
{
- EsUnselect( out, p_sys->es[i], p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
+ EsUnselect( out, p_sys->es[i],
+ p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
}
}
for( i = 0; i < p_sys->i_es; i++ )
{
for( i = 0; i < p_sys->i_es; i++ )
{
- if( p_sys->es[i]->p_dec && p_sys->es[i]->fmt.i_cat == AUDIO_ES )
- EsUnselect( out, p_sys->es[i], p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
+ if( p_sys->es[i]->p_dec &&
+ p_sys->es[i]->fmt.i_cat == AUDIO_ES )
+ EsUnselect( out, p_sys->es[i],
+ p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
}
}
else if( es == (es_out_id_t*)((uint8_t*)NULL+VIDEO_ES) )
{
for( i = 0; i < p_sys->i_es; i++ )
{
- if( p_sys->es[i]->p_dec && p_sys->es[i]->fmt.i_cat == VIDEO_ES )
- EsUnselect( out, p_sys->es[i], p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
+ if( p_sys->es[i]->p_dec &&
+ p_sys->es[i]->fmt.i_cat == VIDEO_ES )
+ EsUnselect( out, p_sys->es[i],
+ p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
}
}
else if( es == (es_out_id_t*)((uint8_t*)NULL+SPU_ES) )
{
for( i = 0; i < p_sys->i_es; i++ )
{
- if( p_sys->es[i]->p_dec && p_sys->es[i]->fmt.i_cat == SPU_ES )
- EsUnselect( out, p_sys->es[i], p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
+ if( p_sys->es[i]->p_dec &&
+ p_sys->es[i]->fmt.i_cat == SPU_ES )
+ EsUnselect( out, p_sys->es[i],
+ p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
}
}
else
i_pcr = (int64_t)va_arg( args, int64_t );
/* search program */
- /* 11 is a vodoo trick to avoid non_pcr*9/100 to be null */
- input_ClockSetPCR( p_sys->p_input, &p_pgrm->clock, (i_pcr + 11 ) * 9 / 100);
+ /* 11 is a vodoo trick to avoid non_pcr*9/100 to be null */
+ input_ClockSetPCR( p_sys->p_input, &p_pgrm->clock,
+ (i_pcr + 11 ) * 9 / 100);
return VLC_SUCCESS;
}
#define STREAM_CACHE_SIZE (4*STREAM_CACHE_TRACK*1024*1024)
/* How many data we try to prebuffer */
#define STREAM_CACHE_PREBUFFER_SIZE (32767)
-
-#define STREAM_CACHE_PREBUFFER_LENGTH (100*1000) /* Maximum time we take to pre-buffer */
+/* Maximum time we take to pre-buffer */
+#define STREAM_CACHE_PREBUFFER_LENGTH (100*1000)
/* Method1: Simple, for pf_block.
* We get blocks and put them in the linked list.
* We release blocks once the total size is bigger than CACHE_BLOCK_SIZE
*/
-#define STREAM_DATA_WAIT 40000 /* Time between before a pf_block retry */
+#define STREAM_DATA_WAIT 40000 /* Time between before a pf_block retry */
/* Method2: A bit more complex, for pf_read
* - We use ring buffers, only one if unseekable, all if seekable
/* Method 2: for pf_read */
struct
{
- int i_offset; /* Buffer ofset in the current track */
+ int i_offset; /* Buffer offset in the current track */
int i_tk; /* Current track */
stream_track_t tk[STREAM_CACHE_TRACK];
p_sys->stream.i_tk = 0;
p_sys->stream.p_buffer = malloc( STREAM_CACHE_SIZE );
p_sys->stream.i_used = 0;
- access2_Control( p_access, ACCESS_GET_MTU, &p_sys->stream.i_read_size );
+ access2_Control( p_access, ACCESS_GET_MTU,
+ &p_sys->stream.i_read_size );
if( p_sys->stream.i_read_size <= 0 )
p_sys->stream.i_read_size = STREAM_READ_ATONCE;
else if( p_sys->stream.i_read_size <= 256 )
while( i_data < i_read )
{
- int i_current = p_sys->block.p_current->i_buffer - p_sys->block.i_offset;
+ int i_current =
+ p_sys->block.p_current->i_buffer - p_sys->block.i_offset;
int i_copy = __MIN( i_current, i_read - i_data);
/* Copy data */
if( p_data )
{
- memcpy( p_data, &p_sys->block.p_current->p_buffer[p_sys->block.i_offset], i_copy );
+ memcpy( p_data,
+ &p_sys->block.p_current->p_buffer[p_sys->block.i_offset],
+ i_copy );
p_data += i_copy;
}
i_data += i_copy;
}
/* Fill enough data */
- while( p_sys->block.i_size - (p_sys->i_pos - p_sys->block.i_start) < i_read )
+ while( p_sys->block.i_size - (p_sys->i_pos - p_sys->block.i_start)
+ < i_read )
{
block_t **pp_last = p_sys->block.pp_last;
uint8_t *p_data = (uint8_t *)p_read;
int i_data = 0;
- if( tk->i_start >= tk->i_end )
- return 0; /* EOF */
+ if( tk->i_start >= tk->i_end ) return 0; /* EOF */
#if 0
msg_Dbg( s, "AStreamReadStream: %d pos="I64Fd" tk=%d start="I64Fd
stream_track_t *tk = &p_sys->stream.tk[p_sys->stream.i_tk];
/* We read but won't increase i_start after initial start + offset */
- int i_toread = __MIN( p_sys->stream.i_used, STREAM_CACHE_TRACK_SIZE -
- (tk->i_end - tk->i_start - p_sys->stream.i_offset) );
+ int i_toread =
+ __MIN( p_sys->stream.i_used, STREAM_CACHE_TRACK_SIZE -
+ (tk->i_end - tk->i_start - p_sys->stream.i_offset) );
int64_t i_start, i_stop;
if( i_toread <= 0 ) return VLC_EGENERIC; /* EOF */
p_sys->stream.i_offset -= i_invalid;
}
-
i_toread -= i_read;
p_sys->stream.i_used -= i_read;
int64_t i_date = mdate();
int i_read;
- if( s->b_die ||
- tk->i_end >= STREAM_CACHE_PREBUFFER_SIZE ||
- ( i_first > 0 && i_first + STREAM_CACHE_PREBUFFER_LENGTH < i_date ) )
+ if( s->b_die || tk->i_end >= STREAM_CACHE_PREBUFFER_SIZE ||
+ (i_first > 0 && i_first + STREAM_CACHE_PREBUFFER_LENGTH < i_date) )
{
int64_t i_byterate;
return p_line;
}
}
-
/* Add Navigation entries */
sprintf( val.psz_string, "title %2i", i );
var_Destroy( p_input, val.psz_string );
- var_Create( p_input, val.psz_string, VLC_VAR_INTEGER|VLC_VAR_HASCHOICE|VLC_VAR_ISCOMMAND );
+ var_Create( p_input, val.psz_string,
+ VLC_VAR_INTEGER|VLC_VAR_HASCHOICE|VLC_VAR_ISCOMMAND );
var_AddCallback( p_input, val.psz_string, NavigationCallback, (void *)i );
if( p_input->title[i]->psz_name == NULL ||
/*****************************************************************************
* All Callbacks:
*****************************************************************************/
-static int StateCallback ( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
return VLC_EGENERIC;
}
-static int RateCallback ( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val;
}
static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, length;
}
-static int TimeCallback ( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, length;
return VLC_SUCCESS;
}
-static int ProgramCallback ( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
return VLC_SUCCESS;
}
-static int TitleCallback ( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, count;
}
static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val, count;
}
static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
vlc_value_t val;
return VLC_SUCCESS;
}
-static int ESCallback ( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
}
static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
{
input_thread_t *p_input = (input_thread_t*)p_this;
return VLC_SUCCESS;
}
-