mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Fixed AudioEngine deleting a sharedptr while it's being used by Phonon.
This commit is contained in:
@@ -219,12 +219,6 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
|
|
||||||
if ( !m_input.isNull() || m_isPlayingHttp )
|
if ( !m_input.isNull() || m_isPlayingHttp )
|
||||||
{
|
{
|
||||||
if ( !m_input.isNull() )
|
|
||||||
{
|
|
||||||
m_input->close();
|
|
||||||
m_input.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_expectStop = true;
|
m_expectStop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +227,12 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
m_mediaObject->setCurrentSource( io.data() );
|
m_mediaObject->setCurrentSource( io.data() );
|
||||||
m_mediaObject->currentSource().setAutoDelete( false );
|
m_mediaObject->currentSource().setAutoDelete( false );
|
||||||
m_isPlayingHttp = false;
|
m_isPlayingHttp = false;
|
||||||
|
|
||||||
|
if ( !m_input.isNull() )
|
||||||
|
{
|
||||||
|
m_input->close();
|
||||||
|
m_input.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
/* === 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 )
|
|
||||||
{
|
|
||||||
Q_UNUSED( 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 )
|
|
||||||
{
|
|
||||||
Q_UNUSED( seconds );
|
|
||||||
m_buffer.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DummyTranscode::clearBuffers()
|
|
||||||
{
|
|
||||||
m_buffer.clear();
|
|
||||||
m_init = false;
|
|
||||||
}
|
|
||||||
|
|
@@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
<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
|
|
@@ -1,12 +0,0 @@
|
|||||||
[Protocol]
|
|
||||||
exec=/home/leo/kde/tomahawk/build/tomahawk "%u"
|
|
||||||
protocol=tomahawk
|
|
||||||
input=none
|
|
||||||
output=none
|
|
||||||
helper=true
|
|
||||||
listing=
|
|
||||||
reading=false
|
|
||||||
writing=false
|
|
||||||
makedir=false
|
|
||||||
deleting=false
|
|
||||||
|
|
Reference in New Issue
Block a user