[vlc-commits] core: add the "input" clock source

Thomas Guillem git at videolan.org
Mon Apr 12 07:49:42 UTC 2021


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr  1 15:31:38 2021 +0200| [2200210d935e515e25094cc776f5828be17caa61] | committer: Thomas Guillem

core: add the "input" clock source

The "--clock-master=input" option (disabled by default) allow to setup
the input_clock_t as the master clock. This will restore the VLC 3.0
behavior and use PCR update points as the clock source. Therefore, audio
and video tracks will be altered to catch-up with the input.

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

 src/clock/clock.h   |  1 +
 src/input/es_out.c  | 16 +++++++++++++++-
 src/libvlc-module.c |  3 ++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/clock/clock.h b/src/clock/clock.h
index e737339169..f8af2b0c18 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -23,6 +23,7 @@
 enum vlc_clock_master_source
 {
     VLC_CLOCK_MASTER_AUDIO = 0,
+    VLC_CLOCK_MASTER_INPUT,
     VLC_CLOCK_MASTER_MONOTONIC,
     VLC_CLOCK_MASTER_DEFAULT = VLC_CLOCK_MASTER_AUDIO,
 };
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 99bfd8aa59..1bb1b22773 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -284,6 +284,7 @@ clock_source_Inherit(vlc_object_t *obj)
         { "0", VLC_CLOCK_MASTER_AUDIO }, /* legacy option */
         { "1", VLC_CLOCK_MASTER_MONOTONIC }, /* legacy option */
         { "audio", VLC_CLOCK_MASTER_AUDIO },
+        { "input", VLC_CLOCK_MASTER_INPUT },
         { "monotonic", VLC_CLOCK_MASTER_MONOTONIC },
     };
 
@@ -1391,6 +1392,7 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, input_source_t *source, in
 {
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
     input_thread_t    *p_input = p_sys->p_input;
+    input_thread_private_t *priv = input_priv(p_input);
 
     /* Sticky groups will be attached to any existing programs, no need to
      * create one. */
@@ -1419,7 +1421,18 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, input_source_t *source, in
         return NULL;
     }
 
-    p_pgrm->p_input_clock = input_clock_New( NULL, p_sys->rate );
+    vlc_clock_t *p_master_clock = NULL;
+    switch( p_sys->clock_source )
+    {
+        case VLC_CLOCK_MASTER_INPUT:
+            p_pgrm->p_master_clock = p_master_clock =
+                vlc_clock_main_CreateMaster( p_pgrm->p_main_clock, NULL, NULL );
+            break;
+        default:
+            break;
+    }
+
+    p_pgrm->p_input_clock = input_clock_New( p_master_clock, p_sys->rate );
     if( !p_pgrm->p_input_clock )
     {
         vlc_clock_main_Delete( p_pgrm->p_main_clock );
@@ -2207,6 +2220,7 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )
             clock_source_cat = AUDIO_ES;
             break;
         case VLC_CLOCK_MASTER_MONOTONIC:
+        case VLC_CLOCK_MASTER_INPUT:
             clock_source_cat = UNKNOWN_ES;
             break;
         default:
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 94b6a644e5..0f94c65737 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -539,9 +539,10 @@ static const char *const screensaver_texts[] = {
 #define CLOCK_MASTER_TEXT N_("Clock master source")
 
 static const char *const ppsz_clock_master_values[] = {
-    "audio", "monotonic",
+    "input", "audio", "monotonic",
 };
 static const char *const ppsz_clock_master_descriptions[] = {
+    N_("Input (PCR)"),
     N_("Audio"),
     N_("Monotonic")
 };



More information about the vlc-commits mailing list