[vlc-devel] [PATCH V3 03/19] es_out: add the ES_OUT_ADD_ORIGIN_TIME control

Thomas Guillem thomas at gllm.fr
Fri Sep 6 17:20:33 CEST 2019


This control will send origin points to the main clock. This will be used for
clock update notification.

Only the ts module need this control for now.
---
 include/vlc_es_out.h         |  4 ++++
 src/input/es_out.c           | 17 +++++++++++++++++
 src/input/es_out_timeshift.c | 16 ++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 8ee4ef0be1..44d58513f2 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -64,6 +64,10 @@ enum es_out_query_e
     ES_OUT_SET_GROUP_PCR,       /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/
     ES_OUT_RESET_PCR,           /* no arg */
 
+    /* A demux module can add origin points if they are different than
+     * VLC_TICK_0/VLC_TICK_0 */
+    ES_OUT_ADD_ORIGIN_TIME, /* arg1=int i_group, arg2=vlc_tick_t origin, arg3=vlc_tick_t pts*/
+
     /* This will update the fmt, drain and restart the decoder (if any).
      * The new fmt must have the same i_cat and i_id. */
     ES_OUT_SET_ES_FMT,         /* arg1= es_out_id_t* arg2=es_format_t* res=can fail */
diff --git a/src/input/es_out.c b/src/input/es_out.c
index bf93dcbe32..c401e7251d 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3061,6 +3061,23 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
         EsOutChangePosition( out, true );
         return VLC_SUCCESS;
 
+    case ES_OUT_ADD_ORIGIN_TIME:
+    {
+        es_out_pgrm_t *p_pgrm = NULL;
+        int            i_group = 0;
+        vlc_tick_t     i_origin;
+        vlc_tick_t     i_ts;
+
+        i_group = va_arg( args, int );
+        p_pgrm = EsOutProgramFind( out, i_group );
+        if( !p_pgrm )
+            return VLC_EGENERIC;
+
+        i_origin = va_arg( args, vlc_tick_t );
+        i_ts = va_arg( args, vlc_tick_t );
+        return vlc_clock_main_AddOriginPoint(p_pgrm->p_main_clock, i_origin, i_ts);
+    }
+
     case ES_OUT_SET_GROUP:
     {
         int i = va_arg( args, int );
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 2fd8855251..782644bf9c 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -101,6 +101,12 @@ typedef struct attribute_packed
             int64_t i_i64;
         } int_i64;
         struct
+        {
+            int     i_int;
+            int64_t i_i64_1;
+            int64_t i_i64_2;
+        } int_i64_i64;
+        struct
         {
             int        i_int;
             vlc_meta_t *p_meta;
@@ -607,6 +613,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
     case ES_OUT_SET_PCR:
     case ES_OUT_SET_GROUP_PCR:
     case ES_OUT_RESET_PCR:
+    case ES_OUT_ADD_ORIGIN_TIME:
     case ES_OUT_SET_NEXT_DISPLAY_TIME:
     case ES_OUT_SET_GROUP_META:
     case ES_OUT_SET_GROUP_EPG:
@@ -1405,6 +1412,11 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
         p_cmd->u.control.u.int_i64.i_int = va_arg( args, int );
         p_cmd->u.control.u.int_i64.i_i64 = va_arg( args, vlc_tick_t );
         break;
+    case ES_OUT_ADD_ORIGIN_TIME:
+        p_cmd->u.control.u.int_i64_i64.i_int = va_arg( args, int );
+        p_cmd->u.control.u.int_i64_i64.i_i64_1 = va_arg( args, int64_t );
+        p_cmd->u.control.u.int_i64_i64.i_i64_2 = va_arg( args, int64_t );
+        break;
 
     case ES_OUT_SET_ES_SCRAMBLED_STATE:
         p_cmd->u.control.u.es_bool.p_es = va_arg( args, es_out_id_t * );
@@ -1562,6 +1574,10 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
     case ES_OUT_SET_GROUP_PCR:          /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/
         return es_out_Control( p_out, i_query, p_cmd->u.control.u.int_i64.i_int,
                                                p_cmd->u.control.u.int_i64.i_i64 );
+    case ES_OUT_ADD_ORIGIN_TIME:
+        return es_out_Control( p_out, i_query, p_cmd->u.control.u.int_i64_i64.i_int,
+                                               p_cmd->u.control.u.int_i64_i64.i_i64_1,
+                                               p_cmd->u.control.u.int_i64_i64.i_i64_2 );
 
     case ES_OUT_RESET_PCR:           /* no arg */
     case ES_OUT_SET_EOS:
-- 
2.20.1



More information about the vlc-devel mailing list