[vlmc-devel] ISourceRenderer: Introduce a isStopped method

Hugo Beauzée-Luyssen git at videolan.org
Thu Mar 24 13:22:25 CET 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Mar 15 23:47:35 2016 +0100| [8729a1df0a07ed1f00e57bf0d950ae8f613ad535] | committer: Hugo Beauzée-Luyssen

ISourceRenderer: Introduce a isStopped method

> https://code.videolan.org/videolan/vlmc/commit/8729a1df0a07ed1f00e57bf0d950ae8f613ad535
---

 src/Backend/ISourceRenderer.h               | 1 +
 src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp | 6 ++++++
 src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h   | 1 +
 src/Backend/VLC/VLCSourceRenderer.cpp       | 6 ++++++
 src/Backend/VLC/VLCSourceRenderer.h         | 1 +
 5 files changed, 15 insertions(+)

diff --git a/src/Backend/ISourceRenderer.h b/src/Backend/ISourceRenderer.h
index 21efa50..653a0eb 100644
--- a/src/Backend/ISourceRenderer.h
+++ b/src/Backend/ISourceRenderer.h
@@ -65,6 +65,7 @@ namespace Backend
          */
         virtual void    start() = 0;
         virtual void    stop() = 0;
+        virtual bool    isStopped() = 0;
         virtual void    playPause() = 0;
         virtual void    setPause( bool isPaused ) = 0;
         virtual void    nextFrame() = 0;
diff --git a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp
index 636149a..e612517 100644
--- a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp
+++ b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp
@@ -259,3 +259,9 @@ LibVLCpp::MediaPlayer::willPlay()
 {
     return libvlc_media_player_will_play( *this ) != 0;
 }
+
+libvlc_state_t
+MediaPlayer::state()
+{
+    return libvlc_media_player_get_state( *this );
+}
diff --git a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h
index 2408090..771cf45 100644
--- a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h
+++ b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h
@@ -77,6 +77,7 @@ namespace   LibVLCpp
         void                                setupVmem( const char* chroma, unsigned int width,
                                                        unsigned int height, unsigned int pitch );
         bool                                willPlay();
+        libvlc_state_t                      state();
 
 
         void                                registerEvents( libvlc_callback_t callback, void* data );
diff --git a/src/Backend/VLC/VLCSourceRenderer.cpp b/src/Backend/VLC/VLCSourceRenderer.cpp
index 8f092ce..2b8f2cd 100644
--- a/src/Backend/VLC/VLCSourceRenderer.cpp
+++ b/src/Backend/VLC/VLCSourceRenderer.cpp
@@ -182,6 +182,12 @@ VLCSourceRenderer::stop()
     m_mediaPlayer->stop();
 }
 
+bool
+VLCSourceRenderer::isStopped()
+{
+    return m_mediaPlayer->state() == libvlc_Stopped;
+}
+
 void
 VLCSourceRenderer::playPause()
 {
diff --git a/src/Backend/VLC/VLCSourceRenderer.h b/src/Backend/VLC/VLCSourceRenderer.h
index cb62179..ac0fe4e 100644
--- a/src/Backend/VLC/VLCSourceRenderer.h
+++ b/src/Backend/VLC/VLCSourceRenderer.h
@@ -59,6 +59,7 @@ public:
     virtual void    setName( const char* name );
     virtual void    start();
     virtual void    stop();
+    virtual bool    isStopped() override;
     virtual void    playPause();
     virtual void    setPause( bool isPaused ) override;
     virtual void    nextFrame();



More information about the Vlmc-devel mailing list