[vlmc-devel] ISource: expose the parsed state

Hugo Beauzée-Luyssen git at videolan.org
Mon Feb 24 01:59:12 CET 2014


vlmc | branch: ibackend | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Feb 24 01:00:21 2014 +0200| [b6eb37ccee78f794d96e5812414fd0f4b993c78d] | committer: Hugo Beauzée-Luyssen

ISource: expose the parsed state

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

 src/Backend/ISource.h         |    1 +
 src/Backend/VLC/VLCSource.cpp |   10 ++++++++++
 src/Backend/VLC/VLCSource.h   |    2 ++
 3 files changed, 13 insertions(+)

diff --git a/src/Backend/ISource.h b/src/Backend/ISource.h
index 1bc425e..7faf67d 100644
--- a/src/Backend/ISource.h
+++ b/src/Backend/ISource.h
@@ -41,6 +41,7 @@ namespace Backend
              * @return
              */
             virtual bool            preparse() = 0;
+            virtual bool            isParsed() const = 0;
             virtual unsigned int    width() const = 0;
             virtual unsigned int    height() const = 0;
             virtual int64_t         length() const = 0;
diff --git a/src/Backend/VLC/VLCSource.cpp b/src/Backend/VLC/VLCSource.cpp
index 0b836f7..4393f40 100644
--- a/src/Backend/VLC/VLCSource.cpp
+++ b/src/Backend/VLC/VLCSource.cpp
@@ -31,6 +31,7 @@ using namespace Backend::VLC;
 
 VLCSource::VLCSource( VLCBackend* backend, const QString& path )
     : m_backend( backend )
+    , m_isParsed( false )
 {
     m_media = new LibVLCpp::Media( backend->vlcInstance(), path );
 }
@@ -55,6 +56,9 @@ VLCSource::createRenderer( ISourceRendererEventCb *callback )
 bool
 VLCSource::preparse()
 {
+    // This assume we won't try to parse the same media twice ast the same time
+    m_isParsed = true;
+
     VmemRenderer*           renderer = new VmemRenderer( m_backend, this, NULL );
     LibVLCpp::MediaPlayer*  mediaPlayer = renderer->mediaPlayer();
     {
@@ -84,6 +88,12 @@ VLCSource::preparse()
     return true;
 }
 
+bool
+VLCSource::isParsed() const
+{
+    return m_isParsed;
+}
+
 static bool
 checkTimeChanged( const libvlc_event_t* event )
 {
diff --git a/src/Backend/VLC/VLCSource.h b/src/Backend/VLC/VLCSource.h
index 79944ce..2eb91c2 100644
--- a/src/Backend/VLC/VLCSource.h
+++ b/src/Backend/VLC/VLCSource.h
@@ -43,6 +43,7 @@ public:
     virtual ~VLCSource();
     virtual ISourceRenderer*    createRenderer( ISourceRendererEventCb* callback );
     virtual bool                preparse();
+    virtual bool                isParsed() const;
     virtual quint32             width() const;
     virtual quint32             height() const;
     virtual int64_t             length() const;
@@ -68,6 +69,7 @@ private:
     unsigned int                m_nbAudioTracks;
     int64_t                     m_length; //in milliseconds.
     QImage*                     m_snapshot;
+    bool                        m_isParsed;
 };
 
 



More information about the Vlmc-devel mailing list