[vlc-commits] demux: mock: allow a track to be added at a later time

Hugo Beauzée-Luyssen git at videolan.org
Thu Oct 18 13:12:56 CEST 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Oct 18 11:50:27 2018 +0200| [f7b08bf6a1020f0396e183df3460bdd3eb70d6bd] | committer: Thomas Guillem

demux: mock: allow a track to be added at a later time

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

 modules/demux/mock.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/modules/demux/mock.c b/modules/demux/mock.c
index f4facd5fb7..03d282606b 100644
--- a/modules/demux/mock.c
+++ b/modules/demux/mock.c
@@ -108,6 +108,9 @@ var_InheritFourcc(vlc_object_t *obj, const char *name)
     X(can_control_rate, bool, add_bool, var_InheritBool, true) \
     X(can_record, bool, add_bool, var_InheritBool, true) \
     X(error, bool, add_bool, var_InheritBool, false) \
+    X(add_video_track_at, vlc_tick_t, add_integer, var_InheritInteger, VLC_TICK_INVALID ) \
+    X(add_audio_track_at, vlc_tick_t, add_integer, var_InheritInteger, VLC_TICK_INVALID ) \
+    X(add_spu_track_at, vlc_tick_t, add_integer, var_InheritInteger, VLC_TICK_INVALID ) \
 
 struct demux_sys
 {
@@ -590,6 +593,26 @@ Demux(demux_t *demux)
     sys->pts += sys->step_length;
     if (sys->pts > sys->length)
         sys->pts = sys->length;
+
+    if (sys->add_video_track_at != VLC_TICK_INVALID &&
+        sys->add_video_track_at <= sys->pts)
+    {
+        InitVideoTracks(demux, 0, 1);
+        sys->add_video_track_at = VLC_TICK_INVALID;
+    }
+    if (sys->add_audio_track_at != VLC_TICK_INVALID &&
+        sys->add_audio_track_at <= sys->pts)
+    {
+        InitAudioTracks(demux, 0, 1);
+        sys->add_audio_track_at = VLC_TICK_INVALID;
+    }
+    if (sys->add_spu_track_at != VLC_TICK_INVALID &&
+        sys->add_spu_track_at <= sys->pts)
+    {
+        InitSubTracks(demux, 0, 1);
+        sys->add_spu_track_at = VLC_TICK_INVALID;
+    }
+
     return sys->pts == sys->length ? VLC_DEMUXER_EOF : VLC_DEMUXER_SUCCESS;
 }
 



More information about the vlc-commits mailing list