[vlc-devel] commit: Merged ES_OUT_SET_ACTIVE/_MODE. (Laurent Aimar )

git version control git at videolan.org
Sun Jan 31 01:41:56 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 30 22:10:12 2010 +0100| [92410cb5c3ae0f983ddd61c784d8eb78fe13a2f6] | committer: Laurent Aimar 

Merged ES_OUT_SET_ACTIVE/_MODE.

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

 src/input/es_out.c           |   44 ++++++++++++++++-------------------------
 src/input/es_out.h           |   11 +++++----
 src/input/es_out_timeshift.c |    8 -------
 src/input/input.c            |    6 +---
 4 files changed, 25 insertions(+), 44 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1b215f6..bb94572 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2111,10 +2111,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
             *pb = EsIsSelected( es );
             return VLC_SUCCESS;
 
-        case ES_OUT_SET_ACTIVE:
+        case ES_OUT_SET_MODE:
         {
-            b = (bool) va_arg( args, int );
-            if( b && !p_sys->b_active && p_sys->i_es > 0 )
+            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 );
+
+            if( i_mode != ES_OUT_MODE_NONE && !p_sys->b_active && p_sys->i_es > 0 )
             {
                 /* XXX Terminate vout if there are tracks but no video one.
                  * This one is not mandatory but is he earliest place where it
@@ -2128,33 +2131,20 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
                 if( i >= p_sys->i_es )
                     input_resource_TerminateVout( p_sys->p_input->p->p_resource );
             }
-            p_sys->b_active = b;
-            return VLC_SUCCESS;
-        }
+            p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
+            p_sys->i_mode = i_mode;
 
-        case ES_OUT_SET_MODE:
-            i = (int) va_arg( args, int );
-            if( i == ES_OUT_MODE_NONE || i == ES_OUT_MODE_ALL ||
-                i == ES_OUT_MODE_AUTO || i == ES_OUT_MODE_PARTIAL )
+            /* Reapply policy mode */
+            for( i = 0; i < p_sys->i_es; i++ )
             {
-                p_sys->i_mode = i;
-
-                /* Reapply policy mode */
-                for( i = 0; i < p_sys->i_es; i++ )
-                {
-                    if( EsIsSelected( p_sys->es[i] ) )
-                    {
-                        EsUnselect( out, p_sys->es[i],
-                                    p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
-                    }
-                }
-                for( i = 0; i < p_sys->i_es; i++ )
-                {
-                    EsOutSelect( out, p_sys->es[i], false );
-                }
-                return VLC_SUCCESS;
+                if( EsIsSelected( p_sys->es[i] ) )
+                    EsUnselect( out, p_sys->es[i],
+                                p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
             }
-            return VLC_EGENERIC;
+            for( i = 0; i < p_sys->i_es; i++ )
+                EsOutSelect( out, p_sys->es[i], false );
+            return VLC_SUCCESS;
+        }
 
         case ES_OUT_SET_ES:
         case ES_OUT_RESTART_ES:
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 36cb807..32ec39a 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -41,12 +41,8 @@ enum es_out_mode_e
 
 enum es_out_query_private_e
 {
-
-    /* activate application of mode */
-    ES_OUT_SET_ACTIVE = ES_OUT_PRIVATE_START,       /* arg1= bool                     */
-
     /* set/get mode */
-    ES_OUT_SET_MODE,                                /* arg1= int                            */
+    ES_OUT_SET_MODE = ES_OUT_PRIVATE_START,         /* arg1= int                            */
 
     /* Get date to wait before demuxing more data */
     ES_OUT_GET_WAKE_UP,                             /* arg1=mtime_t*            res=cannot fail */
@@ -85,6 +81,11 @@ enum es_out_query_private_e
     ES_OUT_SET_JITTER,                              /* arg1=mtime_t i_pts_delay arg2=int i_cr_average res=cannot fail */
 };
 
+static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
+{
+    int i_ret = es_out_Control( p_out, ES_OUT_SET_MODE, i_mode );
+    assert( !i_ret );
+}
 static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
 {
     mtime_t i_wu;
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 51f38cf..a63256e 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -588,7 +588,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
         return VLC_EGENERIC;
 
     /* Pass-through control */
-    case ES_OUT_SET_ACTIVE:
     case ES_OUT_SET_MODE:
     case ES_OUT_SET_GROUP:
     case ES_OUT_SET_PCR:
@@ -1305,10 +1304,6 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
     switch( i_query )
     {
     /* Pass-through control */
-    case ES_OUT_SET_ACTIVE:  /* arg1= bool                     */
-        p_cmd->u.control.u.b_bool = (bool)va_arg( args, int );
-        break;
-
     case ES_OUT_SET_MODE:    /* arg1= int                            */
     case ES_OUT_SET_GROUP:   /* arg1= int                            */
     case ES_OUT_DEL_GROUP:   /* arg1=int i_group */
@@ -1450,9 +1445,6 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
     switch( i_query )
     {
     /* Pass-through control */
-    case ES_OUT_SET_ACTIVE:  /* arg1= bool                     */
-        return es_out_Control( p_out, i_query, p_cmd->u.control.u.b_bool );
-
     case ES_OUT_SET_MODE:    /* arg1= int                            */
     case ES_OUT_SET_GROUP:   /* arg1= int                            */
     case ES_OUT_DEL_GROUP:   /* arg1=int i_group */
diff --git a/src/input/input.c b/src/input/input.c
index 745e9bf..86a8b2c 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1140,7 +1140,6 @@ static void InitPrograms( input_thread_t * p_input )
     UpdatePtsDelay( p_input );
 
     /* Set up es_out */
-    es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, true );
     i_es_out_mode = ES_OUT_MODE_AUTO;
     if( p_input->p->p_sout )
     {
@@ -1162,7 +1161,7 @@ static void InitPrograms( input_thread_t * p_input )
             }
         }
     }
-    es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, i_es_out_mode );
+    es_out_SetMode( p_input->p->p_es_out, i_es_out_mode );
 
     /* Inform the demuxer about waited group (needed only for DVB) */
     if( i_es_out_mode == ES_OUT_MODE_ALL )
@@ -1356,8 +1355,7 @@ static void End( input_thread_t * p_input )
     input_ControlVarStop( p_input );
 
     /* Stop es out activity */
-    es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, false );
-    es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
+    es_out_SetMode( p_input->p->p_es_out, ES_OUT_MODE_NONE );
 
     /* Clean up master */
     InputSourceClean( &p_input->p->input );




More information about the vlc-devel mailing list