Merge lp:~thomas-voss/qtvideo-node/adjust-to-media-hub-interface-changes into lp:qtvideo-node

Proposed by Thomas Voß
Status: Merged
Approved by: Ricardo Mendoza
Approved revision: 57
Merged at revision: 59
Proposed branch: lp:~thomas-voss/qtvideo-node/adjust-to-media-hub-interface-changes
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:~thomas-voss/qtvideo-node/adjust-to-media-hub-interface-changes
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+246179@code.launchpad.net

Commit message

Adjust to interface changes in media hub.

Description of the change

Adjust to interface changes in media hub.

To post a comment you must log in.
57. By Thomas Voß

Adjust test case.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-03-27 16:12:37 +0000
+++ debian/control 2015-01-12 16:52:56 +0000
@@ -6,6 +6,7 @@
6 libgl1-mesa-dev[!armhf],6 libgl1-mesa-dev[!armhf],
7 libgles2-mesa-dev[armhf],7 libgles2-mesa-dev[armhf],
8 libhybris-dev (>=0.1.0+git20131207+e452e83-0ubuntu3),8 libhybris-dev (>=0.1.0+git20131207+e452e83-0ubuntu3),
9 libmedia-hub-dev(>=3.0.0),
9 libplatform-api-headers | ubuntu-platform-api-headers,10 libplatform-api-headers | ubuntu-platform-api-headers,
10 libpulse-dev,11 libpulse-dev,
11 libqt5opengl5-dev,12 libqt5opengl5-dev,
1213
=== modified file 'src/shadervideomaterial.cpp'
--- src/shadervideomaterial.cpp 2014-10-20 21:21:49 +0000
+++ src/shadervideomaterial.cpp 2015-01-12 16:52:56 +0000
@@ -30,6 +30,8 @@
30#include "shadervideomaterial.h"30#include "shadervideomaterial.h"
31#include "shadervideoshader.h"31#include "shadervideoshader.h"
3232
33#include <core/media/video/sink.h>
34
33#include <camera_compatibility_layer.h>35#include <camera_compatibility_layer.h>
34#include <qtubuntu_media_signals.h>36#include <qtubuntu_media_signals.h>
35#include <surface_texture_client_hybris.h>37#include <surface_texture_client_hybris.h>
@@ -41,7 +43,6 @@
41 m_camControl(0),43 m_camControl(0),
42 m_textureId(0),44 m_textureId(0),
43 m_surfaceTextureClient(0),45 m_surfaceTextureClient(0),
44 m_glConsumer(0),
45 m_readyToRender(false),46 m_readyToRender(false),
46 m_orientation(SharedSignal::Orientation::rotate0)47 m_orientation(SharedSignal::Orientation::rotate0)
47{48{
@@ -85,21 +86,21 @@
85 m_surfaceTextureClient = surface_texture_client;86 m_surfaceTextureClient = surface_texture_client;
86}87}
8788
88void ShaderVideoMaterial::setGLConsumer(GLConsumerWrapperHybris gl_consumer)89void ShaderVideoMaterial::setGLVideoSink(const std::shared_ptr<core::ubuntu::media::video::Sink>& sink)
89{90{
90 m_glConsumer = gl_consumer;91 m_videoSink = sink;
91}92}
9293
93GLConsumerWrapperHybris ShaderVideoMaterial::glConsumer() const94const std::shared_ptr<core::ubuntu::media::video::Sink>& ShaderVideoMaterial::glVideoSink() const
94{95{
95 return m_glConsumer;96 return m_videoSink;
96}97}
9798
98bool ShaderVideoMaterial::updateTexture()99bool ShaderVideoMaterial::updateTexture()
99{100{
100 bool textureDirty = false;101 bool textureDirty = false;
101102
102 if (!m_camControl && !m_textureId && !m_glConsumer) {103 if (!m_camControl && !m_textureId && !m_videoSink) {
103 return false;104 return false;
104 }105 }
105106
@@ -107,12 +108,13 @@
107 android_camera_update_preview_texture(m_camControl);108 android_camera_update_preview_texture(m_camControl);
108 android_camera_get_preview_texture_transformation(m_camControl, m_textureMatrix);109 android_camera_get_preview_texture_transformation(m_camControl, m_textureMatrix);
109 textureDirty = true;110 textureDirty = true;
110 } else if (m_glConsumer != NULL && !m_readyToRender) {111 } else if (m_videoSink && !m_readyToRender) {
111 m_readyToRender = true;112 m_readyToRender = true;
112 } else if (m_glConsumer != NULL && m_readyToRender) {113 } else if (m_videoSink && m_readyToRender) {
113 gl_consumer_update_texture(m_glConsumer);114 if (m_videoSink->swap_buffers()) {
114 gl_consumer_get_transformation_matrix(m_glConsumer, static_cast<float*>(m_textureMatrix));115 m_videoSink->transformation_matrix(static_cast<float*>(m_textureMatrix));
115 textureDirty = true;116 textureDirty = true;
117 }
116 }118 }
117119
118 // See if the video needs rotation120 // See if the video needs rotation
119121
=== modified file 'src/shadervideomaterial.h'
--- src/shadervideomaterial.h 2014-10-16 01:45:58 +0000
+++ src/shadervideomaterial.h 2015-01-12 16:52:56 +0000
@@ -29,6 +29,12 @@
29#include <QVideoSurfaceFormat>29#include <QVideoSurfaceFormat>
30#include <qtubuntu_media_signals.h>30#include <qtubuntu_media_signals.h>
3131
32#include <memory>
33
34namespace core { namespace ubuntu { namespace media { namespace video {
35class Sink;
36} } } }
37
32struct CameraControl;38struct CameraControl;
33struct MediaPlayerWrapper;39struct MediaPlayerWrapper;
34class ShaderVideoShader;40class ShaderVideoShader;
@@ -53,8 +59,8 @@
53 GLuint textureId() const { return m_textureId; }59 GLuint textureId() const { return m_textureId; }
5460
55 void setSurfaceTextureClient(SurfaceTextureClientHybris surface_texture_client);61 void setSurfaceTextureClient(SurfaceTextureClientHybris surface_texture_client);
56 void setGLConsumer(GLConsumerWrapperHybris gl_consumer);62 void setGLVideoSink(const std::shared_ptr<core::ubuntu::media::video::Sink>& sink);
57 GLConsumerWrapperHybris glConsumer() const;63 const std::shared_ptr<core::ubuntu::media::video::Sink>& glVideoSink() const;
5864
59 bool updateTexture();65 bool updateTexture();
6066
@@ -73,7 +79,7 @@
73 CameraControl *m_camControl;79 CameraControl *m_camControl;
74 GLuint m_textureId;80 GLuint m_textureId;
75 SurfaceTextureClientHybris m_surfaceTextureClient;81 SurfaceTextureClientHybris m_surfaceTextureClient;
76 GLConsumerWrapperHybris m_glConsumer;82 std::shared_ptr<core::ubuntu::media::video::Sink> m_videoSink;
77 bool m_readyToRender;83 bool m_readyToRender;
78 static ShaderVideoShader *m_videoShader; // the shader is cached in the Qt scene graph84 static ShaderVideoShader *m_videoShader; // the shader is cached in the Qt scene graph
79 SharedSignal::Orientation m_orientation;85 SharedSignal::Orientation m_orientation;
8086
=== modified file 'src/shadervideonode.cpp'
--- src/shadervideonode.cpp 2014-10-16 02:37:25 +0000
+++ src/shadervideonode.cpp 2015-01-12 16:52:56 +0000
@@ -28,8 +28,7 @@
28 */28 */
29ShaderVideoNode::ShaderVideoNode(const QVideoSurfaceFormat &format) :29ShaderVideoNode::ShaderVideoNode(const QVideoSurfaceFormat &format) :
30 m_format(format),30 m_format(format),
31 m_textureId(0),31 m_textureId(0)
32 m_glConsumer(0)
33{32{
34 m_material = new ShaderVideoMaterial(format);33 m_material = new ShaderVideoMaterial(format);
35 setMaterial(m_material);34 setMaterial(m_material);
@@ -73,13 +72,12 @@
73 return;72 return;
74 }73 }
75 m_material->setCamControl((CameraControl*)ci);74 m_material->setCamControl((CameraControl*)ci);
76 } else if (frame.availableMetaData().contains("GLConsumer")) {75 } else if (frame.availableMetaData().contains("GLVideoSink")) {
77 qDebug() << "** Setting GLConsumer instance";76 qDebug() << "** Setting GLConsumer instance";
78 m_glConsumer = reinterpret_cast<GLConsumerWrapperHybris>(77 auto sink = frame.metaData("GLVideoSink").value<std::shared_ptr<core::ubuntu::media::video::Sink>>();
79 frame.metaData("GLConsumer").value<unsigned int>());78 m_material->setGLVideoSink(sink);
80 m_material->setGLConsumer(m_glConsumer);79 if (not sink) {
81 if (m_glConsumer == 0) {80 qWarning() << "No valid GL video sink instance in video frame";
82 qWarning() << "No valid GLConsumerWrapperHybris instance in video frame";
83 return;81 return;
84 }82 }
8583
8684
=== modified file 'src/shadervideonode.h'
--- src/shadervideonode.h 2014-03-25 21:13:55 +0000
+++ src/shadervideonode.h 2015-01-12 16:52:56 +0000
@@ -21,6 +21,12 @@
21#include <QObject>21#include <QObject>
22#include <private/qsgvideonode_p.h>22#include <private/qsgvideonode_p.h>
2323
24#include <memory>
25
26namespace core { namespace ubuntu { namespace media { namespace video {
27class Sink;
28} } } }
29
24class CameraControl;30class CameraControl;
25class ShaderVideoMaterial;31class ShaderVideoMaterial;
26class SnapshotGenerator;32class SnapshotGenerator;
@@ -48,8 +54,10 @@
48 QVideoSurfaceFormat m_format;54 QVideoSurfaceFormat m_format;
49 ShaderVideoMaterial *m_material;55 ShaderVideoMaterial *m_material;
50 GLuint m_textureId;56 GLuint m_textureId;
51 GLConsumerWrapperHybris m_glConsumer;57 std::shared_ptr<core::ubuntu::media::video::Sink> m_videoSink;
52 SnapshotGenerator *m_snapshotGenerator;58 SnapshotGenerator *m_snapshotGenerator;
53};59};
5460
61Q_DECLARE_METATYPE(std::shared_ptr<core::ubuntu::media::video::Sink>);
62
55#endif // SHADERVIDEONODE_H63#endif // SHADERVIDEONODE_H
5664
=== modified file 'src/src.pro'
--- src/src.pro 2014-10-16 02:37:25 +0000
+++ src/src.pro 2015-01-12 16:52:56 +0000
@@ -13,7 +13,7 @@
13INSTALLS = target13INSTALLS = target
1414
15INCLUDEPATH += /usr/include/hybris/camera /usr/include/hybris/media /usr/include/libqtubuntu-media-signals15INCLUDEPATH += /usr/include/hybris/camera /usr/include/hybris/media /usr/include/libqtubuntu-media-signals
16LIBS += -lhybris_ics -lcamera -lmedia -lqtubuntu-media-signals16LIBS += -lhybris_ics -lcamera -lmedia -lqtubuntu-media-signals -lmedia-hub-client
1717
18OTHER_FILES += shadervideonode.json18OTHER_FILES += shadervideonode.json
1919
2020
=== modified file 'unittests/shadervideonode/tst_shadervideonode.cpp'
--- unittests/shadervideonode/tst_shadervideonode.cpp 2014-04-08 14:04:27 +0000
+++ unittests/shadervideonode/tst_shadervideonode.cpp 2015-01-12 16:52:56 +0000
@@ -22,6 +22,8 @@
2222
23#include <shadervideomaterial.h>23#include <shadervideomaterial.h>
2424
25#include <core/media/video/sink.h>
26
25#include <qtubuntu_media_signals.h>27#include <qtubuntu_media_signals.h>
2628
27#include "camera_compatibility_layer.h"29#include "camera_compatibility_layer.h"
@@ -31,6 +33,8 @@
3133
32#include "shadervideonode.h"34#include "shadervideonode.h"
3335
36namespace
37{
34class tst_ShaderVideoNode : public QObject38class tst_ShaderVideoNode : public QObject
35{39{
36 Q_OBJECT40 Q_OBJECT
@@ -76,6 +80,26 @@
76 unsigned int m_textureId;80 unsigned int m_textureId;
77};81};
7882
83struct NullSink : public core::ubuntu::media::video::Sink
84{
85 const core::Signal<void>& frame_available() const
86 {
87 static core::Signal<void> sig; return sig;
88 }
89
90 bool transformation_matrix(float*) const
91 {
92 return true;
93 }
94
95 bool swap_buffers() const
96 {
97 return true;
98 }
99};
100
101}
102
79void tst_ShaderVideoNode::initTestCase()103void tst_ShaderVideoNode::initTestCase()
80{104{
81 m_glConsumerSet = false;105 m_glConsumerSet = false;
@@ -114,12 +138,11 @@
114138
115 node.setCurrentFrame(frame);139 node.setCurrentFrame(frame);
116140
117 GLConsumerWrapperHybris *gl_consumer = new GLConsumerWrapperHybris;141 std::shared_ptr<core::ubuntu::media::video::Sink> sink{new NullSink()};
118142
119 frame.setMetaData("GLConsumer", QVariant::fromValue(reinterpret_cast<uint64_t>(gl_consumer)));143 frame.setMetaData("GLVideoSink", QVariant::fromValue(sink));
120 node.setCurrentFrame(frame);144 node.setCurrentFrame(frame);
121 QCOMPARE(QVariant(QMetaType::VoidStar, node.m_material->glConsumer()),145 QCOMPARE(node.m_material->glVideoSink(), sink);
122 QVariant(QMetaType::VoidStar, gl_consumer));
123146
124 QVERIFY(m_glConsumerSet == true);147 QVERIFY(m_glConsumerSet == true);
125}148}

Subscribers

People subscribed via source and target branches