Commit 27c49515 authored by Laurent Aimar's avatar Laurent Aimar

* all: better handling of multiple (video) tracks.

    - now vout are checked for release every 300ms
    - when *-es are triggered, all same es are unselect not only the
    last selected. (more intuitive) The only problems are that it's not
    possible to select again all ES, and the checkbox can show only one
    selected ES.
parent 80d6bfb2
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.124 2003/11/25 00:56:35 fenrir Exp $
* $Id: input_programs.c,v 1.125 2003/11/29 11:12:46 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -1136,13 +1136,25 @@ static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
input_thread_t *p_input = (input_thread_t *)p_this;
unsigned int i;
vlc_value_t val;
unsigned int i_cat = UNKNOWN_ES;
es_descriptor_t *p_es = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Unselect old ES */
/* First search old es type */
for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
{
if( p_input->stream.pp_es[i]->i_id == oldval.i_int &&
if( p_input->stream.pp_es[i]->i_id == oldval.i_int )
{
i_cat = p_input->stream.pp_es[i]->i_cat;
}
}
/* Unselect all old ES */
for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
{
if( p_input->stream.pp_es[i]->i_cat == i_cat &&
p_input->stream.pp_es[i]->i_id != newval.i_int &&
p_input->stream.pp_es[i]->p_dec != NULL )
{
input_UnselectES( p_input, p_input->stream.pp_es[i] );
......@@ -1152,10 +1164,31 @@ static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
/* Select new ES */
for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
{
if( p_input->stream.pp_es[i]->i_id == newval.i_int &&
p_input->stream.pp_es[i]->p_dec == NULL )
if( p_input->stream.pp_es[i]->i_id == newval.i_int )
{
input_SelectES( p_input, p_input->stream.pp_es[i] );
p_es = p_input->stream.pp_es[i];
if( p_es->p_dec == NULL )
{
input_SelectES( p_input, p_es );
}
}
}
if( p_es )
{
/* Fix value (mainly for multiple selected ES */
val.i_int = p_es->i_id;
switch( p_es->i_cat )
{
case AUDIO_ES:
var_Change( p_input, "audio-es", VLC_VAR_SETVALUE, &val, NULL );
break;
case SPU_ES:
var_Change( p_input, "spu-es", VLC_VAR_SETVALUE, &val, NULL );
break;
case VIDEO_ES:
var_Change( p_input, "video-es", VLC_VAR_SETVALUE, &val, NULL );
break;
}
}
......
......@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.65 2003/11/25 00:56:35 fenrir Exp $
* $Id: playlist.c,v 1.66 2003/11/29 11:12:46 fenrir Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -238,11 +238,10 @@ void playlist_Destroy( playlist_t * p_playlist )
static void ObjectGarbageCollector( playlist_t *p_playlist,
int i_type,
vlc_bool_t *pb_obj_destroyed,
mtime_t *pi_obj_destroyed_date )
{
vlc_object_t *p_obj;
if( *pb_obj_destroyed || *pi_obj_destroyed_date > mdate() )
if( *pi_obj_destroyed_date > mdate() )
{
return;
}
......@@ -277,7 +276,7 @@ static void ObjectGarbageCollector( playlist_t *p_playlist,
sout_DeleteInstance( (sout_instance_t*)p_obj );
}
}
*pb_obj_destroyed = VLC_TRUE;
*pi_obj_destroyed_date = 0;
}
}
......@@ -289,10 +288,7 @@ static void RunThread ( playlist_t *p_playlist )
vlc_object_t *p_obj;
vlc_value_t val;
vlc_bool_t b_vout_destroyed = VLC_FALSE; /*we do vout garbage collector */
mtime_t i_vout_destroyed_date = 0;
vlc_bool_t b_sout_destroyed = VLC_FALSE; /*we do vout garbage collector */
mtime_t i_sout_destroyed_date = 0;
/* Tell above that we're ready */
......@@ -327,9 +323,7 @@ static void RunThread ( playlist_t *p_playlist )
/* Destroy object */
vlc_object_destroy( p_input );
b_vout_destroyed = VLC_FALSE;
i_vout_destroyed_date = 0;
b_sout_destroyed = VLC_FALSE;
i_sout_destroyed_date = 0;
continue;
}
......@@ -364,10 +358,8 @@ static void RunThread ( playlist_t *p_playlist )
{
vlc_mutex_unlock( &p_playlist->object_lock );
ObjectGarbageCollector( p_playlist, VLC_OBJECT_VOUT,
&b_vout_destroyed,
&i_vout_destroyed_date );
ObjectGarbageCollector( p_playlist, VLC_OBJECT_SOUT,
&b_sout_destroyed,
&i_sout_destroyed_date );
vlc_mutex_lock( &p_playlist->object_lock );
}
......@@ -381,9 +373,9 @@ static void RunThread ( playlist_t *p_playlist )
{
vlc_mutex_unlock( &p_playlist->object_lock );
ObjectGarbageCollector( p_playlist, VLC_OBJECT_SOUT,
&b_sout_destroyed, &i_sout_destroyed_date );
&i_sout_destroyed_date );
ObjectGarbageCollector( p_playlist, VLC_OBJECT_VOUT,
&b_vout_destroyed, &i_vout_destroyed_date );
&i_vout_destroyed_date );
vlc_mutex_lock( &p_playlist->object_lock );
}
vlc_mutex_unlock( &p_playlist->object_lock );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment