[vlc-commits] demux: adaptative: add support for slave demuxers

Francois Cartegnie git at videolan.org
Wed Oct 7 18:56:57 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct  7 18:11:04 2015 +0200| [31c781a95fffe2d792c7c2c4447f1b1fa9cb7db0] | committer: Francois Cartegnie

demux: adaptative: add support for slave demuxers

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

 modules/demux/adaptative/plumbing/Demuxer.cpp |   37 +++++++++++++++++++++++++
 modules/demux/adaptative/plumbing/Demuxer.hpp |   14 +++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptative/plumbing/Demuxer.cpp b/modules/demux/adaptative/plumbing/Demuxer.cpp
index 6be60d4..9d98075 100644
--- a/modules/demux/adaptative/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptative/plumbing/Demuxer.cpp
@@ -113,3 +113,40 @@ int Demuxer::demux(mtime_t)
         b_eof = true;
     return i_ret;
 }
+
+SlaveDemuxer::SlaveDemuxer(demux_t *p_realdemux, const std::string &name, es_out_t *out, AbstractSourceStream *source)
+    : Demuxer(p_realdemux, name, out, source)
+{
+    length = VLC_TS_INVALID;
+    b_reinitsonseek = false;
+    b_startsfromzero = false;
+}
+
+SlaveDemuxer::~SlaveDemuxer()
+{
+
+}
+
+bool SlaveDemuxer::create()
+{
+    if(Demuxer::create())
+    {
+        length = VLC_TS_INVALID;
+        if(demux_Control(p_demux, DEMUX_GET_LENGTH, &length) != VLC_SUCCESS)
+            b_eof = true;
+        return true;
+    }
+    return false;
+}
+
+int SlaveDemuxer::demux(mtime_t nz_deadline)
+{
+    if( demux_Control(p_demux, DEMUX_SET_NEXT_DEMUX_TIME, VLC_TS_0 + nz_deadline) != VLC_SUCCESS )
+    {
+        b_eof = true;
+        return VLC_DEMUXER_EOF;
+    }
+    int ret = Demuxer::demux(nz_deadline);
+    es_out_Control(p_es_out, ES_OUT_SET_GROUP_PCR, 0, VLC_TS_0 + nz_deadline);
+    return ret;
+}
diff --git a/modules/demux/adaptative/plumbing/Demuxer.hpp b/modules/demux/adaptative/plumbing/Demuxer.hpp
index d1cda2b..e457987 100644
--- a/modules/demux/adaptative/plumbing/Demuxer.hpp
+++ b/modules/demux/adaptative/plumbing/Demuxer.hpp
@@ -59,7 +59,7 @@ namespace adaptative
             virtual bool create(); /* impl */
             virtual bool restart(CommandsQueue &); /* impl */
 
-        private:
+        protected:
             AbstractSourceStream *sourcestream;
             demux_t *p_realdemux;
             demux_t *p_demux;
@@ -68,6 +68,18 @@ namespace adaptative
             bool b_eof;
     };
 
+    class SlaveDemuxer : public Demuxer
+    {
+        public:
+            SlaveDemuxer(demux_t *, const std::string &, es_out_t *, AbstractSourceStream *);
+            virtual ~SlaveDemuxer();
+            virtual bool create(); /* reimpl */
+            virtual int demux(mtime_t); /* reimpl */
+
+        private:
+            mtime_t length;
+    };
+
 }
 
 #endif // DEMUXER_HPP



More information about the vlc-commits mailing list