mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 19:37:09 +02:00
* Keep current transcoder in memory if we keep using it for the next track.
This commit is contained in:
@@ -147,6 +147,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
err = true;
|
err = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_lastTrack = m_currentTrack;
|
||||||
m_currentTrack = result;
|
m_currentTrack = result;
|
||||||
io = TomahawkApp::instance()->getIODeviceForUrl( m_currentTrack );
|
io = TomahawkApp::instance()->getIODeviceForUrl( m_currentTrack );
|
||||||
|
|
||||||
@@ -170,28 +171,33 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
m_input.clear();
|
m_input.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_lastTrack.isNull() || ( m_currentTrack->mimetype() != m_lastTrack->mimetype() ) )
|
||||||
|
{
|
||||||
|
if ( !m_transcode.isNull() )
|
||||||
|
{
|
||||||
|
m_transcode.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_currentTrack->mimetype() == "audio/mpeg" )
|
||||||
|
{
|
||||||
|
m_transcode = QSharedPointer<TranscodeInterface>(new MADTranscode());
|
||||||
|
}
|
||||||
|
#ifndef NO_OGG
|
||||||
|
else if ( m_currentTrack->mimetype() == "application/ogg" )
|
||||||
|
{
|
||||||
|
m_transcode = QSharedPointer<TranscodeInterface>(new VorbisTranscode());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
qDebug() << "Could NOT find suitable transcoder! Stopping audio.";
|
||||||
|
|
||||||
|
if ( !m_transcode.isNull() )
|
||||||
|
connect( m_transcode.data(), SIGNAL( streamInitialized( long, int ) ), SLOT( setStreamData( long, int ) ), Qt::DirectConnection );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !m_transcode.isNull() )
|
if ( !m_transcode.isNull() )
|
||||||
{
|
{
|
||||||
m_transcode->clearBuffers();
|
m_transcode->clearBuffers();
|
||||||
m_transcode.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_currentTrack->mimetype() == "audio/mpeg" )
|
|
||||||
{
|
|
||||||
m_transcode = QSharedPointer<TranscodeInterface>(new MADTranscode());
|
|
||||||
}
|
|
||||||
#ifndef NO_OGG
|
|
||||||
else if ( m_currentTrack->mimetype() == "application/ogg" )
|
|
||||||
{
|
|
||||||
m_transcode = QSharedPointer<TranscodeInterface>(new VorbisTranscode());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
qDebug() << "Could NOT find suitable transcoder! Stopping audio.";
|
|
||||||
|
|
||||||
if ( !m_transcode.isNull() )
|
|
||||||
{
|
|
||||||
connect( m_transcode.data(), SIGNAL( streamInitialized( long, int ) ), SLOT( setStreamData( long, int ) ), Qt::DirectConnection );
|
|
||||||
m_input = io;
|
m_input = io;
|
||||||
|
|
||||||
m_audio->clearBuffers();
|
m_audio->clearBuffers();
|
||||||
|
@@ -84,6 +84,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Tomahawk::result_ptr m_currentTrack;
|
Tomahawk::result_ptr m_currentTrack;
|
||||||
|
Tomahawk::result_ptr m_lastTrack;
|
||||||
PlaylistInterface* m_playlist;
|
PlaylistInterface* m_playlist;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ TrackModel::data( const QModelIndex& index, int role ) const
|
|||||||
return QSize( 0, 18 );
|
return QSize( 0, 18 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( role != Qt::DisplayRole )
|
if ( role != Qt::DisplayRole ) // && role != Qt::ToolTipRole )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
const query_ptr& query = entry->query();
|
const query_ptr& query = entry->query();
|
||||||
|
Reference in New Issue
Block a user