Music Hub  ..
A session-wide music playback service
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
player.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 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  * Jim Hodapp <jim.hodapp@canonical.com>
18  */
19 
20 #ifndef MPRIS_PLAYER_H_
21 #define MPRIS_PLAYER_H_
22 
23 #include <core/media/player.h>
24 #include <core/media/track.h>
25 
26 #include "macros.h"
27 
28 #include <core/dbus/types/any.h>
29 #include <core/dbus/types/object_path.h>
30 #include <core/dbus/types/variant.h>
31 
32 #include <boost/utility/identity_type.hpp>
33 
34 #include <string>
35 #include <tuple>
36 #include <vector>
37 
38 namespace dbus = core::dbus;
39 
40 namespace mpris
41 {
42 struct Player
43 {
44  static const std::string& name()
45  {
46  static const std::string s{"core.ubuntu.media.Service.Player"};
47  return s;
48  }
49 
50  METHOD(Next, Player, std::chrono::seconds(1))
51  METHOD(Previous, Player, std::chrono::seconds(1))
52  METHOD_WITH_TIMEOUT_MS(Pause, Player, 1000)
53  METHOD(PlayPause, Player, std::chrono::seconds(1))
54  METHOD(Stop, Player, std::chrono::seconds(1))
55  METHOD(Play, Player, std::chrono::seconds(1))
56  METHOD(Seek, Player, std::chrono::seconds(1))
57  METHOD(SetPosition, Player, std::chrono::seconds(1))
58  METHOD(CreateVideoSink, Player, std::chrono::seconds(1))
59  METHOD(Key, Player, std::chrono::seconds(1))
60  METHOD(OpenUri, Player, std::chrono::seconds(1))
61 
62  struct Signals
63  {
64  SIGNAL(Seeked, Player, uint64_t)
65  SIGNAL(EndOfStream, Player, void)
66  SIGNAL(PlaybackStatusChanged, Player, core::ubuntu::media::Player::PlaybackStatus)
67  };
68 
69  struct Properties
70  {
74  WRITABLE_PROPERTY(Rate, Player, double)
75  WRITABLE_PROPERTY(Shuffle, Player, bool)
77  WRITABLE_PROPERTY(Volume, Player, double)
78  READABLE_PROPERTY(Position, Player, uint64_t)
79  READABLE_PROPERTY(Duration, Player, uint64_t)
81  READABLE_PROPERTY(MinimumRate, Player, double)
82  READABLE_PROPERTY(MaximumRate, Player, double)
83  READABLE_PROPERTY(IsVideoSource, Player, bool)
84  READABLE_PROPERTY(IsAudioSource, Player, bool)
85  READABLE_PROPERTY(CanGoNext, Player, bool)
86  READABLE_PROPERTY(CanGoPrevious, Player, bool)
87  READABLE_PROPERTY(CanPlay, Player, bool)
88  READABLE_PROPERTY(CanPause, Player, bool)
89  READABLE_PROPERTY(CanSeek, Player, bool)
90  READABLE_PROPERTY(CanControl, Player, bool)
91  };
92 };
93 }
94 
95 #endif // MPRIS_PLAYER_H_
Definition: player.h:40
static const std::string & name()
Definition: player.h:44
#define WRITABLE_PROPERTY(Name, Itf, Type)
Definition: macros.h:77
#define READABLE_PROPERTY(Name, Itf, Type)
Definition: macros.h:64
#define METHOD_WITH_TIMEOUT_MS(Name, Itf, Timeout)
Definition: macros.h:29
STL namespace.
#define METHOD(Name, Itf, Timeout)
Definition: macros.h:41
#define SIGNAL(Name, Itf, ArgType)
Definition: macros.h:53