[vlc-commits] es_out: prevent multi selection if the policy doesn't allow it

Thomas Guillem git at videolan.org
Fri Feb 28 20:46:34 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 20 16:50:06 2020 +0100| [aa49b0341a276c9ebd185092a8c53985ff8408fa] | committer: Thomas Guillem

es_out: prevent multi selection if the policy doesn't allow it

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

 src/input/es_out.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index afb3015c5a..d12e71df2f 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2566,15 +2566,19 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
 static void EsOutSelectList( es_out_t *out, enum es_format_category_e cat,
                              vlc_es_id_t * const*es_id_list )
 {
-
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
     es_out_id_t *other;
+    es_out_es_props_t *p_esprops = GetPropsByCat( p_sys, cat );
 
+    bool unselect_others = false;
     foreach_es_then_es_slaves(other)
     {
-        if( other->fmt.i_cat == cat )
+        if( other->fmt.i_cat != cat )
+            continue;
+
+        bool select = false;
+        if( !unselect_others )
         {
-            bool select = false;
             for( size_t i = 0; ; i++ )
             {
                 vlc_es_id_t *es_id = es_id_list[i];
@@ -2586,14 +2590,18 @@ static void EsOutSelectList( es_out_t *out, enum es_format_category_e cat,
                     break;
                 }
             }
-            if( !select && EsIsSelected( other ) )
-            {
+        }
+        if( !select )
+        {
+            if( EsIsSelected( other ) )
                 EsOutUnselectEs( out, other, other->p_pgrm == p_sys->p_pgrm );
-            }
-            else if( select && !EsIsSelected( other ) )
-            {
+        }
+        else
+        {
+            if( !EsIsSelected( other ) )
                 EsOutSelectEs( out, other );
-            }
+            if( p_esprops->e_policy == ES_OUT_ES_POLICY_EXCLUSIVE )
+                unselect_others = true;
         }
     }
 }



More information about the vlc-commits mailing list