[vlc-devel] [PATCH 1/8] input: simplify es_out_display deletion

Thomas Guillem thomas at gllm.fr
Thu Feb 27 14:55:40 CET 2020


The es_out_display will be destroyed directly from End() (asynchronously from
the thread then). It still need to be created from Create() to allow future
pre-configuration of the es_out (before being started).

It allows to remove the ES_OUT_MODE_END mode and simplify the deletion of the
main es_out: es_out_SetMode() wall called on both es_out (display + timeshift)
to terminate them, but with different modes.
---
 src/input/es_out.c |  7 +++----
 src/input/es_out.h |  1 -
 src/input/input.c  | 16 ++++++++++++----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 6955192dc0a..afcd56d8f84 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -591,6 +591,8 @@ static void EsOutDelete( es_out_t *out )
 {
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
 
+    EsOutTerminate( out );
+
     assert(vlc_list_is_empty(&p_sys->es));
     assert(vlc_list_is_empty(&p_sys->es_slaves));
     assert(vlc_list_is_empty(&p_sys->programs));
@@ -2795,8 +2797,7 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
     {
         const int i_mode = va_arg( args, int );
         assert( i_mode == ES_OUT_MODE_NONE || i_mode == ES_OUT_MODE_ALL ||
-                i_mode == ES_OUT_MODE_AUTO || i_mode == ES_OUT_MODE_PARTIAL ||
-                i_mode == ES_OUT_MODE_END );
+                i_mode == ES_OUT_MODE_AUTO || i_mode == ES_OUT_MODE_PARTIAL );
 
         if (i_mode != ES_OUT_MODE_NONE && !p_sys->b_active && !vlc_list_is_empty(&p_sys->es))
         {
@@ -2832,8 +2833,6 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
             EsOutSelect(out, es, false);
         }
 
-        if( i_mode == ES_OUT_MODE_END )
-            EsOutTerminate( out );
         return VLC_SUCCESS;
     }
 
diff --git a/src/input/es_out.h b/src/input/es_out.h
index e6cde26366f..0057be1a053 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -32,7 +32,6 @@ enum es_out_mode_e
     ES_OUT_MODE_ALL,    /* eg for stream output */
     ES_OUT_MODE_AUTO,   /* best audio/video or for input follow audio-track, sub-track */
     ES_OUT_MODE_PARTIAL,/* select programs given after --programs */
-    ES_OUT_MODE_END     /* mark the es_out as dead */
 };
 
 enum es_out_query_private_e
diff --git a/src/input/input.c b/src/input/input.c
index 475a24b7ad2..58216b6c8f4 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1340,9 +1340,13 @@ static int Init( input_thread_t * p_input )
 error:
     input_ChangeState( p_input, ERROR_S, VLC_TICK_INVALID );
 
-    if( input_priv(p_input)->p_es_out )
-        es_out_Delete( input_priv(p_input)->p_es_out );
-    es_out_SetMode( input_priv(p_input)->p_es_out_display, ES_OUT_MODE_END );
+    if( priv->p_es_out )
+        es_out_Delete( priv->p_es_out );
+    if( priv->p_es_out_display )
+    {
+        es_out_Delete( priv->p_es_out_display );
+        priv->p_es_out_display = NULL;
+    }
     if( input_priv(p_input)->p_resource )
     {
         if( input_priv(p_input)->p_sout )
@@ -1389,7 +1393,11 @@ static void End( input_thread_t * p_input )
     /* Unload all modules */
     if( priv->p_es_out )
         es_out_Delete( priv->p_es_out );
-    es_out_SetMode( priv->p_es_out_display, ES_OUT_MODE_END );
+    if( priv->p_es_out_display )
+    {
+        es_out_Delete( priv->p_es_out_display );
+        priv->p_es_out_display = NULL;
+    }
 
     if( priv->stats != NULL )
     {
-- 
2.20.1



More information about the vlc-devel mailing list