diff --git a/data/sounds/silence.ogg b/data/sounds/silence.ogg
deleted file mode 100644
index d7100cc46..000000000
Binary files a/data/sounds/silence.ogg and /dev/null differ
diff --git a/resources.qrc b/resources.qrc
index f839b1952..8cc61c536 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -170,6 +170,5 @@
data/images/downloadbutton.svg
data/images/nav-back.svg
data/images/nav-forward.svg
- data/sounds/silence.ogg
diff --git a/src/libtomahawk/audio/AudioEngine.cpp b/src/libtomahawk/audio/AudioEngine.cpp
index 63fc0a1b0..d34d760d8 100644
--- a/src/libtomahawk/audio/AudioEngine.cpp
+++ b/src/libtomahawk/audio/AudioEngine.cpp
@@ -167,7 +167,6 @@ AudioEngine::AudioEngine()
d->audioOutput = new AudioOutput( this );
- connect( d->audioOutput, SIGNAL( initialized() ), this, SIGNAL( initialized() ) );
connect( d->audioOutput, SIGNAL( stateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ), d_func(), SLOT( onStateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ) );
connect( d->audioOutput, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
connect( d->audioOutput, SIGNAL( positionChanged( float ) ), SLOT( onPositionChanged( float ) ) );
@@ -290,11 +289,8 @@ AudioEngine::stop( AudioErrorCode errorCode )
if ( d->waitingOnNewTrack )
sendWaitingNotification();
- if ( d->audioOutput->isInitialized() )
- {
- Tomahawk::InfoSystem::InfoPushData pushData( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant(), Tomahawk::InfoSystem::PushNoFlag );
- Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
- }
+ Tomahawk::InfoSystem::InfoPushData pushData( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant(), Tomahawk::InfoSystem::PushNoFlag );
+ Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
}
@@ -570,12 +566,6 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
-
- if ( !d->audioOutput->isInitialized() )
- {
- return;
- }
-
if ( !result )
{
stop();
diff --git a/src/libtomahawk/audio/AudioEngine.h b/src/libtomahawk/audio/AudioEngine.h
index 403ccb2a4..bc129c383 100644
--- a/src/libtomahawk/audio/AudioEngine.h
+++ b/src/libtomahawk/audio/AudioEngine.h
@@ -149,8 +149,6 @@ public slots:
void setShuffled( bool enabled );
signals:
- void initialized();
-
void loading( const Tomahawk::result_ptr track );
void started( const Tomahawk::result_ptr track );
void finished( const Tomahawk::result_ptr track );
diff --git a/src/libtomahawk/audio/AudioOutput.cpp b/src/libtomahawk/audio/AudioOutput.cpp
index c431ddbc8..48dbd00fd 100644
--- a/src/libtomahawk/audio/AudioOutput.cpp
+++ b/src/libtomahawk/audio/AudioOutput.cpp
@@ -25,13 +25,11 @@
#include "audio/MediaStream.h"
#include "utils/Logger.h"
-#include "utils/TomahawkUtils.h"
#include
#include
#include
#include
-#include
#include
#include
@@ -60,7 +58,6 @@ AudioOutput::AudioOutput( QObject* parent )
, m_currentTime( 0 )
, m_totalTime( 0 )
, m_justSeeked( false )
- , m_initialized( false )
, dspPluginCallback( nullptr )
, m_vlcInstance( nullptr )
, m_vlcPlayer( nullptr )
@@ -132,28 +129,7 @@ AudioOutput::AudioOutput( QObject* parent )
}
m_muted = isMuted();
-
- // HACK: play silent ogg file and set volume on that to workaround vlc not allowing to set volume before a file is played
- libvlc_media_player_set_media( m_vlcPlayer, m_vlcMedia );
- libvlc_media_player_play( m_vlcPlayer );
-
- m_silenceFile.setFileName( RESPATH "sounds/silence.ogg" );
- Q_ASSERT( m_silenceFile.exists() );
- Q_ASSERT( m_silenceFile.open( QIODevice::ReadOnly ) );
-
- setCurrentSource( new MediaStream( &m_silenceFile, true ) );
- libvlc_media_player_play( m_vlcPlayer );
-
- #if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
- // if the silence file did not play for 15 secs, we pretend the AudioOutput is initialized, to allow proper error reporting
- QTimer::singleShot( 15000, [&]()
- {
- if ( !m_initialized ) {
- m_initialized = true;
- emit initialized();
- }
- } );
- #endif
+ tDebug() << Q_FUNC_INFO << "Init OK";
}
@@ -179,27 +155,6 @@ AudioOutput::~AudioOutput()
}
-void
-AudioOutput::onInitVlcEvent( const libvlc_event_t* event )
-{
- switch ( event->type )
- {
- case libvlc_MediaPlayerTimeChanged:
- setVolume( volume() );
-
- m_initialized = true;
- m_silenceFile.close();
-
- tDebug() << Q_FUNC_INFO << "Init OK";
- emit initialized();
- break;
-
- default:
- break;
- }
-}
-
-
void
AudioOutput::setAutoDelete( bool ad )
{
@@ -348,13 +303,6 @@ AudioOutput::setCurrentSource( MediaStream* stream )
}
-bool
-AudioOutput::isInitialized() const
-{
- return m_initialized;
-}
-
-
AudioOutput::AudioState
AudioOutput::state() const
{
@@ -607,14 +555,7 @@ AudioOutput::vlcEventCallback( const libvlc_event_t* event, void* opaque )
AudioOutput* that = reinterpret_cast < AudioOutput * > ( opaque );
Q_ASSERT( that );
- if ( !that->isInitialized() )
- {
- that->onInitVlcEvent( event );
- }
- else
- {
- that->onVlcEvent( event );
- }
+ that->onVlcEvent( event );
}
diff --git a/src/libtomahawk/audio/AudioOutput.h b/src/libtomahawk/audio/AudioOutput.h
index ee03b7d71..504cb6cfb 100644
--- a/src/libtomahawk/audio/AudioOutput.h
+++ b/src/libtomahawk/audio/AudioOutput.h
@@ -25,8 +25,6 @@
#include "DllMacro.h"
#include "Typedefs.h"
-#include
-
#include
struct libvlc_instance_t;
@@ -46,7 +44,6 @@ public:
explicit AudioOutput( QObject* parent = nullptr );
~AudioOutput();
- bool isInitialized() const;
AudioState state() const;
void setCurrentSource( const QUrl& stream );
@@ -75,14 +72,11 @@ public:
public slots:
signals:
- void initialized();
void stateChanged( AudioOutput::AudioState, AudioOutput::AudioState );
void tick( qint64 );
void positionChanged( float );
private:
- void onInitVlcEvent( const libvlc_event_t* event );
-
void setState( AudioState state );
void setCurrentTime( qint64 time );
void setCurrentPosition( float position );
@@ -105,9 +99,6 @@ private:
qint64 m_totalTime;
bool m_justSeeked;
- bool m_initialized;
- QFile m_silenceFile;
-
std::function< void( int state, int frameNumber, float* samples, int nb_channels, int nb_samples ) > dspPluginCallback;
libvlc_instance_t* m_vlcInstance;
diff --git a/src/libtomahawk/audio/MediaStream.cpp b/src/libtomahawk/audio/MediaStream.cpp
index 97503bcc1..955c3be9f 100644
--- a/src/libtomahawk/audio/MediaStream.cpp
+++ b/src/libtomahawk/audio/MediaStream.cpp
@@ -41,16 +41,12 @@ MediaStream::MediaStream( const QUrl &url )
}
-MediaStream::MediaStream( QIODevice* device, bool bufferingFinished )
+MediaStream::MediaStream( QIODevice* device )
: QObject( nullptr )
, m_type( IODevice )
, m_ioDevice ( device )
- , m_bufferingFinished( bufferingFinished )
{
- if ( !bufferingFinished )
- {
- QObject::connect( m_ioDevice, SIGNAL( readChannelFinished() ), this, SLOT( bufferingFinished() ) );
- }
+ QObject::connect( m_ioDevice, SIGNAL( readChannelFinished() ), this, SLOT( bufferingFinished() ) );
}
diff --git a/src/libtomahawk/audio/MediaStream.h b/src/libtomahawk/audio/MediaStream.h
index 379f7eaa4..831e70a57 100644
--- a/src/libtomahawk/audio/MediaStream.h
+++ b/src/libtomahawk/audio/MediaStream.h
@@ -42,7 +42,7 @@ public:
MediaStream( QObject* parent = nullptr );
explicit MediaStream( const QUrl &url );
- explicit MediaStream( QIODevice* device, bool bufferingFinished = false );
+ explicit MediaStream( QIODevice* device );
virtual ~MediaStream();
MediaType type() const;