[vlc-commits] sout: sdi: refactor captions stream

Francois Cartegnie git at videolan.org
Mon Oct 8 18:11:27 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep  5 18:54:44 2018 +0200| [ccaa40c0ed9a89c65bf99d9f933e6712de16806a] | committer: Francois Cartegnie

sout: sdi: refactor captions stream

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

 modules/stream_out/sdi/SDIStream.cpp | 36 ++++++++++++++++++++++++------------
 modules/stream_out/sdi/SDIStream.hpp | 25 +++++++++++++++----------
 2 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index 25110a4f2b..441910025a 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -527,24 +527,20 @@ void AudioDecodedStream::setCallbacks()
     p_decoder->cbs = &dec_cbs;
 }
 
-CaptionsStream::CaptionsStream(vlc_object_t *p_obj, const StreamID &id,
+
+AbstractRawStream::AbstractRawStream(vlc_object_t *p_obj, const StreamID &id,
                                AbstractStreamOutputBuffer *buffer)
     : AbstractStream(p_obj, id, buffer)
 {
 
 }
 
-CaptionsStream::~CaptionsStream()
+AbstractRawStream::~AbstractRawStream()
 {
     FlushQueued();
 }
 
-bool CaptionsStream::init(const es_format_t *fmt)
-{
-    return (fmt->i_codec == VLC_CODEC_CEA608);
-}
-
-int CaptionsStream::Send(block_t *p_block)
+int AbstractRawStream::Send(block_t *p_block)
 {
     if(p_block->i_buffer)
         outputbuffer->Enqueue(p_block);
@@ -553,19 +549,35 @@ int CaptionsStream::Send(block_t *p_block)
     return VLC_SUCCESS;
 }
 
-void CaptionsStream::Flush()
+void AbstractRawStream::Flush()
 {
-
+    FlushQueued();
 }
 
-void CaptionsStream::Drain()
+void AbstractRawStream::Drain()
 {
 
 }
 
-void CaptionsStream::FlushQueued()
+void AbstractRawStream::FlushQueued()
 {
     block_t *p;
     while((p = reinterpret_cast<block_t *>(outputbuffer->Dequeue())))
         block_Release(p);
 }
+
+
+CaptionsStream::CaptionsStream(vlc_object_t *p_obj, const StreamID &id,
+                               AbstractStreamOutputBuffer *buffer)
+    : AbstractRawStream(p_obj, id, buffer)
+{
+}
+
+CaptionsStream::~CaptionsStream()
+{
+}
+
+bool CaptionsStream::init(const es_format_t *fmt)
+{
+    return (fmt->i_codec == VLC_CODEC_CEA608);
+}
diff --git a/modules/stream_out/sdi/SDIStream.hpp b/modules/stream_out/sdi/SDIStream.hpp
index 668009ce50..ec50338dd9 100644
--- a/modules/stream_out/sdi/SDIStream.hpp
+++ b/modules/stream_out/sdi/SDIStream.hpp
@@ -158,22 +158,27 @@ namespace sdi_sout
             aout_filters_t *p_filters;
     };
 
-    class CaptionsStream : public AbstractStream
+    class AbstractRawStream : public AbstractStream
     {
         public:
-            CaptionsStream(vlc_object_t *, const StreamID &,
-                           AbstractStreamOutputBuffer *);
-            virtual ~CaptionsStream();
-            virtual bool init(const es_format_t *); /* impl */
-            virtual int Send(block_t*);
-            virtual void Flush();
-            virtual void Drain();
+            AbstractRawStream(vlc_object_t *, const StreamID &,
+                              AbstractStreamOutputBuffer *);
+            virtual ~AbstractRawStream();
+            virtual int Send(block_t*); /* impl */
+            virtual void Flush(); /* impl */
+            virtual void Drain(); /* impl */
 
         protected:
             void FlushQueued();
+    };
 
-        private:
-            void Output(block_t *);
+    class CaptionsStream : public AbstractRawStream
+    {
+        public:
+            CaptionsStream(vlc_object_t *, const StreamID &,
+                           AbstractStreamOutputBuffer *);
+            virtual ~CaptionsStream();
+            virtual bool init(const es_format_t *); /* impl */
     };
 }
 



More information about the vlc-commits mailing list