mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-20 12:52:30 +02:00
* Fixed HTTP streaming.
This commit is contained in:
@@ -62,6 +62,7 @@ AudioEngine::~AudioEngine()
|
||||
delete m_audio;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playPause()
|
||||
{
|
||||
@@ -72,6 +73,7 @@ AudioEngine::playPause()
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::play()
|
||||
{
|
||||
@@ -150,12 +152,14 @@ AudioEngine::setVolume( int percentage )
|
||||
emit volumeChanged( percentage );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::mute()
|
||||
{
|
||||
setVolume( 0 );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::onTrackAboutToClose()
|
||||
{
|
||||
@@ -184,6 +188,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
setCurrentTrack( result );
|
||||
io = Servent::instance()->getIODeviceForUrl( m_currentTrack );
|
||||
if ( m_currentTrack->url().startsWith( "http://" ) )
|
||||
{
|
||||
m_readReady = false;
|
||||
connect( io.data(), SIGNAL( downloadProgress( qint64, qint64 ) ), SLOT( onDownloadProgress( qint64, qint64 ) ) );
|
||||
}
|
||||
else
|
||||
m_readReady = true;
|
||||
|
||||
if ( !io || io.isNull() )
|
||||
{
|
||||
@@ -396,6 +407,14 @@ AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::onDownloadProgress( qint64 recv, qint64 total )
|
||||
{
|
||||
if ( ( recv > 1024 * 32 ) || recv > total )
|
||||
m_readReady = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::run()
|
||||
{
|
||||
@@ -461,6 +480,7 @@ AudioEngine::loop()
|
||||
// are we cleanly at the end of a track, and ready for the next one?
|
||||
if ( !m_input.isNull() &&
|
||||
m_input->atEnd() &&
|
||||
m_readReady &&
|
||||
!m_input->bytesAvailable() &&
|
||||
!m_audio->haveData() &&
|
||||
!m_audio->isPaused() )
|
||||
|
@@ -83,6 +83,8 @@ private slots:
|
||||
void loadPreviousTrack();
|
||||
void loadNextTrack();
|
||||
|
||||
void onDownloadProgress( qint64 recv, qint64 total );
|
||||
|
||||
void setStreamData( long sampleRate, int channels );
|
||||
void timerTriggered( unsigned int seconds );
|
||||
|
||||
@@ -111,6 +113,7 @@ private:
|
||||
PlaylistInterface* m_queue;
|
||||
QMutex m_mutex;
|
||||
|
||||
bool m_readReady;
|
||||
unsigned int m_timeElapsed;
|
||||
int m_i;
|
||||
|
||||
|
Reference in New Issue
Block a user