mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
Changes to make Spotify resolver work
This commit is contained in:
@@ -53,11 +53,8 @@ include( CheckTagLibFileName )
|
|||||||
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
|
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
|
||||||
|
|
||||||
# optional
|
# optional
|
||||||
IF( ENABLE_JREEN )
|
|
||||||
macro_optional_find_package(Jreen)
|
macro_optional_find_package(Jreen)
|
||||||
IF( LIBJREEN_FOUND )
|
IF( ENABLE_JREEN AND NOT LIBJREEN_FOUND )
|
||||||
macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP library" "http://gitorious.org/jreen" FALSE "" "Jreen is needed for the alternative/new Jabber SIP plugin. Built automatically inside Tomahawk, if not installed systemwide and ENABLE_JREEN is true")
|
|
||||||
ELSE( LIBJREEN_FOUND )
|
|
||||||
ADD_SUBDIRECTORY( thirdparty/jreen )
|
ADD_SUBDIRECTORY( thirdparty/jreen )
|
||||||
SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
|
SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
|
||||||
IF( UNIX AND NOT APPLE )
|
IF( UNIX AND NOT APPLE )
|
||||||
@@ -68,17 +65,19 @@ IF( ENABLE_JREEN )
|
|||||||
ENDIF( WIN32 )
|
ENDIF( WIN32 )
|
||||||
SET( LIBJREEN_FOUND true )
|
SET( LIBJREEN_FOUND true )
|
||||||
MESSAGE(STATUS "Internal libjreen: ${LIBJREEN_INCLUDE_DIR}, ${LIBJREEN_LIBRARY}")
|
MESSAGE(STATUS "Internal libjreen: ${LIBJREEN_INCLUDE_DIR}, ${LIBJREEN_LIBRARY}")
|
||||||
ENDIF( LIBJREEN_FOUND )
|
ENDIF( ENABLE_JREEN AND NOT LIBJREEN_FOUND )
|
||||||
ELSE( LIBJREEN_FOUND )
|
|
||||||
macro_optional_find_package(Gloox 1.0)
|
|
||||||
macro_log_feature(GLOOX_FOUND "Gloox" "A portable high-level Jabber/XMPP library for C++" "http://camaya.net/gloox" FALSE "" "Gloox is needed for the Jabber SIP plugin and the XMPP-Bot")
|
|
||||||
|
|
||||||
ENDIF( ENABLE_JREEN )
|
|
||||||
|
|
||||||
IF( WIN32 )
|
IF( WIN32 )
|
||||||
find_library(QTSPARKLE_LIBRARIES qtsparkle)
|
find_library(QTSPARKLE_LIBRARIES qtsparkle)
|
||||||
ENDIF( WIN32 )
|
ENDIF( WIN32 )
|
||||||
|
|
||||||
|
macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP library" "http://gitorious.org/jreen" FALSE "" "Jreen is needed for the alternative/new Jabber SIP plugin. Built automatically inside Tomahawk, if not installed systemwide and ENABLE_JREEN is true")
|
||||||
|
|
||||||
|
macro_optional_find_package(Gloox 1.0)
|
||||||
|
IF( ENABLE_JREEN )
|
||||||
|
set( GLOOX_FOUND false )
|
||||||
|
ENDIF( ENABLE_JREEN)
|
||||||
|
macro_log_feature(GLOOX_FOUND "Gloox" "A portable high-level Jabber/XMPP library for C++" "http://camaya.net/gloox" FALSE "" "Gloox is needed for the Jabber SIP plugin and the XMPP-Bot")
|
||||||
#show dep log
|
#show dep log
|
||||||
macro_display_feature_log()
|
macro_display_feature_log()
|
||||||
MESSAGE("WARNING!")
|
MESSAGE("WARNING!")
|
||||||
|
@@ -112,7 +112,7 @@ public:
|
|||||||
virtual void getInfo( const QString &caller, const InfoType type, const QVariant &data, InfoCustomData customData ) = 0;
|
virtual void getInfo( const QString &caller, const InfoType type, const QVariant &data, InfoCustomData customData ) = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void getCachedInfo( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData );
|
void getCachedInfo( Tomahawk::InfoSystem::InfoCacheCriteria criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData );
|
||||||
void updateCache( Tomahawk::InfoSystem::InfoCacheCriteria criteria, Tomahawk::InfoSystem::InfoType type, QVariant output );
|
void updateCache( Tomahawk::InfoSystem::InfoCacheCriteria criteria, Tomahawk::InfoSystem::InfoType type, QVariant output );
|
||||||
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
|
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
|
||||||
void finished( QString, Tomahawk::InfoSystem::InfoType );
|
void finished( QString, Tomahawk::InfoSystem::InfoType );
|
||||||
|
@@ -178,7 +178,7 @@ LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const Q
|
|||||||
criteria["artist"] = hash["artist"].toString();
|
criteria["artist"] = hash["artist"].toString();
|
||||||
criteria["album"] = hash["album"].toString();
|
criteria["album"] = hash["album"].toString();
|
||||||
|
|
||||||
emit getCachedInfo( criteria, 2419200000, caller, type, data, customData );
|
emit getCachedInfo( criteria, caller, type, data, customData );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -66,7 +66,7 @@ InfoSystemCache::~InfoSystemCache()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoSystemCache::getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData )
|
InfoSystemCache::getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
if( !m_dataCache.contains( type ) || !m_dataCache[type].contains( criteria ) )
|
if( !m_dataCache.contains( type ) || !m_dataCache[type].contains( criteria ) )
|
||||||
@@ -75,48 +75,20 @@ InfoSystemCache::getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria crit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash< InfoCacheCriteria, QDateTime > typemaxtimecache = m_maxTimeCache[type];
|
|
||||||
|
|
||||||
if ( typemaxtimecache[criteria].toMSecsSinceEpoch() < QDateTime::currentMSecsSinceEpoch() )
|
|
||||||
{
|
|
||||||
QHash< InfoCacheCriteria, QVariant > typedatacache = m_dataCache[type];
|
|
||||||
QHash< InfoCacheCriteria, QDateTime > typeinserttimecache = m_insertTimeCache[type];
|
|
||||||
typemaxtimecache.remove( criteria );
|
|
||||||
m_maxTimeCache[type] = typemaxtimecache;
|
|
||||||
typedatacache.remove( criteria );
|
|
||||||
m_dataCache[type] = typedatacache;
|
|
||||||
typeinserttimecache.remove( criteria );
|
|
||||||
m_insertTimeCache[type] = typeinserttimecache;
|
|
||||||
m_dirtySet.insert( type );
|
|
||||||
emit notInCache( criteria, caller, type, input, customData );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( newMaxAge > 0 )
|
|
||||||
{
|
|
||||||
QHash< InfoCacheCriteria, QDateTime > typemaxtimecache = m_maxTimeCache[type];
|
|
||||||
typemaxtimecache[criteria] = QDateTime::fromMSecsSinceEpoch( QDateTime::currentMSecsSinceEpoch() + newMaxAge );
|
|
||||||
m_maxTimeCache[type] = typemaxtimecache;
|
|
||||||
m_dirtySet.insert( type );
|
|
||||||
}
|
|
||||||
|
|
||||||
emit info( caller, type, input, m_dataCache[type][criteria], customData );
|
emit info( caller, type, input, m_dataCache[type][criteria], customData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoSystemCache::updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 maxAge, Tomahawk::InfoSystem::InfoType type, QVariant output )
|
InfoSystemCache::updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, Tomahawk::InfoSystem::InfoType type, QVariant output )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
QHash< InfoCacheCriteria, QVariant > typedatacache = m_dataCache[type];
|
QHash< InfoCacheCriteria, QVariant > typedatacache = m_dataCache[type];
|
||||||
QHash< InfoCacheCriteria, QDateTime > typeinserttimecache = m_insertTimeCache[type];
|
QHash< InfoCacheCriteria, QDateTime > typetimecache = m_timeCache[type];
|
||||||
QHash< InfoCacheCriteria, QDateTime > typemaxtimecache = m_maxTimeCache[type];
|
|
||||||
typedatacache[criteria] = output;
|
typedatacache[criteria] = output;
|
||||||
typeinserttimecache[criteria] = QDateTime::currentDateTimeUtc();
|
typetimecache[criteria] = QDateTime::currentDateTimeUtc();
|
||||||
typemaxtimecache[criteria] = QDateTime::fromMSecsSinceEpoch( QDateTime::currentMSecsSinceEpoch() + maxAge );
|
|
||||||
m_dataCache[type] = typedatacache;
|
m_dataCache[type] = typedatacache;
|
||||||
m_insertTimeCache[type] = typeinserttimecache;
|
m_timeCache[type] = typetimecache;
|
||||||
m_maxTimeCache[type] = typemaxtimecache;
|
|
||||||
m_dirtySet.insert( type );
|
m_dirtySet.insert( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,13 +101,10 @@ InfoSystemCache::loadCache( InfoType type, const QString &cacheFile )
|
|||||||
|
|
||||||
foreach( QString group, cachedSettings.childGroups() )
|
foreach( QString group, cachedSettings.childGroups() )
|
||||||
{
|
{
|
||||||
cachedSettings.beginGroup( group );
|
|
||||||
if ( cachedSettings.value( "maxtime" ).toDateTime().toMSecsSinceEpoch() < QDateTime::currentMSecsSinceEpoch() )
|
|
||||||
continue;
|
|
||||||
QHash< InfoCacheCriteria, QVariant > dataHash = m_dataCache[type];
|
QHash< InfoCacheCriteria, QVariant > dataHash = m_dataCache[type];
|
||||||
QHash< InfoCacheCriteria, QDateTime > insertDateHash = m_insertTimeCache[type];
|
QHash< InfoCacheCriteria, QDateTime > dateHash = m_timeCache[type];
|
||||||
QHash< InfoCacheCriteria, QDateTime > maxDateHash = m_maxTimeCache[type];
|
|
||||||
InfoCacheCriteria criteria;
|
InfoCacheCriteria criteria;
|
||||||
|
cachedSettings.beginGroup( group );
|
||||||
int numCriteria = cachedSettings.beginReadArray( "criteria" );
|
int numCriteria = cachedSettings.beginReadArray( "criteria" );
|
||||||
for( int i = 0; i < numCriteria; i++ )
|
for( int i = 0; i < numCriteria; i++ )
|
||||||
{
|
{
|
||||||
@@ -146,12 +115,10 @@ InfoSystemCache::loadCache( InfoType type, const QString &cacheFile )
|
|||||||
}
|
}
|
||||||
cachedSettings.endArray();
|
cachedSettings.endArray();
|
||||||
dataHash[criteria] = cachedSettings.value( "data" );
|
dataHash[criteria] = cachedSettings.value( "data" );
|
||||||
insertDateHash[criteria] = cachedSettings.value( "inserttime" ).toDateTime();
|
dateHash[criteria] = cachedSettings.value( "time" ).toDateTime();
|
||||||
maxDateHash[criteria] = cachedSettings.value( "maxtime" ).toDateTime();
|
|
||||||
cachedSettings.endGroup();
|
cachedSettings.endGroup();
|
||||||
m_dataCache[type] = dataHash;
|
m_dataCache[type] = dataHash;
|
||||||
m_insertTimeCache[type] = insertDateHash;
|
m_timeCache[type] = dateHash;
|
||||||
m_maxTimeCache[type] = maxDateHash;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,8 +156,7 @@ InfoSystemCache::saveCache( InfoType type, const QString &cacheDir )
|
|||||||
}
|
}
|
||||||
cachedSettings.endArray();
|
cachedSettings.endArray();
|
||||||
cachedSettings.setValue( "data", m_dataCache[type][criteria] );
|
cachedSettings.setValue( "data", m_dataCache[type][criteria] );
|
||||||
cachedSettings.setValue( "inserttime", m_insertTimeCache[type][criteria] );
|
cachedSettings.setValue( "time", m_timeCache[type][criteria] );
|
||||||
cachedSettings.setValue( "maxtime", m_maxTimeCache[type][criteria] );
|
|
||||||
cachedSettings.endGroup();
|
cachedSettings.endGroup();
|
||||||
++criteriaNumber;
|
++criteriaNumber;
|
||||||
}
|
}
|
||||||
|
@@ -45,16 +45,15 @@ signals:
|
|||||||
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
|
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData );
|
void getCachedInfoSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, Tomahawk::InfoSystem::InfoCustomData customData );
|
||||||
void updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, qint64 maxAge, Tomahawk::InfoSystem::InfoType type, QVariant output );
|
void updateCacheSlot( Tomahawk::InfoSystem::InfoCacheCriteria criteria, Tomahawk::InfoSystem::InfoType type, QVariant output );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadCache( InfoType type, const QString &cacheFile );
|
void loadCache( InfoType type, const QString &cacheFile );
|
||||||
void saveCache( InfoType type, const QString &cacheDir );
|
void saveCache( InfoType type, const QString &cacheDir );
|
||||||
|
|
||||||
QHash< InfoType, QHash< InfoCacheCriteria, QVariant > > m_dataCache;
|
QHash< InfoType, QHash< InfoCacheCriteria, QVariant > > m_dataCache;
|
||||||
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_insertTimeCache;
|
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_timeCache;
|
||||||
QHash< InfoType, QHash< InfoCacheCriteria, QDateTime > > m_maxTimeCache;
|
|
||||||
QSet< InfoType > m_dirtySet;
|
QSet< InfoType > m_dirtySet;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@ set( libSources
|
|||||||
sip/SipPlugin.cpp
|
sip/SipPlugin.cpp
|
||||||
|
|
||||||
audio/madtranscode.cpp
|
audio/madtranscode.cpp
|
||||||
|
audio/dummytranscode.cpp
|
||||||
audio/vorbistranscode.cpp
|
audio/vorbistranscode.cpp
|
||||||
audio/flactranscode.cpp
|
audio/flactranscode.cpp
|
||||||
audio/audioengine.cpp
|
audio/audioengine.cpp
|
||||||
@@ -175,6 +176,7 @@ set( libHeaders
|
|||||||
|
|
||||||
audio/transcodeinterface.h
|
audio/transcodeinterface.h
|
||||||
audio/madtranscode.h
|
audio/madtranscode.h
|
||||||
|
audio/dummytranscode.h
|
||||||
audio/vorbistranscode.h
|
audio/vorbistranscode.h
|
||||||
audio/flactranscode.h
|
audio/flactranscode.h
|
||||||
audio/audioengine.h
|
audio/audioengine.h
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include "network/servent.h"
|
#include "network/servent.h"
|
||||||
|
|
||||||
#include "madtranscode.h"
|
#include "madtranscode.h"
|
||||||
|
#include "dummytranscode.h"
|
||||||
#ifndef NO_OGG
|
#ifndef NO_OGG
|
||||||
#include "vorbistranscode.h"
|
#include "vorbistranscode.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -205,7 +206,9 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setCurrentTrack( result );
|
setCurrentTrack( result );
|
||||||
|
qDebug() << "Getting IODEVICE, on thread:" << QThread::currentThread() << QThread::currentThreadId();
|
||||||
io = Servent::instance()->getIODeviceForUrl( m_currentTrack );
|
io = Servent::instance()->getIODeviceForUrl( m_currentTrack );
|
||||||
|
qDebug() << "GOT IODEVICE:" << io.data();
|
||||||
if ( m_currentTrack->url().startsWith( "http://" ) )
|
if ( m_currentTrack->url().startsWith( "http://" ) )
|
||||||
{
|
{
|
||||||
m_readReady = false;
|
m_readReady = false;
|
||||||
@@ -228,12 +231,15 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
qDebug() << "Starting new song from url:" << m_currentTrack->url();
|
qDebug() << "Starting new song from url:" << m_currentTrack->url();
|
||||||
emit loading( m_currentTrack );
|
emit loading( m_currentTrack );
|
||||||
|
|
||||||
|
qDebug() << "input is:" << m_input.isNull();
|
||||||
if ( !m_input.isNull() )
|
if ( !m_input.isNull() )
|
||||||
{
|
{
|
||||||
m_input->close();
|
m_input->close();
|
||||||
m_input.clear();
|
m_input.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !m_lastTrack.isNull() ) qDebug() << "LAST TRACK:" << m_lastTrack->mimetype();
|
||||||
|
qDebug() << "LOADING SONG:" << m_currentTrack->mimetype();
|
||||||
if ( m_lastTrack.isNull() || ( m_currentTrack->mimetype() != m_lastTrack->mimetype() ) )
|
if ( m_lastTrack.isNull() || ( m_currentTrack->mimetype() != m_lastTrack->mimetype() ) )
|
||||||
{
|
{
|
||||||
if ( !m_transcode.isNull() )
|
if ( !m_transcode.isNull() )
|
||||||
@@ -241,7 +247,10 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
m_transcode.clear();
|
m_transcode.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_currentTrack->mimetype() == "audio/mpeg" )
|
if ( m_currentTrack->mimetype() == "audio/basic" )
|
||||||
|
{
|
||||||
|
m_transcode = QSharedPointer<TranscodeInterface>(new DummyTranscode());
|
||||||
|
} else if ( m_currentTrack->mimetype() == "audio/mpeg" )
|
||||||
{
|
{
|
||||||
m_transcode = QSharedPointer<TranscodeInterface>(new MADTranscode());
|
m_transcode = QSharedPointer<TranscodeInterface>(new MADTranscode());
|
||||||
}
|
}
|
||||||
@@ -430,6 +439,8 @@ AudioEngine::onDownloadProgress( qint64 recv, qint64 total )
|
|||||||
{
|
{
|
||||||
if ( ( recv > 1024 * 32 ) || recv > total )
|
if ( ( recv > 1024 * 32 ) || recv > total )
|
||||||
m_readReady = true;
|
m_readReady = true;
|
||||||
|
|
||||||
|
// qDebug() << "Got onDownloadProgress from reading http stream, received enough?" << m_readReady << "(" << recv << "> 1024 * 32 and" << recv << "<" << total << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -459,15 +470,17 @@ AudioEngine::loop()
|
|||||||
{
|
{
|
||||||
QMutexLocker lock( &m_mutex );
|
QMutexLocker lock( &m_mutex );
|
||||||
|
|
||||||
/* if ( m_i % 200 == 0 )
|
// if ( m_i % 200 == 0 )
|
||||||
{
|
// {
|
||||||
if ( !m_input.isNull() )
|
// if ( !m_input.isNull() )
|
||||||
qDebug() << "Outer audio loop" << m_input->bytesAvailable() << m_audio->needData();
|
// qDebug() << "Outer audio loop" << m_input->bytesAvailable() << m_audio->needData();
|
||||||
}*/
|
// }
|
||||||
|
|
||||||
if ( m_i % 10 == 0 && m_audio->isPlaying() )
|
if ( m_i % 10 == 0 && m_audio->isPlaying() )
|
||||||
m_audio->triggerTimers();
|
m_audio->triggerTimers();
|
||||||
|
|
||||||
|
// qDebug() << !m_transcode.isNull() << !m_input.isNull() << m_audio->needData() << !m_audio->isPaused();
|
||||||
|
// if( !m_input.isNull() ) qDebug() << "INPUT has bytes:" << m_input->bytesAvailable();
|
||||||
if( !m_transcode.isNull() &&
|
if( !m_transcode.isNull() &&
|
||||||
!m_input.isNull() &&
|
!m_input.isNull() &&
|
||||||
m_input->bytesAvailable() &&
|
m_input->bytesAvailable() &&
|
||||||
@@ -503,6 +516,7 @@ AudioEngine::loop()
|
|||||||
!m_audio->haveData() &&
|
!m_audio->haveData() &&
|
||||||
!m_audio->isPaused() )
|
!m_audio->isPaused() )
|
||||||
{
|
{
|
||||||
|
qDebug() << !m_input.isNull() << m_input->atEnd() << m_readReady << !m_input->bytesAvailable() << !m_audio->haveData() << !m_audio->isPaused();
|
||||||
qDebug() << "Starting next track then";
|
qDebug() << "Starting next track then";
|
||||||
loadNextTrack();
|
loadNextTrack();
|
||||||
// will need data immediately:
|
// will need data immediately:
|
||||||
|
62
src/libtomahawk/audio/dummytranscode.cpp
Normal file
62
src/libtomahawk/audio/dummytranscode.cpp
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dummytranscode.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
DummyTranscode::DummyTranscode()
|
||||||
|
: m_init( false )
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DummyTranscode::~DummyTranscode()
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DummyTranscode::processData( const QByteArray &buffer, bool finish )
|
||||||
|
{
|
||||||
|
m_buffer.append( buffer );
|
||||||
|
// qDebug() << "DUMMYTRANSCODING:" << buffer.size();
|
||||||
|
|
||||||
|
if( !m_init && m_buffer.size() >= 16364 ) {
|
||||||
|
m_init = true;
|
||||||
|
emit streamInitialized( 44100, 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DummyTranscode::onSeek( int seconds )
|
||||||
|
{
|
||||||
|
m_buffer.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DummyTranscode::clearBuffers()
|
||||||
|
{
|
||||||
|
m_buffer.clear();
|
||||||
|
m_init = false;
|
||||||
|
}
|
||||||
|
|
63
src/libtomahawk/audio/dummytranscode.h
Normal file
63
src/libtomahawk/audio/dummytranscode.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) 2011 Leo Franchi <leo@kdab.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DUMMYTRANSCODE_H
|
||||||
|
#define DUMMYTRANSCODE_H
|
||||||
|
|
||||||
|
#include "audio/transcodeinterface.h"
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#define _BUFFER_PREFERRED 32768
|
||||||
|
|
||||||
|
class DLLEXPORT DummyTranscode : public TranscodeInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DummyTranscode();
|
||||||
|
virtual ~DummyTranscode();
|
||||||
|
|
||||||
|
const QStringList supportedTypes() const { QStringList l; l << "audio/basic"; return l; }
|
||||||
|
|
||||||
|
int needData() { return true; } // always eats data
|
||||||
|
bool haveData() { return !m_buffer.isEmpty(); }
|
||||||
|
|
||||||
|
unsigned int preferredDataSize() { return _BUFFER_PREFERRED; }
|
||||||
|
|
||||||
|
QByteArray data() { QByteArray b = m_buffer; m_buffer.clear(); return b; }
|
||||||
|
|
||||||
|
virtual void setBufferCapacity( int bytes ) { m_bufferCapacity = bytes; }
|
||||||
|
int bufferSize() { return m_buffer.size(); }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void clearBuffers();
|
||||||
|
virtual void onSeek( int seconds );
|
||||||
|
virtual void processData( const QByteArray& data, bool finish );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void streamInitialized( long sampleRate, int channels );
|
||||||
|
void timeChanged( int seconds );
|
||||||
|
|
||||||
|
private:
|
||||||
|
QByteArray m_buffer;
|
||||||
|
int m_bufferCapacity;
|
||||||
|
bool m_init;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DUMMYTRANSCODE_H
|
@@ -832,7 +832,6 @@ Servent::registerIODeviceFactory( const QString &proto, boost::function<QSharedP
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QSharedPointer<QIODevice>
|
QSharedPointer<QIODevice>
|
||||||
Servent::getIODeviceForUrl( const Tomahawk::result_ptr& result )
|
Servent::getIODeviceForUrl( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
@@ -845,9 +844,9 @@ Servent::getIODeviceForUrl( const Tomahawk::result_ptr& result )
|
|||||||
|
|
||||||
const QString proto = rx.cap( 1 );
|
const QString proto = rx.cap( 1 );
|
||||||
//const QString urlpart = rx.cap( 2 );
|
//const QString urlpart = rx.cap( 2 );
|
||||||
|
qDebug() << "Getting IODevice for URL:" << proto << m_iofactories.contains( proto );
|
||||||
if ( !m_iofactories.contains( proto ) )
|
if ( !m_iofactories.contains( proto ) )
|
||||||
return sp;
|
return sp;
|
||||||
|
|
||||||
return m_iofactories.value( proto )( result );
|
return m_iofactories.value( proto )( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,5 +869,5 @@ Servent::httpIODeviceFactory( const Tomahawk::result_ptr& result )
|
|||||||
qDebug() << Q_FUNC_INFO << result->url();
|
qDebug() << Q_FUNC_INFO << result->url();
|
||||||
QNetworkRequest req( result->url() );
|
QNetworkRequest req( result->url() );
|
||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
|
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
|
||||||
return QSharedPointer<QIODevice>( reply );
|
return QSharedPointer<QIODevice>( reply, &QObject::deleteLater );
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ StreamConnection::StreamConnection( Servent* s, ControlConnection* cc, QString f
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
BufferIODevice* bio = new BufferIODevice( result->size() );
|
BufferIODevice* bio = new BufferIODevice( result->size() );
|
||||||
m_iodev = QSharedPointer<QIODevice>( bio ); // device audio data gets written to
|
m_iodev = QSharedPointer<QIODevice>( bio, &QObject::deleteLater ); // device audio data gets written to
|
||||||
m_iodev->open( QIODevice::ReadWrite );
|
m_iodev->open( QIODevice::ReadWrite );
|
||||||
|
|
||||||
Servent::instance()->registerStreamConnection( this );
|
Servent::instance()->registerStreamConnection( this );
|
||||||
|
@@ -46,6 +46,8 @@ ScriptResolver::ScriptResolver( const QString& exe )
|
|||||||
|
|
||||||
ScriptResolver::~ScriptResolver()
|
ScriptResolver::~ScriptResolver()
|
||||||
{
|
{
|
||||||
|
stop();
|
||||||
|
|
||||||
Tomahawk::Pipeline::instance()->removeResolver( this );
|
Tomahawk::Pipeline::instance()->removeResolver( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +239,7 @@ void
|
|||||||
ScriptResolver::stop()
|
ScriptResolver::stop()
|
||||||
{
|
{
|
||||||
m_stopped = true;
|
m_stopped = true;
|
||||||
|
qDebug() << "KILLING PROCESS!";
|
||||||
m_proc.kill();
|
m_proc.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -223,7 +223,7 @@ TomahawkApp::init()
|
|||||||
qDebug() << "Init Scrobbler.";
|
qDebug() << "Init Scrobbler.";
|
||||||
m_scrobbler = new Scrobbler( this );
|
m_scrobbler = new Scrobbler( this );
|
||||||
qDebug() << "Setting NAM.";
|
qDebug() << "Setting NAM.";
|
||||||
TomahawkUtils::setNam( new lastfm::NetworkAccessManager( this ) );
|
TomahawkUtils::setNam( lastfm::nam() );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
qDebug() << "Setting NAM.";
|
qDebug() << "Setting NAM.";
|
||||||
@@ -290,6 +290,13 @@ TomahawkApp::~TomahawkApp()
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
// stop script resolvers
|
||||||
|
foreach( Tomahawk::ExternalResolver* r, m_scriptResolvers )
|
||||||
|
{
|
||||||
|
delete r;
|
||||||
|
}
|
||||||
|
m_scriptResolvers.clear();
|
||||||
|
|
||||||
delete m_sipHandler;
|
delete m_sipHandler;
|
||||||
delete m_servent;
|
delete m_servent;
|
||||||
delete m_scanManager;
|
delete m_scanManager;
|
||||||
|
Reference in New Issue
Block a user