diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2016-01-08 14:15:35 -0200 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2016-04-19 15:03:24 -0300 |
commit | 94b494c1f442ee7b04e7b47bbd6b4583e5bec7fe (patch) | |
tree | 7cbe298d0e037e78daa7a57e831721b75b9e9e36 /dynamic-layers | |
parent | 9da4e87c7fd2090dc17f1e6dbaeb44d4364d08b3 (diff) | |
download | meta-freescale-94b494c1f442ee7b04e7b47bbd6b4583e5bec7fe.tar.gz |
qt4: Move BSP related bbappend files to dynamic layer
The Qt4 recipes are now in a specific layer, meta-qt4, so we cannot
append those recipes if the layer is not included.
This moves the bbappend files to the 'qt4-layer' collection, enabling it in
case the collection is available.
Fixes [YOCTO: #8898]
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'dynamic-layers')
8 files changed, 685 insertions, 0 deletions
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-embedded_%.bbappend b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-embedded_%.bbappend new file mode 100644 index 00000000..14324ca1 --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-embedded_%.bbappend | |||
@@ -0,0 +1 @@ | |||
include qt4-imx-support.inc | |||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-imx-support.inc b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-imx-support.inc new file mode 100644 index 00000000..0efb5645 --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-imx-support.inc | |||
@@ -0,0 +1,28 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/qt4:" | ||
2 | |||
3 | python __anonymous () { | ||
4 | families = ['mx6'] | ||
5 | cur_families = (d.getVar('SOC_FAMILY', True) or '').split(':') | ||
6 | if any(map(lambda x: x in cur_families, | ||
7 | families)): | ||
8 | d.appendVarFlag('do_configure', 'depends', ' virtual/kernel:do_shared_workdir') | ||
9 | } | ||
10 | |||
11 | SRC_URI_append_mx6 += " \ | ||
12 | file://0001-Add-support-for-i.MX-codecs-to-phonon.patch \ | ||
13 | file://0002-i.MX-video-renderer-Allow-v4l-device-from-environmen.patch \ | ||
14 | file://0003-i.MX6-force-egl-visual-ID-33.patch \ | ||
15 | " | ||
16 | |||
17 | DEPENDS_append_mx6 = " virtual/kernel virtual/libgles2" | ||
18 | QT_GLFLAGS_mx6 = "-opengl es2 -openvg" | ||
19 | QT_CONFIG_FLAGS_append_mx6 = " -I${STAGING_KERNEL_DIR}/include/uapi \ | ||
20 | -I${STAGING_KERNEL_DIR}/include/ \ | ||
21 | -DLINUX=1 -DEGL_API_FB=1 \ | ||
22 | -DQT_QPA_EXPERIMENTAL_TOUCHEVENT=1" | ||
23 | |||
24 | # The QT_CONFIG_FLAGS can pollute *.la files with -Dxxx | ||
25 | do_compile_append_mx6 () { | ||
26 | find lib -name "*.la" | xargs -n1 sed -i 's/-D.*=1//g' | ||
27 | } | ||
28 | |||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-x11-free_%.bbappend b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-x11-free_%.bbappend new file mode 100644 index 00000000..14324ca1 --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4-x11-free_%.bbappend | |||
@@ -0,0 +1 @@ | |||
include qt4-imx-support.inc | |||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0001-Add-support-for-i.MX-codecs-to-phonon.patch b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0001-Add-support-for-i.MX-codecs-to-phonon.patch new file mode 100644 index 00000000..1213650c --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0001-Add-support-for-i.MX-codecs-to-phonon.patch | |||
@@ -0,0 +1,468 @@ | |||
1 | From 2ff5682e42771519757756dedbf27b7a9e8e25d9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Rogerio Pimentel <rogerio.pimentel@freescale.com> | ||
3 | Date: Tue, 24 Jul 2012 13:47:01 -0300 | ||
4 | Subject: [PATCH] Add support for i.MX codecs to phonon | ||
5 | |||
6 | Add support for i.MX codecs to phonon | ||
7 | |||
8 | Signed-off-by: Daniele Dall'Acqua <daniele.d@freescale.com> | ||
9 | Signed-off-by: Rogerio Pimentel <rogerio.pimentel@freescale.com> | ||
10 | --- | ||
11 | src/3rdparty/phonon/gstreamer/abstractrenderer.h | 1 + | ||
12 | src/3rdparty/phonon/gstreamer/mediaobject.cpp | 4 + | ||
13 | src/3rdparty/phonon/gstreamer/videowidget.cpp | 60 ++------ | ||
14 | src/3rdparty/phonon/gstreamer/videowidget.h | 1 + | ||
15 | src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | 169 ++++++++++++++-------- | ||
16 | src/3rdparty/phonon/gstreamer/widgetrenderer.h | 17 ++- | ||
17 | src/3rdparty/phonon/gstreamer/x11renderer.cpp | 22 +--- | ||
18 | 7 files changed, 141 insertions(+), 133 deletions(-) | ||
19 | |||
20 | diff --git a/src/3rdparty/phonon/gstreamer/abstractrenderer.h b/src/3rdparty/phonon/gstreamer/abstractrenderer.h | ||
21 | index 10a2822..fa0d87d 100644 | ||
22 | --- a/src/3rdparty/phonon/gstreamer/abstractrenderer.h | ||
23 | +++ b/src/3rdparty/phonon/gstreamer/abstractrenderer.h | ||
24 | @@ -49,6 +49,7 @@ public: | ||
25 | virtual bool eventFilter(QEvent *) = 0; | ||
26 | virtual void handlePaint(QPaintEvent *) {} | ||
27 | virtual bool paintsOnWidget() { return true; } // Controls overlays | ||
28 | + virtual void handleMove(QMoveEvent * event ) {}; | ||
29 | |||
30 | protected: | ||
31 | VideoWidget *m_videoWidget; | ||
32 | diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp | ||
33 | index 23a60c0..f806d64 100644 | ||
34 | --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp | ||
35 | +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp | ||
36 | @@ -515,6 +515,9 @@ void MediaObject::createPipeline() | ||
37 | // reduce buffer overruns as these are not gracefully handled at the moment. | ||
38 | m_audioPipe = gst_element_factory_make("queue", NULL); | ||
39 | g_object_set(G_OBJECT(m_audioPipe), "max-size-time", MAX_QUEUE_TIME, (const char*)NULL); | ||
40 | + g_object_set(G_OBJECT(m_audioPipe), "max-size-time", 0, (const char*)NULL); | ||
41 | + g_object_set(G_OBJECT(m_audioPipe), "max-size-buffers", 0, (const char*)NULL); | ||
42 | + g_object_set(G_OBJECT(m_audioPipe), "max-size-bytes", 0, (const char*)NULL); | ||
43 | gst_bin_add(GST_BIN(m_audioGraph), m_audioPipe); | ||
44 | GstPad *audiopad = gst_element_get_pad (m_audioPipe, "sink"); | ||
45 | gst_element_add_pad (m_audioGraph, gst_ghost_pad_new ("sink", audiopad)); | ||
46 | @@ -527,6 +530,7 @@ void MediaObject::createPipeline() | ||
47 | |||
48 | m_videoPipe = gst_element_factory_make("queue", NULL); | ||
49 | g_object_set(G_OBJECT(m_videoPipe), "max-size-time", MAX_QUEUE_TIME, (const char*)NULL); | ||
50 | + g_object_set(G_OBJECT(m_videoPipe), "max-size-time", 33000, (const char*)NULL); | ||
51 | gst_bin_add(GST_BIN(m_videoGraph), m_videoPipe); | ||
52 | GstPad *videopad = gst_element_get_pad (m_videoPipe, "sink"); | ||
53 | gst_element_add_pad (m_videoGraph, gst_ghost_pad_new ("sink", videopad)); | ||
54 | diff --git a/src/3rdparty/phonon/gstreamer/videowidget.cpp b/src/3rdparty/phonon/gstreamer/videowidget.cpp | ||
55 | index a4c6f79..3682d3f 100644 | ||
56 | --- a/src/3rdparty/phonon/gstreamer/videowidget.cpp | ||
57 | +++ b/src/3rdparty/phonon/gstreamer/videowidget.cpp | ||
58 | @@ -83,50 +83,16 @@ void VideoWidget::setupVideoBin() | ||
59 | Q_ASSERT(m_videoBin); | ||
60 | gst_object_ref (GST_OBJECT (m_videoBin)); //Take ownership | ||
61 | gst_object_sink (GST_OBJECT (m_videoBin)); | ||
62 | - | ||
63 | - //The videoplug element is the final element before the pluggable videosink | ||
64 | - m_videoplug = gst_element_factory_make ("identity", NULL); | ||
65 | - | ||
66 | - //Colorspace ensures that the output of the stream matches the input format accepted by our video sink | ||
67 | - m_colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL); | ||
68 | - | ||
69 | - //Video scale is used to prepare the correct aspect ratio and scale. | ||
70 | - GstElement *videoScale = gst_element_factory_make ("videoscale", NULL); | ||
71 | - | ||
72 | - //We need a queue to support the tee from parent node | ||
73 | - GstElement *queue = gst_element_factory_make ("queue", NULL); | ||
74 | - | ||
75 | - if (queue && m_videoBin && videoScale && m_colorspace && videoSink && m_videoplug) { | ||
76 | - //Ensure that the bare essentials are prepared | ||
77 | - gst_bin_add_many (GST_BIN (m_videoBin), queue, m_colorspace, m_videoplug, videoScale, videoSink, (const char*)NULL); | ||
78 | - bool success = false; | ||
79 | - //Video balance controls color/sat/hue in the YUV colorspace | ||
80 | - m_videoBalance = gst_element_factory_make ("videobalance", NULL); | ||
81 | - if (m_videoBalance) { | ||
82 | - // For video balance to work we have to first ensure that the video is in YUV colorspace, | ||
83 | - // then hand it off to the videobalance filter before finally converting it back to RGB. | ||
84 | - // Hence we nede a videoFilter to convert the colorspace before and after videobalance | ||
85 | - GstElement *m_colorspace2 = gst_element_factory_make ("ffmpegcolorspace", NULL); | ||
86 | - gst_bin_add_many(GST_BIN(m_videoBin), m_videoBalance, m_colorspace2, (const char*)NULL); | ||
87 | - success = gst_element_link_many(queue, m_colorspace, m_videoBalance, m_colorspace2, videoScale, m_videoplug, videoSink, (const char*)NULL); | ||
88 | - } else { | ||
89 | - //If video balance is not available, just connect to sink directly | ||
90 | - success = gst_element_link_many(queue, m_colorspace, videoScale, m_videoplug, videoSink, (const char*)NULL); | ||
91 | - } | ||
92 | - | ||
93 | - if (success) { | ||
94 | - GstPad *videopad = gst_element_get_pad (queue, "sink"); | ||
95 | - gst_element_add_pad (m_videoBin, gst_ghost_pad_new ("sink", videopad)); | ||
96 | - gst_object_unref (videopad); | ||
97 | -#ifndef Q_WS_QPA | ||
98 | - QWidget *parentWidget = qobject_cast<QWidget*>(parent()); | ||
99 | - if (parentWidget) | ||
100 | - parentWidget->winId(); // Due to some existing issues with alien in 4.4, | ||
101 | - // we must currently force the creation of a parent widget. | ||
102 | -#endif | ||
103 | - m_isValid = true; //initialization ok, accept input | ||
104 | - } | ||
105 | - } | ||
106 | + gst_bin_add_many (GST_BIN (m_videoBin), videoSink, NULL); | ||
107 | + GstPad *videopad = gst_element_get_pad (videoSink,"sink"); | ||
108 | + gst_element_add_pad (m_videoBin, gst_ghost_pad_new ("sink", videopad)); | ||
109 | + gst_object_unref (videopad); | ||
110 | + QWidget *parentWidget = qobject_cast<QWidget*>(parent()); | ||
111 | + | ||
112 | + if (parentWidget) | ||
113 | + parentWidget->winId(); // Due to some existing issues with alien in 4.4, | ||
114 | + // we must currently force the creation of a parent widget. | ||
115 | + m_isValid = true; //initialization ok, accept input | ||
116 | } | ||
117 | |||
118 | void VideoWidget::paintEvent(QPaintEvent *event) | ||
119 | @@ -135,6 +101,12 @@ void VideoWidget::paintEvent(QPaintEvent *event) | ||
120 | m_renderer->handlePaint(event); | ||
121 | } | ||
122 | |||
123 | +void VideoWidget::moveEvent(QMoveEvent * event ) | ||
124 | +{ | ||
125 | + Q_ASSERT(m_renderer); | ||
126 | + m_renderer->handleMove(event); | ||
127 | +} | ||
128 | + | ||
129 | void VideoWidget::setVisible(bool val) { | ||
130 | Q_ASSERT(m_renderer); | ||
131 | |||
132 | diff --git a/src/3rdparty/phonon/gstreamer/videowidget.h b/src/3rdparty/phonon/gstreamer/videowidget.h | ||
133 | index 8603f6a..38c7b17 100644 | ||
134 | --- a/src/3rdparty/phonon/gstreamer/videowidget.h | ||
135 | +++ b/src/3rdparty/phonon/gstreamer/videowidget.h | ||
136 | @@ -65,6 +65,7 @@ public: | ||
137 | qreal saturation() const; | ||
138 | void setSaturation(qreal); | ||
139 | void setMovieSize(const QSize &size); | ||
140 | + void moveEvent(QMoveEvent * event ); | ||
141 | QSize sizeHint() const; | ||
142 | QRect scaleToAspect(QRect srcRect, int w, int h) const; | ||
143 | QRect calculateDrawFrameRect() const; | ||
144 | diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | ||
145 | index 423af9d..aa4925a 100644 | ||
146 | --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | ||
147 | +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | ||
148 | @@ -15,7 +15,9 @@ | ||
149 | along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
150 | */ | ||
151 | |||
152 | +#include <QMouseEvent> | ||
153 | #include <QtGui/QPainter> | ||
154 | +#include <QPaintEvent> | ||
155 | #include <gst/gst.h> | ||
156 | #include "common.h" | ||
157 | #include "message.h" | ||
158 | @@ -24,6 +26,18 @@ | ||
159 | #include "widgetrenderer.h" | ||
160 | #include "qrgb.h" | ||
161 | |||
162 | +#include <stdio.h> | ||
163 | +#include <stdlib.h> | ||
164 | +#include <errno.h> | ||
165 | +#include <stdint.h> | ||
166 | +#include <fcntl.h> | ||
167 | +#include <sys/ioctl.h> | ||
168 | +#include <unistd.h> | ||
169 | +#include <linux/mxcfb.h> | ||
170 | + | ||
171 | +#define MXCFB_GBL_ALPHA 255 | ||
172 | +#define MXCFB_CLR_KEY 0x00000000 // ARGB8888 | ||
173 | + | ||
174 | // support old OpenGL installations (1.2) | ||
175 | // assume that if TEXTURE0 isn't defined, none are | ||
176 | #ifndef GL_TEXTURE0 | ||
177 | @@ -35,26 +49,6 @@ | ||
178 | #ifndef QT_NO_PHONON_VIDEO | ||
179 | QT_BEGIN_NAMESPACE | ||
180 | |||
181 | -static void frameRendered() | ||
182 | -{ | ||
183 | - static QString displayFps = qgetenv("PHONON_GST_FPS"); | ||
184 | - if (displayFps.isEmpty()) | ||
185 | - return; | ||
186 | - | ||
187 | - static int frames = 0; | ||
188 | - static QTime lastTime = QTime::currentTime(); | ||
189 | - QTime time = QTime::currentTime(); | ||
190 | - | ||
191 | - int delta = lastTime.msecsTo(time); | ||
192 | - if (delta > 2000) { | ||
193 | - printf("FPS: %f\n", 1000.0 * frames / qreal(delta)); | ||
194 | - lastTime = time; | ||
195 | - frames = 0; | ||
196 | - } | ||
197 | - | ||
198 | - ++frames; | ||
199 | -} | ||
200 | - | ||
201 | namespace Phonon | ||
202 | { | ||
203 | namespace Gstreamer | ||
204 | @@ -62,17 +56,11 @@ namespace Gstreamer | ||
205 | |||
206 | WidgetRenderer::WidgetRenderer(VideoWidget *videoWidget) | ||
207 | : AbstractRenderer(videoWidget) | ||
208 | - , m_width(0) | ||
209 | - , m_height(0) | ||
210 | { | ||
211 | - videoWidget->backend()->logMessage("Creating QWidget renderer"); | ||
212 | - if ((m_videoSink = GST_ELEMENT(g_object_new(get_type_RGB(), NULL)))) { | ||
213 | - gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership | ||
214 | + if ((m_videoSink = gst_element_factory_make("mfw_v4lsink", NULL)) && m_videoSink != NULL) { | ||
215 | + | ||
216 | + gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership | ||
217 | gst_object_sink (GST_OBJECT (m_videoSink)); | ||
218 | - | ||
219 | - QWidgetVideoSinkBase* sink = reinterpret_cast<QWidgetVideoSinkBase*>(m_videoSink); | ||
220 | - // Let the videosink know which widget to direct frame updates to | ||
221 | - sink->renderWidget = videoWidget; | ||
222 | } | ||
223 | |||
224 | // Clear the background with black by default | ||
225 | @@ -84,67 +72,124 @@ WidgetRenderer::WidgetRenderer(VideoWidget *videoWidget) | ||
226 | m_videoWidget->setAttribute(Qt::WA_PaintOnScreen, false); | ||
227 | } | ||
228 | |||
229 | -void WidgetRenderer::setNextFrame(const QByteArray &array, int w, int h) | ||
230 | +WidgetRenderer::~WidgetRenderer() | ||
231 | { | ||
232 | - if (m_videoWidget->root()->state() == Phonon::LoadingState) | ||
233 | - return; | ||
234 | - | ||
235 | - m_frame = QImage(); | ||
236 | - { | ||
237 | - m_frame = QImage((uchar *)array.constData(), w, h, QImage::Format_RGB32); | ||
238 | - } | ||
239 | + if (m_videoSink) { | ||
240 | + gst_object_unref (GST_OBJECT (m_videoSink)); | ||
241 | + m_videoSink = 0; | ||
242 | + } | ||
243 | +} | ||
244 | |||
245 | - m_array = array; | ||
246 | - m_width = w; | ||
247 | - m_height = h; | ||
248 | +void WidgetRenderer::setVideoSize(void) | ||
249 | +{ | ||
250 | |||
251 | - m_videoWidget->update(); | ||
252 | + int adj_x; | ||
253 | + int adj_y; | ||
254 | + | ||
255 | + QSize wSize = m_videoWidget->size(); | ||
256 | + m_drawFrameRect = m_videoWidget->calculateDrawFrameRect(); | ||
257 | + framePos = m_videoWidget->mapToGlobal(QPoint(0,0)); | ||
258 | + | ||
259 | + //Center the video in the widget | ||
260 | + | ||
261 | + adj_x = (wSize.width()/2) - (m_drawFrameRect.width()/2); | ||
262 | + adj_y = (wSize.height()/2) - (m_drawFrameRect.height()/2); | ||
263 | + g_object_set(G_OBJECT(m_videoSink), "axis-left",adj_x + framePos.x(),(const char*)NULL); | ||
264 | + g_object_set(G_OBJECT(m_videoSink), "axis-top", adj_y + framePos.y(), (const char*)NULL); | ||
265 | + g_object_set(G_OBJECT(m_videoSink), "disp-width", m_drawFrameRect.width(), (const char*)NULL); | ||
266 | + g_object_set(G_OBJECT(m_videoSink), "disp-height", m_drawFrameRect.height(), (const char*)NULL); | ||
267 | + g_object_set(G_OBJECT(m_videoSink), "setpara", 1, (const char*)NULL); | ||
268 | } | ||
269 | |||
270 | void WidgetRenderer::handleMediaNodeEvent(const MediaNodeEvent *event) | ||
271 | { | ||
272 | switch (event->type()) { | ||
273 | - case MediaNodeEvent::SourceChanged: | ||
274 | - { | ||
275 | - clearFrame(); | ||
276 | - break; | ||
277 | - } | ||
278 | default: | ||
279 | break; | ||
280 | } | ||
281 | } | ||
282 | |||
283 | -void WidgetRenderer::clearFrame() | ||
284 | +void WidgetRenderer::handlePaint(QPaintEvent *event) | ||
285 | { | ||
286 | - m_frame = QImage(); | ||
287 | - m_array = QByteArray(); | ||
288 | - m_videoWidget->update(); | ||
289 | + Q_UNUSED(event); | ||
290 | + QPainter painter(m_videoWidget); | ||
291 | + painter.fillRect(m_videoWidget->rect(), m_videoWidget->palette().background()); | ||
292 | } | ||
293 | |||
294 | -const QImage &WidgetRenderer::currentFrame() const | ||
295 | +int WidgetRenderer::setOverlay(void) | ||
296 | { | ||
297 | - return m_frame; | ||
298 | + struct mxcfb_color_key color_key; | ||
299 | + struct mxcfb_gbl_alpha alpha; | ||
300 | + int fd_fb; | ||
301 | + | ||
302 | + if ((fd_fb = open("/dev/fb0", O_RDWR, 0)) < 0) | ||
303 | + { | ||
304 | + printf("Unable to open %s\n", "/dev/fb0"); | ||
305 | + return -1; | ||
306 | + | ||
307 | + } | ||
308 | + | ||
309 | + alpha.alpha = MXCFB_GBL_ALPHA; | ||
310 | + alpha.enable = 1; | ||
311 | + | ||
312 | + if (ioctl(fd_fb, MXCFB_SET_GBL_ALPHA, &alpha) < 0) { | ||
313 | + printf("Error in applying Alpha\n"); | ||
314 | + } | ||
315 | + | ||
316 | + color_key.color_key = MXCFB_CLR_KEY & 0x00FFFFFF; | ||
317 | + color_key.enable = 1; | ||
318 | + if ( ioctl(fd_fb, MXCFB_SET_CLR_KEY, &color_key) < 0) { | ||
319 | + | ||
320 | + printf("Error in applying Color Key\n"); | ||
321 | + return -1; | ||
322 | + } | ||
323 | + | ||
324 | + close (fd_fb); | ||
325 | + | ||
326 | + return 0; | ||
327 | } | ||
328 | |||
329 | -void WidgetRenderer::handlePaint(QPaintEvent *event) | ||
330 | +void WidgetRenderer::handleMove( QMoveEvent * event) | ||
331 | { | ||
332 | - Q_UNUSED(event); | ||
333 | - QPainter painter(m_videoWidget); | ||
334 | - m_drawFrameRect = m_videoWidget->calculateDrawFrameRect(); | ||
335 | - painter.drawImage(drawFrameRect(), currentFrame()); | ||
336 | - frameRendered(); | ||
337 | + Q_UNUSED(event); | ||
338 | + | ||
339 | + if (framePos != m_videoWidget->mapToGlobal(QPoint(0,0))) | ||
340 | + setVideoSize(); | ||
341 | } | ||
342 | |||
343 | bool WidgetRenderer::eventFilter(QEvent * event) | ||
344 | { | ||
345 | - if (event->type() == QEvent::User) { | ||
346 | - NewFrameEvent *frameEvent= static_cast <NewFrameEvent *>(event); | ||
347 | - setNextFrame(frameEvent->frame, frameEvent->width, frameEvent->height); | ||
348 | - return true; | ||
349 | + if (event->type() == QEvent::Show) { | ||
350 | + | ||
351 | + setOverlay(); | ||
352 | + return true; | ||
353 | + | ||
354 | + } else if (event->type() == QEvent::Resize) { | ||
355 | + | ||
356 | + setVideoSize(); | ||
357 | + return true; | ||
358 | } | ||
359 | + if (framePos != m_videoWidget->mapToGlobal(QPoint(0,0))) | ||
360 | + setVideoSize(); | ||
361 | return false; | ||
362 | } | ||
363 | |||
364 | +void WidgetRenderer::aspectRatioChanged(Phonon::VideoWidget::AspectRatio) | ||
365 | +{ | ||
366 | + setVideoSize(); | ||
367 | +} | ||
368 | + | ||
369 | +void WidgetRenderer::scaleModeChanged(Phonon::VideoWidget::ScaleMode) | ||
370 | +{ | ||
371 | + setVideoSize(); | ||
372 | +} | ||
373 | + | ||
374 | +void WidgetRenderer::movieSizeChanged(const QSize &movieSize) | ||
375 | +{ | ||
376 | + Q_UNUSED(movieSize); | ||
377 | + setVideoSize(); | ||
378 | +} | ||
379 | + | ||
380 | } | ||
381 | } //namespace Phonon::Gstreamer | ||
382 | |||
383 | diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.h b/src/3rdparty/phonon/gstreamer/widgetrenderer.h | ||
384 | index 03ee9c0..6de1a03 100644 | ||
385 | --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.h | ||
386 | +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.h | ||
387 | @@ -40,20 +40,21 @@ class WidgetRenderer : public AbstractRenderer | ||
388 | { | ||
389 | public: | ||
390 | WidgetRenderer(VideoWidget *videoWidget); | ||
391 | + ~WidgetRenderer(void); | ||
392 | bool eventFilter(QEvent * event); | ||
393 | void handlePaint(QPaintEvent *paintEvent); | ||
394 | void handleMediaNodeEvent(const MediaNodeEvent *event); | ||
395 | - const QImage& currentFrame() const; | ||
396 | QRect drawFrameRect() const { return m_drawFrameRect; } | ||
397 | - void setNextFrame(const QByteArray &array, int width, int height); | ||
398 | - bool frameIsSet() { return !m_array.isNull(); } | ||
399 | - void clearFrame(); | ||
400 | + void aspectRatioChanged(Phonon::VideoWidget::AspectRatio aspectRatio); | ||
401 | + void scaleModeChanged(Phonon::VideoWidget::ScaleMode scaleMode); | ||
402 | + void movieSizeChanged(const QSize &movieSize); | ||
403 | + void setVideoSize(void); | ||
404 | + int setOverlay(void); | ||
405 | + void handleMove(QMoveEvent* event); | ||
406 | private: | ||
407 | - mutable QImage m_frame; | ||
408 | - QByteArray m_array; | ||
409 | - int m_width; | ||
410 | - int m_height; | ||
411 | + void paintEvent ( QPaintEvent * event ); | ||
412 | QRect m_drawFrameRect; | ||
413 | + QPoint framePos; | ||
414 | }; | ||
415 | |||
416 | } | ||
417 | diff --git a/src/3rdparty/phonon/gstreamer/x11renderer.cpp b/src/3rdparty/phonon/gstreamer/x11renderer.cpp | ||
418 | index 968f3a8..c4662e7 100644 | ||
419 | --- a/src/3rdparty/phonon/gstreamer/x11renderer.cpp | ||
420 | +++ b/src/3rdparty/phonon/gstreamer/x11renderer.cpp | ||
421 | @@ -31,6 +31,8 @@ | ||
422 | #include "mediaobject.h" | ||
423 | #include "message.h" | ||
424 | |||
425 | +#define FSL_GSTREAMER 1 | ||
426 | + | ||
427 | QT_BEGIN_NAMESPACE | ||
428 | |||
429 | namespace Phonon | ||
430 | @@ -78,31 +80,16 @@ X11Renderer::~X11Renderer() | ||
431 | { | ||
432 | m_renderWidget->setAttribute(Qt::WA_PaintOnScreen, false); | ||
433 | m_renderWidget->setAttribute(Qt::WA_NoSystemBackground, false); | ||
434 | + if (m_videoSink) { | ||
435 | + gst_object_unref (GST_OBJECT (m_videoSink)); | ||
436 | + } | ||
437 | delete m_renderWidget; | ||
438 | } | ||
439 | |||
440 | GstElement* X11Renderer::createVideoSink() | ||
441 | { | ||
442 | - GstElement *videoSink = gst_element_factory_make ("xvimagesink", NULL); | ||
443 | - if (videoSink) { | ||
444 | - // Check if the xv sink is usable | ||
445 | - if (gst_element_set_state(videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) { | ||
446 | - gst_object_unref(GST_OBJECT(videoSink)); | ||
447 | - videoSink = 0; | ||
448 | - } else { | ||
449 | - // Note that this should not really be necessary as these are | ||
450 | - // default values, though under certain conditions values are retained | ||
451 | - // even between application instances. (reproducible on 0.10.16/Gutsy) | ||
452 | - g_object_set(G_OBJECT(videoSink), "brightness", 0, (const char*)NULL); | ||
453 | - g_object_set(G_OBJECT(videoSink), "contrast", 0, (const char*)NULL); | ||
454 | - g_object_set(G_OBJECT(videoSink), "hue", 0, (const char*)NULL); | ||
455 | - g_object_set(G_OBJECT(videoSink), "saturation", 0, (const char*)NULL); | ||
456 | - } | ||
457 | - } | ||
458 | - | ||
459 | - if (!videoSink) | ||
460 | - videoSink = gst_element_factory_make ("ximagesink", NULL); | ||
461 | |||
462 | + GstElement *videoSink = gst_element_factory_make ("mfw_v4lsink", NULL); | ||
463 | gst_object_ref (GST_OBJECT (videoSink)); //Take ownership | ||
464 | gst_object_sink (GST_OBJECT (videoSink)); | ||
465 | |||
466 | -- | ||
467 | 1.7.1 | ||
468 | |||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0002-i.MX-video-renderer-Allow-v4l-device-from-environmen.patch b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0002-i.MX-video-renderer-Allow-v4l-device-from-environmen.patch new file mode 100644 index 00000000..0226db59 --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0002-i.MX-video-renderer-Allow-v4l-device-from-environmen.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From 023befba9aad60ef58177fd987a6aa40c357b2b2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Nelson <eric.nelson@boundarydevices.com> | ||
3 | Date: Fri, 16 Aug 2013 11:42:23 -0700 | ||
4 | Subject: [PATCH] i.MX video renderer: Allow v4l device from environment | ||
5 | |||
6 | The i.MX6 supports multiple IPUs and multiple V4L2 output | ||
7 | devices for each. | ||
8 | |||
9 | Devices are numbered starting with /dev/video16 and defined | ||
10 | for each configured display. In general, /dev/video16 will | ||
11 | correspond to the RGB (background) layer for /dev/fb0. | ||
12 | If a display is the first on an IPU, an additional V4L2 | ||
13 | output will be defined that corresponds to the normally | ||
14 | YUV overlay (foreground) layer. | ||
15 | |||
16 | This patch allows association of the proper device for | ||
17 | a particular session for use in multi-headed applications. | ||
18 | The default is /dev/video17: | ||
19 | export v4lsinkdev=/dev/video17 | ||
20 | |||
21 | Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> | ||
22 | --- | ||
23 | src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | 5 ++++- | ||
24 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
25 | |||
26 | diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | ||
27 | index aa4925a..a502ccd 100644 | ||
28 | --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | ||
29 | +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp | ||
30 | @@ -58,9 +58,12 @@ WidgetRenderer::WidgetRenderer(VideoWidget *videoWidget) | ||
31 | : AbstractRenderer(videoWidget) | ||
32 | { | ||
33 | if ((m_videoSink = gst_element_factory_make("mfw_v4lsink", NULL)) && m_videoSink != NULL) { | ||
34 | - | ||
35 | + char *videodev; | ||
36 | gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership | ||
37 | gst_object_sink (GST_OBJECT (m_videoSink)); | ||
38 | + videodev=getenv("v4lsinkdev"); | ||
39 | + if (videodev) | ||
40 | + g_object_set (G_OBJECT (m_videoSink), "device", videodev, NULL); | ||
41 | } | ||
42 | |||
43 | // Clear the background with black by default | ||
44 | -- | ||
45 | 1.8.1.2 | ||
46 | |||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0003-i.MX6-force-egl-visual-ID-33.patch b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0003-i.MX6-force-egl-visual-ID-33.patch new file mode 100644 index 00000000..9aa158d7 --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/0003-i.MX6-force-egl-visual-ID-33.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From: Javier Viguera <javier.viguera@digi.com> | ||
2 | Date: Mon, 3 Mar 2014 17:10:41 +0100 | ||
3 | Subject: [PATCH] i.MX6: force egl visual ID 33 | ||
4 | |||
5 | Workaround mismatch between EGL binary libraries and QT for FSL MX6 | ||
6 | based platforms. | ||
7 | |||
8 | Error: | ||
9 | Warning: EGL suggested using X Visual ID 33 (ARGB0888) for EGL config 28 (ARGB0444), but this is incompatable | ||
10 | Unable to find an X11 visual which matches EGL config 28 | ||
11 | |||
12 | Patch adapted from: | ||
13 | |||
14 | http://wiki.wandboard.org/index.php/Integrate_Qt5_into_yocto_sato_image_on_Wandboard | ||
15 | |||
16 | Upstream-Status: Inappropriate [workaround] | ||
17 | |||
18 | Signed-off-by: Javier Viguera <javier.viguera@digi.com> | ||
19 | --- | ||
20 | src/gui/egl/qegl_x11.cpp | 2 +- | ||
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp | ||
24 | index 196d0f77bf2d..8acf5a6c99d4 100644 | ||
25 | --- a/src/gui/egl/qegl_x11.cpp | ||
26 | +++ b/src/gui/egl/qegl_x11.cpp | ||
27 | @@ -319,7 +319,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) | ||
28 | } | ||
29 | |||
30 | qWarning("Unable to find an X11 visual which matches EGL config %d", configId); | ||
31 | - return (VisualID)0; | ||
32 | + return (VisualID)33; | ||
33 | } | ||
34 | |||
35 | void qt_set_winid_on_widget(QWidget* w, Qt::HANDLE id) | ||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/mx6/g++.conf b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/mx6/g++.conf new file mode 100644 index 00000000..915ecba0 --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/mx6/g++.conf | |||
@@ -0,0 +1,40 @@ | |||
1 | # | ||
2 | # qmake configuration for common gcc | ||
3 | # | ||
4 | |||
5 | QMAKE_COMPILER = gcc | ||
6 | |||
7 | QMAKE_CC = $(OE_QMAKE_CC) | ||
8 | QMAKE_CFLAGS += $(OE_QMAKE_CFLAGS) -DLINUX=1 -DEGL_API_FB=1 | ||
9 | QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $(OE_QMAKE_CFLAGS) | ||
10 | QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} | ||
11 | QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} | ||
12 | |||
13 | QMAKE_CXX = $(OE_QMAKE_CXX) | ||
14 | QMAKE_CXXFLAGS += $(OE_QMAKE_CXXFLAGS) -DLINUX=1 -DEGL_API_FB=1 | ||
15 | QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO | ||
16 | QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} | ||
17 | QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE | ||
18 | |||
19 | QMAKE_LINK = $(OE_QMAKE_LINK) | ||
20 | QMAKE_LINK_SHLIB = $(OE_QMAKE_LINK) | ||
21 | QMAKE_LINK_C = $(OE_QMAKE_LINK) | ||
22 | QMAKE_LINK_C_SHLIB = $(OE_QMAKE_LINK) | ||
23 | QMAKE_LFLAGS += $(OE_QMAKE_LDFLAGS) | ||
24 | QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined | ||
25 | QMAKE_LFLAGS_RPATH = -Wl,-rpath-link, | ||
26 | |||
27 | QMAKE_PCH_OUTPUT_EXT = .gch | ||
28 | |||
29 | # -Bsymbolic-functions (ld) support | ||
30 | QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions | ||
31 | QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, | ||
32 | |||
33 | # do not depend on gdb | ||
34 | CONFIG -= gdb_dwarf_index | ||
35 | |||
36 | # some linking helper... | ||
37 | CONFIG += rpath_libdirs | ||
38 | |||
39 | # for the SDK | ||
40 | isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG = $(OE_QMAKE_QT_CONFIG) | ||
diff --git a/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/mx6/linux.conf b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/mx6/linux.conf new file mode 100644 index 00000000..c644d8ba --- /dev/null +++ b/dynamic-layers/qt4-layer/recipes-qt4/qt4/qt4/mx6/linux.conf | |||
@@ -0,0 +1,66 @@ | |||
1 | # | ||
2 | # qmake configuration for common linux | ||
3 | # | ||
4 | |||
5 | QMAKE_CFLAGS_THREAD += -D_REENTRANT | ||
6 | QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD | ||
7 | |||
8 | QMAKE_INCDIR = | ||
9 | QMAKE_LIBDIR = | ||
10 | QMAKE_INCDIR_X11 = | ||
11 | QMAKE_LIBDIR_X11 = | ||
12 | QMAKE_INCDIR_QT = $(OE_QMAKE_INCDIR_QT) | ||
13 | QMAKE_LIBDIR_QT = $(OE_QMAKE_LIBDIR_QT) | ||
14 | QMAKE_INCDIR_OPENGL = | ||
15 | QMAKE_LIBDIR_OPENGL = | ||
16 | QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL | ||
17 | QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL | ||
18 | QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL | ||
19 | QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL | ||
20 | QMAKE_INCDIR_EGL = | ||
21 | QMAKE_LIBDIR_EGL = | ||
22 | QMAKE_INCDIR_OPENVG = | ||
23 | QMAKE_LIBDIR_OPENVG = | ||
24 | |||
25 | |||
26 | QMAKE_LIBS = | ||
27 | QMAKE_LIBS_DYNLOAD = -ldl | ||
28 | QMAKE_LIBS_X11 = $(OE_QMAKE_LIBS_X11) | ||
29 | QMAKE_LIBS_X11SM = $(OE_QMAKE_LIBS_X11SM) | ||
30 | QMAKE_LIBS_NIS = -lnsl | ||
31 | QMAKE_LIBS_EGL = -lEGL -lGAL -DLINUX=1 -DEGL_API_FB=1 | ||
32 | QMAKE_LIBS_OPENGL = -lGL | ||
33 | QMAKE_LIBS_OPENGL_QT = -lGL | ||
34 | QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM | ||
35 | QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 -lGAL -lEGL -DLINUX=1 -DEGL_API_FB=1 | ||
36 | QMAKE_LIBS_OPENVG = -lOpenVG -lGAL -lEGL -DLINUX=1 -DEGL_API_FB=1 | ||
37 | QMAKE_LIBS_THREAD = -lpthread | ||
38 | |||
39 | QMAKE_MOC = $(OE_QMAKE_MOC) | ||
40 | QMAKE_UIC = $(OE_QMAKE_UIC) | ||
41 | QMAKE_UIC3 = $(OE_QMAKE_UIC3) | ||
42 | QMAKE_RCC = $(OE_QMAKE_RCC) | ||
43 | QMAKE_QDBUSCPP2XML = $(OE_QMAKE_QDBUSCPP2XML) | ||
44 | QMAKE_QDBUSXML2CPP = $(OE_QMAKE_QDBUSXML2CPP) | ||
45 | |||
46 | QMAKE_AR = $(OE_QMAKE_AR) cqs | ||
47 | QMAKE_OBJCOPY = objcopy | ||
48 | QMAKE_RANLIB = | ||
49 | |||
50 | QMAKE_TAR = tar -cf | ||
51 | QMAKE_GZIP = gzip -9f | ||
52 | |||
53 | QMAKE_COPY = cp -f | ||
54 | QMAKE_COPY_FILE = $(COPY) | ||
55 | QMAKE_COPY_DIR = $(COPY) -r | ||
56 | QMAKE_MOVE = mv -f | ||
57 | QMAKE_DEL_FILE = rm -f | ||
58 | QMAKE_DEL_DIR = rmdir | ||
59 | QMAKE_STRIP = $(OE_QMAKE_STRIP) | ||
60 | QMAKE_STRIPFLAGS_LIB += --strip-unneeded | ||
61 | QMAKE_CHK_DIR_EXISTS = test -d | ||
62 | QMAKE_MKDIR = mkdir -p | ||
63 | QMAKE_INSTALL_FILE = install -m 644 -p | ||
64 | QMAKE_INSTALL_PROGRAM = install -m 755 -p | ||
65 | |||
66 | include(unix.conf) | ||