Music Hub  ..
A session-wide music playback service
engine.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013-2014 Canonical Ltd.
3  * Copyright © 2022 UBports Foundation.
4  *
5  * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License version 3,
9  * as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Authored by: Thomas Voß <thomas.voss@canonical.com>
20  * Jim Hodapp <jim.hodapp@canonical.com>
21  */
22 #ifndef LOMIRI_MEDIAHUBSERVICE_GSTREAMER_ENGINE_H
23 #define LOMIRI_MEDIAHUBSERVICE_GSTREAMER_ENGINE_H
24 
25 #include "../engine.h"
26 
27 #include <QScopedPointer>
28 
29 class QUrl;
30 
31 namespace gstreamer
32 {
33 class EnginePrivate;
35 {
36 public:
38  ~Engine();
39 
40  const QSharedPointer<MetaDataExtractor>& metaDataExtractor() const;
41 
42  bool open_resource_for_uri(const QUrl &uri, bool do_pipeline_reset);
43  bool open_resource_for_uri(const QUrl &uri, const lomiri::MediaHubService::Player::HeadersType& headers);
44  void create_video_sink(uint32_t texture_id);
45 
46  // use_main_thread will set the pipeline's new state in the main thread context
47  bool play();
48  bool stop();
49  bool pause();
50  bool seek_to(const std::chrono::microseconds& ts);
51 
52  uint64_t position() const;
53  uint64_t duration() const;
54 
55  void reset();
56 
57 protected:
60  void doSetVolume(double volume) override;
61 
62 private:
63  Q_DECLARE_PRIVATE(Engine)
64  QScopedPointer<EnginePrivate> d_ptr;
65 };
66 }
67 
68 #endif // LOMIRI_MEDIAHUBSERVICE_GSTREAMER_ENGINE_H
lomiri::MediaHubService::Engine::volume
double volume() const
Definition: engine.cpp:225
gstreamer::Engine::reset
void reset()
Definition: engine.cpp:410
gstreamer::Engine::Engine
Engine(const lomiri::MediaHubService::Player::PlayerKey key)
Definition: engine.cpp:296
gstreamer::Engine::create_video_sink
void create_video_sink(uint32_t texture_id)
Definition: engine.cpp:337
gstreamer::Engine::pause
bool pause()
Definition: engine.cpp:378
gstreamer::Engine::stop
bool stop()
Definition: engine.cpp:357
gstreamer::Engine::seek_to
bool seek_to(const std::chrono::microseconds &ts)
Definition: engine.cpp:392
lomiri::MediaHubService::Engine::lifetime
Player::Lifetime lifetime() const
Definition: engine.cpp:171
gstreamer::Engine::doSetVolume
void doSetVolume(double volume) override
Definition: engine.cpp:428
lomiri::MediaHubService::Player::HeadersType
QMap< QString, QString > HeadersType
Definition: player.h:57
gstreamer::Engine::position
uint64_t position() const
Definition: engine.cpp:398
lomiri::MediaHubService::Player::AudioStreamRole
AudioStreamRole
Definition: player.h:113
gstreamer
Definition: bus.h:34
lomiri::MediaHubService::Player::PlayerKey
uint32_t PlayerKey
Definition: player.h:55
gstreamer::Engine::doSetAudioStreamRole
void doSetAudioStreamRole(lomiri::MediaHubService::Player::AudioStreamRole role) override
gstreamer::Engine::doSetLifetime
void doSetLifetime(lomiri::MediaHubService::Player::Lifetime lifetime) override
gstreamer::Engine::~Engine
~Engine()
Definition: engine.cpp:315
gstreamer::Engine::metaDataExtractor
const QSharedPointer< MetaDataExtractor > & metaDataExtractor() const
lomiri::MediaHubService::Player::Lifetime
Lifetime
Definition: player.h:129
gstreamer::Engine::duration
uint64_t duration() const
Definition: engine.cpp:404
gstreamer::Engine::play
bool play()
Definition: engine.cpp:343
lomiri::MediaHubService::Engine
Definition: engine.h:44
gstreamer::Engine::open_resource_for_uri
bool open_resource_for_uri(const QUrl &uri, bool do_pipeline_reset)
Definition: engine.cpp:321
gstreamer::Engine
Definition: engine.h:34