2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
|
|
|
|
Clementine 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.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-02-21 21:49:38 +01:00
|
|
|
#ifndef PHONONENGINE_H
|
|
|
|
#define PHONONENGINE_H
|
|
|
|
|
|
|
|
#include "enginebase.h"
|
|
|
|
|
2010-02-21 22:23:06 +01:00
|
|
|
#include <phonon/mediaobject.h>
|
|
|
|
#include <phonon/audiooutput.h>
|
|
|
|
|
|
|
|
class QTimer;
|
2010-02-21 21:49:38 +01:00
|
|
|
|
|
|
|
class PhononEngine : public Engine::Base {
|
2010-02-21 22:23:06 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-02-21 21:49:38 +01:00
|
|
|
public:
|
|
|
|
PhononEngine();
|
|
|
|
~PhononEngine();
|
|
|
|
|
|
|
|
bool init();
|
|
|
|
|
|
|
|
bool canDecode( const QUrl &url ) const;
|
|
|
|
|
|
|
|
bool load( const QUrl &url, bool stream = false );
|
|
|
|
bool play( uint offset = 0 );
|
|
|
|
void stop();
|
|
|
|
void pause();
|
|
|
|
void unpause();
|
|
|
|
|
|
|
|
Engine::State state() const;
|
|
|
|
uint position() const;
|
|
|
|
uint length() const;
|
|
|
|
|
|
|
|
void seek( uint ms );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void setVolumeSW( uint percent );
|
|
|
|
|
2010-02-21 22:23:06 +01:00
|
|
|
private slots:
|
|
|
|
void PhononFinished();
|
|
|
|
void PhononStateChanged(Phonon::State new_state);
|
|
|
|
void StateTimeoutExpired();
|
|
|
|
|
2010-02-21 21:49:38 +01:00
|
|
|
private:
|
|
|
|
Phonon::MediaObject* media_object_;
|
|
|
|
Phonon::AudioOutput* audio_output_;
|
2010-02-21 22:23:06 +01:00
|
|
|
|
|
|
|
QTimer* state_timer_;
|
2010-03-30 02:38:32 +02:00
|
|
|
|
|
|
|
qint64 seek_offset_;
|
2010-02-21 21:49:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PHONONENGINE_H
|