1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

Whitelist rtmp:// to passed as plain URL to Phonon

This commit is contained in:
Uwe L. Korn
2014-03-08 01:44:01 +00:00
parent faec1b6f03
commit 8ca2c24597
3 changed files with 13 additions and 3 deletions

View File

@@ -627,7 +627,8 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
setCurrentTrack( result ); setCurrentTrack( result );
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() ) ) if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() )
&& !TomahawkUtils::isRtmpResult( d->currentTrack->url() ) )
{ {
boost::function< void ( QSharedPointer< QIODevice >& ) > callback = boost::function< void ( QSharedPointer< QIODevice >& ) > callback =
boost::bind( &AudioEngine::performLoadTrack, this, result, _1 ); boost::bind( &AudioEngine::performLoadTrack, this, result, _1 );
@@ -655,7 +656,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr& result, QSharedPointe
bool err = false; bool err = false;
{ {
if ( !( TomahawkUtils::isLocalResult( d->currentTrack->url() ) || TomahawkUtils::isHttpResult( d->currentTrack->url() ) ) if ( !( TomahawkUtils::isLocalResult( d->currentTrack->url() ) || TomahawkUtils::isHttpResult( d->currentTrack->url() ) || TomahawkUtils::isRtmpResult( d->currentTrack->url() ) )
&& ( !io || io.isNull() ) ) && ( !io || io.isNull() ) )
{ {
tLog() << "Error getting iodevice for" << result->url(); tLog() << "Error getting iodevice for" << result->url();
@@ -668,7 +669,8 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr& result, QSharedPointe
d->state = Loading; d->state = Loading;
emit loading( d->currentTrack ); emit loading( d->currentTrack );
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() ) ) if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() )
&& !TomahawkUtils::isRtmpResult( d->currentTrack->url() ) )
{ {
QSharedPointer<QNetworkReply> qnr = io.objectCast<QNetworkReply>(); QSharedPointer<QNetworkReply> qnr = io.objectCast<QNetworkReply>();
if ( !qnr.isNull() ) if ( !qnr.isNull() )

View File

@@ -554,6 +554,13 @@ isLocalResult( const QString& url )
} }
bool
isRtmpResult( const QString& url )
{
return url.startsWith( "rtmp://" );
}
void void
crash() crash()
{ {

View File

@@ -172,6 +172,7 @@ namespace TomahawkUtils
*/ */
DLLEXPORT bool isHttpResult( const QString& url ); DLLEXPORT bool isHttpResult( const QString& url );
DLLEXPORT bool isLocalResult( const QString& url ); DLLEXPORT bool isLocalResult( const QString& url );
DLLEXPORT bool isRtmpResult( const QString& url );
DLLEXPORT bool verifyFile( const QString& filePath, const QString& signature ); DLLEXPORT bool verifyFile( const QString& filePath, const QString& signature );
DLLEXPORT QString extractScriptPayload( const QString& filename, const QString& resolverId, const QString& dirName = "atticaresolvers" ); DLLEXPORT QString extractScriptPayload( const QString& filename, const QString& resolverId, const QString& dirName = "atticaresolvers" );