Merge lp:~thomas-voss/media-hub/decouple-player-skeleton-and-implementation into lp:media-hub
- decouple-player-skeleton-and-implementation
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ricardo Mendoza |
Approved revision: | 121 |
Merged at revision: | 125 |
Proposed branch: | lp:~thomas-voss/media-hub/decouple-player-skeleton-and-implementation |
Merge into: | lp:media-hub |
Prerequisite: | lp:~thomas-voss/media-hub/decouple-service-skeleton-and-implementation |
Diff against target: |
620 lines (+245/-112) 5 files modified
src/core/media/null_track_list.h (+114/-0) src/core/media/player_implementation.cpp (+101/-81) src/core/media/player_implementation.h (+8/-10) src/core/media/player_skeleton.h (+13/-15) src/core/media/service_implementation.cpp (+9/-6) |
To merge this branch: | bzr merge lp:~thomas-voss/media-hub/decouple-player-skeleton-and-implementation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Jim Hodapp (community) | code | Needs Fixing | |
Review via email: mp+243303@code.launchpad.net |
Commit message
Decouple PlayerSkeleton and PlayerImplement
able to inherit from arbitrary base classes, as long as they provide the set of properties and signals defined by media::Player.
Adjust the implementation to account for decoupling.
Description of the change
Decouple PlayerSkeleton and PlayerImplement
able to inherit from arbitrary base classes, as long as they provide the set of properties and signals defined by media::Player.
Adjust the implementation to account for decoupling.
PS Jenkins bot (ps-jenkins) wrote : | # |
Jim Hodapp (jhodapp) wrote : | # |
One comment inline below.
- 114. By Thomas Voß
-
[ Jim Hodapp ]
* Resubmitting with prerequisite branch (LP: #1331041)
[ Justin McPherson ]
* Resubmitting with prerequisite branch (LP: #1331041)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:114
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 115. By Thomas Voß
-
Address reviewer comments.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:115
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 116. By Thomas Voß
-
[ Jim Hodapp ]
* Error reporting all the way up to the app level from the playbin
pipeline.
[ Ubuntu daily release ]
* New rebuild forced
[ Jim Hodapp ]
* Don't auto-resume playback of videos after a phone call ends. (LP:
#1411273)
[ Ubuntu daily release ]
* New rebuild forced
[ Ricardo Salveti de Araujo ]
* service_implementation: adding debug for call started/ended signals.
Make sure account and connection are available when setting up
account manager (patch from Gustavo Boiko). call_monitor: don't
check caps when hooking up on/off signals, until bug 1409125 is
fixed. Enable parallel building . (LP: #1409125)
[ Jim Hodapp ]
* Pause playback when recording begins. (LP: #1398047)
[ Ricardo Salveti de Araujo ]
* call_monitor.cpp: waiting for bridge to be up, and also protecting
the on_change call (LP: #1408137)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:116
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 117. By Thomas Voß
-
Merge prereq branch.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:117
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 118. By Thomas Voß
-
Merge prereq branch.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:118
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 119. By Thomas Voß
-
Merge prereq branch.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:119
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 120. By Thomas Voß
-
Move handling of a dying client to its own thread to prvent from deadlocks.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:120
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 121. By Thomas Voß
-
* debian/control:
- Removing pre-depends that are not required
- Bumping standards-version to 3.9.6
[ Ricardo Salveti de Araujo ]
* Migrating tests to use ogg instead of mp3/avi removed:
tests/h264.avi tests/test.mp3 added: tests/test-audio-1. ogg
tests/test-video. ogg tests/test.mp3 renamed: tests/test.ogg =>
tests/test-audio. ogg
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:121
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file 'src/core/media/null_track_list.h' |
2 | --- src/core/media/null_track_list.h 1970-01-01 00:00:00 +0000 |
3 | +++ src/core/media/null_track_list.h 2015-03-12 11:47:38 +0000 |
4 | @@ -0,0 +1,114 @@ |
5 | +/* |
6 | + * |
7 | + * This program is free software: you can redistribute it and/or modify it |
8 | + * under the terms of the GNU Lesser General Public License version 3, |
9 | + * as published by the Free Software Foundation. |
10 | + * |
11 | + * This program is distributed in the hope that it will be useful, |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | + * GNU Lesser General Public License for more details. |
15 | + * |
16 | + * You should have received a copy of the GNU Lesser General Public License |
17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | + * |
19 | + * Authored by: Thomas Voß <thomas.voss@canonical.com> |
20 | + */ |
21 | + |
22 | +#ifndef CORE_MEDIA_NULL_TRACK_LIST_H_ |
23 | +#define CORE_MEDIA_NULL_TRACK_LIST_H_ |
24 | + |
25 | +#include <core/media/track.h> |
26 | +#include <core/media/track_list.h> |
27 | + |
28 | +namespace core |
29 | +{ |
30 | +namespace ubuntu |
31 | +{ |
32 | +namespace media |
33 | +{ |
34 | +// A helper type to replace the playlist implementation below. |
35 | +// Please note that this type is only a temporary manner. Ideally, |
36 | +// the actual implementation should be injected as a dependency from the |
37 | +// outside. |
38 | +struct NullTrackList : public media::TrackList |
39 | +{ |
40 | + NullTrackList() = default; |
41 | + |
42 | + bool has_next() |
43 | + { |
44 | + return false; |
45 | + } |
46 | + |
47 | + media::Track::Id next() |
48 | + { |
49 | + return media::Track::Id{}; |
50 | + } |
51 | + |
52 | + media::Track::UriType query_uri_for_track(const media::Track::Id&) |
53 | + { |
54 | + return media::Track::UriType{}; |
55 | + } |
56 | + |
57 | + const core::Property<bool>& can_edit_tracks() const override |
58 | + { |
59 | + return props_and_sigs.can_edit_tracks; |
60 | + } |
61 | + |
62 | + const core::Property<Container>& tracks() const override |
63 | + { |
64 | + return props_and_sigs.tracks; |
65 | + } |
66 | + |
67 | + virtual media::Track::MetaData query_meta_data_for_track(const media::Track::Id&) override |
68 | + { |
69 | + return media::Track::MetaData{}; |
70 | + } |
71 | + |
72 | + void add_track_with_uri_at(const media::Track::UriType&, const media::Track::Id&, bool) override |
73 | + { |
74 | + } |
75 | + |
76 | + void remove_track(const media::Track::Id&) override |
77 | + { |
78 | + } |
79 | + |
80 | + void go_to(const media::Track::Id&) override |
81 | + { |
82 | + } |
83 | + |
84 | + const core::Signal<void>& on_track_list_replaced() const override |
85 | + { |
86 | + return props_and_sigs.on_track_list_replaced; |
87 | + } |
88 | + |
89 | + const core::Signal<media::Track::Id>& on_track_added() const override |
90 | + { |
91 | + return props_and_sigs.on_track_added; |
92 | + } |
93 | + |
94 | + const core::Signal<media::Track::Id>& on_track_removed() const override |
95 | + { |
96 | + return props_and_sigs.on_track_removed; |
97 | + } |
98 | + |
99 | + const core::Signal<media::Track::Id>& on_track_changed() const override |
100 | + { |
101 | + return props_and_sigs.on_track_changed; |
102 | + } |
103 | + |
104 | + struct |
105 | + { |
106 | + core::Property<bool> can_edit_tracks; |
107 | + core::Property<TrackList::Container> tracks; |
108 | + core::Signal<void> on_track_list_replaced; |
109 | + core::Signal<media::Track::Id> on_track_added; |
110 | + core::Signal<media::Track::Id> on_track_removed; |
111 | + core::Signal<media::Track::Id> on_track_changed; |
112 | + } props_and_sigs; |
113 | +}; |
114 | +} |
115 | +} |
116 | +} |
117 | + |
118 | +#endif // CORE_MEDIA_NULL_TRACK_LIST_H_ |
119 | |
120 | === modified file 'src/core/media/player_implementation.cpp' |
121 | --- src/core/media/player_implementation.cpp 2015-03-12 11:47:38 +0000 |
122 | +++ src/core/media/player_implementation.cpp 2015-03-12 11:47:38 +0000 |
123 | @@ -23,6 +23,7 @@ |
124 | |
125 | #include "client_death_observer.h" |
126 | #include "engine.h" |
127 | +#include "null_track_list.h" |
128 | #include "track_list_implementation.h" |
129 | |
130 | #include "gstreamer/engine.h" |
131 | @@ -39,7 +40,8 @@ |
132 | |
133 | using namespace std; |
134 | |
135 | -struct media::PlayerImplementation::Private : |
136 | +template<typename Parent> |
137 | +struct media::PlayerImplementation<Parent>::Private : |
138 | public std::enable_shared_from_this<Private> |
139 | { |
140 | enum class wakelock_clear_t |
141 | @@ -50,30 +52,18 @@ |
142 | WAKELOCK_CLEAR_INVALID |
143 | }; |
144 | |
145 | - Private(PlayerImplementation* parent, const media::PlayerImplementation::Configuration& config) |
146 | + Private(PlayerImplementation* parent, const media::PlayerImplementation<Parent>::Configuration& config) |
147 | : parent(parent), |
148 | config(config), |
149 | display_state_lock(config.power_state_controller->display_state_lock()), |
150 | system_state_lock(config.power_state_controller->system_state_lock()), |
151 | engine(std::make_shared<gstreamer::Engine>()), |
152 | - track_list( |
153 | - new media::TrackListImplementation( |
154 | - config.session->path().as_string() + "/TrackList", |
155 | - engine->meta_data_extractor())), |
156 | + track_list(std::make_shared<NullTrackList>()), |
157 | system_wakelock_count(0), |
158 | display_wakelock_count(0), |
159 | previous_state(Engine::State::stopped), |
160 | engine_state_change_connection(engine->state().changed().connect(make_state_change_handler())) |
161 | { |
162 | - config.client_death_observer->register_for_death_notifications_with_key(config.key); |
163 | - config.client_death_observer->on_client_with_key_died().connect([this](const media::Player::PlayerKey& died) |
164 | - { |
165 | - if (died != this->config.key) |
166 | - return; |
167 | - |
168 | - on_client_died(); |
169 | - }); |
170 | - |
171 | // Poor man's logging of release/acquire events. |
172 | display_state_lock->acquired().connect([](media::power::DisplayState state) |
173 | { |
174 | @@ -257,7 +247,7 @@ |
175 | // the execution of the functor may surpass the lifetime of this Private |
176 | // object instance. By keeping a weak_ptr to the private object instance |
177 | // we can check if the object is dead before calling methods on it |
178 | - std::weak_ptr<Private> weak_self{shared_from_this()}; |
179 | + std::weak_ptr<Private> weak_self{this->shared_from_this()}; |
180 | auto wakelock_type = current_wakelock_type(); |
181 | return [weak_self, wakelock_type] { |
182 | if (auto self = weak_self.lock()) |
183 | @@ -271,14 +261,14 @@ |
184 | } |
185 | |
186 | // Our link back to our parent. |
187 | - media::PlayerImplementation* parent; |
188 | + media::PlayerImplementation<Parent>* parent; |
189 | // We just store the parameters passed on construction. |
190 | - media::PlayerImplementation::Configuration config; |
191 | + media::PlayerImplementation<Parent>::Configuration config; |
192 | media::power::StateController::Lock<media::power::DisplayState>::Ptr display_state_lock; |
193 | media::power::StateController::Lock<media::power::SystemState>::Ptr system_state_lock; |
194 | |
195 | std::shared_ptr<Engine> engine; |
196 | - std::shared_ptr<TrackListImplementation> track_list; |
197 | + std::shared_ptr<media::NullTrackList> track_list; |
198 | std::atomic<int> system_wakelock_count; |
199 | std::atomic<int> display_wakelock_count; |
200 | Engine::State previous_state; |
201 | @@ -286,37 +276,29 @@ |
202 | core::Connection engine_state_change_connection; |
203 | }; |
204 | |
205 | -media::PlayerImplementation::PlayerImplementation(const media::PlayerImplementation::Configuration& config) |
206 | - : media::PlayerSkeleton |
207 | - { |
208 | - media::PlayerSkeleton::Configuration |
209 | - { |
210 | - config.bus, |
211 | - config.session, |
212 | - config.request_context_resolver, |
213 | - config.request_authenticator |
214 | - } |
215 | - }, |
216 | +template<typename Parent> |
217 | +media::PlayerImplementation<Parent>::PlayerImplementation(const media::PlayerImplementation<Parent>::Configuration& config) |
218 | + : Parent{config.parent}, |
219 | d{std::make_shared<Private>(this, config)} |
220 | { |
221 | // Initialize default values for Player interface properties |
222 | - can_play().set(true); |
223 | - can_pause().set(true); |
224 | - can_seek().set(true); |
225 | - can_go_previous().set(true); |
226 | - can_go_next().set(true); |
227 | - is_video_source().set(false); |
228 | - is_audio_source().set(false); |
229 | - is_shuffle().set(true); |
230 | - playback_rate().set(1.f); |
231 | - playback_status().set(Player::PlaybackStatus::null); |
232 | - loop_status().set(Player::LoopStatus::none); |
233 | - position().set(0); |
234 | - duration().set(0); |
235 | - audio_stream_role().set(Player::AudioStreamRole::multimedia); |
236 | + Parent::can_play().set(true); |
237 | + Parent::can_pause().set(true); |
238 | + Parent::can_seek().set(true); |
239 | + Parent::can_go_previous().set(true); |
240 | + Parent::can_go_next().set(true); |
241 | + Parent::is_video_source().set(false); |
242 | + Parent::is_audio_source().set(false); |
243 | + Parent::is_shuffle().set(true); |
244 | + Parent::playback_rate().set(1.f); |
245 | + Parent::playback_status().set(Player::PlaybackStatus::null); |
246 | + Parent::loop_status().set(Player::LoopStatus::none); |
247 | + Parent::position().set(0); |
248 | + Parent::duration().set(0); |
249 | + Parent::audio_stream_role().set(Player::AudioStreamRole::multimedia); |
250 | d->engine->audio_stream_role().set(Player::AudioStreamRole::multimedia); |
251 | - orientation().set(Player::Orientation::rotate0); |
252 | - lifetime().set(Player::Lifetime::normal); |
253 | + Parent::orientation().set(Player::Orientation::rotate0); |
254 | + Parent::lifetime().set(Player::Lifetime::normal); |
255 | d->engine->lifetime().set(Player::Lifetime::normal); |
256 | |
257 | // Make sure that the Position property gets updated from the Engine |
258 | @@ -325,7 +307,7 @@ |
259 | { |
260 | return d->engine->position().get(); |
261 | }; |
262 | - position().install(position_getter); |
263 | + Parent::position().install(position_getter); |
264 | |
265 | // Make sure that the Duration property gets updated from the Engine |
266 | // every time the client requests duration |
267 | @@ -333,23 +315,23 @@ |
268 | { |
269 | return d->engine->duration().get(); |
270 | }; |
271 | - duration().install(duration_getter); |
272 | + Parent::duration().install(duration_getter); |
273 | |
274 | std::function<bool()> video_type_getter = [this]() |
275 | { |
276 | return d->engine->is_video_source().get(); |
277 | }; |
278 | - is_video_source().install(video_type_getter); |
279 | + Parent::is_video_source().install(video_type_getter); |
280 | |
281 | std::function<bool()> audio_type_getter = [this]() |
282 | { |
283 | return d->engine->is_audio_source().get(); |
284 | }; |
285 | - is_audio_source().install(audio_type_getter); |
286 | + Parent::is_audio_source().install(audio_type_getter); |
287 | |
288 | // Make sure that the audio_stream_role property gets updated on the Engine side |
289 | // whenever the client side sets the role |
290 | - audio_stream_role().changed().connect([this](media::Player::AudioStreamRole new_role) |
291 | + Parent::audio_stream_role().changed().connect([this](media::Player::AudioStreamRole new_role) |
292 | { |
293 | d->engine->audio_stream_role().set(new_role); |
294 | }); |
295 | @@ -358,10 +340,10 @@ |
296 | // update the Player's cached value |
297 | d->engine->orientation().changed().connect([this](const Player::Orientation& o) |
298 | { |
299 | - orientation().set(o); |
300 | + Parent::orientation().set(o); |
301 | }); |
302 | |
303 | - lifetime().changed().connect([this](media::Player::Lifetime lifetime) |
304 | + Parent::lifetime().changed().connect([this](media::Player::Lifetime lifetime) |
305 | { |
306 | d->engine->lifetime().set(lifetime); |
307 | }); |
308 | @@ -387,31 +369,52 @@ |
309 | |
310 | d->engine->seeked_to_signal().connect([this](uint64_t value) |
311 | { |
312 | - seeked_to()(value); |
313 | + Parent::seeked_to()(value); |
314 | }); |
315 | |
316 | d->engine->end_of_stream_signal().connect([this]() |
317 | { |
318 | - end_of_stream()(); |
319 | + Parent::end_of_stream()(); |
320 | }); |
321 | |
322 | d->engine->playback_status_changed_signal().connect([this](const Player::PlaybackStatus& status) |
323 | { |
324 | - playback_status_changed()(status); |
325 | + Parent::playback_status_changed()(status); |
326 | }); |
327 | |
328 | d->engine->video_dimension_changed_signal().connect([this](const media::video::Dimensions& dimensions) |
329 | { |
330 | - video_dimension_changed()(dimensions); |
331 | + Parent::video_dimension_changed()(dimensions); |
332 | }); |
333 | |
334 | d->engine->error_signal().connect([this](const Player::Error& e) |
335 | + { |
336 | + Parent::error()(e); |
337 | + }); |
338 | + |
339 | + // Everything is setup, we now subscribe to death notifications. |
340 | + std::weak_ptr<Private> wp{d}; |
341 | + |
342 | + d->config.client_death_observer->register_for_death_notifications_with_key(config.key); |
343 | + d->config.client_death_observer->on_client_with_key_died().connect([wp](const media::Player::PlayerKey& died) |
344 | { |
345 | - error()(e); |
346 | + if (auto sp = wp.lock()) |
347 | + { |
348 | + if (died != sp->config.key) |
349 | + return; |
350 | + |
351 | + static const std::chrono::milliseconds timeout{1000}; |
352 | + media::timeout(timeout.count(), true, [wp]() |
353 | + { |
354 | + if (auto sp = wp.lock()) |
355 | + sp->on_client_died(); |
356 | + }); |
357 | + } |
358 | }); |
359 | } |
360 | |
361 | -media::PlayerImplementation::~PlayerImplementation() |
362 | +template<typename Parent> |
363 | +media::PlayerImplementation<Parent>::~PlayerImplementation() |
364 | { |
365 | // Install null getters as these properties may be destroyed |
366 | // after the engine has been destroyed since they are owned by the |
367 | @@ -420,84 +423,101 @@ |
368 | { |
369 | return static_cast<uint64_t>(0); |
370 | }; |
371 | - position().install(position_getter); |
372 | + Parent::position().install(position_getter); |
373 | |
374 | std::function<uint64_t()> duration_getter = [this]() |
375 | { |
376 | return static_cast<uint64_t>(0); |
377 | }; |
378 | - duration().install(duration_getter); |
379 | + Parent::duration().install(duration_getter); |
380 | |
381 | std::function<bool()> video_type_getter = [this]() |
382 | { |
383 | return false; |
384 | }; |
385 | - is_video_source().install(video_type_getter); |
386 | + Parent::is_video_source().install(video_type_getter); |
387 | |
388 | std::function<bool()> audio_type_getter = [this]() |
389 | { |
390 | return false; |
391 | }; |
392 | - is_audio_source().install(audio_type_getter); |
393 | + Parent::is_audio_source().install(audio_type_getter); |
394 | } |
395 | |
396 | -std::shared_ptr<media::TrackList> media::PlayerImplementation::track_list() |
397 | +template<typename Parent> |
398 | +std::shared_ptr<media::TrackList> media::PlayerImplementation<Parent>::track_list() |
399 | { |
400 | return d->track_list; |
401 | } |
402 | |
403 | // TODO: Convert this to be a property instead of sync call |
404 | -media::Player::PlayerKey media::PlayerImplementation::key() const |
405 | +template<typename Parent> |
406 | +media::Player::PlayerKey media::PlayerImplementation<Parent>::key() const |
407 | { |
408 | return d->config.key; |
409 | } |
410 | |
411 | -media::video::Sink::Ptr media::PlayerImplementation::create_gl_texture_video_sink(std::uint32_t texture_id) |
412 | +template<typename Parent> |
413 | +media::video::Sink::Ptr media::PlayerImplementation<Parent>::create_gl_texture_video_sink(std::uint32_t texture_id) |
414 | { |
415 | d->engine->create_video_sink(texture_id); |
416 | return media::video::Sink::Ptr{}; |
417 | } |
418 | |
419 | -bool media::PlayerImplementation::open_uri(const Track::UriType& uri) |
420 | +template<typename Parent> |
421 | +bool media::PlayerImplementation<Parent>::open_uri(const Track::UriType& uri) |
422 | { |
423 | return d->engine->open_resource_for_uri(uri); |
424 | } |
425 | |
426 | -bool media::PlayerImplementation::open_uri(const Track::UriType& uri, const Player::HeadersType& headers) |
427 | +template<typename Parent> |
428 | +bool media::PlayerImplementation<Parent>::open_uri(const Track::UriType& uri, const Player::HeadersType& headers) |
429 | { |
430 | return d->engine->open_resource_for_uri(uri, headers); |
431 | } |
432 | |
433 | -void media::PlayerImplementation::next() |
434 | -{ |
435 | -} |
436 | - |
437 | -void media::PlayerImplementation::previous() |
438 | -{ |
439 | -} |
440 | - |
441 | -void media::PlayerImplementation::play() |
442 | +template<typename Parent> |
443 | +void media::PlayerImplementation<Parent>::next() |
444 | +{ |
445 | +} |
446 | + |
447 | +template<typename Parent> |
448 | +void media::PlayerImplementation<Parent>::previous() |
449 | +{ |
450 | +} |
451 | + |
452 | +template<typename Parent> |
453 | +void media::PlayerImplementation<Parent>::play() |
454 | { |
455 | d->engine->play(); |
456 | } |
457 | |
458 | -void media::PlayerImplementation::pause() |
459 | +template<typename Parent> |
460 | +void media::PlayerImplementation<Parent>::pause() |
461 | { |
462 | d->engine->pause(); |
463 | } |
464 | |
465 | -void media::PlayerImplementation::stop() |
466 | +template<typename Parent> |
467 | +void media::PlayerImplementation<Parent>::stop() |
468 | { |
469 | std::cout << __PRETTY_FUNCTION__ << std::endl; |
470 | d->engine->stop(); |
471 | } |
472 | |
473 | -void media::PlayerImplementation::seek_to(const std::chrono::microseconds& ms) |
474 | +template<typename Parent> |
475 | +void media::PlayerImplementation<Parent>::seek_to(const std::chrono::microseconds& ms) |
476 | { |
477 | d->engine->seek_to(ms); |
478 | } |
479 | |
480 | -const core::Signal<>& media::PlayerImplementation::on_client_disconnected() const |
481 | +template<typename Parent> |
482 | +const core::Signal<>& media::PlayerImplementation<Parent>::on_client_disconnected() const |
483 | { |
484 | return d->on_client_disconnected; |
485 | } |
486 | + |
487 | +#include <core/media/player_skeleton.h> |
488 | + |
489 | +// For linking purposes, we have to make sure that we have all symbols included within the dso. |
490 | +template class media::PlayerImplementation<media::PlayerSkeleton>; |
491 | |
492 | === modified file 'src/core/media/player_implementation.h' |
493 | --- src/core/media/player_implementation.h 2015-03-12 11:47:38 +0000 |
494 | +++ src/core/media/player_implementation.h 2015-03-12 11:47:38 +0000 |
495 | @@ -19,7 +19,7 @@ |
496 | #ifndef CORE_UBUNTU_MEDIA_PLAYER_IMPLEMENTATION_H_ |
497 | #define CORE_UBUNTU_MEDIA_PLAYER_IMPLEMENTATION_H_ |
498 | |
499 | -#include "player_skeleton.h" |
500 | +#include <core/media/player.h> |
501 | |
502 | #include "apparmor/ubuntu.h" |
503 | #include "client_death_observer.h" |
504 | @@ -36,20 +36,18 @@ |
505 | class Engine; |
506 | class Service; |
507 | |
508 | -class PlayerImplementation : public PlayerSkeleton |
509 | +template<typename Parent> |
510 | +class PlayerImplementation : public Parent |
511 | { |
512 | public: |
513 | // All creation time arguments go here |
514 | struct Configuration |
515 | { |
516 | - std::shared_ptr<core::dbus::Bus> bus; |
517 | - std::shared_ptr<core::dbus::Object> session; |
518 | - std::shared_ptr<Service> service; |
519 | - PlayerKey key; |
520 | - |
521 | + // All creation time configuration options of the Parent class. |
522 | + typename Parent::Configuration parent; |
523 | + // The unique key identifying the player instance. |
524 | + Player::PlayerKey key; |
525 | // Functional dependencies |
526 | - apparmor::ubuntu::RequestContextResolver::Ptr request_context_resolver; |
527 | - apparmor::ubuntu::RequestAuthenticator::Ptr request_authenticator; |
528 | ClientDeathObserver::Ptr client_death_observer; |
529 | power::StateController::Ptr power_state_controller; |
530 | }; |
531 | @@ -58,7 +56,7 @@ |
532 | ~PlayerImplementation(); |
533 | |
534 | virtual std::shared_ptr<TrackList> track_list(); |
535 | - virtual PlayerKey key() const; |
536 | + virtual Player::PlayerKey key() const; |
537 | |
538 | virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id); |
539 | |
540 | |
541 | === modified file 'src/core/media/player_skeleton.h' |
542 | --- src/core/media/player_skeleton.h 2015-03-12 11:47:38 +0000 |
543 | +++ src/core/media/player_skeleton.h 2015-03-12 11:47:38 +0000 |
544 | @@ -48,6 +48,19 @@ |
545 | class PlayerSkeleton : public core::ubuntu::media::Player |
546 | { |
547 | public: |
548 | + // All creation time arguments go here. |
549 | + struct Configuration |
550 | + { |
551 | + // The bus connection we are associated with. |
552 | + std::shared_ptr<core::dbus::Bus> bus; |
553 | + // The session object that we want to expose the skeleton upon. |
554 | + std::shared_ptr<core::dbus::Object> session; |
555 | + // Our functional dependencies. |
556 | + apparmor::ubuntu::RequestContextResolver::Ptr request_context_resolver; |
557 | + apparmor::ubuntu::RequestAuthenticator::Ptr request_authenticator; |
558 | + }; |
559 | + |
560 | + PlayerSkeleton(const Configuration& configuration); |
561 | ~PlayerSkeleton(); |
562 | |
563 | virtual const core::Property<bool>& can_play() const; |
564 | @@ -84,21 +97,6 @@ |
565 | virtual const core::Signal<video::Dimensions>& video_dimension_changed() const; |
566 | virtual const core::Signal<Error>& error() const; |
567 | |
568 | -protected: |
569 | - // All creation time arguments go here. |
570 | - struct Configuration |
571 | - { |
572 | - // The bus connection we are associated with. |
573 | - std::shared_ptr<core::dbus::Bus> bus; |
574 | - // The session object that we want to expose the skeleton upon. |
575 | - std::shared_ptr<core::dbus::Object> session; |
576 | - // Our functional dependencies. |
577 | - apparmor::ubuntu::RequestContextResolver::Ptr request_context_resolver; |
578 | - apparmor::ubuntu::RequestAuthenticator::Ptr request_authenticator; |
579 | - }; |
580 | - |
581 | - PlayerSkeleton(const Configuration& configuration); |
582 | - |
583 | // These properties are not exposed to the client, but still need to be |
584 | // able to be settable from within the Player: |
585 | virtual core::Property<PlaybackStatus>& playback_status(); |
586 | |
587 | === modified file 'src/core/media/service_implementation.cpp' |
588 | --- src/core/media/service_implementation.cpp 2015-03-12 11:47:38 +0000 |
589 | +++ src/core/media/service_implementation.cpp 2015-03-12 11:47:38 +0000 |
590 | @@ -26,6 +26,7 @@ |
591 | #include "audio/output_observer.h" |
592 | #include "client_death_observer.h" |
593 | #include "player_configuration.h" |
594 | +#include "player_skeleton.h" |
595 | #include "player_implementation.h" |
596 | #include "power/battery_observer.h" |
597 | #include "power/state_controller.h" |
598 | @@ -164,14 +165,16 @@ |
599 | std::shared_ptr<media::Player> media::ServiceImplementation::create_session( |
600 | const media::Player::Configuration& conf) |
601 | { |
602 | - auto player = std::make_shared<media::PlayerImplementation>(media::PlayerImplementation::Configuration |
603 | + auto player = std::make_shared<media::PlayerImplementation<media::PlayerSkeleton>>(media::PlayerImplementation<media::PlayerSkeleton>::Configuration |
604 | { |
605 | - conf.bus, |
606 | - conf.session, |
607 | - shared_from_this(), |
608 | + media::PlayerSkeleton::Configuration |
609 | + { |
610 | + conf.bus, |
611 | + conf.session, |
612 | + d->request_context_resolver, |
613 | + d->request_authenticator |
614 | + }, |
615 | conf.key, |
616 | - d->request_context_resolver, |
617 | - d->request_authenticator, |
618 | d->client_death_observer, |
619 | d->power_state_controller |
620 | }); |
FAILED: Continuous integration, rev:113 jenkins. qa.ubuntu. com/job/ media-hub- ci/196/ jenkins. qa.ubuntu. com/job/ media-hub- vivid-amd64- ci/36/console jenkins. qa.ubuntu. com/job/ media-hub- vivid-armhf- ci/36/console jenkins. qa.ubuntu. com/job/ media-hub- vivid-i386- ci/36/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/media- hub-ci/ 196/rebuild
http://