mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
* Ignore results with unsupported mimetypes.
This commit is contained in:
@@ -93,6 +93,21 @@ AudioEngine::~AudioEngine()
|
||||
}
|
||||
|
||||
|
||||
QStringList
|
||||
AudioEngine::supportedMimeTypes() const
|
||||
{
|
||||
if ( m_supportedMimeTypes.isEmpty() )
|
||||
{
|
||||
m_supportedMimeTypes = Phonon::BackendCapabilities::availableMimeTypes();
|
||||
m_supportedMimeTypes << "audio/basic";
|
||||
|
||||
return m_supportedMimeTypes;
|
||||
}
|
||||
else
|
||||
return m_supportedMimeTypes;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::playPause()
|
||||
{
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <phonon/MediaObject>
|
||||
#include <phonon/AudioOutput>
|
||||
#include <phonon/BackendCapabilities>
|
||||
|
||||
#include "infosystem/infosystem.h"
|
||||
|
||||
@@ -52,6 +53,7 @@ public:
|
||||
explicit AudioEngine();
|
||||
~AudioEngine();
|
||||
|
||||
QStringList supportedMimeTypes() const;
|
||||
unsigned int volume() const { return m_audioOutput->volume() * 100.0; } // in percent
|
||||
|
||||
AudioState state() const { return m_state; }
|
||||
@@ -148,6 +150,7 @@ private:
|
||||
bool m_waitingOnNewTrack;
|
||||
bool m_infoSystemConnected;
|
||||
|
||||
mutable QStringList m_supportedMimeTypes;
|
||||
AudioState m_state;
|
||||
|
||||
static AudioEngine* s_instance;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "pipeline.h"
|
||||
#include "resolver.h"
|
||||
#include "sourcelist.h"
|
||||
#include "audio/audioengine.h"
|
||||
|
||||
#include "utils/logger.h"
|
||||
|
||||
@@ -104,7 +105,17 @@ Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
|
||||
{
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
m_results.append( newresults );
|
||||
|
||||
const QStringList smt = AudioEngine::instance()->supportedMimeTypes();
|
||||
foreach ( const Tomahawk::result_ptr& result, newresults )
|
||||
{
|
||||
if ( !smt.contains( result->mimetype() ) )
|
||||
{
|
||||
tDebug() << "Won't accept result, unsupported mimetype" << result->toString() << result->mimetype();
|
||||
}
|
||||
else
|
||||
m_results.append( result );
|
||||
}
|
||||
qStableSort( m_results.begin(), m_results.end(), Query::resultSorter );
|
||||
|
||||
// hook up signals, and check solved status
|
||||
|
Reference in New Issue
Block a user