Music Hub  ..
A session-wide music playback service
player_implementation.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013-2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 
19 #ifndef CORE_UBUNTU_MEDIA_PLAYER_IMPLEMENTATION_H_
20 #define CORE_UBUNTU_MEDIA_PLAYER_IMPLEMENTATION_H_
21 
22 #include <core/media/player.h>
23 
24 #include "apparmor/ubuntu.h"
25 #include "client_death_observer.h"
26 #include "power/state_controller.h"
27 
28 #include <memory>
29 
30 namespace core
31 {
32 namespace ubuntu
33 {
34 namespace media
35 {
36 class Engine;
37 class Service;
38 
39 template<typename Parent>
41 {
42 public:
43  // All creation time arguments go here
45  {
46  // All creation time configuration options of the Parent class.
47  typename Parent::Configuration parent;
48  // The unique key identifying the player instance.
50  // Functional dependencies
53  };
54 
55  PlayerImplementation(const Configuration& configuration);
57 
58  virtual std::string uuid() const;
59  virtual void reconnect();
60  virtual void abandon();
61 
62  virtual std::shared_ptr<TrackList> track_list();
63  virtual Player::PlayerKey key() const;
64 
65  virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id);
66 
67  virtual bool open_uri(const Track::UriType& uri);
68  virtual bool open_uri(const Track::UriType& uri, const Player::HeadersType& headers);
69  virtual void next();
70  virtual void previous();
71  virtual void play();
72  virtual void pause();
73  virtual void stop();
74  virtual void seek_to(const std::chrono::microseconds& offset);
75 
76  const core::Signal<>& on_client_disconnected() const;
77 
78 protected:
80 
81 private:
82  struct Private;
83  std::shared_ptr<Private> d;
84 };
85 
86 }
87 }
88 }
89 #endif // CORE_UBUNTU_MEDIA_PLAYER_IMPLEMENTATION_H_
virtual bool open_uri(const Track::UriType &uri)
PlayerImplementation(const Configuration &configuration)
void emit_playback_status_changed(const Player::PlaybackStatus &status)
Definition: player.h:33
virtual std::string uuid() const
const core::Signal & on_client_disconnected() const
std::map< std::string, std::string > HeadersType
Definition: player.h:65
std::shared_ptr< ClientDeathObserver > Ptr
virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id)
std::shared_ptr< Sink > Ptr
To save us some typing.
Definition: sink.h:39
virtual std::shared_ptr< TrackList > track_list()
std::string UriType
Definition: track.h:40
std::shared_ptr< StateController > Ptr
virtual void seek_to(const std::chrono::microseconds &offset)