Merge lp:~phablet-team/qtubuntu-media/audio_role into lp:qtubuntu-media
- audio_role
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Simon Fels | ||||
Approved revision: | 111 | ||||
Merged at revision: | 103 | ||||
Proposed branch: | lp:~phablet-team/qtubuntu-media/audio_role | ||||
Merge into: | lp:qtubuntu-media | ||||
Diff against target: |
1123 lines (+550/-146) 18 files modified
debian/changelog (+6/-0) src/aal/aal.pro (+2/-0) src/aal/aalaudiorolecontrol.cpp (+106/-0) src/aal/aalaudiorolecontrol.h (+48/-0) src/aal/aalmediaplayercontrol.cpp (+0/-8) src/aal/aalmediaplayercontrol.h (+1/-5) src/aal/aalmediaplayerservice.cpp (+127/-92) src/aal/aalmediaplayerservice.h (+6/-6) tests/integration/audiorole/audiorole.pro (+23/-0) tests/integration/audiorole/tst_audiorole.cpp (+138/-0) tests/integration/audiorole/tst_audiorole.h (+54/-0) tests/integration/integration.pro (+1/-0) tests/tests.pro (+3/-0) tests/unit/player.cpp (+12/-23) tests/unit/player.h (+11/-7) tests/unit/service.cpp (+7/-2) tests/unit/tst_mediaplayerplugin.cpp (+3/-3) tests/unit/unit.pro (+2/-0) |
||||
To merge this branch: | bzr merge lp:~phablet-team/qtubuntu-media/audio_role | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alfonso Sanchez-Beato | Approve | ||
Simon Fels | Needs Fixing | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+287368@code.launchpad.net |
Commit message
Only use the new QAudio based audio role type. No need for the old QMediaPlayer audio role type.
Description of the change
Only use the new QAudio based audio role type. No need for the old QMediaPlayer audio role type.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:104
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:105
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 108. By Jim Hodapp
-
Unify two redudant case statements
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
See comments.
Alfonso Sanchez-Beato (alfonsosanchezbeato) : | # |
Jim Hodapp (jhodapp) wrote : | # |
Addressed review comments.
- 109. By Jim Hodapp
-
Addressed review comments
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
LGTM
- 110. By Jim Hodapp
-
Make sure to not break the indicator-sound controls
Simon Fels (morphis) wrote : | # |
LGTM but tests are still failing.
Jim Hodapp (jhodapp) wrote : | # |
What tests are failing? Nothing is failing for me.
On Tue, Mar 22, 2016 at 12:47 PM, Simon Fels <email address hidden>
wrote:
> LGTM but tests are still failing.
> --
>
> https:/
> Your team Ubuntu Phablet Team is subscribed to branch lp:qtubuntu-media.
>
- 111. By Jim Hodapp
-
Include missing qaudio.h header so that unit tests compile
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2016-02-22 19:00:10 +0000 |
3 | +++ debian/changelog 2016-03-22 19:23:08 +0000 |
4 | @@ -1,3 +1,9 @@ |
5 | +qtubuntu-media (0.8.1+16.04.20160226.1-0ubuntu1) UNRELEASED; urgency=medium |
6 | + |
7 | + * Unify the audio role implementation between vivid and xenial. |
8 | + |
9 | + -- Jim Hodapp <jim.hodapp@canonical.com> Fri, 26 Feb 2016 21:36:37 +0000 |
10 | + |
11 | qtubuntu-media (0.8.0+16.04.20160222.1-0ubuntu1) xenial; urgency=medium |
12 | |
13 | * URI encode the URI that we call setMedia() on or add to the playlist |
14 | |
15 | === modified file 'src/aal/aal.pro' |
16 | --- src/aal/aal.pro 2015-12-18 15:38:48 +0000 |
17 | +++ src/aal/aal.pro 2016-03-22 19:23:08 +0000 |
18 | @@ -23,6 +23,7 @@ |
19 | aalvideorenderercontrol.h \ |
20 | aalmediaplaylistprovider.h \ |
21 | aalmediaplaylistcontrol.h \ |
22 | + aalaudiorolecontrol.h \ |
23 | aalutility.h |
24 | |
25 | SOURCES += \ |
26 | @@ -32,4 +33,5 @@ |
27 | aalvideorenderercontrol.cpp \ |
28 | aalmediaplaylistprovider.cpp \ |
29 | aalmediaplaylistcontrol.cpp \ |
30 | + aalaudiorolecontrol.cpp \ |
31 | aalutility.cpp |
32 | |
33 | === added file 'src/aal/aalaudiorolecontrol.cpp' |
34 | --- src/aal/aalaudiorolecontrol.cpp 1970-01-01 00:00:00 +0000 |
35 | +++ src/aal/aalaudiorolecontrol.cpp 2016-03-22 19:23:08 +0000 |
36 | @@ -0,0 +1,106 @@ |
37 | +/* |
38 | + * Copyright (C) 2016 Canonical, Ltd. |
39 | + * |
40 | + * This program is free software; you can redistribute it and/or modify |
41 | + * it under the terms of the GNU Lesser General Public License as published by |
42 | + * the Free Software Foundation; version 3. |
43 | + * |
44 | + * This program is distributed in the hope that it will be useful, |
45 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
46 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
47 | + * GNU General Public License for more details. |
48 | + * |
49 | + * You should have received a copy of the GNU Lesser General Public License |
50 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
51 | + */ |
52 | + |
53 | +#include "aalaudiorolecontrol.h" |
54 | + |
55 | +#include <QDebug> |
56 | + |
57 | +namespace media = core::ubuntu::media; |
58 | + |
59 | +AalAudioRoleControl::AalAudioRoleControl |
60 | + (const std::shared_ptr<core::ubuntu::media::Player>& playerSession) |
61 | + : QAudioRoleControl() |
62 | + , m_audioRole(QAudio::MusicRole) |
63 | + , m_hubPlayerSession(playerSession) |
64 | +{ |
65 | +} |
66 | + |
67 | +QAudio::Role AalAudioRoleControl::audioRole() const |
68 | +{ |
69 | + return m_audioRole; |
70 | +} |
71 | + |
72 | +void AalAudioRoleControl::setAudioRole(QAudio::Role role) |
73 | +{ |
74 | + if (m_hubPlayerSession == nullptr) |
75 | + { |
76 | + qWarning() << "Failed to setAudioRole since m_hubPlayerSession is NULL"; |
77 | + return; |
78 | + } |
79 | + |
80 | + try { |
81 | + m_hubPlayerSession->audio_stream_role().set(fromQAudioRole(role)); |
82 | + } |
83 | + catch (const std::runtime_error &e) { |
84 | + qWarning() << "Failed to set audio stream role: " << e.what(); |
85 | + return; |
86 | + } |
87 | + |
88 | + if (role != m_audioRole) |
89 | + Q_EMIT audioRoleChanged(m_audioRole = role); |
90 | +} |
91 | + |
92 | +QList<QAudio::Role> AalAudioRoleControl::supportedAudioRoles() const |
93 | +{ |
94 | + return QList<QAudio::Role>() << QAudio::MusicRole |
95 | + << QAudio::VideoRole |
96 | + << QAudio::AlarmRole |
97 | + << QAudio::NotificationRole |
98 | + << QAudio::RingtoneRole |
99 | + << QAudio::VoiceCommunicationRole; |
100 | +} |
101 | + |
102 | +QAudio::Role AalAudioRoleControl::toQAudioRole(const media::Player::AudioStreamRole &role) |
103 | +{ |
104 | + switch (role) |
105 | + { |
106 | + case media::Player::AudioStreamRole::multimedia: |
107 | + return QAudio::MusicRole; |
108 | + case media::Player::AudioStreamRole::alarm: |
109 | + return QAudio::AlarmRole; |
110 | + case media::Player::AudioStreamRole::alert: |
111 | + return QAudio::NotificationRole; |
112 | + case media::Player::AudioStreamRole::phone: |
113 | + return QAudio::VoiceCommunicationRole; |
114 | + default: |
115 | + qWarning() << "Unhandled or invalid core::ubuntu::media::AudioStreamRole: " << role; |
116 | + return QAudio::MusicRole; |
117 | + } |
118 | +} |
119 | + |
120 | +media::Player::AudioStreamRole AalAudioRoleControl::fromQAudioRole(const QAudio::Role &role) |
121 | +{ |
122 | + // If we don't have a valid role, this should be the default translation |
123 | + if (role == QAudio::Role::UnknownRole) |
124 | + return media::Player::AudioStreamRole::multimedia; |
125 | + |
126 | + switch (role) |
127 | + { |
128 | + case QAudio::MusicRole: |
129 | + case QAudio::VideoRole: |
130 | + return media::Player::AudioStreamRole::multimedia; |
131 | + case QAudio::AlarmRole: |
132 | + return media::Player::AudioStreamRole::alarm; |
133 | + case QAudio::NotificationRole: |
134 | + case QAudio::RingtoneRole: |
135 | + return media::Player::AudioStreamRole::alert; |
136 | + case QAudio::VoiceCommunicationRole: |
137 | + return media::Player::AudioStreamRole::phone; |
138 | + default: |
139 | + qWarning() << "Unhandled or invalid QAudio::Role:" << role; |
140 | + return media::Player::AudioStreamRole::multimedia; |
141 | + } |
142 | +} |
143 | |
144 | === added file 'src/aal/aalaudiorolecontrol.h' |
145 | --- src/aal/aalaudiorolecontrol.h 1970-01-01 00:00:00 +0000 |
146 | +++ src/aal/aalaudiorolecontrol.h 2016-03-22 19:23:08 +0000 |
147 | @@ -0,0 +1,48 @@ |
148 | +/* |
149 | + * Copyright (C) 2016 Canonical, Ltd. |
150 | + * |
151 | + * This program is free software; you can redistribute it and/or modify |
152 | + * it under the terms of the GNU Lesser General Public License as published by |
153 | + * the Free Software Foundation; version 3. |
154 | + * |
155 | + * This program is distributed in the hope that it will be useful, |
156 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
157 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
158 | + * GNU General Public License for more details. |
159 | + * |
160 | + * You should have received a copy of the GNU Lesser General Public License |
161 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
162 | + */ |
163 | + |
164 | +#ifndef AALAUDIOROLECONTROL_H |
165 | +#define AALAUDIOROLECONTROL_H |
166 | + |
167 | +#include <core/media/player.h> |
168 | + |
169 | +#include <qaudiorolecontrol.h> |
170 | + |
171 | +class AalAudioRoleControl : public QAudioRoleControl |
172 | +{ |
173 | +public: |
174 | + explicit AalAudioRoleControl |
175 | + (const std::shared_ptr<core::ubuntu::media::Player>& playerSession); |
176 | + AalAudioRoleControl(const AalAudioRoleControl&) = delete; |
177 | + |
178 | + AalAudioRoleControl& operator=(const AalAudioRoleControl&) = delete; |
179 | + bool operator==(const AalAudioRoleControl&) const = delete; |
180 | + |
181 | + QAudio::Role audioRole() const; |
182 | + void setAudioRole(QAudio::Role role); |
183 | + QList<QAudio::Role> supportedAudioRoles() const; |
184 | + |
185 | + static QAudio::Role toQAudioRole |
186 | + (const core::ubuntu::media::Player::AudioStreamRole &role); |
187 | + static core::ubuntu::media::Player::AudioStreamRole fromQAudioRole |
188 | + (const QAudio::Role &role); |
189 | + |
190 | +private: |
191 | + QAudio::Role m_audioRole; |
192 | + std::shared_ptr<core::ubuntu::media::Player> m_hubPlayerSession; |
193 | +}; |
194 | + |
195 | +#endif // AALAUDIOROLECONTROL_H |
196 | |
197 | === modified file 'src/aal/aalmediaplayercontrol.cpp' |
198 | --- src/aal/aalmediaplayercontrol.cpp 2015-12-18 15:38:48 +0000 |
199 | +++ src/aal/aalmediaplayercontrol.cpp 2016-03-22 19:23:08 +0000 |
200 | @@ -61,20 +61,12 @@ |
201 | return m_status; |
202 | } |
203 | |
204 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
205 | -QMediaPlayer::AudioRole AalMediaPlayerControl::audioRole() const |
206 | -#else |
207 | QAudio::Role AalMediaPlayerControl::audioRole() const |
208 | -#endif |
209 | { |
210 | return m_service->audioRole(); |
211 | } |
212 | |
213 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
214 | -void AalMediaPlayerControl::setAudioRole(QMediaPlayer::AudioRole audioRole) |
215 | -#else |
216 | void AalMediaPlayerControl::setAudioRole(QAudio::Role audioRole) |
217 | -#endif |
218 | { |
219 | qDebug() << __PRETTY_FUNCTION__; |
220 | m_service->setAudioRole(audioRole); |
221 | |
222 | === modified file 'src/aal/aalmediaplayercontrol.h' |
223 | --- src/aal/aalmediaplayercontrol.h 2015-10-06 06:32:14 +0000 |
224 | +++ src/aal/aalmediaplayercontrol.h 2016-03-22 19:23:08 +0000 |
225 | @@ -18,6 +18,7 @@ |
226 | #define AALMEDIAPLAYER_H |
227 | |
228 | #include <QMediaPlayerControl> |
229 | +#include <QtMultimedia/qaudio.h> |
230 | |
231 | class AalMediaPlayerService; |
232 | |
233 | @@ -32,13 +33,8 @@ |
234 | |
235 | virtual QMediaPlayer::State state() const; |
236 | virtual QMediaPlayer::MediaStatus mediaStatus() const; |
237 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
238 | - virtual QMediaPlayer::AudioRole audioRole() const; |
239 | - virtual void setAudioRole(QMediaPlayer::AudioRole audioRole); |
240 | -#else |
241 | virtual QAudio::Role audioRole() const; |
242 | virtual void setAudioRole(QAudio::Role audioRole); |
243 | -#endif |
244 | virtual qint64 duration() const; |
245 | virtual qint64 position() const; |
246 | virtual void setPosition(qint64); |
247 | |
248 | === modified file 'src/aal/aalmediaplayerservice.cpp' |
249 | --- src/aal/aalmediaplayerservice.cpp 2016-02-19 16:38:09 +0000 |
250 | +++ src/aal/aalmediaplayerservice.cpp 2016-03-22 19:23:08 +0000 |
251 | @@ -18,6 +18,7 @@ |
252 | #include "aalmediaplayerservice.h" |
253 | #include "aalmediaplaylistcontrol.h" |
254 | #include "aalmediaplaylistprovider.h" |
255 | +#include "aalaudiorolecontrol.h" |
256 | #include "aalutility.h" |
257 | |
258 | #include <qmediaplaylistcontrol_p.h> |
259 | @@ -62,29 +63,93 @@ |
260 | core::Signal<void> the_void; |
261 | } |
262 | |
263 | -AalMediaPlayerService::AalMediaPlayerService(QObject *parent): |
264 | - QMediaService(parent), |
265 | - m_hubPlayerSession(NULL), |
266 | - m_playbackStatusChangedConnection(the_void.connect([](){})), |
267 | - m_errorConnection(the_void.connect([](){})), |
268 | - m_endOfStreamConnection(the_void.connect([](){})), |
269 | - m_mediaPlayerControl(nullptr), |
270 | - m_videoOutput(nullptr), |
271 | - m_mediaPlaylistControl(nullptr), |
272 | - m_mediaPlaylistProvider(nullptr), |
273 | - m_videoOutputReady(false), |
274 | - m_firstPlayback(true), |
275 | - m_cachedDuration(0), |
276 | - m_mediaPlaylist(NULL), |
277 | - m_doReattachSession(false) |
278 | +AalMediaPlayerService::AalMediaPlayerService(QObject *parent) |
279 | + : |
280 | + QMediaService(parent), |
281 | + m_hubPlayerSession(NULL), |
282 | + m_playbackStatusChangedConnection(the_void.connect([](){})), |
283 | + m_errorConnection(the_void.connect([](){})), |
284 | + m_endOfStreamConnection(the_void.connect([](){})), |
285 | + m_mediaPlayerControl(nullptr), |
286 | + m_videoOutput(nullptr), |
287 | + m_mediaPlaylistControl(nullptr), |
288 | + m_mediaPlaylistProvider(nullptr), |
289 | + m_audioRoleControl(nullptr), |
290 | + m_videoOutputReady(false), |
291 | + m_firstPlayback(true), |
292 | + m_cachedDuration(0), |
293 | + m_mediaPlaylist(NULL), |
294 | + m_doReattachSession(false) |
295 | #ifdef MEASURE_PERFORMANCE |
296 | - , m_lastFrameDecodeStart(0) |
297 | - , m_currentFrameDecodeStart(0) |
298 | - , m_avgCount(0) |
299 | - , m_frameDecodeAvg(0) |
300 | + , m_lastFrameDecodeStart(0) |
301 | + , m_currentFrameDecodeStart(0) |
302 | + , m_avgCount(0) |
303 | + , m_frameDecodeAvg(0) |
304 | #endif |
305 | { |
306 | - m_hubService = media::Service::Client::instance(); |
307 | + constructNewPlayerService(); |
308 | + // Note: this must be in the constructor and not part of constructNewPlayerService() |
309 | + // or it won't successfully connect to the signal |
310 | + connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &AalMediaPlayerService::onApplicationStateChanged); |
311 | +} |
312 | + |
313 | +AalMediaPlayerService::AalMediaPlayerService |
314 | + (const std::shared_ptr<core::ubuntu::media::Service> &service, QObject *parent) |
315 | + : |
316 | + QMediaService(parent), |
317 | + m_hubService(service), |
318 | + m_hubPlayerSession(NULL), |
319 | + m_playbackStatusChangedConnection(the_void.connect([](){})), |
320 | + m_errorConnection(the_void.connect([](){})), |
321 | + m_endOfStreamConnection(the_void.connect([](){})), |
322 | + m_mediaPlayerControl(nullptr), |
323 | + m_videoOutput(nullptr), |
324 | + m_mediaPlaylistControl(nullptr), |
325 | + m_mediaPlaylistProvider(nullptr), |
326 | + m_audioRoleControl(nullptr), |
327 | + m_videoOutputReady(false), |
328 | + m_firstPlayback(true), |
329 | + m_cachedDuration(0), |
330 | + m_mediaPlaylist(NULL), |
331 | + m_doReattachSession(false) |
332 | + #ifdef MEASURE_PERFORMANCE |
333 | + , m_lastFrameDecodeStart(0) |
334 | + , m_currentFrameDecodeStart(0) |
335 | + , m_avgCount(0) |
336 | + , m_frameDecodeAvg(0) |
337 | + #endif |
338 | +{ |
339 | + constructNewPlayerService(); |
340 | + // Note: this must be in the constructor and not part of constructNewPlayerService() |
341 | + // or it won't successfully connect to the signal |
342 | + connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &AalMediaPlayerService::onApplicationStateChanged); |
343 | +} |
344 | + |
345 | +AalMediaPlayerService::~AalMediaPlayerService() |
346 | +{ |
347 | + m_errorConnection.disconnect(); |
348 | + m_playbackStatusChangedConnection.disconnect(); |
349 | + |
350 | + if (m_audioRoleControl) |
351 | + deleteAudioRoleControl(); |
352 | + |
353 | + if (m_videoOutput) |
354 | + deleteVideoRendererControl(); |
355 | + |
356 | + if (m_mediaPlaylistControl) |
357 | + deletePlaylistControl(); |
358 | + |
359 | + if (m_mediaPlayerControl) |
360 | + deleteMediaPlayerControl(); |
361 | + |
362 | + if (m_hubPlayerSession) |
363 | + destroyPlayerSession(); |
364 | +} |
365 | + |
366 | +void AalMediaPlayerService::constructNewPlayerService() |
367 | +{ |
368 | + if (not m_hubService.get()) |
369 | + m_hubService = media::Service::Client::instance(); |
370 | |
371 | // As core::Connection doesn't allow us to start with a disconnected connection |
372 | // instance we have to connect it first with a dummy signal and then disconnect |
373 | @@ -103,6 +168,7 @@ |
374 | |
375 | createMediaPlayerControl(); |
376 | createVideoRendererControl(); |
377 | + createAudioRoleControl(); |
378 | |
379 | m_playbackStatusChangedConnection = m_hubPlayerSession->playback_status_changed().connect( |
380 | [this](const media::Player::PlaybackStatus &status) { |
381 | @@ -112,26 +178,6 @@ |
382 | |
383 | m_errorConnection = m_hubPlayerSession->error().connect( |
384 | std::bind(&AalMediaPlayerService::onError, this, _1)); |
385 | - |
386 | - connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &AalMediaPlayerService::onApplicationStateChanged); |
387 | -} |
388 | - |
389 | -AalMediaPlayerService::~AalMediaPlayerService() |
390 | -{ |
391 | - m_errorConnection.disconnect(); |
392 | - m_playbackStatusChangedConnection.disconnect(); |
393 | - |
394 | - if (m_videoOutput) |
395 | - deleteVideoRendererControl(); |
396 | - |
397 | - if (m_mediaPlaylistControl) |
398 | - deletePlaylistControl(); |
399 | - |
400 | - if (m_mediaPlayerControl) |
401 | - deleteMediaPlayerControl(); |
402 | - |
403 | - if (m_hubPlayerSession) |
404 | - destroyPlayerSession(); |
405 | } |
406 | |
407 | QMediaControl *AalMediaPlayerService::requestControl(const char *name) |
408 | @@ -164,7 +210,15 @@ |
409 | return m_mediaPlaylistControl; |
410 | } |
411 | |
412 | - return NULL; |
413 | + if (qstrcmp(name, QAudioRoleControl_iid) == 0) |
414 | + { |
415 | + if (not m_audioRoleControl) |
416 | + createAudioRoleControl(); |
417 | + |
418 | + return m_audioRoleControl; |
419 | + } |
420 | + |
421 | + return nullptr; |
422 | } |
423 | |
424 | void AalMediaPlayerService::releaseControl(QMediaControl *control) |
425 | @@ -176,10 +230,10 @@ |
426 | bool AalMediaPlayerService::newMediaPlayer() |
427 | { |
428 | // Only one player session needed |
429 | - if (m_hubPlayerSession != NULL) |
430 | + if (m_hubPlayerSession != nullptr) |
431 | return true; |
432 | |
433 | - if (m_hubService == NULL) |
434 | + if (m_hubService == nullptr) |
435 | { |
436 | qWarning() << "Cannot create new media player instance without a valid media-hub service instance"; |
437 | return false; |
438 | @@ -228,51 +282,26 @@ |
439 | m_videoOutput->playbackComplete(); |
440 | } |
441 | |
442 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
443 | -QMediaPlayer::AudioRole AalMediaPlayerService::audioRole() const |
444 | -#else |
445 | QAudio::Role AalMediaPlayerService::audioRole() const |
446 | -#endif |
447 | { |
448 | - if (m_hubPlayerSession == NULL) |
449 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
450 | - return QMediaPlayer::MultimediaRole; |
451 | -#else |
452 | - return QAudio::VideoRole; |
453 | -#endif |
454 | + if (m_audioRoleControl == nullptr) |
455 | + { |
456 | + qWarning() << "Failed to get audio role, m_audioRoleControl is NULL"; |
457 | + return QAudio::UnknownRole; |
458 | + } |
459 | |
460 | - try { |
461 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
462 | - return static_cast<QMediaPlayer::AudioRole>(m_hubPlayerSession->audio_stream_role().get()); |
463 | -#else |
464 | - return static_cast<QAudio::Role>(m_hubPlayerSession->audio_stream_role().get()); |
465 | -#endif |
466 | - } |
467 | - catch (const std::runtime_error &e) { |
468 | - qWarning() << "Failed to get audio stream role: " << e.what(); |
469 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
470 | - return QMediaPlayer::MultimediaRole; |
471 | -#else |
472 | - return QAudio::VideoRole; |
473 | -#endif |
474 | - } |
475 | + return m_audioRoleControl->audioRole(); |
476 | } |
477 | |
478 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
479 | -void AalMediaPlayerService::setAudioRole(QMediaPlayer::AudioRole audioRole) |
480 | -#else |
481 | void AalMediaPlayerService::setAudioRole(QAudio::Role audioRole) |
482 | -#endif |
483 | { |
484 | - if (m_hubPlayerSession == NULL) |
485 | + if (m_audioRoleControl == nullptr) |
486 | + { |
487 | + qWarning() << "Failed to set audio role, m_audioRoleControl is NULL"; |
488 | return; |
489 | + } |
490 | |
491 | - try { |
492 | - m_hubPlayerSession->audio_stream_role().set(static_cast<media::Player::AudioStreamRole>(audioRole)); |
493 | - } |
494 | - catch (const std::runtime_error &e) { |
495 | - qWarning() << "Failed to set audio stream role: " << e.what(); |
496 | - } |
497 | + m_audioRoleControl->setAudioRole(audioRole); |
498 | } |
499 | |
500 | void AalMediaPlayerService::setMediaPlaylist(const QMediaPlaylist &playlist) |
501 | @@ -544,7 +573,7 @@ |
502 | |
503 | void AalMediaPlayerService::createMediaPlayerControl() |
504 | { |
505 | - if (m_hubPlayerSession == NULL) |
506 | + if (m_hubPlayerSession == nullptr) |
507 | return; |
508 | |
509 | m_mediaPlayerControl = new AalMediaPlayerControl(this); |
510 | @@ -553,7 +582,7 @@ |
511 | |
512 | void AalMediaPlayerService::createVideoRendererControl() |
513 | { |
514 | - if (m_hubPlayerSession == NULL) |
515 | + if (m_hubPlayerSession == nullptr) |
516 | return; |
517 | |
518 | m_videoOutput = new AalVideoRendererControl(this); |
519 | @@ -561,16 +590,21 @@ |
520 | |
521 | void AalMediaPlayerService::createPlaylistControl() |
522 | { |
523 | - qDebug() << Q_FUNC_INFO; |
524 | m_mediaPlaylistControl = new AalMediaPlaylistControl(this); |
525 | m_mediaPlaylistProvider = new AalMediaPlaylistProvider(this); |
526 | m_mediaPlaylistControl->setPlaylistProvider(m_mediaPlaylistProvider); |
527 | } |
528 | |
529 | +void AalMediaPlayerService::createAudioRoleControl() |
530 | +{ |
531 | + if (m_hubPlayerSession == nullptr) |
532 | + return; |
533 | + |
534 | + m_audioRoleControl = new AalAudioRoleControl(m_hubPlayerSession); |
535 | +} |
536 | + |
537 | void AalMediaPlayerService::deleteMediaPlayerControl() |
538 | { |
539 | - qDebug() << Q_FUNC_INFO; |
540 | - |
541 | if (not m_hubPlayerSession) |
542 | return; |
543 | |
544 | @@ -583,8 +617,6 @@ |
545 | |
546 | void AalMediaPlayerService::destroyPlayerSession() |
547 | { |
548 | - qDebug() << Q_FUNC_INFO; |
549 | - |
550 | if (not m_hubPlayerSession) |
551 | return; |
552 | |
553 | @@ -613,8 +645,6 @@ |
554 | |
555 | void AalMediaPlayerService::deletePlaylistControl() |
556 | { |
557 | - qDebug() << Q_FUNC_INFO; |
558 | - |
559 | if (m_mediaPlaylistProvider) |
560 | { |
561 | delete m_mediaPlaylistProvider; |
562 | @@ -627,6 +657,15 @@ |
563 | } |
564 | } |
565 | |
566 | +void AalMediaPlayerService::deleteAudioRoleControl() |
567 | +{ |
568 | + if (m_audioRoleControl) |
569 | + { |
570 | + delete m_audioRoleControl; |
571 | + m_audioRoleControl = nullptr; |
572 | + } |
573 | +} |
574 | + |
575 | void AalMediaPlayerService::signalQMediaPlayerError(const media::Player::Error &error) |
576 | { |
577 | QMediaPlayer::Error outError = QMediaPlayer::NoError; |
578 | @@ -788,11 +827,7 @@ |
579 | { |
580 | // If this player is a multimedia audioRole, then it should possible to |
581 | // use it for MPRIS control |
582 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
583 | - if (audioRole() == QMediaPlayer::MultimediaRole) |
584 | -#else |
585 | if (audioRole() == QAudio::VideoRole || audioRole() == QAudio::MusicRole) |
586 | -#endif |
587 | { |
588 | qDebug() << "Setting player as current player"; |
589 | try { |
590 | |
591 | === modified file 'src/aal/aalmediaplayerservice.h' |
592 | --- src/aal/aalmediaplayerservice.h 2015-12-18 15:38:48 +0000 |
593 | +++ src/aal/aalmediaplayerservice.h 2016-03-22 19:23:08 +0000 |
594 | @@ -34,6 +34,7 @@ |
595 | class AalMediaPlaylistProvider; |
596 | class QMediaPlayerControl; |
597 | class AalVideoRendererControl; |
598 | +class AalAudioRoleControl; |
599 | class tst_MediaPlayerPlugin; |
600 | class QTimerEvent; |
601 | |
602 | @@ -58,7 +59,7 @@ |
603 | |
604 | AalMediaPlayerService(QObject *parent = 0); |
605 | AalMediaPlayerService(const std::shared_ptr<core::ubuntu::media::Service> &service, |
606 | - const std::shared_ptr<core::ubuntu::media::Player> &player, QObject *parent = 0); |
607 | + QObject *parent = 0); |
608 | ~AalMediaPlayerService(); |
609 | |
610 | QMediaControl* requestControl(const char *name); |
611 | @@ -74,13 +75,8 @@ |
612 | // Call this before attempting to play the same video a second time (after EOS) |
613 | void resetVideoSink(); |
614 | |
615 | -#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) |
616 | - QMediaPlayer::AudioRole audioRole() const; |
617 | - void setAudioRole(QMediaPlayer::AudioRole audioRole); |
618 | -#else |
619 | QAudio::Role audioRole() const; |
620 | void setAudioRole(QAudio::Role audioRole); |
621 | -#endif |
622 | |
623 | void setMedia(const QUrl &url); |
624 | void setMediaPlaylist(const QMediaPlaylist& playlist); |
625 | @@ -117,6 +113,7 @@ |
626 | void onApplicationStateChanged(Qt::ApplicationState state); |
627 | |
628 | protected: |
629 | + void constructNewPlayerService(); |
630 | void updateClientSignals(); |
631 | void connectSignals(); |
632 | void disconnectSignals(); |
633 | @@ -129,11 +126,13 @@ |
634 | void createMediaPlayerControl(); |
635 | void createVideoRendererControl(); |
636 | void createPlaylistControl(); |
637 | + void createAudioRoleControl(); |
638 | |
639 | void deleteMediaPlayerControl(); |
640 | void destroyPlayerSession(); |
641 | void deleteVideoRendererControl(); |
642 | void deletePlaylistControl(); |
643 | + void deleteAudioRoleControl(); |
644 | |
645 | // Signals the proper QMediaPlayer::Error from a core::ubuntu::media::Error |
646 | void signalQMediaPlayerError(const core::ubuntu::media::Player::Error &error); |
647 | @@ -152,6 +151,7 @@ |
648 | AalVideoRendererControl *m_videoOutput; |
649 | AalMediaPlaylistControl *m_mediaPlaylistControl; |
650 | AalMediaPlaylistProvider *m_mediaPlaylistProvider; |
651 | + AalAudioRoleControl *m_audioRoleControl; |
652 | bool m_videoOutputReady; |
653 | bool m_firstPlayback; |
654 | |
655 | |
656 | === added directory 'tests/integration/audiorole' |
657 | === added file 'tests/integration/audiorole/audiorole.pro' |
658 | --- tests/integration/audiorole/audiorole.pro 1970-01-01 00:00:00 +0000 |
659 | +++ tests/integration/audiorole/audiorole.pro 2016-03-22 19:23:08 +0000 |
660 | @@ -0,0 +1,23 @@ |
661 | +include(../../coverage.pri) |
662 | + |
663 | +CONFIG += testcase |
664 | +QMAKE_CXXFLAGS += -std=c++11 |
665 | +DEFINES += QT_NO_KEYWORDS |
666 | +TARGET = tst_audiorole |
667 | + |
668 | +QT += core multimedia testlib |
669 | + |
670 | +QT_TESTCASE_BUILDDIR = . |
671 | + |
672 | +INCLUDEPATH += ../../src/aal \ |
673 | + /usr/include/qt5/QtMultimedia \ |
674 | + |
675 | +HEADERS += \ |
676 | + tst_audiorole.h |
677 | + |
678 | +SOURCES += \ |
679 | + tst_audiorole.cpp \ |
680 | + ../../../src/aal/aalutility.cpp |
681 | + |
682 | +# media-hub is required to be running for these tests |
683 | +#system(/sbin/stop media-hub; /sbin/start media-hub) |
684 | |
685 | === added directory 'tests/integration/audiorole/testdata' |
686 | === added file 'tests/integration/audiorole/testdata/Ubuntu.ogg' |
687 | Binary files tests/integration/audiorole/testdata/Ubuntu.ogg 1970-01-01 00:00:00 +0000 and tests/integration/audiorole/testdata/Ubuntu.ogg 2016-03-22 19:23:08 +0000 differ |
688 | === added file 'tests/integration/audiorole/tst_audiorole.cpp' |
689 | --- tests/integration/audiorole/tst_audiorole.cpp 1970-01-01 00:00:00 +0000 |
690 | +++ tests/integration/audiorole/tst_audiorole.cpp 2016-03-22 19:23:08 +0000 |
691 | @@ -0,0 +1,138 @@ |
692 | +/* |
693 | + * Copyright (C) 2016 Canonical, Ltd. |
694 | + * |
695 | + * This program is free software; you can redistribute it and/or modify |
696 | + * it under the terms of the GNU Lesser General Public License as published by |
697 | + * the Free Software Foundation; version 3. |
698 | + * |
699 | + * This program is distributed in the hope that it will be useful, |
700 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
701 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
702 | + * GNU General Public License for more details. |
703 | + * |
704 | + * You should have received a copy of the GNU Lesser General Public License |
705 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
706 | + */ |
707 | + |
708 | +#include "tst_audiorole.h" |
709 | + |
710 | +#include <unistd.h> |
711 | + |
712 | +#include <QMediaPlayer> |
713 | +#include <QMediaPlaylist> |
714 | + |
715 | +#include <QtTest/QtTest> |
716 | + |
717 | +void tst_AudioRole::initTestCase() |
718 | +{ |
719 | +} |
720 | + |
721 | +void tst_AudioRole::cleanupTestCase() |
722 | +{ |
723 | +} |
724 | + |
725 | +void tst_AudioRole::init() |
726 | +{ |
727 | +} |
728 | + |
729 | +void tst_AudioRole::verifyAudioRolePlays() |
730 | +{ |
731 | + QMediaPlayer *player = new QMediaPlayer; |
732 | + const QString fullFileUri {"file://" + QFINDTESTDATA("testdata/Ubuntu.ogg")}; |
733 | + const QMediaContent content {QUrl{fullFileUri}}; |
734 | + qDebug() << "Trying to play file:" << fullFileUri; |
735 | + player->setMedia(content); |
736 | + QSignalSpy spy(player, SIGNAL(audioRoleChanged(QAudio::Role))); |
737 | + player->setAudioRole(QAudio::MusicRole); |
738 | + QCOMPARE(spy.count(), 1); |
739 | + |
740 | + player->play(); |
741 | + sleep(1); |
742 | + qDebug() << "player->error():" << player->error(); |
743 | + qDebug() << "player->mediaStatus():" << player->mediaStatus(); |
744 | + QCOMPARE(player->audioRole(), QAudio::MusicRole); |
745 | + QVERIFY(player->mediaStatus() != QMediaPlayer::InvalidMedia); |
746 | + QCOMPARE(player->state(), QMediaPlayer::State::PlayingState); |
747 | +} |
748 | + |
749 | +void tst_AudioRole::verifyVideoRolePlays() |
750 | +{ |
751 | + QMediaPlayer *player = new QMediaPlayer; |
752 | + const QString fullFileUri {"file://" + QFINDTESTDATA("testdata/Ubuntu.ogg")}; |
753 | + const QMediaContent content {QUrl{fullFileUri}}; |
754 | + qDebug() << "Trying to play file:" << fullFileUri; |
755 | + player->setMedia(content); |
756 | + QSignalSpy spy(player, SIGNAL(audioRoleChanged(QAudio::Role))); |
757 | + player->setAudioRole(QAudio::VideoRole); |
758 | + QCOMPARE(spy.count(), 1); |
759 | + |
760 | + player->play(); |
761 | + sleep(1); |
762 | + qDebug() << "player->error():" << player->error(); |
763 | + qDebug() << "player->mediaStatus():" << player->mediaStatus(); |
764 | + QCOMPARE(player->audioRole(), QAudio::VideoRole); |
765 | + QVERIFY(player->mediaStatus() != QMediaPlayer::InvalidMedia); |
766 | + QCOMPARE(player->state(), QMediaPlayer::State::PlayingState); |
767 | +} |
768 | + |
769 | +void tst_AudioRole::verifyAlarmRolePlays() |
770 | +{ |
771 | + QMediaPlayer *player = new QMediaPlayer; |
772 | + const QString fullFileUri {"file://" + QFINDTESTDATA("testdata/Ubuntu.ogg")}; |
773 | + const QMediaContent content {QUrl{fullFileUri}}; |
774 | + qDebug() << "Trying to play file:" << fullFileUri; |
775 | + player->setMedia(content); |
776 | + QSignalSpy spy(player, SIGNAL(audioRoleChanged(QAudio::Role))); |
777 | + player->setAudioRole(QAudio::AlarmRole); |
778 | + QCOMPARE(spy.count(), 1); |
779 | + |
780 | + player->play(); |
781 | + sleep(1); |
782 | + qDebug() << "player->error():" << player->error(); |
783 | + qDebug() << "player->mediaStatus():" << player->mediaStatus(); |
784 | + QCOMPARE(player->audioRole(), QAudio::AlarmRole); |
785 | + QVERIFY(player->mediaStatus() != QMediaPlayer::InvalidMedia); |
786 | + QCOMPARE(player->state(), QMediaPlayer::State::PlayingState); |
787 | +} |
788 | + |
789 | +void tst_AudioRole::verifyNotificationRolePlays() |
790 | +{ |
791 | + QMediaPlayer *player = new QMediaPlayer; |
792 | + const QString fullFileUri {"file://" + QFINDTESTDATA("testdata/Ubuntu.ogg")}; |
793 | + const QMediaContent content {QUrl{fullFileUri}}; |
794 | + qDebug() << "Trying to play file:" << fullFileUri; |
795 | + player->setMedia(content); |
796 | + QSignalSpy spy(player, SIGNAL(audioRoleChanged(QAudio::Role))); |
797 | + player->setAudioRole(QAudio::NotificationRole); |
798 | + QCOMPARE(spy.count(), 1); |
799 | + |
800 | + player->play(); |
801 | + sleep(1); |
802 | + qDebug() << "player->error():" << player->error(); |
803 | + qDebug() << "player->mediaStatus():" << player->mediaStatus(); |
804 | + QCOMPARE(player->audioRole(), QAudio::NotificationRole); |
805 | + QVERIFY(player->mediaStatus() != QMediaPlayer::InvalidMedia); |
806 | + QCOMPARE(player->state(), QMediaPlayer::State::PlayingState); |
807 | +} |
808 | + |
809 | +void tst_AudioRole::verifyVoiceCommunicationRolePlays() |
810 | +{ |
811 | + QMediaPlayer *player = new QMediaPlayer; |
812 | + const QString fullFileUri {"file://" + QFINDTESTDATA("testdata/Ubuntu.ogg")}; |
813 | + const QMediaContent content {QUrl{fullFileUri}}; |
814 | + qDebug() << "Trying to play file:" << fullFileUri; |
815 | + player->setMedia(content); |
816 | + QSignalSpy spy(player, SIGNAL(audioRoleChanged(QAudio::Role))); |
817 | + player->setAudioRole(QAudio::VoiceCommunicationRole); |
818 | + QCOMPARE(spy.count(), 1); |
819 | + |
820 | + player->play(); |
821 | + sleep(1); |
822 | + qDebug() << "player->error():" << player->error(); |
823 | + qDebug() << "player->mediaStatus():" << player->mediaStatus(); |
824 | + QCOMPARE(player->audioRole(), QAudio::VoiceCommunicationRole); |
825 | + QVERIFY(player->mediaStatus() != QMediaPlayer::InvalidMedia); |
826 | + QCOMPARE(player->state(), QMediaPlayer::State::PlayingState); |
827 | +} |
828 | + |
829 | +QTEST_GUILESS_MAIN(tst_AudioRole) |
830 | |
831 | === added file 'tests/integration/audiorole/tst_audiorole.h' |
832 | --- tests/integration/audiorole/tst_audiorole.h 1970-01-01 00:00:00 +0000 |
833 | +++ tests/integration/audiorole/tst_audiorole.h 2016-03-22 19:23:08 +0000 |
834 | @@ -0,0 +1,54 @@ |
835 | +/* |
836 | + * Copyright (C) 2016 Canonical, Ltd. |
837 | + * |
838 | + * This program is free software; you can redistribute it and/or modify |
839 | + * it under the terms of the GNU Lesser General Public License as published by |
840 | + * the Free Software Foundation; version 3. |
841 | + * |
842 | + * This program is distributed in the hope that it will be useful, |
843 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
844 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
845 | + * GNU General Public License for more details. |
846 | + * |
847 | + * You should have received a copy of the GNU Lesser General Public License |
848 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
849 | + */ |
850 | + |
851 | +#ifndef tst_AudioRole_H |
852 | +#define tst_AudioRole_H |
853 | + |
854 | +#include <core/media/player.h> |
855 | + |
856 | +#include <deque> |
857 | +#include <future> |
858 | +#include <memory> |
859 | + |
860 | +#include <QMediaPlayer> |
861 | +#include <QMediaPlaylist> |
862 | +#include <QObject> |
863 | + |
864 | +class AalMediaPlaylistControl; |
865 | +class QMediaPlayer; |
866 | + |
867 | +class tst_AudioRole : public QObject |
868 | +{ |
869 | + Q_OBJECT |
870 | + |
871 | +private Q_SLOTS: |
872 | + // We want the setup to be run prior to every test case to |
873 | + // ensure correct test isolation, see http://qt-project.org/doc/qt-5/qtest-overview.html. |
874 | + void initTestCase(); |
875 | + void cleanupTestCase(); |
876 | + |
877 | + void init(); |
878 | + |
879 | + void verifyAudioRolePlays(); |
880 | + void verifyVideoRolePlays(); |
881 | + void verifyAlarmRolePlays(); |
882 | + void verifyNotificationRolePlays(); |
883 | + void verifyVoiceCommunicationRolePlays(); |
884 | + |
885 | +private: |
886 | +}; |
887 | + |
888 | +#endif // tst_AudioRole_H |
889 | |
890 | === modified file 'tests/integration/integration.pro' |
891 | --- tests/integration/integration.pro 2016-02-12 21:53:36 +0000 |
892 | +++ tests/integration/integration.pro 2016-03-22 19:23:08 +0000 |
893 | @@ -4,3 +4,4 @@ |
894 | |
895 | SUBDIRS += uris |
896 | SUBDIRS += playlists |
897 | +SUBDIRS += audiorole |
898 | |
899 | === modified file 'tests/tests.pro' |
900 | --- tests/tests.pro 2016-02-12 21:59:09 +0000 |
901 | +++ tests/tests.pro 2016-03-22 19:23:08 +0000 |
902 | @@ -6,4 +6,7 @@ |
903 | |
904 | # We can't run our integration tests yet on other platforms as on arm |
905 | # as they expect a working media-hub we don't have yet anywhere else. |
906 | +# However, this needs to remain commented out until for manual test |
907 | +# execution until we are able to get a Jenkins instance setup for the |
908 | +# media stack. |
909 | #system(uname -a | grep arm):SUBDIRS += integration |
910 | |
911 | === modified file 'tests/unit/player.cpp' |
912 | --- tests/unit/player.cpp 2015-06-08 19:15:43 +0000 |
913 | +++ tests/unit/player.cpp 2016-03-22 19:23:08 +0000 |
914 | @@ -77,6 +77,12 @@ |
915 | return 0; |
916 | } |
917 | |
918 | +media::video::Sink::Ptr TestPlayer::create_gl_texture_video_sink(uint32_t texture_id) |
919 | +{ |
920 | + Q_UNUSED(texture_id); |
921 | + throw std::runtime_error{"Not implemented"}; |
922 | +} |
923 | + |
924 | bool TestPlayer::open_uri(const Track::UriType& uri) |
925 | { |
926 | Q_UNUSED(uri); |
927 | @@ -89,11 +95,6 @@ |
928 | return true; |
929 | } |
930 | |
931 | -std::shared_ptr<core::ubuntu::media::video::Sink> TestPlayer::create_gl_texture_video_sink(uint32_t texture_id) |
932 | -{ |
933 | - Q_UNUSED(texture_id); throw std::runtime_error{"Not implemented"}; |
934 | -} |
935 | - |
936 | void TestPlayer::next() |
937 | { |
938 | } |
939 | @@ -167,12 +168,6 @@ |
940 | return ret; |
941 | } |
942 | |
943 | -const core::Property<TestPlayer::Orientation>& TestPlayer::orientation() const |
944 | -{ |
945 | - static core::Property<Player::Orientation> ret(Player::Orientation::rotate0); |
946 | - return ret; |
947 | -} |
948 | - |
949 | const core::Property<Player::LoopStatus>& TestPlayer::loop_status() const |
950 | { |
951 | static core::Property<Player::LoopStatus> ret(Player::LoopStatus::none); |
952 | @@ -232,6 +227,12 @@ |
953 | return role; |
954 | } |
955 | |
956 | +const core::Property<Player::Orientation>& TestPlayer::orientation() const |
957 | +{ |
958 | + static const core::Property<Player::Orientation> orientation(Player::Orientation::rotate0); |
959 | + return orientation; |
960 | +} |
961 | + |
962 | const core::Property<Player::Lifetime>& TestPlayer::lifetime() const |
963 | { |
964 | static const core::Property<Player::Lifetime> lifetime(Player::Lifetime::normal); |
965 | @@ -292,12 +293,6 @@ |
966 | return ret; |
967 | } |
968 | |
969 | -const core::Signal<Player::PlaybackStatus>& TestPlayer::playback_status_changed() const |
970 | -{ |
971 | - static core::Signal<Player::PlaybackStatus> ret; |
972 | - return ret; |
973 | -} |
974 | - |
975 | core::Signal<Player::PlaybackStatus>& TestPlayer::playback_status_changed() |
976 | { |
977 | static core::Signal<Player::PlaybackStatus> ret; |
978 | @@ -310,12 +305,6 @@ |
979 | return ret; |
980 | } |
981 | |
982 | -const core::Signal<uint64_t>& TestPlayer::duration_changed() const |
983 | -{ |
984 | - static core::Signal<uint64_t> ret; |
985 | - return ret; |
986 | -} |
987 | - |
988 | const core::Signal<Player::Error>& TestPlayer::error() const |
989 | { |
990 | static core::Signal<Player::Error> ret; |
991 | |
992 | === modified file 'tests/unit/player.h' |
993 | --- tests/unit/player.h 2015-06-08 19:15:43 +0000 |
994 | +++ tests/unit/player.h 2016-03-22 19:23:08 +0000 |
995 | @@ -37,8 +37,12 @@ |
996 | { |
997 | public: |
998 | TestPlayer(); |
999 | + TestPlayer(const TestPlayer&) = delete; |
1000 | virtual ~TestPlayer(); |
1001 | |
1002 | + Player& operator=(const Player&) = delete; |
1003 | + bool operator==(const Player&) const = delete; |
1004 | + |
1005 | virtual std::string uuid() const; |
1006 | virtual void reconnect(); |
1007 | virtual void abandon(); |
1008 | @@ -46,15 +50,16 @@ |
1009 | virtual std::shared_ptr<TrackList> track_list(); |
1010 | virtual PlayerKey key() const; |
1011 | |
1012 | + virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id); |
1013 | + |
1014 | virtual bool open_uri(const Track::UriType& uri); |
1015 | - virtual bool open_uri(const Track::UriType&, const HeadersType&); |
1016 | - virtual std::shared_ptr<core::ubuntu::media::video::Sink> create_gl_texture_video_sink(uint32_t texture_id); |
1017 | + virtual bool open_uri(const Track::UriType& uri, const HeadersType&); |
1018 | virtual void next(); |
1019 | virtual void previous(); |
1020 | virtual void play(); |
1021 | virtual void pause(); |
1022 | + virtual void stop(); |
1023 | virtual void seek_to(const std::chrono::microseconds& offset); |
1024 | - virtual void stop(); |
1025 | |
1026 | virtual const core::Property<bool>& can_play() const; |
1027 | virtual const core::Property<bool>& can_pause() const; |
1028 | @@ -64,7 +69,6 @@ |
1029 | virtual const core::Property<bool>& is_video_source() const; |
1030 | virtual const core::Property<bool>& is_audio_source() const; |
1031 | virtual const core::Property<PlaybackStatus>& playback_status() const; |
1032 | - virtual const core::Property<Orientation>& orientation() const; |
1033 | virtual const core::Property<LoopStatus>& loop_status() const; |
1034 | virtual const core::Property<PlaybackRate>& playback_rate() const; |
1035 | virtual const core::Property<bool>& shuffle() const; |
1036 | @@ -75,6 +79,7 @@ |
1037 | virtual const core::Property<int64_t>& position() const; |
1038 | virtual const core::Property<int64_t>& duration() const; |
1039 | virtual const core::Property<AudioStreamRole>& audio_stream_role() const; |
1040 | + virtual const core::Property<Orientation>& orientation() const; |
1041 | virtual const core::Property<Lifetime>& lifetime() const; |
1042 | |
1043 | virtual core::Property<LoopStatus>& loop_status(); |
1044 | @@ -87,10 +92,9 @@ |
1045 | virtual const core::Signal<int64_t>& seeked_to() const; |
1046 | virtual const core::Signal<void>& about_to_finish() const; |
1047 | virtual const core::Signal<void>& end_of_stream() const; |
1048 | - virtual const core::Signal<PlaybackStatus>& playback_status_changed() const; |
1049 | virtual core::Signal<PlaybackStatus>& playback_status_changed(); |
1050 | - virtual const core::Signal<core::ubuntu::media::video::Dimensions>& video_dimension_changed() const; |
1051 | - virtual const core::Signal<uint64_t>& duration_changed() const; |
1052 | + virtual const core::Signal<video::Dimensions>& video_dimension_changed() const; |
1053 | + /** Signals all errors and warnings (typically from GStreamer and below) */ |
1054 | virtual const core::Signal<Error>& error() const; |
1055 | |
1056 | private: |
1057 | |
1058 | === modified file 'tests/unit/service.cpp' |
1059 | --- tests/unit/service.cpp 2015-10-20 13:06:11 +0000 |
1060 | +++ tests/unit/service.cpp 2016-03-22 19:23:08 +0000 |
1061 | @@ -15,6 +15,11 @@ |
1062 | */ |
1063 | |
1064 | #include "service.h" |
1065 | +#include "player.h" |
1066 | + |
1067 | +#include <core/media/player.h> |
1068 | + |
1069 | +#include <memory> |
1070 | |
1071 | namespace core { |
1072 | namespace ubuntu { |
1073 | @@ -22,12 +27,12 @@ |
1074 | |
1075 | const std::shared_ptr<media::Service> TestService::Client::instance() |
1076 | { |
1077 | - return NULL; |
1078 | + return std::make_shared<TestService>(); |
1079 | } |
1080 | |
1081 | std::shared_ptr<Player> TestService::create_session(const Player::Configuration&) |
1082 | { |
1083 | - return NULL; |
1084 | + return std::make_shared<TestPlayer>(); |
1085 | } |
1086 | |
1087 | void TestService::detach_session(const std::string&, const Player::Configuration&) |
1088 | |
1089 | === modified file 'tests/unit/tst_mediaplayerplugin.cpp' |
1090 | --- tests/unit/tst_mediaplayerplugin.cpp 2015-12-18 15:38:48 +0000 |
1091 | +++ tests/unit/tst_mediaplayerplugin.cpp 2016-03-22 19:23:08 +0000 |
1092 | @@ -34,10 +34,10 @@ |
1093 | |
1094 | void tst_MediaPlayerPlugin::init() |
1095 | { |
1096 | - m_hubService.reset(new TestService()); |
1097 | - m_service = new AalMediaPlayerService(this); |
1098 | + m_hubService = TestService::Client::instance(); |
1099 | + m_service = new AalMediaPlayerService(m_hubService, this); |
1100 | m_service->setService(m_hubService); |
1101 | - m_player.reset(new TestPlayer()); |
1102 | + m_player = m_hubService->create_session(TestPlayer::Client::default_configuration()); |
1103 | m_service->setPlayer(m_player); |
1104 | m_playerControl = m_service->requestControl(QMediaPlayerControl_iid); |
1105 | m_mediaPlayerControl = m_service->mediaPlayerControl(); |
1106 | |
1107 | === modified file 'tests/unit/unit.pro' |
1108 | --- tests/unit/unit.pro 2015-12-18 15:38:48 +0000 |
1109 | +++ tests/unit/unit.pro 2016-03-22 19:23:08 +0000 |
1110 | @@ -21,6 +21,7 @@ |
1111 | ../../src/aal/aalvideorenderercontrol.h \ |
1112 | ../../src/aal/aalmediaplaylistprovider.h \ |
1113 | ../../src/aal/aalmediaplaylistcontrol.h \ |
1114 | + ../../src/aal/aalaudiorolecontrol.h \ |
1115 | ../../src/aal/aalutility.h \ |
1116 | tst_mediaplayerplugin.h \ |
1117 | tst_mediaplaylistcontrol.h \ |
1118 | @@ -40,4 +41,5 @@ |
1119 | ../../src/aal/aalmediaplayerservice.cpp \ |
1120 | ../../src/aal/aalmediaplayerserviceplugin.cpp \ |
1121 | ../../src/aal/aalvideorenderercontrol.cpp \ |
1122 | + ../../src/aal/aalaudiorolecontrol.cpp \ |
1123 | ../../src/aal/aalutility.cpp |
FAILED: Continuous integration, rev:103 jenkins. qa.ubuntu. com/job/ qtubuntu- media-ci/ 142/ jenkins. qa.ubuntu. com/job/ qtubuntu- media-vivid- amd64-ci/ 67/console jenkins. qa.ubuntu. com/job/ qtubuntu- media-vivid- armhf-ci/ 67/console jenkins. qa.ubuntu. com/job/ qtubuntu- media-vivid- i386-ci/ 67/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtubuntu- media-ci/ 142/rebuild
http://