strawberry-audio-player-win.../src/engine/phononengine.h

90 lines
2.3 KiB
C
Raw Normal View History

/*
* Strawberry Music Player
* This file was part of Clementine
2018-12-29 03:21:15 +01:00
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2017-2018, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
2018-02-27 18:06:05 +01:00
#ifndef PHONONENGINE_H
#define PHONONENGINE_H
#include "config.h"
#include <phonon/mediaobject.h>
#include <phonon/audiooutput.h>
#include <QtGlobal>
#include <QObject>
#include <QUrl>
#include "enginebase.h"
2018-02-27 18:06:05 +01:00
class QTimer;
class TaskManager;
class PhononEngine : public Engine::Base {
Q_OBJECT
public:
2020-04-07 16:49:15 +02:00
explicit PhononEngine(TaskManager *task_manager);
2018-02-27 18:06:05 +01:00
~PhononEngine();
bool Init();
2018-10-02 00:38:52 +02:00
OutputDetailsList GetOutputsList() const;
2018-02-27 18:06:05 +01:00
bool CanDecode(const QUrl &url);
2019-09-15 20:27:32 +02:00
bool Load(const QUrl &stream_url, const QUrl &original_url, const Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec);
bool Play(const quint64 offset_nanosec);
void Stop(const bool stop_after = false);
2018-02-27 18:06:05 +01:00
void Pause();
void Unpause();
Engine::State state() const;
uint position() const;
uint length() const;
2019-09-15 20:27:32 +02:00
void Seek(const quint64 offset_nanosec);
2018-02-27 18:06:05 +01:00
qint64 position_nanosec() const;
qint64 length_nanosec() const;
2018-10-02 00:38:52 +02:00
2019-09-15 20:27:32 +02:00
QString DefaultOutput() { return QString(""); }
2018-07-01 01:29:52 +02:00
bool ValidOutput(const QString &output);
bool CustomDeviceSupport(const QString &output);
bool ALSADeviceSupport(const QString &output);
2018-02-27 18:06:05 +01:00
protected:
2019-09-15 20:27:32 +02:00
void SetVolumeSW(const uint percent );
2018-02-27 18:06:05 +01:00
private slots:
void PhononFinished();
2019-09-15 20:27:32 +02:00
void PhononStateChanged(const Phonon::State new_state);
2018-02-27 18:06:05 +01:00
void StateTimeoutExpired();
private:
Phonon::MediaObject *media_object_;
Phonon::AudioOutput *audio_output_;
QTimer *state_timer_;
qint64 seek_offset_;
};
#endif // PHONONENGINE_H