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::shared_ptr<TrackList> track_list();
59  virtual Player::PlayerKey key() const;
60 
61  virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id);
62 
63  virtual bool open_uri(const Track::UriType& uri);
64  virtual bool open_uri(const Track::UriType& uri, const Player::HeadersType& headers);
65  virtual void next();
66  virtual void previous();
67  virtual void play();
68  virtual void pause();
69  virtual void stop();
70  virtual void seek_to(const std::chrono::microseconds& offset);
71 
72  const core::Signal<>& on_client_disconnected() const;
73 
74 protected:
76 
77 private:
78  struct Private;
79  std::shared_ptr<Private> d;
80 };
81 }
82 }
83 }
84 #endif // CORE_UBUNTU_MEDIA_PLAYER_IMPLEMENTATION_H_
85 
virtual bool open_uri(const Track::UriType &uri)
PlayerImplementation(const Configuration &configuration)
void emit_playback_status_changed(const Player::PlaybackStatus &status)
virtual Player::PlayerKey key() const
Definition: player.h:32
std::map< std::string, std::string > HeadersType
Definition: player.h:48
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()
const core::Signal & on_client_disconnected() const
std::string UriType
Definition: track.h:40
std::shared_ptr< StateController > Ptr
virtual void seek_to(const std::chrono::microseconds &offset)