~ci-train-bot/media-hub/media-hub-ubuntu-zesty-1823

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/**
 * Copyright (C) 2013-2015 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Thomas Voß <thomas.voss@canonical.com>
 *              Jim Hodapp <jim.hodapp@canonical.com>
 */

#ifndef CORE_UBUNTU_MEDIA_PLAYER_SKELETON_H_
#define CORE_UBUNTU_MEDIA_PLAYER_SKELETON_H_

#include <core/media/player.h>

#include "player_traits.h"

#include "apparmor/ubuntu.h"
#include "mpris/player.h"

#include <core/dbus/skeleton.h>
#include <core/dbus/types/object_path.h>

#include <memory>

namespace core
{
namespace ubuntu
{
namespace media
{
namespace helper
{
struct ExternalServices;
}

class Service;

class PlayerSkeleton : public core::ubuntu::media::Player
{
  public:
    // All creation time arguments go here.
    struct Configuration
    {
        // The bus connection we are associated with.
        std::shared_ptr<core::dbus::Bus> bus;
        // The service instance we are exposed under.
        std::shared_ptr<core::dbus::Service> service;
        // The session object that we want to expose the skeleton upon.
        std::shared_ptr<core::dbus::Object> session;
        // The Service instance that manages Player instances
        core::ubuntu::media::Service* player_service;
        // Our functional dependencies.
        apparmor::ubuntu::RequestContextResolver::Ptr request_context_resolver;
        apparmor::ubuntu::RequestAuthenticator::Ptr request_authenticator;
    };

    PlayerSkeleton(const Configuration& configuration);
    ~PlayerSkeleton();

    virtual const core::Property<bool>& can_play() const;
    virtual const core::Property<bool>& can_pause() const;
    virtual const core::Property<bool>& can_seek() const;
    virtual const core::Property<bool>& can_go_previous() const;
    virtual const core::Property<bool>& can_go_next() const;
    virtual const core::Property<bool>& is_video_source() const;
    virtual const core::Property<bool>& is_audio_source() const;
    virtual const core::Property<PlaybackStatus>& playback_status() const;
    virtual const core::Property<AVBackend::Backend>& backend() const;
    virtual const core::Property<LoopStatus>& loop_status() const;
    virtual const core::Property<PlaybackRate>& playback_rate() const;
    virtual const core::Property<bool>& shuffle() const;
    virtual const core::Property<Track::MetaData>& meta_data_for_current_track() const;
    virtual const core::Property<Volume>& volume() const;
    virtual const core::Property<PlaybackRate>& minimum_playback_rate() const;
    virtual const core::Property<PlaybackRate>& maximum_playback_rate() const;
    virtual const core::Property<int64_t>& position() const;
    virtual const core::Property<int64_t>& duration() const;
    virtual const core::Property<AudioStreamRole>& audio_stream_role() const;
    virtual const core::Property<Orientation>& orientation() const;
    virtual const core::Property<Lifetime>& lifetime() const;

    virtual core::Property<LoopStatus>& loop_status();
    virtual core::Property<PlaybackRate>& playback_rate();
    virtual core::Property<bool>& shuffle();
    virtual core::Property<Volume>& volume();
    virtual core::Property<AudioStreamRole>& audio_stream_role();
    virtual core::Property<Lifetime>& lifetime();

    virtual const core::Signal<int64_t>& seeked_to() const;
    virtual const core::Signal<void>& about_to_finish() const;
    virtual const core::Signal<void>& end_of_stream() const;
    virtual const core::Signal<video::Dimensions>& video_dimension_changed() const;
    virtual const core::Signal<Error>& error() const;
    virtual const core::Signal<int>& buffering_changed() const;

    // These properties are not exposed to the client, but still need to be
    // able to be settable from within the Player:
    virtual core::Property<PlaybackStatus>& playback_status();
    virtual core::Property<AVBackend::Backend>& backend();
    virtual core::Property<bool>& can_play();
    virtual core::Property<bool>& can_pause();
    virtual core::Property<bool>& can_seek();
    virtual core::Property<bool>& can_go_previous();
    virtual core::Property<bool>& can_go_next();
    virtual core::Property<bool>& is_video_source();
    virtual core::Property<bool>& is_audio_source();
    virtual core::Property<Track::MetaData>& meta_data_for_current_track();
    virtual core::Property<PlaybackRate>& minimum_playback_rate();
    virtual core::Property<PlaybackRate>& maximum_playback_rate();
    virtual core::Property<int64_t>& position();
    virtual core::Property<int64_t>& duration();
    virtual core::Property<Orientation>& orientation();

    virtual core::Signal<int64_t>& seeked_to();
    virtual core::Signal<void>& about_to_finish();
    virtual core::Signal<void>& end_of_stream();
    virtual core::Signal<PlaybackStatus>& playback_status_changed();
    virtual core::Signal<video::Dimensions>& video_dimension_changed();
    virtual core::Signal<Error>& error();
    virtual core::Signal<int>& buffering_changed();

  private:
    struct Private;
    std::shared_ptr<Private> d;
};
}
}
}

#endif // CORE_UBUNTU_MEDIA_PLAYER_SKELETON_H_