[vlc-commits] es_out: remove a legacy variable usage

Thomas Guillem git at videolan.org
Wed Jul 18 18:07:07 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 18 17:29:19 2018 +0200| [bcbed03e56092496f27f49ba66336b476722109e] | committer: Thomas Guillem

es_out: remove a legacy variable usage

Add the EsOutGetSelectedCat() helper to replace var_GetInteger( p_input,
"*-es").

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bcbed03e56092496f27f49ba66336b476722109e
---

 src/input/es_out.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1a894f3936..30e226de66 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -430,6 +430,18 @@ static es_out_id_t *EsOutGetFromID( es_out_t *out, int i_id )
     return NULL;
 }
 
+static es_out_id_t *EsOutGetSelectedCat( es_out_t *out,
+                                         enum es_format_category_e cat )
+{
+    es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
+    es_out_id_t *es;
+
+    foreach_es_then_es_slaves( es )
+        if( es->fmt.i_cat == cat && EsIsSelected( es ) )
+            return es;
+    return NULL;
+}
+
 static bool EsOutDecodersIsEmpty( es_out_t *out )
 {
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
@@ -1795,7 +1807,8 @@ static void EsDeleteCCChannels( es_out_t *out, es_out_id_t *parent )
     if( parent->cc.type == 0 )
         return;
 
-    const int i_spu_id = var_GetInteger( p_input, "spu-es");
+    es_out_id_t *spu_es = EsOutGetSelectedCat( out, SPU_ES );
+    const int i_spu_id = spu_es ? spu_es->i_id : -1;
 
     uint64_t i_bitmap = parent->cc.i_bitmap;
     for( int i = 0; i_bitmap > 0; i++, i_bitmap >>= 1 )



More information about the vlc-commits mailing list