Merge lp:~phablet-team/media-hub/media-hub-desktop into lp:media-hub
- media-hub-desktop
- Merge into trunk
Proposed by
Jim Hodapp
Status: | Merged |
---|---|
Approved by: | Konrad Zapałowicz |
Approved revision: | 210 |
Merged at revision: | 204 |
Proposed branch: | lp:~phablet-team/media-hub/media-hub-desktop |
Merge into: | lp:media-hub |
Diff against target: |
1013 lines (+504/-61) 27 files modified
CMakeLists.txt (+8/-2) debian/changelog (+6/-0) include/core/media/player.h (+16/-0) src/core/media/CMakeLists.txt (+42/-37) src/core/media/backend.cpp (+43/-0) src/core/media/client_death_observer.cpp (+18/-1) src/core/media/codec.h (+43/-0) src/core/media/engine.h (+1/-1) src/core/media/gstreamer/engine.cpp (+3/-3) src/core/media/gstreamer/engine.h (+2/-2) src/core/media/mpris/player.h (+6/-1) src/core/media/player_implementation.cpp (+1/-0) src/core/media/player_skeleton.cpp (+10/-0) src/core/media/player_skeleton.h (+2/-0) src/core/media/player_stub.cpp (+11/-1) src/core/media/player_stub.h (+1/-0) src/core/media/recorder_observer.cpp (+18/-1) src/core/media/server/server.cpp (+15/-2) src/core/media/stub_client_death_observer.cpp (+66/-0) src/core/media/stub_client_death_observer.h (+64/-0) src/core/media/stub_recorder_observer.cpp (+40/-0) src/core/media/stub_recorder_observer.h (+50/-0) src/core/media/video/hybris_gl_sink.h (+1/-1) src/core/media/video/platform_default_sink.cpp (+18/-2) src/core/media/video/platform_default_sink.h (+2/-1) tests/acceptance-tests/service.cpp (+8/-0) tests/unit-tests/test-gstreamer-engine.cpp (+9/-6) |
To merge this branch: | bzr merge lp:~phablet-team/media-hub/media-hub-desktop |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alfonso Sanchez-Beato | Approve | ||
Konrad Zapałowicz (community) | Approve | ||
Review via email: mp+302712@code.launchpad.net |
Commit message
Make media-hub work on the desktop. Everything except for video playback works with this commit.
Description of the change
Make media-hub work on the desktop. Everything except for video playback works with this commit.
To post a comment you must log in.
- 206. By Jim Hodapp
-
Add simple unit test that ensures the service comes up.
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
review:
Needs Information
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote : | # |
LGTM except that I need an explanation if it is possible to cache get_backend_type()
review:
Needs Information
(code)
Revision history for this message
Jim Hodapp (jhodapp) wrote : | # |
Thanks for the very timely reviews guys. See my replies inline.
- 207. By Jim Hodapp
-
Dynamically detect hybris backend instead of setting environment variable
- 208. By Jim Hodapp
-
Cleanup and make sure to unref the plugin instance
- 209. By Jim Hodapp
-
Move debug message for hybris backend detection
- 210. By Jim Hodapp
-
Expose the backend selection to the stub side
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
LGTM
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2016-07-19 21:16:56 +0000 | |||
3 | +++ CMakeLists.txt 2016-08-15 19:28:06 +0000 | |||
4 | @@ -20,7 +20,7 @@ | |||
5 | 20 | # we define the version to be 5.0.0 | 20 | # we define the version to be 5.0.0 |
6 | 21 | if (${DISTRO_CODENAME} STREQUAL "vivid") | 21 | if (${DISTRO_CODENAME} STREQUAL "vivid") |
7 | 22 | set(UBUNTU_MEDIA_HUB_VERSION_MAJOR 4) | 22 | set(UBUNTU_MEDIA_HUB_VERSION_MAJOR 4) |
9 | 23 | set(UBUNTU_MEDIA_HUB_VERSION_MINOR 5) | 23 | set(UBUNTU_MEDIA_HUB_VERSION_MINOR 6) |
10 | 24 | set(UBUNTU_MEDIA_HUB_VERSION_PATCH 0) | 24 | set(UBUNTU_MEDIA_HUB_VERSION_PATCH 0) |
11 | 25 | else () | 25 | else () |
12 | 26 | set(UBUNTU_MEDIA_HUB_VERSION_MAJOR 5) | 26 | set(UBUNTU_MEDIA_HUB_VERSION_MAJOR 5) |
13 | @@ -53,7 +53,13 @@ | |||
14 | 53 | pkg_check_modules(GIO gio-2.0 REQUIRED) | 53 | pkg_check_modules(GIO gio-2.0 REQUIRED) |
15 | 54 | pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED) | 54 | pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED) |
16 | 55 | 55 | ||
18 | 56 | add_definitions(-DMEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | 56 | include(CheckIncludeFiles) |
19 | 57 | check_include_files("hybris/media/media_codec_layer.h" MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | ||
20 | 58 | if (DEFINED MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | ||
21 | 59 | add_definitions(-DMEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | ||
22 | 60 | else() | ||
23 | 61 | MESSAGE(STATUS "*libhybris not found*") | ||
24 | 62 | endif() | ||
25 | 57 | 63 | ||
26 | 58 | ##################################################################### | 64 | ##################################################################### |
27 | 59 | # Enable code coverage calculation with gcov/gcovr/lcov | 65 | # Enable code coverage calculation with gcov/gcovr/lcov |
28 | 60 | 66 | ||
29 | === modified file 'debian/changelog' | |||
30 | --- debian/changelog 2016-07-20 21:28:28 +0000 | |||
31 | +++ debian/changelog 2016-08-15 19:28:06 +0000 | |||
32 | @@ -1,3 +1,9 @@ | |||
33 | 1 | media-hub (4.6.0+16.10.20160815-0ubuntu1) yakkety; urgency=medium | ||
34 | 2 | |||
35 | 3 | * Make media-hub work on the desktop with Unity7/Unity8 sessions. | ||
36 | 4 | |||
37 | 5 | -- Jim Hodapp <jim.hodapp@canonical.com> Fri, 12 Aug 2016 15:17:28 +0000 | ||
38 | 6 | |||
39 | 1 | media-hub (4.5.0+16.10.20160720-0ubuntu1) yakkety; urgency=medium | 7 | media-hub (4.5.0+16.10.20160720-0ubuntu1) yakkety; urgency=medium |
40 | 2 | 8 | ||
41 | 3 | * Emit client side signal when the dbus connection between | 9 | * Emit client side signal when the dbus connection between |
42 | 4 | 10 | ||
43 | === modified file 'include/core/media/player.h' | |||
44 | --- include/core/media/player.h 2016-06-01 00:43:04 +0000 | |||
45 | +++ include/core/media/player.h 2016-08-15 19:28:06 +0000 | |||
46 | @@ -39,6 +39,21 @@ | |||
47 | 39 | class Service; | 39 | class Service; |
48 | 40 | class TrackList; | 40 | class TrackList; |
49 | 41 | 41 | ||
50 | 42 | struct AVBackend | ||
51 | 43 | { | ||
52 | 44 | enum Backend | ||
53 | 45 | { | ||
54 | 46 | none, | ||
55 | 47 | hybris | ||
56 | 48 | }; | ||
57 | 49 | |||
58 | 50 | /** | ||
59 | 51 | * @brief Returns the type of audio/video decoding/encoding backend being used. | ||
60 | 52 | * @return Returns the current backend type. | ||
61 | 53 | */ | ||
62 | 54 | static Backend get_backend_type(); | ||
63 | 55 | }; | ||
64 | 56 | |||
65 | 42 | class Player : public std::enable_shared_from_this<Player> | 57 | class Player : public std::enable_shared_from_this<Player> |
66 | 43 | { | 58 | { |
67 | 44 | public: | 59 | public: |
68 | @@ -162,6 +177,7 @@ | |||
69 | 162 | virtual const core::Property<bool>& is_video_source() const = 0; | 177 | virtual const core::Property<bool>& is_video_source() const = 0; |
70 | 163 | virtual const core::Property<bool>& is_audio_source() const = 0; | 178 | virtual const core::Property<bool>& is_audio_source() const = 0; |
71 | 164 | virtual const core::Property<PlaybackStatus>& playback_status() const = 0; | 179 | virtual const core::Property<PlaybackStatus>& playback_status() const = 0; |
72 | 180 | virtual const core::Property<AVBackend::Backend>& backend() const = 0; | ||
73 | 165 | virtual const core::Property<LoopStatus>& loop_status() const = 0; | 181 | virtual const core::Property<LoopStatus>& loop_status() const = 0; |
74 | 166 | virtual const core::Property<PlaybackRate>& playback_rate() const = 0; | 182 | virtual const core::Property<PlaybackRate>& playback_rate() const = 0; |
75 | 167 | virtual const core::Property<bool>& shuffle() const = 0; | 183 | virtual const core::Property<bool>& shuffle() const = 0; |
76 | 168 | 184 | ||
77 | === modified file 'src/core/media/CMakeLists.txt' | |||
78 | --- src/core/media/CMakeLists.txt 2016-06-15 17:49:49 +0000 | |||
79 | +++ src/core/media/CMakeLists.txt 2016-08-15 19:28:06 +0000 | |||
80 | @@ -17,6 +17,7 @@ | |||
81 | 17 | add_library( | 17 | add_library( |
82 | 18 | media-hub-common SHARED | 18 | media-hub-common SHARED |
83 | 19 | 19 | ||
84 | 20 | backend.cpp | ||
85 | 20 | the_session_bus.cpp | 21 | the_session_bus.cpp |
86 | 21 | util/utils.cpp | 22 | util/utils.cpp |
87 | 22 | ) | 23 | ) |
88 | @@ -27,6 +28,7 @@ | |||
89 | 27 | ${Boost_LIBRARIES} | 28 | ${Boost_LIBRARIES} |
90 | 28 | ${DBUS_LIBRARIES} | 29 | ${DBUS_LIBRARIES} |
91 | 29 | ${DBUS_CPP_LDFLAGS} | 30 | ${DBUS_CPP_LDFLAGS} |
92 | 31 | ${PC_GSTREAMER_1_0_LIBRARIES} | ||
93 | 30 | ) | 32 | ) |
94 | 31 | set_target_properties( | 33 | set_target_properties( |
95 | 32 | media-hub-common | 34 | media-hub-common |
96 | @@ -89,42 +91,44 @@ | |||
97 | 89 | ) | 91 | ) |
98 | 90 | 92 | ||
99 | 91 | add_library( | 93 | add_library( |
136 | 92 | media-hub-service | 94 | media-hub-service |
137 | 93 | 95 | ||
138 | 94 | ${MEDIA_HUB_HEADERS} | 96 | ${MEDIA_HUB_HEADERS} |
139 | 95 | ${MPRIS_HEADERS} | 97 | ${MPRIS_HEADERS} |
140 | 96 | 98 | ||
141 | 97 | logger/logger.cpp | 99 | logger/logger.cpp |
142 | 98 | 100 | ||
143 | 99 | client_death_observer.cpp | 101 | client_death_observer.cpp |
144 | 100 | hashed_keyed_player_store.cpp | 102 | hashed_keyed_player_store.cpp |
145 | 101 | hybris_client_death_observer.cpp | 103 | hybris_client_death_observer.cpp |
146 | 102 | cover_art_resolver.cpp | 104 | stub_client_death_observer.cpp |
147 | 103 | engine.cpp | 105 | cover_art_resolver.cpp |
148 | 104 | metadata.cpp | 106 | engine.cpp |
149 | 105 | 107 | metadata.cpp | |
150 | 106 | apparmor/context.cpp | 108 | |
151 | 107 | apparmor/ubuntu.cpp | 109 | apparmor/context.cpp |
152 | 108 | 110 | apparmor/ubuntu.cpp | |
153 | 109 | audio/pulse_audio_output_observer.cpp | 111 | |
154 | 110 | audio/ostream_reporter.cpp | 112 | audio/pulse_audio_output_observer.cpp |
155 | 111 | audio/output_observer.cpp | 113 | audio/ostream_reporter.cpp |
156 | 112 | 114 | audio/output_observer.cpp | |
157 | 113 | power/battery_observer.cpp | 115 | |
158 | 114 | power/state_controller.cpp | 116 | power/battery_observer.cpp |
159 | 115 | 117 | power/state_controller.cpp | |
160 | 116 | recorder_observer.cpp | 118 | |
161 | 117 | hybris_recorder_observer.cpp | 119 | recorder_observer.cpp |
162 | 118 | 120 | hybris_recorder_observer.cpp | |
163 | 119 | gstreamer/engine.cpp | 121 | stub_recorder_observer.cpp |
164 | 120 | gstreamer/playbin.cpp | 122 | |
165 | 121 | 123 | gstreamer/engine.cpp | |
166 | 122 | player_skeleton.cpp | 124 | gstreamer/playbin.cpp |
167 | 123 | player_implementation.cpp | 125 | |
168 | 124 | service_skeleton.cpp | 126 | player_skeleton.cpp |
169 | 125 | service_implementation.cpp | 127 | player_implementation.cpp |
170 | 126 | track_list_skeleton.cpp | 128 | service_skeleton.cpp |
171 | 127 | track_list_implementation.cpp | 129 | service_implementation.cpp |
172 | 130 | track_list_skeleton.cpp | ||
173 | 131 | track_list_implementation.cpp | ||
174 | 128 | ) | 132 | ) |
175 | 129 | 133 | ||
176 | 130 | target_link_libraries( | 134 | target_link_libraries( |
177 | @@ -146,11 +150,12 @@ | |||
178 | 146 | ${PC_PULSE_AUDIO_LIBRARIES} | 150 | ${PC_PULSE_AUDIO_LIBRARIES} |
179 | 147 | ) | 151 | ) |
180 | 148 | 152 | ||
182 | 149 | include_directories(${PROJECT_SOURCE_DIR}/src/ ${HYBRIS_MEDIA_CFLAGS}) | 153 | include_directories(${PROJECT_SOURCE_DIR}/src/ ${HYBRIS_MEDIA_CFLAGS} ${PC_GSTREAMER_1_0_INCLUDE_DIRS}) |
183 | 150 | 154 | ||
184 | 151 | add_executable( | 155 | add_executable( |
185 | 152 | media-hub-server | 156 | media-hub-server |
186 | 153 | 157 | ||
187 | 158 | backend.cpp | ||
188 | 154 | server/server.cpp | 159 | server/server.cpp |
189 | 155 | ) | 160 | ) |
190 | 156 | 161 | ||
191 | 157 | 162 | ||
192 | === added file 'src/core/media/backend.cpp' | |||
193 | --- src/core/media/backend.cpp 1970-01-01 00:00:00 +0000 | |||
194 | +++ src/core/media/backend.cpp 2016-08-15 19:28:06 +0000 | |||
195 | @@ -0,0 +1,43 @@ | |||
196 | 1 | /* | ||
197 | 2 | * Copyright (C) 2016 Canonical Ltd | ||
198 | 3 | * | ||
199 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
200 | 5 | * you may not use this file except in compliance with the License. | ||
201 | 6 | * You may obtain a copy of the License at | ||
202 | 7 | * | ||
203 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
204 | 9 | * | ||
205 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
206 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
207 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
208 | 13 | * See the License for the specific language governing permissions and | ||
209 | 14 | * limitations under the License. | ||
210 | 15 | * | ||
211 | 16 | * Authored by: Jim Hodapp <jim.hodapp@canonical.com> | ||
212 | 17 | */ | ||
213 | 18 | |||
214 | 19 | #include <core/media/player.h> | ||
215 | 20 | #include "core/media/logger/logger.h" | ||
216 | 21 | |||
217 | 22 | #include <gst/gst.h> | ||
218 | 23 | |||
219 | 24 | namespace media = core::ubuntu::media; | ||
220 | 25 | |||
221 | 26 | media::AVBackend::Backend media::AVBackend::get_backend_type() | ||
222 | 27 | { | ||
223 | 28 | GstRegistry *registry; | ||
224 | 29 | GstPlugin *plugin; | ||
225 | 30 | |||
226 | 31 | registry = gst_registry_get(); | ||
227 | 32 | if (not registry) | ||
228 | 33 | return media::AVBackend::Backend::none; | ||
229 | 34 | |||
230 | 35 | plugin = gst_registry_lookup(registry, "libgstandroidmedia.so"); | ||
231 | 36 | if (plugin) | ||
232 | 37 | { | ||
233 | 38 | gst_object_unref(plugin); | ||
234 | 39 | return media::AVBackend::Backend::hybris; | ||
235 | 40 | } | ||
236 | 41 | |||
237 | 42 | return media::AVBackend::Backend::none; | ||
238 | 43 | } | ||
239 | 0 | 44 | ||
240 | === modified file 'src/core/media/client_death_observer.cpp' | |||
241 | --- src/core/media/client_death_observer.cpp 2014-11-26 09:18:33 +0000 | |||
242 | +++ src/core/media/client_death_observer.cpp 2016-08-15 19:28:06 +0000 | |||
243 | @@ -16,7 +16,11 @@ | |||
244 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
245 | 17 | */ | 17 | */ |
246 | 18 | 18 | ||
247 | 19 | #include "core/media/logger/logger.h" | ||
248 | 20 | |||
249 | 19 | #include <core/media/client_death_observer.h> | 21 | #include <core/media/client_death_observer.h> |
250 | 22 | #include <core/media/hybris_client_death_observer.h> | ||
251 | 23 | #include <core/media/stub_client_death_observer.h> | ||
252 | 20 | 24 | ||
253 | 21 | namespace media = core::ubuntu::media; | 25 | namespace media = core::ubuntu::media; |
254 | 22 | 26 | ||
255 | @@ -26,7 +30,20 @@ | |||
256 | 26 | // Accesses the default client death observer implementation for the platform. | 30 | // Accesses the default client death observer implementation for the platform. |
257 | 27 | media::ClientDeathObserver::Ptr media::platform_default_client_death_observer() | 31 | media::ClientDeathObserver::Ptr media::platform_default_client_death_observer() |
258 | 28 | { | 32 | { |
260 | 29 | return media::HybrisClientDeathObserver::create(); | 33 | const media::AVBackend::Backend b {media::AVBackend::get_backend_type()}; |
261 | 34 | switch (b) | ||
262 | 35 | { | ||
263 | 36 | case media::AVBackend::Backend::hybris: | ||
264 | 37 | return media::HybrisClientDeathObserver::create(); | ||
265 | 38 | case media::AVBackend::Backend::none: | ||
266 | 39 | MH_WARNING( | ||
267 | 40 | "No video backend selected. Client disconnect functionality won't work." | ||
268 | 41 | ); | ||
269 | 42 | return media::StubClientDeathObserver::create(); | ||
270 | 43 | default: | ||
271 | 44 | MH_INFO("Invalid or no A/V backend specified, using \"hybris\" as a default."); | ||
272 | 45 | return media::HybrisClientDeathObserver::create(); | ||
273 | 46 | } | ||
274 | 30 | } | 47 | } |
275 | 31 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER | 48 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER |
276 | 32 | // Just throws a std::logic_error as we have not yet defined a default way to | 49 | // Just throws a std::logic_error as we have not yet defined a default way to |
277 | 33 | 50 | ||
278 | === modified file 'src/core/media/codec.h' | |||
279 | --- src/core/media/codec.h 2016-06-14 19:41:18 +0000 | |||
280 | +++ src/core/media/codec.h 2016-08-15 19:28:06 +0000 | |||
281 | @@ -192,6 +192,49 @@ | |||
282 | 192 | in = static_cast<core::ubuntu::media::Player::PlaybackStatus>(out.pop_int16()); | 192 | in = static_cast<core::ubuntu::media::Player::PlaybackStatus>(out.pop_int16()); |
283 | 193 | } | 193 | } |
284 | 194 | }; | 194 | }; |
285 | 195 | |||
286 | 196 | namespace helper | ||
287 | 197 | { | ||
288 | 198 | template<> | ||
289 | 199 | struct TypeMapper<core::ubuntu::media::AVBackend::Backend> | ||
290 | 200 | { | ||
291 | 201 | constexpr static ArgumentType type_value() | ||
292 | 202 | { | ||
293 | 203 | return core::dbus::ArgumentType::int16; | ||
294 | 204 | } | ||
295 | 205 | constexpr static bool is_basic_type() | ||
296 | 206 | { | ||
297 | 207 | return false; | ||
298 | 208 | } | ||
299 | 209 | constexpr static bool requires_signature() | ||
300 | 210 | { | ||
301 | 211 | return false; | ||
302 | 212 | } | ||
303 | 213 | |||
304 | 214 | static std::string signature() | ||
305 | 215 | { | ||
306 | 216 | static const std::string s = TypeMapper<std::int16_t>::signature(); | ||
307 | 217 | return s; | ||
308 | 218 | } | ||
309 | 219 | }; | ||
310 | 220 | } | ||
311 | 221 | |||
312 | 222 | template<> | ||
313 | 223 | struct Codec<core::ubuntu::media::AVBackend::Backend> | ||
314 | 224 | { | ||
315 | 225 | static void encode_argument(core::dbus::Message::Writer& out, | ||
316 | 226 | const core::ubuntu::media::AVBackend::Backend& in) | ||
317 | 227 | { | ||
318 | 228 | out.push_int16(static_cast<std::int16_t>(in)); | ||
319 | 229 | } | ||
320 | 230 | |||
321 | 231 | static void decode_argument(core::dbus::Message::Reader& out, | ||
322 | 232 | core::ubuntu::media::AVBackend::Backend& in) | ||
323 | 233 | { | ||
324 | 234 | in = static_cast<core::ubuntu::media::AVBackend::Backend>(out.pop_int16()); | ||
325 | 235 | } | ||
326 | 236 | }; | ||
327 | 237 | |||
328 | 195 | namespace helper | 238 | namespace helper |
329 | 196 | { | 239 | { |
330 | 197 | template<> | 240 | template<> |
331 | 198 | 241 | ||
332 | === modified file 'src/core/media/engine.h' | |||
333 | --- src/core/media/engine.h 2016-07-11 01:21:38 +0000 | |||
334 | +++ src/core/media/engine.h 2016-08-15 19:28:06 +0000 | |||
335 | @@ -82,7 +82,7 @@ | |||
336 | 82 | // support this feature. | 82 | // support this feature. |
337 | 83 | virtual void create_video_sink(uint32_t texture_id) = 0; | 83 | virtual void create_video_sink(uint32_t texture_id) = 0; |
338 | 84 | 84 | ||
340 | 85 | virtual bool play() = 0; | 85 | virtual bool play(bool use_main_context = false) = 0; |
341 | 86 | virtual bool stop(bool use_main_context = false) = 0; | 86 | virtual bool stop(bool use_main_context = false) = 0; |
342 | 87 | virtual bool pause() = 0; | 87 | virtual bool pause() = 0; |
343 | 88 | virtual bool seek_to(const std::chrono::microseconds& ts) = 0; | 88 | virtual bool seek_to(const std::chrono::microseconds& ts) = 0; |
344 | 89 | 89 | ||
345 | === modified file 'src/core/media/gstreamer/engine.cpp' | |||
346 | --- src/core/media/gstreamer/engine.cpp 2016-07-11 01:21:38 +0000 | |||
347 | +++ src/core/media/gstreamer/engine.cpp 2016-08-15 19:28:06 +0000 | |||
348 | @@ -445,9 +445,9 @@ | |||
349 | 445 | d->playbin.create_video_sink(texture_id); | 445 | d->playbin.create_video_sink(texture_id); |
350 | 446 | } | 446 | } |
351 | 447 | 447 | ||
353 | 448 | bool gstreamer::Engine::play() | 448 | bool gstreamer::Engine::play(bool use_main_thread /* = false */) |
354 | 449 | { | 449 | { |
356 | 450 | const auto result = d->playbin.set_state_and_wait(GST_STATE_PLAYING); | 450 | const auto result = d->playbin.set_state_and_wait(GST_STATE_PLAYING, use_main_thread); |
357 | 451 | 451 | ||
358 | 452 | if (result) | 452 | if (result) |
359 | 453 | { | 453 | { |
360 | @@ -459,7 +459,7 @@ | |||
361 | 459 | return result; | 459 | return result; |
362 | 460 | } | 460 | } |
363 | 461 | 461 | ||
365 | 462 | bool gstreamer::Engine::stop(bool use_main_thread) | 462 | bool gstreamer::Engine::stop(bool use_main_thread /* = false */) |
366 | 463 | { | 463 | { |
367 | 464 | // No need to wait, and we can immediately return. | 464 | // No need to wait, and we can immediately return. |
368 | 465 | if (d->state == media::Engine::State::stopped) | 465 | if (d->state == media::Engine::State::stopped) |
369 | 466 | 466 | ||
370 | === modified file 'src/core/media/gstreamer/engine.h' | |||
371 | --- src/core/media/gstreamer/engine.h 2016-07-11 01:21:38 +0000 | |||
372 | +++ src/core/media/gstreamer/engine.h 2016-08-15 19:28:06 +0000 | |||
373 | @@ -37,8 +37,8 @@ | |||
374 | 37 | bool open_resource_for_uri(const core::ubuntu::media::Track::UriType& uri, const core::ubuntu::media::Player::HeadersType& headers); | 37 | bool open_resource_for_uri(const core::ubuntu::media::Track::UriType& uri, const core::ubuntu::media::Player::HeadersType& headers); |
375 | 38 | void create_video_sink(uint32_t texture_id); | 38 | void create_video_sink(uint32_t texture_id); |
376 | 39 | 39 | ||
379 | 40 | bool play(); | 40 | // use_main_thread will set the pipeline's new state in the main thread context |
380 | 41 | // use_main_thread will set the pipeline's new_state in the main thread context | 41 | bool play(bool use_main_thread = false); |
381 | 42 | bool stop(bool use_main_thread = false); | 42 | bool stop(bool use_main_thread = false); |
382 | 43 | bool pause(); | 43 | bool pause(); |
383 | 44 | bool seek_to(const std::chrono::microseconds& ts); | 44 | bool seek_to(const std::chrono::microseconds& ts); |
384 | 45 | 45 | ||
385 | === modified file 'src/core/media/mpris/player.h' | |||
386 | --- src/core/media/mpris/player.h 2016-06-16 02:34:40 +0000 | |||
387 | +++ src/core/media/mpris/player.h 2016-08-15 19:28:06 +0000 | |||
388 | @@ -166,7 +166,7 @@ | |||
389 | 166 | { | 166 | { |
390 | 167 | DBUS_CPP_READABLE_PROPERTY_DEF(PlaybackStatus, Player, std::string) | 167 | DBUS_CPP_READABLE_PROPERTY_DEF(PlaybackStatus, Player, std::string) |
391 | 168 | DBUS_CPP_READABLE_PROPERTY_DEF(TypedPlaybackStatus, Player, core::ubuntu::media::Player::PlaybackStatus) | 168 | DBUS_CPP_READABLE_PROPERTY_DEF(TypedPlaybackStatus, Player, core::ubuntu::media::Player::PlaybackStatus) |
393 | 169 | 169 | DBUS_CPP_WRITABLE_PROPERTY_DEF(TypedBackend, Player, core::ubuntu::media::AVBackend::Backend) | |
394 | 170 | DBUS_CPP_WRITABLE_PROPERTY_DEF(LoopStatus, Player, std::string) | 170 | DBUS_CPP_WRITABLE_PROPERTY_DEF(LoopStatus, Player, std::string) |
395 | 171 | DBUS_CPP_WRITABLE_PROPERTY_DEF(TypedLoopStatus, Player, core::ubuntu::media::Player::LoopStatus) | 171 | DBUS_CPP_WRITABLE_PROPERTY_DEF(TypedLoopStatus, Player, core::ubuntu::media::Player::LoopStatus) |
396 | 172 | DBUS_CPP_WRITABLE_PROPERTY_DEF(AudioStreamRole, Player, core::ubuntu::media::Player::AudioStreamRole) | 172 | DBUS_CPP_WRITABLE_PROPERTY_DEF(AudioStreamRole, Player, core::ubuntu::media::Player::AudioStreamRole) |
397 | @@ -220,6 +220,7 @@ | |||
398 | 220 | Properties::IsAudioSource::ValueType is_audio_source{true}; | 220 | Properties::IsAudioSource::ValueType is_audio_source{true}; |
399 | 221 | Properties::PlaybackStatus::ValueType playback_status{PlaybackStatus::stopped}; | 221 | Properties::PlaybackStatus::ValueType playback_status{PlaybackStatus::stopped}; |
400 | 222 | Properties::TypedPlaybackStatus::ValueType typed_playback_status{core::ubuntu::media::Player::PlaybackStatus::null}; | 222 | Properties::TypedPlaybackStatus::ValueType typed_playback_status{core::ubuntu::media::Player::PlaybackStatus::null}; |
401 | 223 | Properties::TypedBackend::ValueType typed_backend{core::ubuntu::media::AVBackend::Backend::none}; | ||
402 | 223 | Properties::LoopStatus::ValueType loop_status{LoopStatus::none}; | 224 | Properties::LoopStatus::ValueType loop_status{LoopStatus::none}; |
403 | 224 | Properties::TypedLoopStatus::ValueType typed_loop_status{core::ubuntu::media::Player::LoopStatus::none}; | 225 | Properties::TypedLoopStatus::ValueType typed_loop_status{core::ubuntu::media::Player::LoopStatus::none}; |
404 | 225 | Properties::PlaybackRate::ValueType playback_rate{1.f}; | 226 | Properties::PlaybackRate::ValueType playback_rate{1.f}; |
405 | @@ -248,6 +249,7 @@ | |||
406 | 248 | configuration.object->template get_property<Properties::IsAudioSource>(), | 249 | configuration.object->template get_property<Properties::IsAudioSource>(), |
407 | 249 | configuration.object->template get_property<Properties::PlaybackStatus>(), | 250 | configuration.object->template get_property<Properties::PlaybackStatus>(), |
408 | 250 | configuration.object->template get_property<Properties::TypedPlaybackStatus>(), | 251 | configuration.object->template get_property<Properties::TypedPlaybackStatus>(), |
409 | 252 | configuration.object->template get_property<Properties::TypedBackend>(), | ||
410 | 251 | configuration.object->template get_property<Properties::LoopStatus>(), | 253 | configuration.object->template get_property<Properties::LoopStatus>(), |
411 | 252 | configuration.object->template get_property<Properties::TypedLoopStatus>(), | 254 | configuration.object->template get_property<Properties::TypedLoopStatus>(), |
412 | 253 | configuration.object->template get_property<Properties::AudioStreamRole>(), | 255 | configuration.object->template get_property<Properties::AudioStreamRole>(), |
413 | @@ -284,6 +286,7 @@ | |||
414 | 284 | properties.is_audio_source->set(configuration.defaults.is_audio_source); | 286 | properties.is_audio_source->set(configuration.defaults.is_audio_source); |
415 | 285 | properties.playback_status->set(configuration.defaults.playback_status); | 287 | properties.playback_status->set(configuration.defaults.playback_status); |
416 | 286 | properties.typed_playback_status->set(configuration.defaults.typed_playback_status); | 288 | properties.typed_playback_status->set(configuration.defaults.typed_playback_status); |
417 | 289 | properties.typed_backend->set(configuration.defaults.typed_backend); | ||
418 | 287 | properties.loop_status->set(configuration.defaults.loop_status); | 290 | properties.loop_status->set(configuration.defaults.loop_status); |
419 | 288 | properties.typed_loop_status->set(configuration.defaults.typed_loop_status); | 291 | properties.typed_loop_status->set(configuration.defaults.typed_loop_status); |
420 | 289 | properties.audio_stream_role->set(core::ubuntu::media::Player::AudioStreamRole::multimedia); | 292 | properties.audio_stream_role->set(core::ubuntu::media::Player::AudioStreamRole::multimedia); |
421 | @@ -371,6 +374,7 @@ | |||
422 | 371 | dict[Properties::CanGoPrevious::name()] = dbus::types::Variant::encode(properties.can_go_previous->get()); | 374 | dict[Properties::CanGoPrevious::name()] = dbus::types::Variant::encode(properties.can_go_previous->get()); |
423 | 372 | dict[Properties::PlaybackStatus::name()] = dbus::types::Variant::encode(properties.playback_status->get()); | 375 | dict[Properties::PlaybackStatus::name()] = dbus::types::Variant::encode(properties.playback_status->get()); |
424 | 373 | dict[Properties::TypedPlaybackStatus::name()] = dbus::types::Variant::encode(properties.typed_playback_status->get()); | 376 | dict[Properties::TypedPlaybackStatus::name()] = dbus::types::Variant::encode(properties.typed_playback_status->get()); |
425 | 377 | dict[Properties::TypedBackend::name()] = dbus::types::Variant::encode(properties.typed_backend->get()); | ||
426 | 374 | dict[Properties::LoopStatus::name()] = dbus::types::Variant::encode(properties.loop_status->get()); | 378 | dict[Properties::LoopStatus::name()] = dbus::types::Variant::encode(properties.loop_status->get()); |
427 | 375 | dict[Properties::TypedLoopStatus::name()] = dbus::types::Variant::encode(properties.typed_loop_status->get()); | 379 | dict[Properties::TypedLoopStatus::name()] = dbus::types::Variant::encode(properties.typed_loop_status->get()); |
428 | 376 | dict[Properties::AudioStreamRole::name()] = dbus::types::Variant::encode(properties.audio_stream_role->get()); | 380 | dict[Properties::AudioStreamRole::name()] = dbus::types::Variant::encode(properties.audio_stream_role->get()); |
429 | @@ -403,6 +407,7 @@ | |||
430 | 403 | 407 | ||
431 | 404 | std::shared_ptr<core::dbus::Property<Properties::PlaybackStatus>> playback_status; | 408 | std::shared_ptr<core::dbus::Property<Properties::PlaybackStatus>> playback_status; |
432 | 405 | std::shared_ptr<core::dbus::Property<Properties::TypedPlaybackStatus>> typed_playback_status; | 409 | std::shared_ptr<core::dbus::Property<Properties::TypedPlaybackStatus>> typed_playback_status; |
433 | 410 | std::shared_ptr<core::dbus::Property<Properties::TypedBackend>> typed_backend; | ||
434 | 406 | std::shared_ptr<core::dbus::Property<Properties::LoopStatus>> loop_status; | 411 | std::shared_ptr<core::dbus::Property<Properties::LoopStatus>> loop_status; |
435 | 407 | std::shared_ptr<core::dbus::Property<Properties::TypedLoopStatus>> typed_loop_status; | 412 | std::shared_ptr<core::dbus::Property<Properties::TypedLoopStatus>> typed_loop_status; |
436 | 408 | std::shared_ptr<core::dbus::Property<Properties::AudioStreamRole>> audio_stream_role; | 413 | std::shared_ptr<core::dbus::Property<Properties::AudioStreamRole>> audio_stream_role; |
437 | 409 | 414 | ||
438 | === modified file 'src/core/media/player_implementation.cpp' | |||
439 | --- src/core/media/player_implementation.cpp 2016-07-11 01:21:38 +0000 | |||
440 | +++ src/core/media/player_implementation.cpp 2016-08-15 19:28:06 +0000 | |||
441 | @@ -505,6 +505,7 @@ | |||
442 | 505 | Parent::shuffle().set(false); | 505 | Parent::shuffle().set(false); |
443 | 506 | Parent::playback_rate().set(1.f); | 506 | Parent::playback_rate().set(1.f); |
444 | 507 | Parent::playback_status().set(Player::PlaybackStatus::null); | 507 | Parent::playback_status().set(Player::PlaybackStatus::null); |
445 | 508 | Parent::backend().set(media::AVBackend::get_backend_type()); | ||
446 | 508 | Parent::loop_status().set(Player::LoopStatus::none); | 509 | Parent::loop_status().set(Player::LoopStatus::none); |
447 | 509 | Parent::position().set(0); | 510 | Parent::position().set(0); |
448 | 510 | Parent::duration().set(0); | 511 | Parent::duration().set(0); |
449 | 511 | 512 | ||
450 | === modified file 'src/core/media/player_skeleton.cpp' | |||
451 | --- src/core/media/player_skeleton.cpp 2016-06-16 02:34:40 +0000 | |||
452 | +++ src/core/media/player_skeleton.cpp 2016-08-15 19:28:06 +0000 | |||
453 | @@ -471,6 +471,11 @@ | |||
454 | 471 | return *d->skeleton.properties.typed_playback_status; | 471 | return *d->skeleton.properties.typed_playback_status; |
455 | 472 | } | 472 | } |
456 | 473 | 473 | ||
457 | 474 | const core::Property<media::AVBackend::Backend>& media::PlayerSkeleton::backend() const | ||
458 | 475 | { | ||
459 | 476 | return *d->skeleton.properties.typed_backend; | ||
460 | 477 | } | ||
461 | 478 | |||
462 | 474 | const core::Property<media::Player::LoopStatus>& media::PlayerSkeleton::loop_status() const | 479 | const core::Property<media::Player::LoopStatus>& media::PlayerSkeleton::loop_status() const |
463 | 475 | { | 480 | { |
464 | 476 | return *d->skeleton.properties.typed_loop_status; | 481 | return *d->skeleton.properties.typed_loop_status; |
465 | @@ -581,6 +586,11 @@ | |||
466 | 581 | return *d->skeleton.properties.typed_playback_status; | 586 | return *d->skeleton.properties.typed_playback_status; |
467 | 582 | } | 587 | } |
468 | 583 | 588 | ||
469 | 589 | core::Property<media::AVBackend::Backend>& media::PlayerSkeleton::backend() | ||
470 | 590 | { | ||
471 | 591 | return *d->skeleton.properties.typed_backend; | ||
472 | 592 | } | ||
473 | 593 | |||
474 | 584 | core::Property<bool>& media::PlayerSkeleton::can_play() | 594 | core::Property<bool>& media::PlayerSkeleton::can_play() |
475 | 585 | { | 595 | { |
476 | 586 | return *d->skeleton.properties.can_play; | 596 | return *d->skeleton.properties.can_play; |
477 | 587 | 597 | ||
478 | === modified file 'src/core/media/player_skeleton.h' | |||
479 | --- src/core/media/player_skeleton.h 2016-06-01 00:43:04 +0000 | |||
480 | +++ src/core/media/player_skeleton.h 2016-08-15 19:28:06 +0000 | |||
481 | @@ -75,6 +75,7 @@ | |||
482 | 75 | virtual const core::Property<bool>& is_video_source() const; | 75 | virtual const core::Property<bool>& is_video_source() const; |
483 | 76 | virtual const core::Property<bool>& is_audio_source() const; | 76 | virtual const core::Property<bool>& is_audio_source() const; |
484 | 77 | virtual const core::Property<PlaybackStatus>& playback_status() const; | 77 | virtual const core::Property<PlaybackStatus>& playback_status() const; |
485 | 78 | virtual const core::Property<AVBackend::Backend>& backend() const; | ||
486 | 78 | virtual const core::Property<LoopStatus>& loop_status() const; | 79 | virtual const core::Property<LoopStatus>& loop_status() const; |
487 | 79 | virtual const core::Property<PlaybackRate>& playback_rate() const; | 80 | virtual const core::Property<PlaybackRate>& playback_rate() const; |
488 | 80 | virtual const core::Property<bool>& shuffle() const; | 81 | virtual const core::Property<bool>& shuffle() const; |
489 | @@ -105,6 +106,7 @@ | |||
490 | 105 | // These properties are not exposed to the client, but still need to be | 106 | // These properties are not exposed to the client, but still need to be |
491 | 106 | // able to be settable from within the Player: | 107 | // able to be settable from within the Player: |
492 | 107 | virtual core::Property<PlaybackStatus>& playback_status(); | 108 | virtual core::Property<PlaybackStatus>& playback_status(); |
493 | 109 | virtual core::Property<AVBackend::Backend>& backend(); | ||
494 | 108 | virtual core::Property<bool>& can_play(); | 110 | virtual core::Property<bool>& can_play(); |
495 | 109 | virtual core::Property<bool>& can_pause(); | 111 | virtual core::Property<bool>& can_pause(); |
496 | 110 | virtual core::Property<bool>& can_seek(); | 112 | virtual core::Property<bool>& can_seek(); |
497 | 111 | 113 | ||
498 | === modified file 'src/core/media/player_stub.cpp' | |||
499 | --- src/core/media/player_stub.cpp 2016-07-19 21:22:18 +0000 | |||
500 | +++ src/core/media/player_stub.cpp 2016-08-15 19:28:06 +0000 | |||
501 | @@ -54,7 +54,6 @@ | |||
502 | 54 | object(object), | 54 | object(object), |
503 | 55 | key(object->invoke_method_synchronously<mpris::Player::Key, media::Player::PlayerKey>().value()), | 55 | key(object->invoke_method_synchronously<mpris::Player::Key, media::Player::PlayerKey>().value()), |
504 | 56 | uuid(uuid), | 56 | uuid(uuid), |
505 | 57 | sink_factory(media::video::make_platform_default_sink_factory(key)), | ||
506 | 58 | properties | 57 | properties |
507 | 59 | { | 58 | { |
508 | 60 | // Link the properties from the server side to the client side over the bus | 59 | // Link the properties from the server side to the client side over the bus |
509 | @@ -67,6 +66,7 @@ | |||
510 | 67 | object->get_property<mpris::Player::Properties::IsVideoSource>(), | 66 | object->get_property<mpris::Player::Properties::IsVideoSource>(), |
511 | 68 | object->get_property<mpris::Player::Properties::IsAudioSource>(), | 67 | object->get_property<mpris::Player::Properties::IsAudioSource>(), |
512 | 69 | object->get_property<mpris::Player::Properties::TypedPlaybackStatus>(), | 68 | object->get_property<mpris::Player::Properties::TypedPlaybackStatus>(), |
513 | 69 | object->get_property<mpris::Player::Properties::TypedBackend>(), | ||
514 | 70 | object->get_property<mpris::Player::Properties::TypedLoopStatus>(), | 70 | object->get_property<mpris::Player::Properties::TypedLoopStatus>(), |
515 | 71 | object->get_property<mpris::Player::Properties::PlaybackRate>(), | 71 | object->get_property<mpris::Player::Properties::PlaybackRate>(), |
516 | 72 | object->get_property<mpris::Player::Properties::Shuffle>(), | 72 | object->get_property<mpris::Player::Properties::Shuffle>(), |
517 | @@ -91,6 +91,8 @@ | |||
518 | 91 | object->get_signal<mpris::Player::Signals::Error>() | 91 | object->get_signal<mpris::Player::Signals::Error>() |
519 | 92 | } | 92 | } |
520 | 93 | { | 93 | { |
521 | 94 | sink_factory = media::video::make_platform_default_sink_factory(key, | ||
522 | 95 | properties.backend->get()); | ||
523 | 94 | } | 96 | } |
524 | 95 | 97 | ||
525 | 96 | ~Private() | 98 | ~Private() |
526 | @@ -116,6 +118,7 @@ | |||
527 | 116 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::IsAudioSource>> is_audio_source; | 118 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::IsAudioSource>> is_audio_source; |
528 | 117 | 119 | ||
529 | 118 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::TypedPlaybackStatus>> playback_status; | 120 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::TypedPlaybackStatus>> playback_status; |
530 | 121 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::TypedBackend>> backend; | ||
531 | 119 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::TypedLoopStatus>> loop_status; | 122 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::TypedLoopStatus>> loop_status; |
532 | 120 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::PlaybackRate>> playback_rate; | 123 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::PlaybackRate>> playback_rate; |
533 | 121 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::Shuffle>> shuffle; | 124 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::Shuffle>> shuffle; |
534 | @@ -237,10 +240,12 @@ | |||
535 | 237 | const std::string& uuid) | 240 | const std::string& uuid) |
536 | 238 | : d(new Private{parent, service, object, uuid}) | 241 | : d(new Private{parent, service, object, uuid}) |
537 | 239 | { | 242 | { |
538 | 243 | MH_TRACE(""); | ||
539 | 240 | } | 244 | } |
540 | 241 | 245 | ||
541 | 242 | media::PlayerStub::~PlayerStub() | 246 | media::PlayerStub::~PlayerStub() |
542 | 243 | { | 247 | { |
543 | 248 | MH_TRACE(""); | ||
544 | 244 | } | 249 | } |
545 | 245 | 250 | ||
546 | 246 | std::string media::PlayerStub::uuid() const | 251 | std::string media::PlayerStub::uuid() const |
547 | @@ -412,6 +417,11 @@ | |||
548 | 412 | return *d->properties.playback_status; | 417 | return *d->properties.playback_status; |
549 | 413 | } | 418 | } |
550 | 414 | 419 | ||
551 | 420 | const core::Property<media::AVBackend::Backend>& media::PlayerStub::backend() const | ||
552 | 421 | { | ||
553 | 422 | return *d->properties.backend; | ||
554 | 423 | } | ||
555 | 424 | |||
556 | 415 | const core::Property<media::Player::LoopStatus>& media::PlayerStub::loop_status() const | 425 | const core::Property<media::Player::LoopStatus>& media::PlayerStub::loop_status() const |
557 | 416 | { | 426 | { |
558 | 417 | return *d->properties.loop_status; | 427 | return *d->properties.loop_status; |
559 | 418 | 428 | ||
560 | === modified file 'src/core/media/player_stub.h' | |||
561 | --- src/core/media/player_stub.h 2016-06-01 00:43:04 +0000 | |||
562 | +++ src/core/media/player_stub.h 2016-08-15 19:28:06 +0000 | |||
563 | @@ -71,6 +71,7 @@ | |||
564 | 71 | virtual const core::Property<bool>& is_video_source() const; | 71 | virtual const core::Property<bool>& is_video_source() const; |
565 | 72 | virtual const core::Property<bool>& is_audio_source() const; | 72 | virtual const core::Property<bool>& is_audio_source() const; |
566 | 73 | virtual const core::Property<PlaybackStatus>& playback_status() const; | 73 | virtual const core::Property<PlaybackStatus>& playback_status() const; |
567 | 74 | virtual const core::Property<AVBackend::Backend>& backend() const; | ||
568 | 74 | virtual const core::Property<LoopStatus>& loop_status() const; | 75 | virtual const core::Property<LoopStatus>& loop_status() const; |
569 | 75 | virtual const core::Property<PlaybackRate>& playback_rate() const; | 76 | virtual const core::Property<PlaybackRate>& playback_rate() const; |
570 | 76 | virtual const core::Property<bool>& shuffle() const; | 77 | virtual const core::Property<bool>& shuffle() const; |
571 | 77 | 78 | ||
572 | === modified file 'src/core/media/recorder_observer.cpp' | |||
573 | --- src/core/media/recorder_observer.cpp 2014-11-26 09:36:44 +0000 | |||
574 | +++ src/core/media/recorder_observer.cpp 2016-08-15 19:28:06 +0000 | |||
575 | @@ -16,13 +16,30 @@ | |||
576 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
577 | 17 | */ | 17 | */ |
578 | 18 | 18 | ||
579 | 19 | #include "core/media/logger/logger.h" | ||
580 | 20 | |||
581 | 21 | #include <core/media/player.h> | ||
582 | 19 | #include <core/media/recorder_observer.h> | 22 | #include <core/media/recorder_observer.h> |
583 | 20 | 23 | ||
584 | 21 | #include <core/media/hybris_recorder_observer.h> | 24 | #include <core/media/hybris_recorder_observer.h> |
585 | 25 | #include <core/media/stub_recorder_observer.h> | ||
586 | 22 | 26 | ||
587 | 23 | namespace media = core::ubuntu::media; | 27 | namespace media = core::ubuntu::media; |
588 | 24 | 28 | ||
589 | 25 | media::RecorderObserver::Ptr media::make_platform_default_recorder_observer() | 29 | media::RecorderObserver::Ptr media::make_platform_default_recorder_observer() |
590 | 26 | { | 30 | { |
592 | 27 | return media::HybrisRecorderObserver::create(); | 31 | const media::AVBackend::Backend b {media::AVBackend::get_backend_type()}; |
593 | 32 | switch (b) | ||
594 | 33 | { | ||
595 | 34 | case media::AVBackend::Backend::hybris: | ||
596 | 35 | return media::HybrisRecorderObserver::create(); | ||
597 | 36 | case media::AVBackend::Backend::none: | ||
598 | 37 | MH_WARNING( | ||
599 | 38 | "No video backend selected. Video recording functionality won't work." | ||
600 | 39 | ); | ||
601 | 40 | return media::StubRecorderObserver::create(); | ||
602 | 41 | default: | ||
603 | 42 | MH_INFO("Invalid or no A/V backend specified, using \"hybris\" as a default."); | ||
604 | 43 | return media::HybrisRecorderObserver::create(); | ||
605 | 44 | } | ||
606 | 28 | } | 45 | } |
607 | 29 | 46 | ||
608 | === modified file 'src/core/media/server/server.cpp' | |||
609 | --- src/core/media/server/server.cpp 2016-04-05 19:34:22 +0000 | |||
610 | +++ src/core/media/server/server.cpp 2016-08-15 19:28:06 +0000 | |||
611 | @@ -58,7 +58,7 @@ | |||
612 | 58 | severity = media::Logger::Severity::kFatal; | 58 | severity = media::Logger::Severity::kFatal; |
613 | 59 | else | 59 | else |
614 | 60 | std::cerr << "Invalid log level \"" << level | 60 | std::cerr << "Invalid log level \"" << level |
616 | 61 | << "\", setting to info. Valid options: [trace, debug, info, warning, error, fatal]. " | 61 | << "\", setting to info. Valid options: [trace, debug, info, warning, error, fatal]." |
617 | 62 | << std::endl; | 62 | << std::endl; |
618 | 63 | } | 63 | } |
619 | 64 | else | 64 | else |
620 | @@ -71,7 +71,20 @@ | |||
621 | 71 | // All platform-specific initialization routines go here. | 71 | // All platform-specific initialization routines go here. |
622 | 72 | void platform_init() | 72 | void platform_init() |
623 | 73 | { | 73 | { |
625 | 74 | decoding_service_init(); | 74 | const media::AVBackend::Backend b {media::AVBackend::get_backend_type()}; |
626 | 75 | switch (b) | ||
627 | 76 | { | ||
628 | 77 | case media::AVBackend::Backend::hybris: | ||
629 | 78 | MH_DEBUG("Found hybris backend"); | ||
630 | 79 | decoding_service_init(); | ||
631 | 80 | break; | ||
632 | 81 | case media::AVBackend::Backend::none: | ||
633 | 82 | MH_WARNING("No video backend selected. Video functionality won't work."); | ||
634 | 83 | break; | ||
635 | 84 | default: | ||
636 | 85 | MH_INFO("Invalid or no A/V backend specified, using \"hybris\" as a default."); | ||
637 | 86 | decoding_service_init(); | ||
638 | 87 | } | ||
639 | 75 | } | 88 | } |
640 | 76 | } | 89 | } |
641 | 77 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER | 90 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER |
642 | 78 | 91 | ||
643 | === added file 'src/core/media/stub_client_death_observer.cpp' | |||
644 | --- src/core/media/stub_client_death_observer.cpp 1970-01-01 00:00:00 +0000 | |||
645 | +++ src/core/media/stub_client_death_observer.cpp 2016-08-15 19:28:06 +0000 | |||
646 | @@ -0,0 +1,66 @@ | |||
647 | 1 | /* | ||
648 | 2 | * Copyright © 2016 Canonical Ltd. | ||
649 | 3 | * | ||
650 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
651 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
652 | 6 | * as published by the Free Software Foundation. | ||
653 | 7 | * | ||
654 | 8 | * This program is distributed in the hope that it will be useful, | ||
655 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
656 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
657 | 11 | * GNU Lesser General Public License for more details. | ||
658 | 12 | * | ||
659 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
660 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
661 | 15 | * | ||
662 | 16 | * Authored by: Jim Hodapp <jim.hodapp@canonical.com> | ||
663 | 17 | */ | ||
664 | 18 | |||
665 | 19 | #include <core/media/stub_client_death_observer.h> | ||
666 | 20 | |||
667 | 21 | namespace media = core::ubuntu::media; | ||
668 | 22 | |||
669 | 23 | namespace | ||
670 | 24 | { | ||
671 | 25 | typedef std::pair<media::Player::PlayerKey, std::weak_ptr<media::StubClientDeathObserver>> Holder; | ||
672 | 26 | } | ||
673 | 27 | |||
674 | 28 | void media::StubClientDeathObserver::on_client_died_cb(void* context) | ||
675 | 29 | { | ||
676 | 30 | auto holder = static_cast<Holder*>(context); | ||
677 | 31 | |||
678 | 32 | if (not holder) | ||
679 | 33 | return; | ||
680 | 34 | |||
681 | 35 | // We check if we are still alive or if we already got killed. | ||
682 | 36 | if (auto sp = holder->second.lock()) | ||
683 | 37 | { | ||
684 | 38 | sp->client_with_key_died(holder->first); | ||
685 | 39 | } | ||
686 | 40 | |||
687 | 41 | // And with that, we have reached end of life for our holder object. | ||
688 | 42 | delete holder; | ||
689 | 43 | } | ||
690 | 44 | |||
691 | 45 | // Creates an instance of the StubClientDeathObserver. | ||
692 | 46 | media::ClientDeathObserver::Ptr media::StubClientDeathObserver::create() | ||
693 | 47 | { | ||
694 | 48 | return media::ClientDeathObserver::Ptr{new media::StubClientDeathObserver{}}; | ||
695 | 49 | } | ||
696 | 50 | |||
697 | 51 | media::StubClientDeathObserver::StubClientDeathObserver() | ||
698 | 52 | { | ||
699 | 53 | } | ||
700 | 54 | |||
701 | 55 | media::StubClientDeathObserver::~StubClientDeathObserver() | ||
702 | 56 | { | ||
703 | 57 | } | ||
704 | 58 | |||
705 | 59 | void media::StubClientDeathObserver::register_for_death_notifications_with_key(const media::Player::PlayerKey&) | ||
706 | 60 | { | ||
707 | 61 | } | ||
708 | 62 | |||
709 | 63 | const core::Signal<media::Player::PlayerKey>& media::StubClientDeathObserver::on_client_with_key_died() const | ||
710 | 64 | { | ||
711 | 65 | return client_with_key_died; | ||
712 | 66 | } | ||
713 | 0 | 67 | ||
714 | === added file 'src/core/media/stub_client_death_observer.h' | |||
715 | --- src/core/media/stub_client_death_observer.h 1970-01-01 00:00:00 +0000 | |||
716 | +++ src/core/media/stub_client_death_observer.h 2016-08-15 19:28:06 +0000 | |||
717 | @@ -0,0 +1,64 @@ | |||
718 | 1 | /* | ||
719 | 2 | * Copyright © 2016 Canonical Ltd. | ||
720 | 3 | * | ||
721 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
722 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
723 | 6 | * as published by the Free Software Foundation. | ||
724 | 7 | * | ||
725 | 8 | * This program is distributed in the hope that it will be useful, | ||
726 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
727 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
728 | 11 | * GNU Lesser General Public License for more details. | ||
729 | 12 | * | ||
730 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
731 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
732 | 15 | * | ||
733 | 16 | * Authored by: Jim Hodapp <jim.hodapp@canonical.com> | ||
734 | 17 | */ | ||
735 | 18 | |||
736 | 19 | #ifndef CORE_UBUNTU_MEDIA_STUB_CLIENT_DEATH_OBSERVER_H_ | ||
737 | 20 | #define CORE_UBUNTU_MEDIA_STUB_CLIENT_DEATH_OBSERVER_H_ | ||
738 | 21 | |||
739 | 22 | #include <core/media/client_death_observer.h> | ||
740 | 23 | |||
741 | 24 | namespace core | ||
742 | 25 | { | ||
743 | 26 | namespace ubuntu | ||
744 | 27 | { | ||
745 | 28 | namespace media | ||
746 | 29 | { | ||
747 | 30 | // Models functionality to be notified whenever a client | ||
748 | 31 | // of the service goes away, and thus allows us to clean | ||
749 | 32 | // up in that case. | ||
750 | 33 | // Generic empty implementation. | ||
751 | 34 | class StubClientDeathObserver : public ClientDeathObserver, | ||
752 | 35 | public std::enable_shared_from_this<StubClientDeathObserver> | ||
753 | 36 | { | ||
754 | 37 | public: | ||
755 | 38 | // Our static callback that we inject to the hybris world. | ||
756 | 39 | static void on_client_died_cb(void* context); | ||
757 | 40 | |||
758 | 41 | // Creates an instance of the StubClientDeathObserver or throws | ||
759 | 42 | // if the underlying platform does not support it. | ||
760 | 43 | static ClientDeathObserver::Ptr create(); | ||
761 | 44 | |||
762 | 45 | // Make std::unique_ptr happy for forward declared Private internals. | ||
763 | 46 | ~StubClientDeathObserver(); | ||
764 | 47 | |||
765 | 48 | // Registers the client with the given key for death notifications. | ||
766 | 49 | void register_for_death_notifications_with_key(const Player::PlayerKey&) override; | ||
767 | 50 | |||
768 | 51 | // Emitted whenever a client dies, reporting the key under which the | ||
769 | 52 | // respective client was known. | ||
770 | 53 | const core::Signal<Player::PlayerKey>& on_client_with_key_died() const override; | ||
771 | 54 | |||
772 | 55 | private: | ||
773 | 56 | StubClientDeathObserver(); | ||
774 | 57 | |||
775 | 58 | core::Signal<media::Player::PlayerKey> client_with_key_died; | ||
776 | 59 | }; | ||
777 | 60 | } | ||
778 | 61 | } | ||
779 | 62 | } | ||
780 | 63 | |||
781 | 64 | #endif // CORE_UBUNTU_MEDIA_STUB_CLIENT_DEATH_OBSERVER_H_ | ||
782 | 0 | 65 | ||
783 | === added file 'src/core/media/stub_recorder_observer.cpp' | |||
784 | --- src/core/media/stub_recorder_observer.cpp 1970-01-01 00:00:00 +0000 | |||
785 | +++ src/core/media/stub_recorder_observer.cpp 2016-08-15 19:28:06 +0000 | |||
786 | @@ -0,0 +1,40 @@ | |||
787 | 1 | /* | ||
788 | 2 | * Copyright © 2016 Canonical Ltd. | ||
789 | 3 | * | ||
790 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
791 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
792 | 6 | * as published by the Free Software Foundation. | ||
793 | 7 | * | ||
794 | 8 | * This program is distributed in the hope that it will be useful, | ||
795 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
796 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
797 | 11 | * GNU Lesser General Public License for more details. | ||
798 | 12 | * | ||
799 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
800 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
801 | 15 | * | ||
802 | 16 | * Authored by: Jim Hodapp <jim.hodapp@canonical.com> | ||
803 | 17 | */ | ||
804 | 18 | |||
805 | 19 | #include <core/media/stub_recorder_observer.h> | ||
806 | 20 | |||
807 | 21 | namespace media = core::ubuntu::media; | ||
808 | 22 | |||
809 | 23 | media::StubRecorderObserver::StubRecorderObserver() | ||
810 | 24 | : current_recording_state(media::RecordingState::stopped) | ||
811 | 25 | { | ||
812 | 26 | } | ||
813 | 27 | |||
814 | 28 | media::StubRecorderObserver::~StubRecorderObserver() | ||
815 | 29 | { | ||
816 | 30 | } | ||
817 | 31 | |||
818 | 32 | const core::Property<media::RecordingState>& media::StubRecorderObserver::recording_state() const | ||
819 | 33 | { | ||
820 | 34 | return current_recording_state; | ||
821 | 35 | } | ||
822 | 36 | |||
823 | 37 | media::RecorderObserver::Ptr media::StubRecorderObserver::create() | ||
824 | 38 | { | ||
825 | 39 | return media::RecorderObserver::Ptr{new media::StubRecorderObserver{}}; | ||
826 | 40 | } | ||
827 | 0 | 41 | ||
828 | === added file 'src/core/media/stub_recorder_observer.h' | |||
829 | --- src/core/media/stub_recorder_observer.h 1970-01-01 00:00:00 +0000 | |||
830 | +++ src/core/media/stub_recorder_observer.h 2016-08-15 19:28:06 +0000 | |||
831 | @@ -0,0 +1,50 @@ | |||
832 | 1 | /* | ||
833 | 2 | * Copyright © 2016 Canonical Ltd. | ||
834 | 3 | * | ||
835 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
836 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
837 | 6 | * as published by the Free Software Foundation. | ||
838 | 7 | * | ||
839 | 8 | * This program is distributed in the hope that it will be useful, | ||
840 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
841 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
842 | 11 | * GNU Lesser General Public License for more details. | ||
843 | 12 | * | ||
844 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
845 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
846 | 15 | * | ||
847 | 16 | * Authored by: Jim Hodapp <jim.hodapp@canonical.com> | ||
848 | 17 | */ | ||
849 | 18 | |||
850 | 19 | #ifndef CORE_UBUNTU_MEDIA_STUB_RECORDER_OBSERVER_H_ | ||
851 | 20 | #define CORE_UBUNTU_MEDIA_STUB_RECORDER_OBSERVER_H_ | ||
852 | 21 | |||
853 | 22 | #include <core/media/recorder_observer.h> | ||
854 | 23 | |||
855 | 24 | namespace core | ||
856 | 25 | { | ||
857 | 26 | namespace ubuntu | ||
858 | 27 | { | ||
859 | 28 | namespace media | ||
860 | 29 | { | ||
861 | 30 | class StubRecorderObserver : public RecorderObserver | ||
862 | 31 | { | ||
863 | 32 | public: | ||
864 | 33 | // Creates a new instance of the StubRecorderObserver | ||
865 | 34 | static RecorderObserver::Ptr create(); | ||
866 | 35 | |||
867 | 36 | ~StubRecorderObserver(); | ||
868 | 37 | |||
869 | 38 | // Getable/observable property describing the recording state of the system. | ||
870 | 39 | const core::Property<RecordingState>& recording_state() const override; | ||
871 | 40 | |||
872 | 41 | private: | ||
873 | 42 | StubRecorderObserver(); | ||
874 | 43 | |||
875 | 44 | core::Property<media::RecordingState> current_recording_state; | ||
876 | 45 | }; | ||
877 | 46 | } | ||
878 | 47 | } | ||
879 | 48 | } | ||
880 | 49 | |||
881 | 50 | #endif // CORE_UBUNTU_MEDIA_STUB_RECORDER_OBSERVER_H_ | ||
882 | 0 | 51 | ||
883 | === modified file 'src/core/media/video/hybris_gl_sink.h' | |||
884 | --- src/core/media/video/hybris_gl_sink.h 2015-01-29 12:12:43 +0000 | |||
885 | +++ src/core/media/video/hybris_gl_sink.h 2016-08-15 19:28:06 +0000 | |||
886 | @@ -34,7 +34,7 @@ | |||
887 | 34 | { | 34 | { |
888 | 35 | class HybrisGlSink : public video::Sink | 35 | class HybrisGlSink : public video::Sink |
889 | 36 | { | 36 | { |
891 | 37 | public: | 37 | public: |
892 | 38 | // Returns a factory functor that allows for creating actual sink instances. | 38 | // Returns a factory functor that allows for creating actual sink instances. |
893 | 39 | static std::function<video::Sink::Ptr(std::uint32_t)> factory_for_key(const media::Player::PlayerKey&); | 39 | static std::function<video::Sink::Ptr(std::uint32_t)> factory_for_key(const media::Player::PlayerKey&); |
894 | 40 | 40 | ||
895 | 41 | 41 | ||
896 | === modified file 'src/core/media/video/platform_default_sink.cpp' | |||
897 | --- src/core/media/video/platform_default_sink.cpp 2016-04-05 14:40:47 +0000 | |||
898 | +++ src/core/media/video/platform_default_sink.cpp 2016-08-15 19:28:06 +0000 | |||
899 | @@ -16,6 +16,8 @@ | |||
900 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
901 | 17 | */ | 17 | */ |
902 | 18 | 18 | ||
903 | 19 | #include "core/media/logger/logger.h" | ||
904 | 20 | |||
905 | 19 | #include <core/media/video/platform_default_sink.h> | 21 | #include <core/media/video/platform_default_sink.h> |
906 | 20 | 22 | ||
907 | 21 | namespace media = core::ubuntu::media; | 23 | namespace media = core::ubuntu::media; |
908 | @@ -56,9 +58,23 @@ | |||
909 | 56 | #if defined(MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | 58 | #if defined(MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) |
910 | 57 | #include <core/media/video/hybris_gl_sink.h> | 59 | #include <core/media/video/hybris_gl_sink.h> |
911 | 58 | 60 | ||
913 | 59 | video::SinkFactory video::make_platform_default_sink_factory(const media::Player::PlayerKey& key) | 61 | video::SinkFactory video::make_platform_default_sink_factory(const media::Player::PlayerKey& key, |
914 | 62 | const media::AVBackend::Backend b) | ||
915 | 60 | { | 63 | { |
917 | 61 | return video::HybrisGlSink::factory_for_key(key); | 64 | switch (b) |
918 | 65 | { | ||
919 | 66 | case media::AVBackend::Backend::hybris: | ||
920 | 67 | MH_DEBUG("Using hybris video sink"); | ||
921 | 68 | return video::HybrisGlSink::factory_for_key(key); | ||
922 | 69 | case media::AVBackend::Backend::none: | ||
923 | 70 | MH_WARNING( | ||
924 | 71 | "No video backend selected. Video rendering functionality won't work." | ||
925 | 72 | ); | ||
926 | 73 | return [](std::uint32_t) { return video::Sink::Ptr{}; }; | ||
927 | 74 | default: | ||
928 | 75 | MH_INFO("Invalid or no A/V backend specified, using \"hybris\" as a default."); | ||
929 | 76 | return video::HybrisGlSink::factory_for_key(key); | ||
930 | 77 | } | ||
931 | 62 | } | 78 | } |
932 | 63 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER | 79 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER |
933 | 64 | video::SinkFactory video::make_platform_default_sink_factory(const media::Player::PlayerKey&) | 80 | video::SinkFactory video::make_platform_default_sink_factory(const media::Player::PlayerKey&) |
934 | 65 | 81 | ||
935 | === modified file 'src/core/media/video/platform_default_sink.h' | |||
936 | --- src/core/media/video/platform_default_sink.h 2015-01-29 12:12:43 +0000 | |||
937 | +++ src/core/media/video/platform_default_sink.h 2016-08-15 19:28:06 +0000 | |||
938 | @@ -35,7 +35,8 @@ | |||
939 | 35 | // A functor that allows for creating actual sinks given a texture id. | 35 | // A functor that allows for creating actual sinks given a texture id. |
940 | 36 | typedef std::function<Sink::Ptr(std::uint32_t)> SinkFactory; | 36 | typedef std::function<Sink::Ptr(std::uint32_t)> SinkFactory; |
941 | 37 | // Returns the platform default sink factory for the player instance identified by the given key. | 37 | // Returns the platform default sink factory for the player instance identified by the given key. |
943 | 38 | SinkFactory make_platform_default_sink_factory(const Player::PlayerKey& key); | 38 | SinkFactory make_platform_default_sink_factory(const Player::PlayerKey& key, |
944 | 39 | const AVBackend::Backend b); | ||
945 | 39 | } | 40 | } |
946 | 40 | } | 41 | } |
947 | 41 | } | 42 | } |
948 | 42 | 43 | ||
949 | === modified file 'tests/acceptance-tests/service.cpp' | |||
950 | --- tests/acceptance-tests/service.cpp 2015-11-02 21:14:29 +0000 | |||
951 | +++ tests/acceptance-tests/service.cpp 2016-08-15 19:28:06 +0000 | |||
952 | @@ -68,6 +68,14 @@ | |||
953 | 68 | } | 68 | } |
954 | 69 | } | 69 | } |
955 | 70 | 70 | ||
956 | 71 | TEST(MediaService, service_is_running) | ||
957 | 72 | { | ||
958 | 73 | auto service = media::Service::Client::instance(); | ||
959 | 74 | auto session = service->create_session(media::Player::Client::default_configuration()); | ||
960 | 75 | EXPECT_TRUE(service != nullptr); | ||
961 | 76 | EXPECT_TRUE(session != nullptr); | ||
962 | 77 | } | ||
963 | 78 | |||
964 | 71 | TEST(MediaService, move_track_in_tracklist_works) | 79 | TEST(MediaService, move_track_in_tracklist_works) |
965 | 72 | { | 80 | { |
966 | 73 | auto service = media::Service::Client::instance(); | 81 | auto service = media::Service::Client::instance(); |
967 | 74 | 82 | ||
968 | === modified file 'tests/unit-tests/test-gstreamer-engine.cpp' | |||
969 | --- tests/unit-tests/test-gstreamer-engine.cpp 2016-06-30 23:23:50 +0000 | |||
970 | +++ tests/unit-tests/test-gstreamer-engine.cpp 2016-08-15 19:28:06 +0000 | |||
971 | @@ -103,9 +103,10 @@ | |||
972 | 103 | std::ref(wst), | 103 | std::ref(wst), |
973 | 104 | std::placeholders::_1)); | 104 | std::placeholders::_1)); |
974 | 105 | 105 | ||
976 | 106 | static const bool do_pipeline_reset = true; | 106 | static const bool do_pipeline_reset = false; |
977 | 107 | EXPECT_TRUE(engine.open_resource_for_uri(test_file_uri, do_pipeline_reset)); | 107 | EXPECT_TRUE(engine.open_resource_for_uri(test_file_uri, do_pipeline_reset)); |
979 | 108 | EXPECT_TRUE(engine.play()); | 108 | static const bool use_main_context = true; |
980 | 109 | EXPECT_TRUE(engine.play(use_main_context)); | ||
981 | 109 | EXPECT_TRUE(wst.wait_for_state_for( | 110 | EXPECT_TRUE(wst.wait_for_state_for( |
982 | 110 | core::ubuntu::media::Engine::State::playing, | 111 | core::ubuntu::media::Engine::State::playing, |
983 | 111 | std::chrono::seconds{4})); | 112 | std::chrono::seconds{4})); |
984 | @@ -145,15 +146,16 @@ | |||
985 | 145 | std::ref(wst), | 146 | std::ref(wst), |
986 | 146 | std::placeholders::_1)); | 147 | std::placeholders::_1)); |
987 | 147 | 148 | ||
989 | 148 | static const bool do_pipeline_reset = true; | 149 | static const bool do_pipeline_reset = false; |
990 | 149 | EXPECT_TRUE(engine.open_resource_for_uri(test_file_uri, do_pipeline_reset)); | 150 | EXPECT_TRUE(engine.open_resource_for_uri(test_file_uri, do_pipeline_reset)); |
992 | 150 | EXPECT_TRUE(engine.play()); | 151 | static const bool use_main_context = true; |
993 | 152 | EXPECT_TRUE(engine.play(use_main_context)); | ||
994 | 151 | EXPECT_TRUE(wst.wait_for_state_for( | 153 | EXPECT_TRUE(wst.wait_for_state_for( |
995 | 152 | core::ubuntu::media::Engine::State::playing, | 154 | core::ubuntu::media::Engine::State::playing, |
996 | 153 | std::chrono::milliseconds{4000})); | 155 | std::chrono::milliseconds{4000})); |
997 | 154 | 156 | ||
998 | 155 | EXPECT_TRUE(wst.wait_for_state_for( | 157 | EXPECT_TRUE(wst.wait_for_state_for( |
1000 | 156 | core::ubuntu::media::Engine::State::ready, | 158 | core::ubuntu::media::Engine::State::stopped, |
1001 | 157 | std::chrono::seconds{10})); | 159 | std::chrono::seconds{10})); |
1002 | 158 | } | 160 | } |
1003 | 159 | 161 | ||
1004 | @@ -207,7 +209,8 @@ | |||
1005 | 207 | std::placeholders::_1)); | 209 | std::placeholders::_1)); |
1006 | 208 | 210 | ||
1007 | 209 | EXPECT_TRUE(engine.open_resource_for_uri(test_audio_uri, headers)); | 211 | EXPECT_TRUE(engine.open_resource_for_uri(test_audio_uri, headers)); |
1009 | 210 | EXPECT_TRUE(engine.play()); | 212 | static const bool use_main_context = true; |
1010 | 213 | EXPECT_TRUE(engine.play(use_main_context)); | ||
1011 | 211 | EXPECT_TRUE(wst.wait_for_state_for( | 214 | EXPECT_TRUE(wst.wait_for_state_for( |
1012 | 212 | core::ubuntu::media::Engine::State::playing, | 215 | core::ubuntu::media::Engine::State::playing, |
1013 | 213 | std::chrono::seconds{10})); | 216 | std::chrono::seconds{10})); |
We need to decide how to detect the platform, see comment below.