Commit 64abedc9 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MetadataWorker: Avoid audio to be heard while loading audio files

parent 6c1ebe47
......@@ -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 );
}
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment