[vlmc-devel] VLCSource: Do not wait for a vout event, that doesn' t fly well for audio files.

Hugo Beauzée-Luyssen git at videolan.org
Fri Mar 7 19:14:35 CET 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Mar  7 18:12:07 2014 +0100| [65af2efc1cd0b835da29bd4f1796cd2ce2905863] | committer: Hugo Beauzée-Luyssen

VLCSource: Do not wait for a vout event, that doesn't fly well for audio files.

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

 src/Backend/VLC/VLCSource.cpp         |   10 +++++++++-
 src/Backend/VLC/VLCSourceRenderer.cpp |    2 +-
 src/Backend/VLC/VLCVmemRenderer.cpp   |    8 +++++---
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/Backend/VLC/VLCSource.cpp b/src/Backend/VLC/VLCSource.cpp
index 24ce0d1..27a813a 100644
--- a/src/Backend/VLC/VLCSource.cpp
+++ b/src/Backend/VLC/VLCSource.cpp
@@ -63,6 +63,13 @@ VLCSource::createRenderer( ISourceRendererEventCb *callback )
     return new VLCSourceRenderer( m_backend, this, callback );
 }
 
+static bool
+checkLengthChanged( const libvlc_event_t* event )
+{
+    Q_ASSERT( event->type == libvlc_MediaPlayerLengthChanged );
+    return ( event->u.media_player_length_changed.new_length > 0 );
+}
+
 bool
 VLCSource::preparse()
 {
@@ -73,7 +80,8 @@ VLCSource::preparse()
     LibVLCpp::MediaPlayer*  mediaPlayer = renderer->mediaPlayer();
     {
         EventWaiter ew( mediaPlayer, true );
-        ew.add( libvlc_MediaPlayerVout );
+        ew.setValidationCallback( &checkLengthChanged );
+        ew.add( libvlc_MediaPlayerLengthChanged );
         renderer->start();
         if ( ew.wait( 3000 ) != EventWaiter::Success )
         {
diff --git a/src/Backend/VLC/VLCSourceRenderer.cpp b/src/Backend/VLC/VLCSourceRenderer.cpp
index 9435421..05d9a5a 100644
--- a/src/Backend/VLC/VLCSourceRenderer.cpp
+++ b/src/Backend/VLC/VLCSourceRenderer.cpp
@@ -34,7 +34,7 @@
 using namespace Backend;
 using namespace Backend::VLC;
 
-VLCSourceRenderer::VLCSourceRenderer( VLCBackend* backendInstance, VLCSource *source , ISourceRendererEventCb *callback )
+VLCSourceRenderer::VLCSourceRenderer( VLCBackend* backendInstance, VLCSource *source, ISourceRendererEventCb *callback )
     : m_backend( backendInstance )
     , m_modes( Playback )
     , m_callback( callback )
diff --git a/src/Backend/VLC/VLCVmemRenderer.cpp b/src/Backend/VLC/VLCVmemRenderer.cpp
index 53c6afc..bef6ba3 100644
--- a/src/Backend/VLC/VLCVmemRenderer.cpp
+++ b/src/Backend/VLC/VLCVmemRenderer.cpp
@@ -20,14 +20,16 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include "VLCVmemRenderer.h"
-
 #include <QImage>
+
+#include "VLCVmemRenderer.h"
 #include "VLCSource.h"
+#include "Tools/VlmcDebug.h"
+
 
 using namespace Backend::VLC;
 
-VmemRenderer::VmemRenderer( VLCBackend* backend, VLCSource *source , ISourceRendererEventCb *callback)
+VmemRenderer::VmemRenderer( VLCBackend* backend, VLCSource *source , ISourceRendererEventCb *callback )
     : VLCSourceRenderer( backend, source, callback )
     , m_snapshotRequired( false )
 {



More information about the Vlmc-devel mailing list