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  */
18 
19 #ifndef MPRIS_PLAYER_H_
20 #define MPRIS_PLAYER_H_
21 
22 #include <core/media/player.h>
23 #include <core/media/track.h>
24 
25 #include "macros.h"
26 
27 #include <core/dbus/types/any.h>
28 #include <core/dbus/types/object_path.h>
29 #include <core/dbus/types/variant.h>
30 
31 #include <boost/utility/identity_type.hpp>
32 
33 #include <string>
34 #include <tuple>
35 #include <vector>
36 
37 namespace dbus = core::dbus;
38 
39 namespace mpris
40 {
41 struct Player
42 {
43  static const std::string& name()
44  {
45  static const std::string s{"core.ubuntu.media.Service.Player"};
46  return s;
47  }
48 
49  METHOD(Next, Player, std::chrono::seconds(1))
50  METHOD(Previous, Player, std::chrono::seconds(1))
51  METHOD_WITH_TIMEOUT_MS(Pause, Player, 1000)
52  METHOD(PlayPause, Player, std::chrono::seconds(1))
53  METHOD(Stop, Player, std::chrono::seconds(1))
54  METHOD(Play, Player, std::chrono::seconds(1))
55  METHOD(Seek, Player, std::chrono::seconds(1))
56  METHOD(SetPosition, Player, std::chrono::seconds(1))
57  METHOD(CreateVideoSink, Player, std::chrono::seconds(1))
58  METHOD(Key, Player, std::chrono::seconds(1))
59  METHOD(OpenUri, Player, std::chrono::seconds(1))
60 
61  struct Signals
62  {
63  SIGNAL(Seeked, Player, uint64_t)
64  SIGNAL(EndOfStream, Player, void)
65  SIGNAL(PlaybackStatusChanged, Player, core::ubuntu::media::Player::PlaybackStatus)
66  };
67 
68  struct Properties
69  {
73  WRITABLE_PROPERTY(Rate, Player, double)
74  WRITABLE_PROPERTY(Shuffle, Player, bool)
76  WRITABLE_PROPERTY(Volume, Player, double)
77  READABLE_PROPERTY(Position, Player, uint64_t)
78  READABLE_PROPERTY(Duration, Player, uint64_t)
79  READABLE_PROPERTY(MinimumRate, Player, double)
80  READABLE_PROPERTY(MaximumRate, Player, double)
81  READABLE_PROPERTY(IsVideoSource, Player, bool)
82  READABLE_PROPERTY(IsAudioSource, Player, bool)
83  READABLE_PROPERTY(CanGoNext, Player, bool)
84  READABLE_PROPERTY(CanGoPrevious, Player, bool)
85  READABLE_PROPERTY(CanPlay, Player, bool)
86  READABLE_PROPERTY(CanPause, Player, bool)
87  READABLE_PROPERTY(CanSeek, Player, bool)
88  READABLE_PROPERTY(CanControl, Player, bool)
89  };
90 };
91 }
92 
93 #endif // MPRIS_PLAYER_H_
static const std::string & name()
Definition: player.h:43
#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
#define METHOD(Name, Itf, Timeout)
Definition: macros.h:41
#define SIGNAL(Name, Itf, ArgType)
Definition: macros.h:53