[vlmc-devel] MetadataWorker: Avoid audio to be heard while loading audio files
Hugo Beauzée-Luyssen
git at videolan.org
Mon Sep 3 23:51:00 CEST 2012
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Sep 3 23:17:24 2012 +0300| [64abedc950d7e5558a506183c9a95269da8b95fd] | committer: Hugo Beauzée-Luyssen
MetadataWorker: Avoid audio to be heard while loading audio files
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=64abedc950d7e5558a506183c9a95269da8b95fd
---
src/LibVLCpp/VLCMediaPlayer.cpp | 5 +++++
src/LibVLCpp/VLCMediaPlayer.h | 1 +
src/Metadata/MetaDataWorker.cpp | 7 ++++---
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/LibVLCpp/VLCMediaPlayer.cpp b/src/LibVLCpp/VLCMediaPlayer.cpp
index 55be8a1..3475a09 100644
--- a/src/LibVLCpp/VLCMediaPlayer.cpp
+++ b/src/LibVLCpp/VLCMediaPlayer.cpp
@@ -294,3 +294,8 @@ MediaPlayer::setKeyInput( bool enabled )
{
libvlc_video_set_key_input( m_internalPtr, enabled );
}
+
+void MediaPlayer::setAudioOutput(const char *module)
+{
+ libvlc_audio_output_set( m_internalPtr, module );
+}
diff --git a/src/LibVLCpp/VLCMediaPlayer.h b/src/LibVLCpp/VLCMediaPlayer.h
index 6de9cd5..50e1fc0 100644
--- a/src/LibVLCpp/VLCMediaPlayer.h
+++ b/src/LibVLCpp/VLCMediaPlayer.h
@@ -71,6 +71,7 @@ namespace LibVLCpp
int getNbAudioTrack();
int getNbVideoTrack();
void setKeyInput( bool enabled );
+ void setAudioOutput(const char* module);
private:
static void callbacks( const libvlc_event_t* event, void* self );
diff --git a/src/Metadata/MetaDataWorker.cpp b/src/Metadata/MetaDataWorker.cpp
index 265b907..643f7fd 100644
--- a/src/Metadata/MetaDataWorker.cpp
+++ b/src/Metadata/MetaDataWorker.cpp
@@ -65,6 +65,9 @@ MetaDataWorker::compute()
computeImageMetaData();
m_media->addConstantParam( ":vout=dummy" );
+ //In VLC 2.x we can't set the volume before the playback has started
+ //so just switch off the audio-output in any case.
+ m_mediaPlayer->setAudioOutput( "dummy" );
m_mediaPlayer->setMedia( m_media->vlcMedia() );
connect( m_mediaPlayer, SIGNAL( playing() ),
this, SLOT( entrypointPlaying() ), Qt::QueuedConnection );
@@ -89,9 +92,7 @@ void
MetaDataWorker::computeDynamicFileMetaData()
{
//Disabling audio for this specific use of the media
- if ( m_media->fileType() == Media::Audio )
- m_media->addVolatileParam( ":volume 0", ":volume 512" );
- else
+ if ( m_media->fileType() == Media::Video )
m_media->addVolatileParam( ":no-audio", ":audio" );
connect( m_mediaPlayer, SIGNAL( lengthChanged( qint64 ) ),
this, SLOT( entrypointLengthChanged( qint64 ) ), Qt::QueuedConnection );
More information about the Vlmc-devel
mailing list