[vlmc-devel] Use a clean new media when creating a renderer
Hugo Beauzée-Luyssen
git at videolan.org
Sun Mar 2 12:50:42 CET 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sat Mar 1 21:34:26 2014 +0100| [524b4ee6200737bcaea25ff4a7e9e7aad98be03a] | committer: Hugo Beauzée-Luyssen
Use a clean new media when creating a renderer
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=524b4ee6200737bcaea25ff4a7e9e7aad98be03a
---
src/Backend/VLC/LibVLCpp/VLCMedia.cpp | 8 --------
src/Backend/VLC/LibVLCpp/VLCMedia.h | 3 ++-
src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp | 7 +++++++
src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h | 1 +
src/Backend/VLC/VLCSource.cpp | 2 +-
src/Backend/VLC/VLCSourceRenderer.cpp | 3 ++-
src/Backend/VLC/VLCVmemRenderer.cpp | 1 +
7 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/Backend/VLC/LibVLCpp/VLCMedia.cpp b/src/Backend/VLC/LibVLCpp/VLCMedia.cpp
index 6e2434e..2284bf6 100644
--- a/src/Backend/VLC/LibVLCpp/VLCMedia.cpp
+++ b/src/Backend/VLC/LibVLCpp/VLCMedia.cpp
@@ -39,14 +39,6 @@ Media::Media(LibVLCpp::Instance* instance, const char *filename )
m_internalPtr = libvlc_media_new_location( *instance, filename);
}
-Media::Media( LibVLCpp::Media &media )
- : m_tracks( NULL )
- , m_nbTracks( 0 )
- , m_mrl( NULL )
-{
- m_internalPtr = libvlc_media_duplicate( media );
-}
-
Media::~Media()
{
if ( m_tracks != NULL )
diff --git a/src/Backend/VLC/LibVLCpp/VLCMedia.h b/src/Backend/VLC/LibVLCpp/VLCMedia.h
index eb8c5dd..ed33bd0 100644
--- a/src/Backend/VLC/LibVLCpp/VLCMedia.h
+++ b/src/Backend/VLC/LibVLCpp/VLCMedia.h
@@ -36,7 +36,6 @@ namespace LibVLCpp
public:
Media( Instance* instance, const char* filename );
- Media(Media &media );
~Media();
void addOption( const char* opt );
void setVideoLockCallback( void* );
@@ -57,6 +56,8 @@ namespace LibVLCpp
// it is only meant to use when iterating over m_tracksInfo
int m_nbTracks;
char* m_mrl;
+
+ Media(const Media&);
};
}
diff --git a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp
index 7d76186..0d1eea6 100644
--- a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp
+++ b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.cpp
@@ -246,3 +246,10 @@ MediaPlayer::setupVmem(const char *chroma, unsigned int width, unsigned int heig
{
libvlc_video_set_format( *this, chroma, width, height, pitch );
}
+
+
+bool
+LibVLCpp::MediaPlayer::willPlay()
+{
+ return libvlc_media_player_will_play( *this ) != 0;
+}
diff --git a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h
index 9a60e8e..b4de7f9 100644
--- a/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h
+++ b/src/Backend/VLC/LibVLCpp/VLCMediaPlayer.h
@@ -75,6 +75,7 @@ namespace LibVLCpp
libvlc_video_display_cb display, void* data );
void setupVmem( const char* chroma, unsigned int width,
unsigned int height, unsigned int pitch );
+ bool willPlay();
void registerEvents( libvlc_callback_t callback, void* data );
diff --git a/src/Backend/VLC/VLCSource.cpp b/src/Backend/VLC/VLCSource.cpp
index 29052f8..24ce0d1 100644
--- a/src/Backend/VLC/VLCSource.cpp
+++ b/src/Backend/VLC/VLCSource.cpp
@@ -73,7 +73,7 @@ VLCSource::preparse()
LibVLCpp::MediaPlayer* mediaPlayer = renderer->mediaPlayer();
{
EventWaiter ew( mediaPlayer, true );
- ew.add( libvlc_MediaPlayerLengthChanged );
+ ew.add( libvlc_MediaPlayerVout );
renderer->start();
if ( ew.wait( 3000 ) != EventWaiter::Success )
{
diff --git a/src/Backend/VLC/VLCSourceRenderer.cpp b/src/Backend/VLC/VLCSourceRenderer.cpp
index 3dbc17e..9435421 100644
--- a/src/Backend/VLC/VLCSourceRenderer.cpp
+++ b/src/Backend/VLC/VLCSourceRenderer.cpp
@@ -44,7 +44,7 @@ VLCSourceRenderer::VLCSourceRenderer( VLCBackend* backendInstance, VLCSource *so
, m_outputFps( .0f )
, m_outputAudioBitrate( 0 )
{
- m_media = new LibVLCpp::Media( *source->media() );
+ m_media = new LibVLCpp::Media( backendInstance->vlcInstance(), source->media()->mrl() );
initMediaPlayer();
}
@@ -154,6 +154,7 @@ void
VLCSourceRenderer::setOption( const QString &option )
{
Q_ASSERT( m_media != NULL );
+ vlmcDebug() << m_name << "Setting option:" << option;
m_media->addOption( qPrintable( option ) );
}
diff --git a/src/Backend/VLC/VLCVmemRenderer.cpp b/src/Backend/VLC/VLCVmemRenderer.cpp
index 8401d5a..4adcb77 100644
--- a/src/Backend/VLC/VLCVmemRenderer.cpp
+++ b/src/Backend/VLC/VLCVmemRenderer.cpp
@@ -31,6 +31,7 @@ VmemRenderer::VmemRenderer( VLCBackend* backend, VLCSource *source , ISourceRend
: VLCSourceRenderer( backend, source, callback )
, m_snapshotRequired( false )
{
+ m_media->parse();
setName( "VmemRenderer" );
m_snapshot = new QImage( 320, 180, QImage::Format_RGB32 );
m_mediaPlayer->setupVmem( "RV32", m_snapshot->width(), m_snapshot->height(), m_snapshot->bytesPerLine() );
More information about the Vlmc-devel
mailing list