Merge lp:~phablet-team/qtvideo-node/media-hub-3 into lp:qtvideo-node

Proposed by Ricardo Mendoza
Status: Needs review
Proposed branch: lp:~phablet-team/qtvideo-node/media-hub-3
Merge into: lp:qtvideo-node
Diff against target: 255 lines (+66/-28)
7 files modified
debian/control (+1/-0)
src/shadervideomaterial.cpp (+13/-11)
src/shadervideomaterial.h (+9/-3)
src/shadervideonode.cpp (+6/-8)
src/shadervideonode.h (+9/-1)
src/src.pro (+1/-1)
unittests/shadervideonode/tst_shadervideonode.cpp (+27/-4)
To merge this branch: bzr merge lp:~phablet-team/qtvideo-node/media-hub-3
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+253119@code.launchpad.net

Commit message

Adjust to new mh3 interfaces.

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

Unmerged revisions

58. By Ricardo Mendoza

Merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-03-12 22:20:19 +0000
3+++ debian/control 2015-03-16 21:23:34 +0000
4@@ -6,6 +6,7 @@
5 libgl1-mesa-dev[!armhf],
6 libgles2-mesa-dev[armhf],
7 libhybris-dev (>=0.1.0+git20131207+e452e83-0ubuntu3),
8+ libmedia-hub-dev(>=3.0.0),
9 libplatform-api-headers | ubuntu-platform-api-headers,
10 libpulse-dev,
11 libqt5opengl5-dev,
12
13=== modified file 'src/shadervideomaterial.cpp'
14--- src/shadervideomaterial.cpp 2015-03-09 11:32:10 +0000
15+++ src/shadervideomaterial.cpp 2015-03-16 21:23:34 +0000
16@@ -30,6 +30,8 @@
17 #include "shadervideomaterial.h"
18 #include "shadervideoshader.h"
19
20+#include <core/media/video/sink.h>
21+
22 #include <camera_compatibility_layer.h>
23 #include <qtubuntu_media_signals.h>
24 #include <surface_texture_client_hybris.h>
25@@ -41,7 +43,6 @@
26 m_camControl(0),
27 m_textureId(0),
28 m_surfaceTextureClient(0),
29- m_glConsumer(0),
30 m_readyToRender(false),
31 m_orientation(SharedSignal::Orientation::rotate0)
32 {
33@@ -107,21 +108,21 @@
34 m_surfaceTextureClient = surface_texture_client;
35 }
36
37-void ShaderVideoMaterial::setGLConsumer(GLConsumerWrapperHybris gl_consumer)
38+void ShaderVideoMaterial::setGLVideoSink(const std::shared_ptr<core::ubuntu::media::video::Sink>& sink)
39 {
40- m_glConsumer = gl_consumer;
41+ m_videoSink = sink;
42 }
43
44-GLConsumerWrapperHybris ShaderVideoMaterial::glConsumer() const
45+const std::shared_ptr<core::ubuntu::media::video::Sink>& ShaderVideoMaterial::glVideoSink() const
46 {
47- return m_glConsumer;
48+ return m_videoSink;
49 }
50
51 bool ShaderVideoMaterial::updateTexture()
52 {
53 bool textureDirty = false;
54
55- if (!m_camControl && !m_textureId && !m_glConsumer) {
56+ if (!m_camControl && !m_textureId && !m_videoSink) {
57 return false;
58 }
59
60@@ -129,12 +130,13 @@
61 android_camera_update_preview_texture(m_camControl);
62 android_camera_get_preview_texture_transformation(m_camControl, m_textureMatrix);
63 textureDirty = true;
64- } else if (m_glConsumer != NULL && !m_readyToRender) {
65+ } else if (m_videoSink && !m_readyToRender) {
66 m_readyToRender = true;
67- } else if (m_glConsumer != NULL && m_readyToRender) {
68- gl_consumer_update_texture(m_glConsumer);
69- gl_consumer_get_transformation_matrix(m_glConsumer, static_cast<float*>(m_textureMatrix));
70- textureDirty = true;
71+ } else if (m_videoSink && m_readyToRender) {
72+ if (m_videoSink->swap_buffers()) {
73+ m_videoSink->transformation_matrix(static_cast<float*>(m_textureMatrix));
74+ textureDirty = true;
75+ }
76 }
77
78 // See if the video needs rotation
79
80=== modified file 'src/shadervideomaterial.h'
81--- src/shadervideomaterial.h 2014-10-16 01:45:58 +0000
82+++ src/shadervideomaterial.h 2015-03-16 21:23:34 +0000
83@@ -29,6 +29,12 @@
84 #include <QVideoSurfaceFormat>
85 #include <qtubuntu_media_signals.h>
86
87+#include <memory>
88+
89+namespace core { namespace ubuntu { namespace media { namespace video {
90+class Sink;
91+} } } }
92+
93 struct CameraControl;
94 struct MediaPlayerWrapper;
95 class ShaderVideoShader;
96@@ -53,8 +59,8 @@
97 GLuint textureId() const { return m_textureId; }
98
99 void setSurfaceTextureClient(SurfaceTextureClientHybris surface_texture_client);
100- void setGLConsumer(GLConsumerWrapperHybris gl_consumer);
101- GLConsumerWrapperHybris glConsumer() const;
102+ void setGLVideoSink(const std::shared_ptr<core::ubuntu::media::video::Sink>& sink);
103+ const std::shared_ptr<core::ubuntu::media::video::Sink>& glVideoSink() const;
104
105 bool updateTexture();
106
107@@ -73,7 +79,7 @@
108 CameraControl *m_camControl;
109 GLuint m_textureId;
110 SurfaceTextureClientHybris m_surfaceTextureClient;
111- GLConsumerWrapperHybris m_glConsumer;
112+ std::shared_ptr<core::ubuntu::media::video::Sink> m_videoSink;
113 bool m_readyToRender;
114 static ShaderVideoShader *m_videoShader; // the shader is cached in the Qt scene graph
115 SharedSignal::Orientation m_orientation;
116
117=== modified file 'src/shadervideonode.cpp'
118--- src/shadervideonode.cpp 2014-10-16 02:37:25 +0000
119+++ src/shadervideonode.cpp 2015-03-16 21:23:34 +0000
120@@ -28,8 +28,7 @@
121 */
122 ShaderVideoNode::ShaderVideoNode(const QVideoSurfaceFormat &format) :
123 m_format(format),
124- m_textureId(0),
125- m_glConsumer(0)
126+ m_textureId(0)
127 {
128 m_material = new ShaderVideoMaterial(format);
129 setMaterial(m_material);
130@@ -73,13 +72,12 @@
131 return;
132 }
133 m_material->setCamControl((CameraControl*)ci);
134- } else if (frame.availableMetaData().contains("GLConsumer")) {
135+ } else if (frame.availableMetaData().contains("GLVideoSink")) {
136 qDebug() << "** Setting GLConsumer instance";
137- m_glConsumer = reinterpret_cast<GLConsumerWrapperHybris>(
138- frame.metaData("GLConsumer").value<unsigned int>());
139- m_material->setGLConsumer(m_glConsumer);
140- if (m_glConsumer == 0) {
141- qWarning() << "No valid GLConsumerWrapperHybris instance in video frame";
142+ auto sink = frame.metaData("GLVideoSink").value<std::shared_ptr<core::ubuntu::media::video::Sink>>();
143+ m_material->setGLVideoSink(sink);
144+ if (not sink) {
145+ qWarning() << "No valid GL video sink instance in video frame";
146 return;
147 }
148
149
150=== modified file 'src/shadervideonode.h'
151--- src/shadervideonode.h 2014-03-25 21:13:55 +0000
152+++ src/shadervideonode.h 2015-03-16 21:23:34 +0000
153@@ -21,6 +21,12 @@
154 #include <QObject>
155 #include <private/qsgvideonode_p.h>
156
157+#include <memory>
158+
159+namespace core { namespace ubuntu { namespace media { namespace video {
160+class Sink;
161+} } } }
162+
163 class CameraControl;
164 class ShaderVideoMaterial;
165 class SnapshotGenerator;
166@@ -48,8 +54,10 @@
167 QVideoSurfaceFormat m_format;
168 ShaderVideoMaterial *m_material;
169 GLuint m_textureId;
170- GLConsumerWrapperHybris m_glConsumer;
171+ std::shared_ptr<core::ubuntu::media::video::Sink> m_videoSink;
172 SnapshotGenerator *m_snapshotGenerator;
173 };
174
175+Q_DECLARE_METATYPE(std::shared_ptr<core::ubuntu::media::video::Sink>);
176+
177 #endif // SHADERVIDEONODE_H
178
179=== modified file 'src/src.pro'
180--- src/src.pro 2014-10-16 02:37:25 +0000
181+++ src/src.pro 2015-03-16 21:23:34 +0000
182@@ -13,7 +13,7 @@
183 INSTALLS = target
184
185 INCLUDEPATH += /usr/include/hybris/camera /usr/include/hybris/media /usr/include/libqtubuntu-media-signals
186-LIBS += -lhybris_ics -lcamera -lmedia -lqtubuntu-media-signals
187+LIBS += -lhybris_ics -lcamera -lmedia -lqtubuntu-media-signals -lmedia-hub-client
188
189 OTHER_FILES += shadervideonode.json
190
191
192=== modified file 'unittests/shadervideonode/tst_shadervideonode.cpp'
193--- unittests/shadervideonode/tst_shadervideonode.cpp 2014-04-08 14:04:27 +0000
194+++ unittests/shadervideonode/tst_shadervideonode.cpp 2015-03-16 21:23:34 +0000
195@@ -22,6 +22,8 @@
196
197 #include <shadervideomaterial.h>
198
199+#include <core/media/video/sink.h>
200+
201 #include <qtubuntu_media_signals.h>
202
203 #include "camera_compatibility_layer.h"
204@@ -31,6 +33,8 @@
205
206 #include "shadervideonode.h"
207
208+namespace
209+{
210 class tst_ShaderVideoNode : public QObject
211 {
212 Q_OBJECT
213@@ -76,6 +80,26 @@
214 unsigned int m_textureId;
215 };
216
217+struct NullSink : public core::ubuntu::media::video::Sink
218+{
219+ const core::Signal<void>& frame_available() const
220+ {
221+ static core::Signal<void> sig; return sig;
222+ }
223+
224+ bool transformation_matrix(float*) const
225+ {
226+ return true;
227+ }
228+
229+ bool swap_buffers() const
230+ {
231+ return true;
232+ }
233+};
234+
235+}
236+
237 void tst_ShaderVideoNode::initTestCase()
238 {
239 m_glConsumerSet = false;
240@@ -114,12 +138,11 @@
241
242 node.setCurrentFrame(frame);
243
244- GLConsumerWrapperHybris *gl_consumer = new GLConsumerWrapperHybris;
245+ std::shared_ptr<core::ubuntu::media::video::Sink> sink{new NullSink()};
246
247- frame.setMetaData("GLConsumer", QVariant::fromValue(reinterpret_cast<uint64_t>(gl_consumer)));
248+ frame.setMetaData("GLVideoSink", QVariant::fromValue(sink));
249 node.setCurrentFrame(frame);
250- QCOMPARE(QVariant(QMetaType::VoidStar, node.m_material->glConsumer()),
251- QVariant(QMetaType::VoidStar, gl_consumer));
252+ QCOMPARE(node.m_material->glVideoSink(), sink);
253
254 QVERIFY(m_glConsumerSet == true);
255 }

Subscribers

People subscribed via source and target branches

to all changes: