]> git.sesse.net Git - vlc/commitdiff
* src/input/es_out.c: when removing an active track, re-run the track selection algo.
authorGildas Bazin <gbazin@videolan.org>
Mon, 22 Aug 2005 20:24:20 +0000 (20:24 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 22 Aug 2005 20:24:20 +0000 (20:24 +0000)
src/input/es_out.c

index a45be729f48b0f85df330ffb181f0d61039337f1..8faf35d125ce6462cd3e8258cb42185126d7bdca 100644 (file)
@@ -1058,6 +1058,8 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
 static void EsOutDel( es_out_t *out, es_out_id_t *es )
 {
     es_out_sys_t *p_sys = out->p_sys;
+    vlc_bool_t b_reselect = VLC_FALSE;
+    int i;
 
     /* We don't try to reselect */
     if( es->p_dec )
@@ -1074,6 +1076,9 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
         msg_Dbg( p_sys->p_input, "Program doesn't contain anymore ES" );
     }
 
+    if( p_sys->p_es_audio == es || p_sys->p_es_video == es ||
+        p_sys->p_es_sub == es ) b_reselect = VLC_TRUE;
+
     if( p_sys->p_es_audio == es ) p_sys->p_es_audio = NULL;
     if( p_sys->p_es_video == es ) p_sys->p_es_video = NULL;
     if( p_sys->p_es_sub   == es ) p_sys->p_es_sub   = NULL;
@@ -1091,6 +1096,14 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
             break;
     }
 
+    /* Re-select another track when needed */
+    if( b_reselect )
+        for( i = 0; i < p_sys->i_es; i++ )
+        {
+            if( es->fmt.i_cat == p_sys->es[i]->fmt.i_cat )
+                EsOutSelect( out, p_sys->es[i], VLC_FALSE );
+        }
+
     if( es->psz_language )
         free( es->psz_language );
     if( es->psz_language_code )