Merge lp:~timo-jyrinki/qtubuntu-media/port_to_new_audio_role_api into lp:qtubuntu-media

Proposed by Timo Jyrinki
Status: Merged
Approved by: Jim Hodapp
Approved revision: 91
Merged at revision: 91
Proposed branch: lp:~timo-jyrinki/qtubuntu-media/port_to_new_audio_role_api
Merge into: lp:qtubuntu-media
Diff against target: 118 lines (+42/-0)
4 files modified
src/aal/aalmediaplayercontrol.cpp (+8/-0)
src/aal/aalmediaplayercontrol.h (+5/-0)
src/aal/aalmediaplayerservice.cpp (+24/-0)
src/aal/aalmediaplayerservice.h (+5/-0)
To merge this branch: bzr merge lp:~timo-jyrinki/qtubuntu-media/port_to_new_audio_role_api
Reviewer Review Type Date Requested Status
Jim Hodapp (community) code Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+273392@code.launchpad.net

Commit message

Port to the new Audio Role API (LP: #1493851)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

LGTM

review: Approve (code)
Revision history for this message
Jim Hodapp (jhodapp) :
review: Needs Information (code)
Revision history for this message
Jim Hodapp (jhodapp) :
91. By Timo Jyrinki

add || for MusicRole as suggested in the comment

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Ok added the MusicRole to the latter one and answered to the first question. Note that I'm not familiar with the whole chain (Android/PulseAudio/Qt) so I don't know as such the correct selections necessarily.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Looks good. One reminder. Before this will function correctly we need to update at least media-hub but I'm also thinking we need to update pulseaudio as it is the layer that gives meaning to these various roles and this new list is completely different.

review: Approve (code)
92. By Timo Jyrinki

Fix invalid non-breaking space character :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/aal/aalmediaplayercontrol.cpp'
2--- src/aal/aalmediaplayercontrol.cpp 2015-08-18 15:48:31 +0000
3+++ src/aal/aalmediaplayercontrol.cpp 2015-11-04 08:24:34 +0000
4@@ -61,12 +61,20 @@
5 return m_status;
6 }
7
8+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
9 QMediaPlayer::AudioRole AalMediaPlayerControl::audioRole() const
10+#else
11+QAudio::Role AalMediaPlayerControl::audioRole() const
12+#endif
13 {
14 return m_service->audioRole();
15 }
16
17+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
18 void AalMediaPlayerControl::setAudioRole(QMediaPlayer::AudioRole audioRole)
19+#else
20+void AalMediaPlayerControl::setAudioRole(QAudio::Role audioRole)
21+#endif
22 {
23 qDebug() << __PRETTY_FUNCTION__;
24 m_service->setAudioRole(audioRole);
25
26=== modified file 'src/aal/aalmediaplayercontrol.h'
27--- src/aal/aalmediaplayercontrol.h 2015-07-24 18:44:13 +0000
28+++ src/aal/aalmediaplayercontrol.h 2015-11-04 08:24:34 +0000
29@@ -32,8 +32,13 @@
30
31 virtual QMediaPlayer::State state() const;
32 virtual QMediaPlayer::MediaStatus mediaStatus() const;
33+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
34 virtual QMediaPlayer::AudioRole audioRole() const;
35 virtual void setAudioRole(QMediaPlayer::AudioRole audioRole);
36+#else
37+ virtual QAudio::Role audioRole() const;
38+ virtual void setAudioRole(QAudio::Role audioRole);
39+#endif
40 virtual qint64 duration() const;
41 virtual qint64 position() const;
42 virtual void setPosition(qint64);
43
44=== modified file 'src/aal/aalmediaplayerservice.cpp'
45--- src/aal/aalmediaplayerservice.cpp 2015-10-20 13:06:11 +0000
46+++ src/aal/aalmediaplayerservice.cpp 2015-11-04 08:24:34 +0000
47@@ -228,21 +228,41 @@
48 m_videoOutput->playbackComplete();
49 }
50
51+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
52 QMediaPlayer::AudioRole AalMediaPlayerService::audioRole() const
53+#else
54+QAudio::Role AalMediaPlayerService::audioRole() const
55+#endif
56 {
57 if (m_hubPlayerSession == NULL)
58+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
59 return QMediaPlayer::MultimediaRole;
60+#else
61+ return QAudio::VideoRole;
62+#endif
63
64 try {
65+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
66 return static_cast<QMediaPlayer::AudioRole>(m_hubPlayerSession->audio_stream_role().get());
67+#else
68+ return static_cast<QAudio::Role>(m_hubPlayerSession->audio_stream_role().get());
69+#endif
70 }
71 catch (const std::runtime_error &e) {
72 qWarning() << "Failed to get audio stream role: " << e.what();
73+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
74 return QMediaPlayer::MultimediaRole;
75+#else
76+ return QAudio::VideoRole;
77+#endif
78 }
79 }
80
81+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
82 void AalMediaPlayerService::setAudioRole(QMediaPlayer::AudioRole audioRole)
83+#else
84+void AalMediaPlayerService::setAudioRole(QAudio::Role audioRole)
85+#endif
86 {
87 if (m_hubPlayerSession == NULL)
88 return;
89@@ -793,7 +813,11 @@
90 {
91 // If this player is a multimedia audioRole, then it should possible to
92 // use it for MPRIS control
93+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
94 if (audioRole() == QMediaPlayer::MultimediaRole)
95+#else
96+ if (audioRole() == QAudio::VideoRole || audioRole() == QAudio::MusicRole)
97+#endif
98 {
99 qDebug() << "Setting player as current player";
100 try {
101
102=== modified file 'src/aal/aalmediaplayerservice.h'
103--- src/aal/aalmediaplayerservice.h 2015-09-08 19:31:18 +0000
104+++ src/aal/aalmediaplayerservice.h 2015-11-04 08:24:34 +0000
105@@ -74,8 +74,13 @@
106 // Call this before attempting to play the same video a second time (after EOS)
107 void resetVideoSink();
108
109+#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
110 QMediaPlayer::AudioRole audioRole() const;
111 void setAudioRole(QMediaPlayer::AudioRole audioRole);
112+#else
113+ QAudio::Role audioRole() const;
114+ void setAudioRole(QAudio::Role audioRole);
115+#endif
116
117 void setMedia(const QUrl &url);
118 void setMedia(const QMediaContent &media);

Subscribers

People subscribed via source and target branches