[vlc-commits] demux: adaptive: use vlc_object as Demuxer parent

Francois Cartegnie git at videolan.org
Thu Jul 18 20:40:54 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 11 10:41:19 2019 +0200| [99c65bc3db6ea11f0e927612f3f240062b9d2fe5] | committer: Francois Cartegnie

demux: adaptive: use vlc_object as Demuxer parent

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

 modules/demux/adaptive/Streams.cpp          |  8 ++++----
 modules/demux/adaptive/Streams.hpp          |  2 +-
 modules/demux/adaptive/plumbing/Demuxer.cpp | 19 +++++++++++--------
 modules/demux/adaptive/plumbing/Demuxer.hpp | 12 ++++++------
 modules/demux/dash/DASHStream.cpp           | 10 +++++-----
 modules/demux/dash/DASHStream.hpp           |  2 +-
 modules/demux/hls/HLSStreams.cpp            | 12 ++++++------
 modules/demux/hls/HLSStreams.hpp            |  4 ++--
 modules/demux/smooth/SmoothStream.cpp       |  4 ++--
 modules/demux/smooth/SmoothStream.hpp       |  2 +-
 10 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index e183efa0c8..e4f0bf4efb 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -594,7 +594,7 @@ void AbstractStream::fillExtraFMTInfo( es_format_t *p_fmt ) const
 
 AbstractDemuxer * AbstractStream::createDemux(const StreamFormat &format)
 {
-    AbstractDemuxer *ret = newDemux( p_realdemux, format,
+    AbstractDemuxer *ret = newDemux( VLC_OBJECT(p_realdemux), format,
                                      fakeEsOut()->getEsOut(), demuxersource );
     if(ret && !ret->create())
     {
@@ -606,18 +606,18 @@ AbstractDemuxer * AbstractStream::createDemux(const StreamFormat &format)
     return ret;
 }
 
-AbstractDemuxer *AbstractStream::newDemux(demux_t *p_realdemux, const StreamFormat &format,
+AbstractDemuxer *AbstractStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
                                           es_out_t *out, AbstractSourceStream *source) const
 {
     AbstractDemuxer *ret = NULL;
     switch((unsigned)format)
     {
         case StreamFormat::MP4:
-            ret = new Demuxer(p_realdemux, "mp4", out, source);
+            ret = new Demuxer(p_obj, "mp4", out, source);
             break;
 
         case StreamFormat::MPEG2TS:
-            ret = new Demuxer(p_realdemux, "ts", out, source);
+            ret = new Demuxer(p_obj, "ts", out, source);
             break;
 
         default:
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 8bba367942..61b2abe64a 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -105,7 +105,7 @@ namespace adaptive
         void setDisabled(bool);
         virtual block_t *checkBlock(block_t *, bool) = 0;
         AbstractDemuxer * createDemux(const StreamFormat &);
-        virtual AbstractDemuxer * newDemux(demux_t *, const StreamFormat &,
+        virtual AbstractDemuxer * newDemux(vlc_object_t *, const StreamFormat &,
                                            es_out_t *, AbstractSourceStream *) const; /* impl */
         virtual bool startDemux();
         virtual bool restartDemux();
diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index e9cb0fc9a8..e7f93f704f 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -76,14 +76,14 @@ bool AbstractDemuxer::needsRestartOnSeek() const
     return b_reinitsonseek;
 }
 
-MimeDemuxer::MimeDemuxer(demux_t *p_realdemux_,
+MimeDemuxer::MimeDemuxer(vlc_object_t *p_obj_,
                          const DemuxerFactoryInterface *factory_,
                          es_out_t *out, AbstractSourceStream *source)
     : AbstractDemuxer()
 {
     p_es_out = out;
     factory = factory_;
-    p_realdemux = p_realdemux_;
+    p_obj = p_obj_;
     demuxer = NULL;
     sourcestream = source;
 }
@@ -116,7 +116,8 @@ bool MimeDemuxer::create()
     }
 
     if(format != StreamFormat(StreamFormat::UNKNOWN))
-        demuxer = factory->newDemux(p_realdemux, format, p_es_out, sourcestream);
+        demuxer = factory->newDemux(VLC_OBJECT(p_obj), format,
+                                    p_es_out, sourcestream);
 
     vlc_stream_Delete(p_newstream);
 
@@ -149,12 +150,13 @@ int MimeDemuxer::demux(vlc_tick_t t)
     return demuxer->demux(t);
 }
 
-Demuxer::Demuxer(demux_t *p_realdemux_, const std::string &name_, es_out_t *out, AbstractSourceStream *source)
+Demuxer::Demuxer(vlc_object_t *p_obj_, const std::string &name_,
+                 es_out_t *out, AbstractSourceStream *source)
     : AbstractDemuxer()
 {
     p_es_out = out;
     name = name_;
-    p_realdemux = p_realdemux_;
+    p_obj = p_obj_;
     p_demux = NULL;
     b_eof = false;
     sourcestream = source;
@@ -182,7 +184,7 @@ bool Demuxer::create()
     if(!p_newstream)
         return false;
 
-    p_demux = demux_New( VLC_OBJECT(p_realdemux), name.c_str(),
+    p_demux = demux_New( p_obj, name.c_str(),
                          p_newstream, p_es_out );
     if(!p_demux)
     {
@@ -223,8 +225,9 @@ int Demuxer::demux(vlc_tick_t)
     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)
+SlaveDemuxer::SlaveDemuxer(vlc_object_t *p_obj, const std::string &name,
+                           es_out_t *out, AbstractSourceStream *source)
+    : Demuxer(p_obj, name, out, source)
 {
     length = VLC_TICK_INVALID;
     b_reinitsonseek = false;
diff --git a/modules/demux/adaptive/plumbing/Demuxer.hpp b/modules/demux/adaptive/plumbing/Demuxer.hpp
index e838f0c19f..b023715dbe 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.hpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.hpp
@@ -55,7 +55,7 @@ namespace adaptive
     class MimeDemuxer : public AbstractDemuxer
     {
         public:
-            MimeDemuxer(demux_t *, const DemuxerFactoryInterface *,
+            MimeDemuxer(vlc_object_t *, const DemuxerFactoryInterface *,
                         es_out_t *, AbstractSourceStream *);
             virtual ~MimeDemuxer();
             virtual int demux(vlc_tick_t); /* impl */
@@ -65,7 +65,7 @@ namespace adaptive
 
         protected:
             AbstractSourceStream *sourcestream;
-            demux_t *p_realdemux;
+            vlc_object_t *p_obj;
             AbstractDemuxer *demuxer;
             const DemuxerFactoryInterface *factory;
             es_out_t *p_es_out;
@@ -74,7 +74,7 @@ namespace adaptive
     class Demuxer : public AbstractDemuxer
     {
         public:
-            Demuxer(demux_t *, const std::string &, es_out_t *, AbstractSourceStream *);
+            Demuxer(vlc_object_t *, const std::string &, es_out_t *, AbstractSourceStream *);
             virtual ~Demuxer();
             virtual int demux(vlc_tick_t); /* impl */
             virtual void drain(); /* impl */
@@ -83,7 +83,7 @@ namespace adaptive
 
         protected:
             AbstractSourceStream *sourcestream;
-            demux_t *p_realdemux;
+            vlc_object_t *p_obj;
             demux_t *p_demux;
             std::string name;
             es_out_t *p_es_out;
@@ -93,7 +93,7 @@ namespace adaptive
     class SlaveDemuxer : public Demuxer
     {
         public:
-            SlaveDemuxer(demux_t *, const std::string &, es_out_t *, AbstractSourceStream *);
+            SlaveDemuxer(vlc_object_t *, const std::string &, es_out_t *, AbstractSourceStream *);
             virtual ~SlaveDemuxer();
             virtual bool create(); /* reimpl */
             virtual int demux(vlc_tick_t); /* reimpl */
@@ -105,7 +105,7 @@ namespace adaptive
     class DemuxerFactoryInterface
     {
         public:
-            virtual AbstractDemuxer * newDemux(demux_t *, const StreamFormat &,
+            virtual AbstractDemuxer * newDemux(vlc_object_t *, const StreamFormat &,
                                                es_out_t *, AbstractSourceStream *) const = 0;
     };
 }
diff --git a/modules/demux/dash/DASHStream.cpp b/modules/demux/dash/DASHStream.cpp
index f472ecc761..6d83213c8a 100644
--- a/modules/demux/dash/DASHStream.cpp
+++ b/modules/demux/dash/DASHStream.cpp
@@ -35,7 +35,7 @@ block_t * DASHStream::checkBlock(block_t *p_block, bool)
     return p_block;
 }
 
-AbstractDemuxer *DASHStream::newDemux(demux_t *p_realdemux, const StreamFormat &format,
+AbstractDemuxer *DASHStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
                                       es_out_t *out, AbstractSourceStream *source) const
 {
     AbstractDemuxer *ret = NULL;
@@ -43,19 +43,19 @@ AbstractDemuxer *DASHStream::newDemux(demux_t *p_realdemux, const StreamFormat &
     {
         case StreamFormat::MP4:
         case StreamFormat::MPEG2TS:
-            ret = AbstractStream::newDemux(p_realdemux, format, out, source);
+            ret = AbstractStream::newDemux(p_obj, format, out, source);
             break;
 
         case StreamFormat::WEBM:
-            ret = new Demuxer(p_realdemux, "mkv", out, source);
+            ret = new Demuxer(p_obj, "mkv", out, source);
             break;
 
         case StreamFormat::WEBVTT:
-            ret = new SlaveDemuxer(p_realdemux, "webvtt", out, source);
+            ret = new SlaveDemuxer(p_obj, "webvtt", out, source);
             break;
 
         case StreamFormat::TTML:
-            ret = new SlaveDemuxer(p_realdemux, "ttml", out, source);
+            ret = new SlaveDemuxer(p_obj, "ttml", out, source);
             break;
 
         default:
diff --git a/modules/demux/dash/DASHStream.hpp b/modules/demux/dash/DASHStream.hpp
index 946615f51b..562c1447d2 100644
--- a/modules/demux/dash/DASHStream.hpp
+++ b/modules/demux/dash/DASHStream.hpp
@@ -33,7 +33,7 @@ namespace dash
 
         protected:
             virtual block_t *checkBlock(block_t *, bool); /* impl */
-            virtual AbstractDemuxer * newDemux(demux_t *, const StreamFormat &,
+            virtual AbstractDemuxer * newDemux(vlc_object_t *, const StreamFormat &,
                                                es_out_t *, AbstractSourceStream *) const; /* reimpl */
     };
 
diff --git a/modules/demux/hls/HLSStreams.cpp b/modules/demux/hls/HLSStreams.cpp
index d5a48a0869..93102a340e 100644
--- a/modules/demux/hls/HLSStreams.cpp
+++ b/modules/demux/hls/HLSStreams.cpp
@@ -125,36 +125,36 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
     return p_block;
 }
 
-AbstractDemuxer *HLSStream::newDemux(demux_t *p_realdemux, const StreamFormat &format,
+AbstractDemuxer *HLSStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
                                      es_out_t *out, AbstractSourceStream *source) const
 {
     AbstractDemuxer *ret = NULL;
     switch((unsigned)format)
     {
         case StreamFormat::PACKEDAAC:
-            ret = new Demuxer(p_realdemux, "aac", out, source);
+            ret = new Demuxer(p_obj, "aac", out, source);
             break;
 
         case StreamFormat::MPEG2TS:
-            ret = new Demuxer(p_realdemux, "ts", out, source);
+            ret = new Demuxer(p_obj, "ts", out, source);
             if(ret)
                 ret->setBitstreamSwitchCompatible(false); /* HLS and unique PAT/PMT versions */
             break;
 
         case StreamFormat::MP4:
-            ret = AbstractStream::newDemux(p_realdemux, format, out, source);
+            ret = AbstractStream::newDemux(p_obj, format, out, source);
             break;
 
 /* Disabled until we can handle empty segments/cue and absolute time
         case StreamFormat::WEBVTT:
-            ret = new Demuxer(p_realdemux, "webvttstream", out, source);
+            ret = new Demuxer(p_obj, "webvttstream", out, source);
             if(ret)
                 ret->setRestartsOnEachSegment(true);
             break;
 */
 
         case StreamFormat::UNKNOWN:
-            ret = new MimeDemuxer(p_realdemux, this, out, source);
+            ret = new MimeDemuxer(p_obj, this, out, source);
             break;
 
         default:
diff --git a/modules/demux/hls/HLSStreams.hpp b/modules/demux/hls/HLSStreams.hpp
index ac56961bd8..d7f554ebb1 100644
--- a/modules/demux/hls/HLSStreams.hpp
+++ b/modules/demux/hls/HLSStreams.hpp
@@ -34,7 +34,7 @@ namespace hls
 
         protected:
             virtual block_t *checkBlock(block_t *, bool); /* reimpl */
-            virtual AbstractDemuxer * newDemux(demux_t *, const StreamFormat &,
+            virtual AbstractDemuxer * newDemux(vlc_object_t *, const StreamFormat &,
                                                es_out_t *, AbstractSourceStream *) const; /* reimpl */
             virtual bool setPosition(vlc_tick_t, bool);
 
@@ -51,7 +51,7 @@ namespace hls
     class HLSStreamFactory : public AbstractStreamFactory
     {
         public:
-            virtual AbstractStream *create(demux_t*, const StreamFormat &,
+            virtual AbstractStream *create(demux_t *, const StreamFormat &,
                                    SegmentTracker *, AbstractConnectionManager *) const;
     };
 
diff --git a/modules/demux/smooth/SmoothStream.cpp b/modules/demux/smooth/SmoothStream.cpp
index 7ebe886c88..8026848403 100644
--- a/modules/demux/smooth/SmoothStream.cpp
+++ b/modules/demux/smooth/SmoothStream.cpp
@@ -31,12 +31,12 @@ SmoothStream::SmoothStream(demux_t *demux)
 {
 }
 
-AbstractDemuxer *SmoothStream::newDemux(demux_t *p_realdemux, const StreamFormat &format,
+AbstractDemuxer *SmoothStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
                                         es_out_t *out, AbstractSourceStream *source) const
 {
     if((unsigned)format != StreamFormat::MP4)
         return NULL;
-    return AbstractStream::newDemux(p_realdemux, format, out, source);
+    return AbstractStream::newDemux(p_obj, format, out, source);
 }
 
 block_t * SmoothStream::checkBlock(block_t *p_block, bool)
diff --git a/modules/demux/smooth/SmoothStream.hpp b/modules/demux/smooth/SmoothStream.hpp
index 69fdfba18d..3aaff235ee 100644
--- a/modules/demux/smooth/SmoothStream.hpp
+++ b/modules/demux/smooth/SmoothStream.hpp
@@ -33,7 +33,7 @@ namespace smooth
 
         protected:
             virtual block_t *checkBlock(block_t *, bool) /* impl */;
-            virtual AbstractDemuxer * newDemux(demux_t *, const StreamFormat &,
+            virtual AbstractDemuxer * newDemux(vlc_object_t *, const StreamFormat &,
                                                es_out_t *, AbstractSourceStream *) const; /* reimpl */
     };
 



More information about the vlc-commits mailing list