diff options
Diffstat (limited to 'src')
25 files changed, 11 insertions, 2251 deletions
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro index 3f955c185..fab9bd408 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -78,17 +78,6 @@ qtConfig(gstreamer_0_10) { qgstbufferpoolinterface.cpp \ qvideosurfacegstsink.cpp \ gstvideoconnector.c - - maemo6 { - PKGCONFIG_PRIVATE += qmsystem2 - - qtConfig(opengles2):qtHaveModule(widgets) { - PRIVATE_HEADERS += qgstreamergltexturerenderer_p.h - SOURCES += qgstreamergltexturerenderer.cpp - QT += opengl - LIBS_PRIVATE += -lEGL -lgstmeegointerfaces-0.10 - } - } } else { PRIVATE_HEADERS += \ qgstvideorendererplugin_p.h \ diff --git a/src/gsttools/gstvideoconnector.c b/src/gsttools/gstvideoconnector.c index d79df2091..b85f5bdbe 100644 --- a/src/gsttools/gstvideoconnector.c +++ b/src/gsttools/gstvideoconnector.c @@ -410,11 +410,7 @@ gst_video_connector_chain (GstPad * pad, GstBuffer * buf) element->latest_buffer = NULL; } - //don't save the last video buffer on maemo6 because of buffers shortage - //with omapxvsink -#ifndef Q_WS_MAEMO_6 element->latest_buffer = gst_buffer_ref(buf); -#endif gst_buffer_unref(buf); gst_object_unref (element); diff --git a/src/gsttools/qgstreamergltexturerenderer.cpp b/src/gsttools/qgstreamergltexturerenderer.cpp deleted file mode 100644 index 3cd7eddf7..000000000 --- a/src/gsttools/qgstreamergltexturerenderer.cpp +++ /dev/null @@ -1,582 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <private/qvideosurfacegstsink_p.h> -#include <qabstractvideosurface.h> -#include <private/qgstutils_p.h> - -#include <QtGui/qevent.h> -#include <QtWidgets/qapplication.h> -#include <QtWidgets/qx11info_x11.h> -#include <QtCore/qdebug.h> -#include <QtCore/qthread.h> - -#include <QtOpenGL/qgl.h> - -#include <gst/gst.h> -#include <gst/interfaces/xoverlay.h> -#include <gst/interfaces/propertyprobe.h> -#include <gst/interfaces/meegovideotexture.h> -#include <gst/interfaces/meegovideorenderswitch.h> - - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#include "qgstreamergltexturerenderer_p.h" - -//#define GL_TEXTURE_SINK_DEBUG 1 - -//from extdefs.h -typedef void *EGLSyncKHR; -typedef khronos_utime_nanoseconds_t EGLTimeKHR; - -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define EGL_SYNC_FENCE_KHR 0x30F9 - -typedef EGLSyncKHR (EGLAPIENTRYP _PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, - EGLenum type, const EGLint * attrib_list); -typedef EGLBoolean (EGLAPIENTRYP _PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, - EGLSyncKHR sync); - - -const QAbstractVideoBuffer::HandleType EGLImageTextureHandle = - QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle+3434); - -// EGLSync functions -_PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR; -_PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR; - -class QGStreamerGLTextureBuffer : public QAbstractVideoBuffer -{ -public: - QGStreamerGLTextureBuffer(MeegoGstVideoTexture *textureSink, int frameNumber) : - QAbstractVideoBuffer(EGLImageTextureHandle), - m_textureSink(MEEGO_GST_VIDEO_TEXTURE(textureSink)), - m_frameNumber(frameNumber) - { - } - - ~QGStreamerGLTextureBuffer() - { - } - - - MapMode mapMode() const { return NotMapped; } - uchar *map(MapMode mode, int *numBytes, int *bytesPerLine) - { - Q_UNUSED(mode); - Q_UNUSED(numBytes); - Q_UNUSED(bytesPerLine); - - //acquire_frame should really be called at buffer construction time - //but it conflicts with id-less implementation of gst texture sink. -#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1 - qDebug() << "acquire frame" << m_frameNumber; -#endif - if (!meego_gst_video_texture_acquire_frame(m_textureSink,m_frameNumber)) - qWarning() << Q_FUNC_INFO << "acquire-frame failed" << m_frameNumber; - - -#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1 - qDebug() << "map frame" << m_frameNumber; -#endif - - gboolean bind_status = meego_gst_video_texture_bind_frame(m_textureSink, GL_TEXTURE_EXTERNAL_OES, m_frameNumber); - if (!bind_status) - qWarning() << Q_FUNC_INFO << "bind-frame failed"; - - return (uchar*)1; - } - - void unmap() - { - gboolean bind_status = meego_gst_video_texture_bind_frame(m_textureSink, GL_TEXTURE_EXTERNAL_OES, -1); - -#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1 - qDebug() << "unmap frame" << m_frameNumber; -#endif - - if (!bind_status) - qWarning() << Q_FUNC_INFO << "unbind-frame failed"; - - //release_frame should really be called in destructor - //but this conflicts with id-less implementation of gst texture sink. -#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1 - qDebug() << "release frame" << m_frameNumber; -#endif - EGLSyncKHR sync = eglCreateSyncKHR(eglGetDisplay((EGLNativeDisplayType)QX11Info::display()), EGL_SYNC_FENCE_KHR, NULL); - meego_gst_video_texture_release_frame(m_textureSink, m_frameNumber, sync); - } - - QVariant handle() const - { - return m_frameNumber; - } - -private: - MeegoGstVideoTexture *m_textureSink; - int m_frameNumber; -}; - - -QGstreamerGLTextureRenderer::QGstreamerGLTextureRenderer(QObject *parent) : - QVideoRendererControl(parent), - m_videoSink(0), - m_surface(0), - m_context(0), - m_winId(0), - m_colorKey(49,0,49), - m_overlayEnabled(false), - m_bufferProbeId(-1) -{ - eglCreateSyncKHR = - (_PFNEGLCREATESYNCKHRPROC)eglGetProcAddress("eglCreateSyncKHR"); - eglDestroySyncKHR = - (_PFNEGLDESTROYSYNCKHRPROC)eglGetProcAddress("eglDestroySyncKHR"); -} - -QGstreamerGLTextureRenderer::~QGstreamerGLTextureRenderer() -{ - if (m_surface && m_surface->isActive()) - m_surface->stop(); - - if (m_videoSink) - gst_object_unref(GST_OBJECT(m_videoSink)); -} - -GstElement *QGstreamerGLTextureRenderer::videoSink() -{ - if (!m_videoSink && isReady()) { - if (m_context && !m_surface->supportedPixelFormats(EGLImageTextureHandle).isEmpty()) { -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << ": using gltexture sink"; -#endif - if (m_context) - m_context->makeCurrent(); - m_videoSink = gst_element_factory_make("gltexturesink", "egl-texture-sink"); - g_object_set(G_OBJECT(m_videoSink), - "x-display", QX11Info::display(), - "egl-display", eglGetDisplay((EGLNativeDisplayType)QX11Info::display()), - "egl-context", eglGetCurrentContext(), - "colorkey", m_colorKey.rgb(), - "autopaint-colorkey", false, - "use-framebuffer-memory", true, - "render-mode", m_overlayEnabled ? VIDEO_RENDERSWITCH_XOVERLAY_MODE - : VIDEO_RENDERSWITCH_TEXTURE_STREAMING_MODE, - (char*)NULL); - - g_signal_connect(G_OBJECT(m_videoSink), "frame-ready", G_CALLBACK(handleFrameReady), (gpointer)this); - } else { - qWarning() << Q_FUNC_INFO << ": Fallback to QVideoSurfaceGstSink since EGLImageTextureHandle is not supported"; - m_videoSink = reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface)); - } - - if (m_videoSink) { - gst_object_ref(GST_OBJECT(m_videoSink)); //Take ownership - gst_object_sink(GST_OBJECT(m_videoSink)); - - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this); - gst_object_unref(GST_OBJECT(pad)); - } - } - - return m_videoSink; -} - -QAbstractVideoSurface *QGstreamerGLTextureRenderer::surface() const -{ - return m_surface; -} - -void QGstreamerGLTextureRenderer::setSurface(QAbstractVideoSurface *surface) -{ - if (m_surface != surface) { -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << surface; -#endif - - bool oldReady = isReady(); - - m_context = const_cast<QGLContext*>(QGLContext::currentContext()); - - if (m_videoSink) - gst_object_unref(GST_OBJECT(m_videoSink)); - - m_videoSink = 0; - - if (m_surface) { - disconnect(m_surface, SIGNAL(supportedFormatsChanged()), - this, SLOT(handleFormatChange())); - } - - m_surface = surface; - - if (oldReady != isReady()) - emit readyChanged(!oldReady); - - if (m_surface) { - connect(m_surface, SIGNAL(supportedFormatsChanged()), - this, SLOT(handleFormatChange())); - } - - emit sinkChanged(); - } -} - -void QGstreamerGLTextureRenderer::handleFormatChange() -{ - if (m_videoSink) - gst_object_unref(GST_OBJECT(m_videoSink)); - - m_videoSink = 0; - emit sinkChanged(); -} - -void QGstreamerGLTextureRenderer::handleFrameReady(GstElement *sink, gint frame, gpointer data) -{ - Q_UNUSED(sink); - QGstreamerGLTextureRenderer* renderer = reinterpret_cast<QGstreamerGLTextureRenderer*>(data); - - QMutexLocker locker(&renderer->m_mutex); - QMetaObject::invokeMethod(renderer, "renderGLFrame", - Qt::QueuedConnection, - Q_ARG(int, frame)); - - //we have to wait to ensure the frame is not reused, - //timeout is added to avoid deadlocks when the main thread is - //waiting for rendering to complete, this is possible for example during state chages. - //If frame is not rendered during 60ms (~1-2 frames interval) it's better to unblock and drop it if necessary - renderer->m_renderCondition.wait(&renderer->m_mutex, 60); -} - -void QGstreamerGLTextureRenderer::renderGLFrame(int frame) -{ -#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1 - qDebug() << Q_FUNC_INFO << "frame:" << frame << "surface active:" << m_surface->isActive(); -#endif - QMutexLocker locker(&m_mutex); - - if (!m_surface) { - m_renderCondition.wakeAll(); - return; - } - - MeegoGstVideoTexture *textureSink = MEEGO_GST_VIDEO_TEXTURE(m_videoSink); - - if (m_context) - m_context->makeCurrent(); - - //don't try to render the frame if state is changed to NULL or READY - GstState pendingState = GST_STATE_NULL; - GstState newState = GST_STATE_NULL; - GstStateChangeReturn res = gst_element_get_state(m_videoSink, - &newState, - &pendingState, - 0);//don't block and return immediately - - if (res == GST_STATE_CHANGE_FAILURE || - newState == GST_STATE_NULL || - pendingState == GST_STATE_NULL) { - stopRenderer(); - m_renderCondition.wakeAll(); - return; - } - - if (!m_surface->isActive()) { - //find the native video size - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - GstCaps *caps = gst_pad_get_negotiated_caps(pad); - - if (caps) { - QSize newNativeSize = QGstUtils::capsCorrectedResolution(caps); - if (m_nativeSize != newNativeSize) { - m_nativeSize = newNativeSize; - emit nativeSizeChanged(); - } - gst_caps_unref(caps); - } - - //start the surface... - QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32, EGLImageTextureHandle); - if (!m_surface->start(format)) { - qWarning() << Q_FUNC_INFO << "failed to start video surface" << format; - m_renderCondition.wakeAll(); - return; - } - } - - QGStreamerGLTextureBuffer *buffer = new QGStreamerGLTextureBuffer(textureSink, frame); - QVideoFrame videoFrame(buffer, - m_surface->surfaceFormat().frameSize(), - m_surface->surfaceFormat().pixelFormat()); - m_surface->present(videoFrame); - m_renderCondition.wakeAll(); -} - -bool QGstreamerGLTextureRenderer::isReady() const -{ - if (!m_surface) - return false; - - if (m_winId > 0) - return true; - - //winId is required only for EGLImageTextureHandle compatible surfaces - return m_surface->supportedPixelFormats(EGLImageTextureHandle).isEmpty(); -} - -bool QGstreamerGLTextureRenderer::processBusMessage(const QGstreamerMessage &message) -{ - GstMessage* gm = message.rawMessage(); - -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << GST_MESSAGE_TYPE_NAME(gm); -#endif - - if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED && - GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_videoSink)) { - GstState oldState; - GstState newState; - gst_message_parse_state_changed(gm, &oldState, &newState, 0); - -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << "State changed:" << oldState << newState; -#endif - - if (newState == GST_STATE_READY || newState == GST_STATE_NULL) { - stopRenderer(); - } - - if (oldState == GST_STATE_READY && newState == GST_STATE_PAUSED) { - updateNativeVideoSize(); - } - } - - return false; -} - -bool QGstreamerGLTextureRenderer::processSyncMessage(const QGstreamerMessage &message) -{ - GstMessage* gm = message.rawMessage(); - - if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) && - gst_structure_has_name(gm->structure, "prepare-xwindow-id") && - m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) { -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO; -#endif - GstXOverlay *overlay = GST_X_OVERLAY(m_videoSink); - - gst_x_overlay_set_xwindow_id(overlay, m_winId); - - if (!m_displayRect.isEmpty()) { - gst_x_overlay_set_render_rectangle(overlay, - m_displayRect.x(), - m_displayRect.y(), - m_displayRect.width(), - m_displayRect.height()); - } - - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this); - - return true; - } - - return false; -} - -void QGstreamerGLTextureRenderer::stopRenderer() -{ -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO; -#endif - - if (m_surface && m_surface->isActive()) - m_surface->stop(); - - if (!m_nativeSize.isEmpty()) { - m_nativeSize = QSize(); - emit nativeSizeChanged(); - } -} - -bool QGstreamerGLTextureRenderer::overlayEnabled() const -{ - return m_overlayEnabled; -} - -void QGstreamerGLTextureRenderer::setOverlayEnabled(bool enabled) -{ - - if (m_videoSink && (m_overlayEnabled != enabled)) { - qDebug() << Q_FUNC_INFO << enabled; - g_object_set(G_OBJECT(m_videoSink), - "render-mode", - enabled ? VIDEO_RENDERSWITCH_XOVERLAY_MODE : VIDEO_RENDERSWITCH_TEXTURE_STREAMING_MODE, - (char *)NULL); - } - - m_overlayEnabled = enabled; -} - - -WId QGstreamerGLTextureRenderer::winId() const -{ - return m_winId; -} - -void QGstreamerGLTextureRenderer::setWinId(WId id) -{ -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << id; -#endif - - if (m_winId == id) - return; - - bool oldReady = isReady(); - - m_winId = id; - - if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) { - //don't set winId in NULL state, - //texture sink opens xvideo port on set_xwindow_id, - //this fails if video resource is not granted by resource policy yet. - //state is changed to READY/PAUSED/PLAYING only after resource is granted. - GstState pendingState = GST_STATE_NULL; - GstState newState = GST_STATE_NULL; - GstStateChangeReturn res = gst_element_get_state(m_videoSink, - &newState, - &pendingState, - 0);//don't block and return immediately - - if (res != GST_STATE_CHANGE_FAILURE && - newState != GST_STATE_NULL && - pendingState != GST_STATE_NULL) - gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_winId); - } - - if (oldReady != isReady()) - emit readyChanged(!oldReady); -} - -QRect QGstreamerGLTextureRenderer::overlayGeometry() const -{ - return m_displayRect; -} - -void QGstreamerGLTextureRenderer::setOverlayGeometry(const QRect &geometry) -{ - if (m_displayRect != geometry) { -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << geometry; -#endif - m_displayRect = geometry; - - if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) { - if (m_displayRect.isEmpty()) - gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), -1, -1, -1, -1); - else - gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), - m_displayRect.x(), - m_displayRect.y(), - m_displayRect.width(), - m_displayRect.height()); - repaintOverlay(); - } - } -} - -QColor QGstreamerGLTextureRenderer::colorKey() const -{ - return m_colorKey; -} - -void QGstreamerGLTextureRenderer::repaintOverlay() -{ - if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) { - //don't call gst_x_overlay_expose if the sink is in null state - GstState state = GST_STATE_NULL; - GstStateChangeReturn res = gst_element_get_state(m_videoSink, &state, NULL, 1000000); - if (res != GST_STATE_CHANGE_FAILURE && state != GST_STATE_NULL) { - gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink)); - } - } -} - -QSize QGstreamerGLTextureRenderer::nativeSize() const -{ - return m_nativeSize; -} - -gboolean QGstreamerGLTextureRenderer::padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data) -{ - QGstreamerGLTextureRenderer *control = reinterpret_cast<QGstreamerGLTextureRenderer*>(user_data); - QMetaObject::invokeMethod(control, "updateNativeVideoSize", Qt::QueuedConnection); - gst_pad_remove_buffer_probe(pad, control->m_bufferProbeId); - - return TRUE; -} - -void QGstreamerGLTextureRenderer::updateNativeVideoSize() -{ - const QSize oldSize = m_nativeSize; - - if (m_videoSink) { - //find video native size to update video widget size hint - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - GstCaps *caps = gst_pad_get_negotiated_caps(pad); - - if (caps) { - m_nativeSize = QGstUtils::capsCorrectedResolution(caps); - gst_caps_unref(caps); - } - } else { - m_nativeSize = QSize(); - } -#ifdef GL_TEXTURE_SINK_DEBUG - qDebug() << Q_FUNC_INFO << oldSize << m_nativeSize << m_videoSink; -#endif - - if (m_nativeSize != oldSize) - emit nativeSizeChanged(); -} diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index d6d6f9c54..d6d74a316 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -46,7 +46,6 @@ qtConfig(pulseaudio) { DEFINES += QT_MULTIMEDIA_PULSEAUDIO PRIVATE_HEADERS += audio/qsoundeffect_pulse_p.h SOURCES += audio/qsoundeffect_pulse_p.cpp - !maemo*:DEFINES += QTM_PULSEAUDIO_DEFAULTBUFFER } else { DEFINES += QT_MULTIMEDIA_QAUDIO PRIVATE_HEADERS += audio/qsoundeffect_qaudio_p.h diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index fcf4fee35..2e2dfc2db 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -62,9 +62,6 @@ #include <unistd.h> //#define QT_PA_DEBUG -#ifndef QTM_PULSEAUDIO_DEFAULTBUFFER -#define QT_PA_STREAM_BUFFER_SIZE_MAX (1024 * 64) //64KB is a trade-off for balancing control latency and uploading overhead -#endif QT_BEGIN_NAMESPACE @@ -679,7 +676,6 @@ void QSoundEffectPrivate::sampleReady() #ifdef QT_PA_DEBUG qDebug() << this << "reuse existing pulsestream"; #endif -#ifdef QTM_PULSEAUDIO_DEFAULTBUFFER const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(m_pulseStream); if (bufferAttr->prebuf > uint32_t(m_sample->data().size())) { pa_buffer_attr newBufferAttr; @@ -693,33 +689,6 @@ void QSoundEffectPrivate::sampleReady() } else { streamReady(); } -#else - const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(m_pulseStream); - if (bufferAttr->tlength < m_sample->data().size() && bufferAttr->tlength < QT_PA_STREAM_BUFFER_SIZE_MAX) { - pa_buffer_attr newBufferAttr; - newBufferAttr.maxlength = -1; - newBufferAttr.tlength = qMin(m_sample->data().size(), QT_PA_STREAM_BUFFER_SIZE_MAX); - newBufferAttr.minreq = bufferAttr->tlength / 2; - newBufferAttr.prebuf = -1; - newBufferAttr.fragsize = -1; - pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_reset_buffer_callback, m_ref->getRef()); - if (op) - pa_operation_unref(op); - else - qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); - } else if (bufferAttr->prebuf > uint32_t(m_sample->data().size())) { - pa_buffer_attr newBufferAttr; - newBufferAttr = *bufferAttr; - newBufferAttr.prebuf = m_sample->data().size(); - pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef()); - if (op) - pa_operation_unref(op); - else - qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); - } else { - streamReady(); - } -#endif } else { if (!pulseDaemon()->context() || pa_context_get_state(pulseDaemon()->context()) != PA_CONTEXT_READY) { connect(pulseDaemon(), SIGNAL(contextReady()), SLOT(contextReady())); @@ -963,17 +932,7 @@ void QSoundEffectPrivate::createPulseStream() } m_pulseStream = stream; -#ifndef QTM_PULSEAUDIO_DEFAULTBUFFER - pa_buffer_attr bufferAttr; - bufferAttr.tlength = qMin(m_sample->data().size(), QT_PA_STREAM_BUFFER_SIZE_MAX); - bufferAttr.maxlength = -1; - bufferAttr.minreq = bufferAttr.tlength / 2; - bufferAttr.prebuf = -1; - bufferAttr.fragsize = -1; - if (pa_stream_connect_playback(m_pulseStream, 0, &bufferAttr, -#else if (pa_stream_connect_playback(m_pulseStream, 0, 0, -#endif PA_STREAM_START_CORKED, 0, 0) < 0) { qWarning("QSoundEffect(pulseaudio): Failed to connect stream, error = %s", pa_strerror(pa_context_errno(pulseDaemon()->context()))); @@ -1048,39 +1007,6 @@ void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata) } } -void QSoundEffectPrivate::stream_reset_buffer_callback(pa_stream *s, int success, void *userdata) -{ -#ifdef QT_PA_DEBUG - qDebug() << "stream_reset_buffer_callback"; -#endif - Q_UNUSED(s); - QSoundEffectRef *ref = reinterpret_cast<QSoundEffectRef*>(userdata); - QSoundEffectPrivate *self = ref->soundEffect(); - ref->release(); - if (!self) - return; - - if (!success) - qWarning("QSoundEffect(pulseaudio): failed to reset buffer attribute"); -#ifdef QT_PA_DEBUG - qDebug() << self << "stream_reset_buffer_callback"; -#endif - const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(self->m_pulseStream); - self->m_pulseBufferSize = bufferAttr->tlength; - if (bufferAttr->prebuf > uint32_t(self->m_sample->data().size())) { - pa_buffer_attr newBufferAttr; - newBufferAttr = *bufferAttr; - newBufferAttr.prebuf = self->m_sample->data().size(); - pa_operation *op = pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata); - if (op) - pa_operation_unref(op); - else - qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); - } else { - QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection); - } -} - void QSoundEffectPrivate::stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata) { #ifdef QT_PA_DEBUG diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h index 020aa031a..7be88c55a 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.h +++ b/src/multimedia/audio/qsoundeffect_pulse_p.h @@ -148,7 +148,6 @@ private: static void stream_flush_reload_callback(pa_stream *s, int success, void *userdata); static void stream_write_done_callback(void *p); static void stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata); - static void stream_reset_buffer_callback(pa_stream *s, int success, void *userdata); pa_stream *m_pulseStream; int m_sinkInputId; diff --git a/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h b/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h deleted file mode 100644 index 8abdd1e02..000000000 --- a/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGSTREAMERGLTEXTURERENDERER_H -#define QGSTREAMERGLTEXTURERENDERER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qvideorenderercontrol.h> -#include <private/qvideosurfacegstsink_p.h> -#include <private/qgstreamerbushelper_p.h> - -#include "qgstreamervideorendererinterface_p.h" -#include <QtGui/qcolor.h> - -#include <X11/extensions/Xv.h> - -QT_BEGIN_NAMESPACE - -class QGLContext; - -class QGstreamerGLTextureRenderer : public QVideoRendererControl, - public QGstreamerVideoRendererInterface, - public QGstreamerSyncMessageFilter, - public QGstreamerBusMessageFilter -{ - Q_OBJECT - Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter) - - Q_PROPERTY(bool overlayEnabled READ overlayEnabled WRITE setOverlayEnabled) - Q_PROPERTY(qulonglong winId READ winId WRITE setWinId) - Q_PROPERTY(QRect overlayGeometry READ overlayGeometry WRITE setOverlayGeometry) - Q_PROPERTY(QColor colorKey READ colorKey) - Q_PROPERTY(QSize nativeSize READ nativeSize NOTIFY nativeSizeChanged) - -public: - QGstreamerGLTextureRenderer(QObject *parent = 0); - virtual ~QGstreamerGLTextureRenderer(); - - QAbstractVideoSurface *surface() const; - void setSurface(QAbstractVideoSurface *surface); - - GstElement *videoSink(); - - bool isReady() const; - bool processBusMessage(const QGstreamerMessage &message); - bool processSyncMessage(const QGstreamerMessage &message); - void stopRenderer(); - - int framebufferNumber() const; - - bool overlayEnabled() const; - WId winId() const; - QRect overlayGeometry() const; - QColor colorKey() const; - QSize nativeSize() const; - -public slots: - void renderGLFrame(int); - - void setOverlayEnabled(bool); - void setWinId(WId id); - void setOverlayGeometry(const QRect &geometry); - void repaintOverlay(); - -signals: - void sinkChanged(); - void readyChanged(bool); - void nativeSizeChanged(); - -private slots: - void handleFormatChange(); - void updateNativeVideoSize(); - -private: - static void handleFrameReady(GstElement *sink, gint frame, gpointer data); - static gboolean padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); - - GstElement *m_videoSink; - QAbstractVideoSurface *m_surface; - QGLContext *m_context; - QSize m_nativeSize; - - WId m_winId; - QColor m_colorKey; - QRect m_displayRect; - bool m_overlayEnabled; - int m_bufferProbeId; - - QMutex m_mutex; - QWaitCondition m_renderCondition; -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERVIDEORENDRER_H diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro index 29ec710f5..c37868933 100644 --- a/src/multimediawidgets/multimediawidgets.pro +++ b/src/multimediawidgets/multimediawidgets.pro @@ -17,27 +17,11 @@ PUBLIC_HEADERS += \ SOURCES += \ qcameraviewfinder.cpp \ + qgraphicsvideoitem.cpp \ qpaintervideosurface.cpp \ qvideowidgetcontrol.cpp \ qvideowidget.cpp -maemo6 { - qtConfig(opengles2) { - PRIVATE_HEADERS += qeglimagetexturesurface_p.h - SOURCES += qeglimagetexturesurface.cpp - - SOURCES += qgraphicsvideoitem_maemo6.cpp - - LIBS_PRIVATE += -lX11 - } else { - SOURCES += qgraphicsvideoitem.cpp - } -} - -!maemo* { - SOURCES += qgraphicsvideoitem.cpp -} - HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS load(qt_module) diff --git a/src/multimediawidgets/qeglimagetexturesurface.cpp b/src/multimediawidgets/qeglimagetexturesurface.cpp deleted file mode 100644 index 5e2073a48..000000000 --- a/src/multimediawidgets/qeglimagetexturesurface.cpp +++ /dev/null @@ -1,533 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qeglimagetexturesurface_p.h> -#include <qpaintervideosurface_p.h> - -#include <QtCore/qmath.h> -#include <QtCore/qvariant.h> -#include <QtCore/qdebug.h> -#include <QtGui/qpainter.h> -#include <QtWidgets/qx11info_x11.h> -#include <qvideosurfaceformat.h> - - -QT_BEGIN_NAMESPACE - -//#define DEBUG_OMAPFB_SURFACE - -const QAbstractVideoBuffer::HandleType EGLImageTextureHandle = -QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle+3434); - -/*! - \class QEglImageTextureSurface - \internal -*/ - -/*! -*/ -QEglImageTextureSurface::QEglImageTextureSurface(QObject *parent) - : QAbstractVideoSurface(parent) - , m_context(0) - , m_program(0) - , m_pixelFormat(QVideoFrame::Format_Invalid) - , m_ready(false) - , m_colorKey(49,0,49) - , m_fallbackSurface(0) - , m_fallbackSurfaceActive(false) -{ - m_fallbackSurface = new QPainterVideoSurface(this); -} - -/*! -*/ -QEglImageTextureSurface::~QEglImageTextureSurface() -{ - if (isActive()) - stop(); -} - -/*! -*/ -QList<QVideoFrame::PixelFormat> QEglImageTextureSurface::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ -#ifdef DEBUG_OMAPFB_SURFACE - qDebug() << Q_FUNC_INFO << handleType; -#endif - - if (handleType == EGLImageTextureHandle) { - return QList<QVideoFrame::PixelFormat>() - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32; - } - - return m_fallbackSurface->supportedPixelFormats(handleType); -} - -const char *qt_glsl_eglTextureVertexShaderProgram = - "attribute highp vec4 vertexCoordArray;\n" - "attribute mediump vec2 textureCoordArray;\n" - "uniform highp mat4 positionMatrix;\n" - "varying mediump vec2 textureCoord;\n" - "void main (void)\n" - "{\n" - " gl_Position = positionMatrix * vertexCoordArray;\n" - " textureCoord = textureCoordArray;\n" - "}"; - -static const char* qt_glsl_eglTextureShaderProgram = - "#extension GL_OES_EGL_image_external: enable\n" - "\n" - "uniform samplerExternalOES texRgb;\n" - "varying mediump vec2 textureCoord;\n" - "\n" - "void main (void)\n" - "{\n" - " gl_FragColor = texture2D(texRgb, textureCoord);\n" - "}"; - - -/*! -*/ -bool QEglImageTextureSurface::start(const QVideoSurfaceFormat &format) -{ -#ifdef DEBUG_OMAPFB_SURFACE - qDebug() << Q_FUNC_INFO << format; -#endif - - m_fallbackSurfaceActive = false; - if (format.handleType() != EGLImageTextureHandle) { - qWarning() << Q_FUNC_INFO << "Non EGLImageTextureHandle based format requested, fallback to QPainterVideoSurface"; - connect(m_fallbackSurface, SIGNAL(activeChanged(bool)), - this, SIGNAL(activeChanged(bool))); - connect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - connect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), - this, SIGNAL(supportedFormatsChanged())); - connect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), - this, SIGNAL(nativeResolutionChanged(QSize))); - connect(m_fallbackSurface, SIGNAL(frameChanged()), - this, SIGNAL(frameChanged())); - - if (m_fallbackSurface->start(format)) { - m_fallbackSurfaceActive = true; - QAbstractVideoSurface::start(format); - } else { - qWarning() << Q_FUNC_INFO << "failed to start video surface:" << m_fallbackSurface->error(); - setError(m_fallbackSurface->error()); - - disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)), - this, SIGNAL(activeChanged(bool))); - disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), - this, SIGNAL(supportedFormatsChanged())); - disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), - this, SIGNAL(nativeResolutionChanged(QSize))); - disconnect(m_fallbackSurface, SIGNAL(frameChanged()), - this, SIGNAL(frameChanged())); - } - - return m_fallbackSurfaceActive; - } - - QAbstractVideoSurface::Error error = NoError; - - if (isActive()) - stop(); - - if (format.frameSize().isEmpty()) { - setError(UnsupportedFormatError); - } else if (m_context) { - m_context->makeCurrent(); - m_program = new QGLShaderProgram(m_context, this); - - if (!m_program->addShaderFromSourceCode(QGLShader::Vertex, qt_glsl_eglTextureVertexShaderProgram)) { - qWarning("QOmapFbVideoSurface: Vertex shader compile error %s", - qPrintable(m_program->log())); - error = ResourceError; - } - - if (error == NoError - && !m_program->addShaderFromSourceCode(QGLShader::Fragment, qt_glsl_eglTextureShaderProgram)) { - qWarning("QOmapFbVideoSurface: Vertex shader compile error %s", - qPrintable(m_program->log())); - error = QAbstractVideoSurface::ResourceError; - } - - if (error == NoError) { - m_program->bindAttributeLocation("textureCoordArray", 1); - if(!m_program->link()) { - qWarning("QOmapFbVideoSurface: Shader link error %s", qPrintable(m_program->log())); - m_program->removeAllShaders(); - error = QAbstractVideoSurface::ResourceError; - } - } - - if (error != QAbstractVideoSurface::NoError) { - delete m_program; - m_program = 0; - } - } - - if (error == QAbstractVideoSurface::NoError) { - m_scanLineDirection = format.scanLineDirection(); - m_frameSize = format.frameSize(); - m_pixelFormat = format.pixelFormat(); - m_frameSize = format.frameSize(); - m_sourceRect = format.viewport(); - m_ready = true; - - return QAbstractVideoSurface::start(format); - } - - QAbstractVideoSurface::stop(); - return false; -} - -/*! -*/ -void QEglImageTextureSurface::stop() -{ -#ifdef DEBUG_OMAPFB_SURFACE - qDebug() << Q_FUNC_INFO; -#endif - - if (m_fallbackSurfaceActive) { - m_fallbackSurface->stop(); - m_fallbackSurfaceActive = false; - - disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)), - this, SIGNAL(activeChanged(bool))); - disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), - this, SIGNAL(supportedFormatsChanged())); - disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), - this, SIGNAL(nativeResolutionChanged(QSize))); - disconnect(m_fallbackSurface, SIGNAL(frameChanged()), - this, SIGNAL(frameChanged())); - - m_ready = false; - QAbstractVideoSurface::stop(); - } - - if (isActive()) { - if (m_context) - m_context->makeCurrent(); - m_frame = QVideoFrame(); - - m_program->removeAllShaders(); - delete m_program; - m_program = 0; - m_ready = false; - - QAbstractVideoSurface::stop(); - } -} - -/*! -*/ -bool QEglImageTextureSurface::present(const QVideoFrame &frame) -{ - if (m_fallbackSurfaceActive) { - if (m_fallbackSurface->present(frame)) { - return true; - } else { - setError(m_fallbackSurface->error()); - stop(); - return false; - } - } - - if (!m_ready) { - if (!isActive()) - setError(StoppedError); - else - m_frame = frame; - } else if (frame.isValid() - && (frame.pixelFormat() != m_pixelFormat || frame.size() != m_frameSize)) { - setError(IncorrectFormatError); - qWarning() << "Received frame of incorrect format, stopping the surface"; - - stop(); - } else { - if (m_context) - m_context->makeCurrent(); - m_frame = frame; - m_ready = false; - emit frameChanged(); - return true; - } - return false; -} - -/*! -*/ -int QEglImageTextureSurface::brightness() const -{ - return m_fallbackSurface->brightness(); -} - -/*! -*/ -void QEglImageTextureSurface::setBrightness(int brightness) -{ - m_fallbackSurface->setBrightness(brightness); -} - -/*! -*/ -int QEglImageTextureSurface::contrast() const -{ - return m_fallbackSurface->contrast(); -} - -/*! -*/ -void QEglImageTextureSurface::setContrast(int contrast) -{ - m_fallbackSurface->setContrast(contrast); -} - -/*! -*/ -int QEglImageTextureSurface::hue() const -{ - return m_fallbackSurface->hue(); -} - -/*! -*/ -void QEglImageTextureSurface::setHue(int hue) -{ - m_fallbackSurface->setHue(hue); -} - -/*! -*/ -int QEglImageTextureSurface::saturation() const -{ - return m_fallbackSurface->saturation(); -} - -/*! -*/ -void QEglImageTextureSurface::setSaturation(int saturation) -{ - m_fallbackSurface->setSaturation(saturation); -} - -/*! -*/ -bool QEglImageTextureSurface::isReady() const -{ - return m_fallbackSurfaceActive ? m_fallbackSurface->isReady() : m_ready; -} - -/*! -*/ -void QEglImageTextureSurface::setReady(bool ready) -{ - m_ready = ready; - if (m_fallbackSurfaceActive) - m_fallbackSurface->setReady(ready); -} - -/*! -*/ -void QEglImageTextureSurface::paint(QPainter *painter, const QRectF &target, const QRectF &sourceRect) -{ - if (m_fallbackSurfaceActive) { - m_fallbackSurface->paint(painter, target, sourceRect); - return; - } - - if (!isActive() || !m_frame.isValid()) { - painter->fillRect(target, QBrush(Qt::black)); - } else { - const QRectF source( - m_sourceRect.x() + m_sourceRect.width() * sourceRect.x(), - m_sourceRect.y() + m_sourceRect.height() * sourceRect.y(), - m_sourceRect.width() * sourceRect.width(), - m_sourceRect.height() * sourceRect.height()); - - bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); - bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST); - - painter->beginNativePainting(); - - if (stencilTestEnabled) - glEnable(GL_STENCIL_TEST); - if (scissorTestEnabled) - glEnable(GL_SCISSOR_TEST); - - const int width = QGLContext::currentContext()->device()->width(); - const int height = QGLContext::currentContext()->device()->height(); - - const QTransform transform = painter->deviceTransform(); - - const GLfloat wfactor = 2.0 / width; - const GLfloat hfactor = -2.0 / height; - - const GLfloat positionMatrix[4][4] = - { - { - /*(0,0)*/ GLfloat(wfactor * transform.m11() - transform.m13()), - /*(0,1)*/ GLfloat(hfactor * transform.m12() + transform.m13()), - /*(0,2)*/ 0.0, - /*(0,3)*/ GLfloat(transform.m13()) - }, { - /*(1,0)*/ GLfloat(wfactor * transform.m21() - transform.m23()), - /*(1,1)*/ GLfloat(hfactor * transform.m22() + transform.m23()), - /*(1,2)*/ 0.0, - /*(1,3)*/ GLfloat(transform.m23()) - }, { - /*(2,0)*/ 0.0, - /*(2,1)*/ 0.0, - /*(2,2)*/ -1.0, - /*(2,3)*/ 0.0 - }, { - /*(3,0)*/ GLfloat(wfactor * transform.dx() - transform.m33()), - /*(3,1)*/ GLfloat(hfactor * transform.dy() + transform.m33()), - /*(3,2)*/ 0.0, - /*(3,3)*/ GLfloat(transform.m33()) - } - }; - - const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.top() - : target.bottom() + 1; - const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.bottom() + 1 - : target.top(); - - - const GLfloat vertexCoordArray[] = - { - GLfloat(target.left()) , GLfloat(vBottom), - GLfloat(target.right() + 1), GLfloat(vBottom), - GLfloat(target.left()) , GLfloat(vTop), - GLfloat(target.right() + 1), GLfloat(vTop) - }; - - const GLfloat txLeft = source.left() / m_frameSize.width(); - const GLfloat txRight = source.right() / m_frameSize.width(); - const GLfloat txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.top() / m_frameSize.height() - : source.bottom() / m_frameSize.height(); - const GLfloat txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.bottom() / m_frameSize.height() - : source.top() / m_frameSize.height(); - - const GLfloat textureCoordArray[] = - { - txLeft , txBottom, - txRight, txBottom, - txLeft , txTop, - txRight, txTop - }; - - m_program->bind(); - - m_program->enableAttributeArray("vertexCoordArray"); - m_program->enableAttributeArray("textureCoordArray"); - m_program->setAttributeArray("vertexCoordArray", vertexCoordArray, 2); - m_program->setAttributeArray("textureCoordArray", textureCoordArray, 2); - m_program->setUniformValue("positionMatrix", positionMatrix); - m_program->setUniformValue("texRgb", 0); - - //map() binds the external texture - m_frame.map(QAbstractVideoBuffer::ReadOnly); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - //it's necessary to unbind the external texture - m_frame.unmap(); - - m_program->release(); - - painter->endNativePainting(); - } -} - -/*! - \fn QEglImageTextureSurface::frameChanged() -*/ - -/*! -*/ -const QGLContext *QEglImageTextureSurface::glContext() const -{ - return m_context; -} - -/*! -*/ -void QEglImageTextureSurface::setGLContext(QGLContext *context) -{ - if (m_context == context) - return; - - stop(); - - m_context = context; - - m_fallbackSurface->setGLContext(context); - if (m_fallbackSurface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) { - m_fallbackSurface->setShaderType(QPainterVideoSurface::GlslShader); - } else { - m_fallbackSurface->setShaderType(QPainterVideoSurface::FragmentProgramShader); - } - - emit supportedFormatsChanged(); -} - -void QEglImageTextureSurface::viewportDestroyed() -{ - m_context = 0; - m_fallbackSurface->viewportDestroyed(); - - setError(ResourceError); - stop(); -} - -#include "moc_qeglimagetexturesurface_p.cpp" -QT_END_NAMESPACE diff --git a/src/multimediawidgets/qeglimagetexturesurface_p.h b/src/multimediawidgets/qeglimagetexturesurface_p.h deleted file mode 100644 index 8affe4dc3..000000000 --- a/src/multimediawidgets/qeglimagetexturesurface_p.h +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLIMAGETEXTURESURFACE_P_H -#define QEGLIMAGETEXTURESURFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qtmultimediawidgetdefs.h> -#include <QtCore/qsize.h> -#include <QtGui/qimage.h> -#include <QtGui/qmatrix4x4.h> -#include <QtGui/qpaintengine.h> - -#include <QtOpenGL/qglshaderprogram.h> - -#include <qabstractvideosurface.h> -#include <qvideosurfaceformat.h> -#include <qvideoframe.h> - -QT_BEGIN_NAMESPACE - -class QGLContext; -class QGLShaderProgram; -class QPainterVideoSurface; - -class QEglImageTextureSurface : public QAbstractVideoSurface -{ - Q_OBJECT -public: - explicit QEglImageTextureSurface(QObject *parent = 0); - ~QEglImageTextureSurface(); - - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; - - bool start(const QVideoSurfaceFormat &format); - void stop(); - - bool present(const QVideoFrame &frame); - - int brightness() const; - void setBrightness(int brightness); - - int contrast() const; - void setContrast(int contrast); - - int hue() const; - void setHue(int hue); - - int saturation() const; - void setSaturation(int saturation); - - bool isReady() const; - void setReady(bool ready); - - void paint(QPainter *painter, const QRectF &target, const QRectF &source = QRectF(0, 0, 1, 1)); - - const QGLContext *glContext() const; - void setGLContext(QGLContext *context); - - bool isOverlayEnabled() const; - void setOverlayEnabled(bool enabled); - - QRect displayRect() const; - void setDisplayRect(const QRect &rect); - -public Q_SLOTS: - void viewportDestroyed(); - -Q_SIGNALS: - void frameChanged(); - -private: - QGLContext *m_context; - QGLShaderProgram *m_program; - - QVideoFrame m_frame; - - QVideoFrame::PixelFormat m_pixelFormat; - QVideoSurfaceFormat::Direction m_scanLineDirection; - QSize m_frameSize; - QRect m_sourceRect; - bool m_ready; - - QRect m_viewport; - QRect m_displayRect; - QColor m_colorKey; - - QPainterVideoSurface *m_fallbackSurface; - bool m_fallbackSurfaceActive; -}; - -QT_END_NAMESPACE - - -#endif diff --git a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp b/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp deleted file mode 100644 index caedaeee1..000000000 --- a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicsvideoitem.h" - -#include <QtCore/qcoreevent.h> -#include <QtCore/qpointer.h> -#include <QtCore/qbasictimer.h> - -#include <QtWidgets/qgraphicsscene.h> - -#include <qmediaobject.h> -#include <qmediaservice.h> -#include <qpaintervideosurface_p.h> -#include <qeglimagetexturesurface_p.h> -#include <qvideorenderercontrol.h> - -#include <qvideosurfaceformat.h> - -#include <X11/Xlib.h> - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) -#include <QtOpenGL/qgl.h> -#endif - -//#define ENABLE_OVERLAY - -namespace -{ -//XInitThreads is necessary for gltexturesink element. -//To ensure it's called before main() it's better to link to -//libQtMultimedia.so directly, not when QML multimedia plugin is loaded. -class InitThreads -{ -public: - InitThreads() - { - XInitThreads(); - } -} _initThreads; -} - -Q_DECLARE_METATYPE(QVideoSurfaceFormat) - -QT_BEGIN_NAMESPACE - -class QGraphicsVideoItemPrivate -{ -public: - QGraphicsVideoItemPrivate() - : q_ptr(0) - , surface(0) - , mediaObject(0) - , service(0) - , rendererControl(0) - , aspectRatioMode(Qt::KeepAspectRatio) - , updatePaintDevice(true) - , rect(0.0, 0.0, 320, 240) - { - } - - QGraphicsVideoItem *q_ptr; - - QEglImageTextureSurface *surface; - QPointer<QMediaObject> mediaObject; - QMediaService *service; - QVideoRendererControl *rendererControl; - Qt::AspectRatioMode aspectRatioMode; - bool updatePaintDevice; - QRectF rect; - QRectF boundingRect; - QRectF sourceRect; - QSizeF nativeSize; - - void clearService(); - void updateRects(); - - void _q_present(); - void _q_formatChanged(const QVideoSurfaceFormat &format); - void _q_updateNativeSize(); - void _q_serviceDestroyed(); -}; - -void QGraphicsVideoItemPrivate::clearService() -{ - if (rendererControl) { - surface->stop(); - rendererControl->setSurface(0); - service->releaseControl(rendererControl); - rendererControl = 0; - } - if (service) { - QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed())); - service = 0; - } -} - -void QGraphicsVideoItemPrivate::updateRects() -{ - q_ptr->prepareGeometryChange(); - - if (nativeSize.isEmpty()) { - //this is necessary for item to receive the - //first paint event and configure video surface. - boundingRect = rect; - } else if (aspectRatioMode == Qt::IgnoreAspectRatio) { - boundingRect = rect; - sourceRect = QRectF(0, 0, 1, 1); - } else if (aspectRatioMode == Qt::KeepAspectRatio) { - QSizeF size = nativeSize; - size.scale(rect.size(), Qt::KeepAspectRatio); - - boundingRect = QRectF(0, 0, size.width(), size.height()); - boundingRect.moveCenter(rect.center()); - - sourceRect = QRectF(0, 0, 1, 1); - } else if (aspectRatioMode == Qt::KeepAspectRatioByExpanding) { - boundingRect = rect; - - QSizeF size = rect.size(); - size.scale(nativeSize, Qt::KeepAspectRatio); - - sourceRect = QRectF( - 0, 0, size.width() / nativeSize.width(), size.height() / nativeSize.height()); - sourceRect.moveCenter(QPointF(0.5, 0.5)); - } -} - -void QGraphicsVideoItemPrivate::_q_present() -{ - if (q_ptr->isObscured()) { - q_ptr->update(boundingRect); - surface->setReady(true); - } else { - q_ptr->update(boundingRect); - } -} - -void QGraphicsVideoItemPrivate::_q_updateNativeSize() -{ - QSize size = surface->surfaceFormat().sizeHint(); - if (size.isEmpty()) - size = rendererControl->property("nativeSize").toSize(); - - if (nativeSize != size) { - nativeSize = size; - - updateRects(); - emit q_ptr->nativeSizeChanged(nativeSize); - } -} - -void QGraphicsVideoItemPrivate::_q_serviceDestroyed() -{ - rendererControl = 0; - service = 0; - - surface->stop(); -} - - -/* - \class QGraphicsVideoItem - - - \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. - - \inmodule QtMultimediaWidgets - \ingroup multimedia - - Attaching a QGraphicsVideoItem to a QMediaObject allows it to display - the video or image output of that media object. A QGraphicsVideoItem - is attached to a media object by passing a pointer to the QMediaObject - to the setMediaObject() function. - - \code - player = new QMediaPlayer(this); - - QGraphicsVideoItem *item = new QGraphicsVideoItem; - player->setVideoOutput(item); - graphicsView->scene()->addItem(item); - graphicsView->show(); - - player->setMedia(video); - player->play(); - \endcode - - \b {Note}: Only a single display output can be attached to a media - object at one time. - - \sa QMediaObject, QMediaPlayer, QVideoWidget -*/ - -/* - Constructs a graphics item that displays video. - - The \a parent is passed to QGraphicsItem. -*/ -QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent) - : QGraphicsObject(parent) - , d_ptr(new QGraphicsVideoItemPrivate) -{ - d_ptr->q_ptr = this; - d_ptr->surface = new QEglImageTextureSurface(this); - - qRegisterMetaType<QVideoSurfaceFormat>(); - - connect(d_ptr->surface, SIGNAL(frameChanged()), this, SLOT(_q_present())); - connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); -} - -/* - Destroys a video graphics item. -*/ -QGraphicsVideoItem::~QGraphicsVideoItem() -{ - if (d_ptr->rendererControl) { - d_ptr->rendererControl->setSurface(0); - d_ptr->service->releaseControl(d_ptr->rendererControl); - } - - delete d_ptr->surface; - delete d_ptr; -} - -/* - \property QGraphicsVideoItem::mediaObject - \brief the media object which provides the video displayed by a graphics - item. -*/ - -QMediaObject *QGraphicsVideoItem::mediaObject() const -{ - return d_func()->mediaObject; -} - -/* - \internal -*/ -bool QGraphicsVideoItem::setMediaObject(QMediaObject *object) -{ - Q_D(QGraphicsVideoItem); - - if (object == d->mediaObject) - return true; - - d->clearService(); - - d->mediaObject = object; - - if (d->mediaObject) { - d->service = d->mediaObject->service(); - - if (d->service) { - QMediaControl *control = d->service->requestControl(QVideoRendererControl_iid); - if (control) { - d->rendererControl = qobject_cast<QVideoRendererControl *>(control); - - if (d->rendererControl) { - connect(d->rendererControl, SIGNAL(nativeSizeChanged()), - this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); - d->_q_updateNativeSize(); - //don't set the surface untill the item is painted - //at least once and the surface is configured - if (!d->updatePaintDevice) - d->rendererControl->setSurface(d->surface); - else - update(boundingRect()); - - connect(d->service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed())); - - return true; - } - if (control) - d->service->releaseControl(control); - } - } - } - - d->mediaObject = 0; - return false; -} - -/* - \property QGraphicsVideoItem::aspectRatioMode - \brief how a video is scaled to fit the graphics item's size. -*/ - -Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const -{ - return d_func()->aspectRatioMode; -} - -void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - Q_D(QGraphicsVideoItem); - - d->aspectRatioMode = mode; - d->updateRects(); -} - -/* - \property QGraphicsVideoItem::offset - \brief the video item's offset. - - QGraphicsVideoItem will draw video using the offset for its top left - corner. -*/ - -QPointF QGraphicsVideoItem::offset() const -{ - return d_func()->rect.topLeft(); -} - -void QGraphicsVideoItem::setOffset(const QPointF &offset) -{ - Q_D(QGraphicsVideoItem); - - d->rect.moveTo(offset); - d->updateRects(); -} - -/* - \property QGraphicsVideoItem::size - \brief the video item's size. - - QGraphicsVideoItem will draw video scaled to fit size according to its - fillMode. -*/ - -QSizeF QGraphicsVideoItem::size() const -{ - return d_func()->rect.size(); -} - -void QGraphicsVideoItem::setSize(const QSizeF &size) -{ - Q_D(QGraphicsVideoItem); - - d->rect.setSize(size.isValid() ? size : QSizeF(0, 0)); - d->updateRects(); -} - -/* - \property QGraphicsVideoItem::nativeSize - \brief the native size of the video. -*/ - -QSizeF QGraphicsVideoItem::nativeSize() const -{ - return d_func()->nativeSize; -} - -/* - \fn QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size) - - Signals that the native \a size of the video has changed. -*/ - -/* - \reimp -*/ -QRectF QGraphicsVideoItem::boundingRect() const -{ - return d_func()->boundingRect; -} - -/* - \reimp -*/ -void QGraphicsVideoItem::paint( - QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_D(QGraphicsVideoItem); - - Q_UNUSED(option); - Q_UNUSED(widget); - - if (d->surface && d->rendererControl && d->updatePaintDevice) { - d->updatePaintDevice = false; - - if (widget) - d->rendererControl->setProperty("winId", qulonglong(widget->winId())); - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - if (widget) - connect(widget, SIGNAL(destroyed()), d->surface, SLOT(viewportDestroyed())); - - d->surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext())); -#endif - if (d->rendererControl->surface() != d->surface) - d->rendererControl->setSurface(d->surface); - } - - - //overlay doesn't work reliably - - //check if the item is obscured: -#ifdef ENABLE_OVERLAY - if (!isObscured()) { - bool obscured = false; - - if (scene()) { - const auto items = scene()->items(mapToScene(boundingRect()), Qt::IntersectsItemBoundingRect); - for (QGraphicsItem *item : items) { - if (item->flags() & QGraphicsItem::ItemHasNoContents) - continue; - - if (item == this) - break; - - if (collidesWithItem(item)) { - obscured = true; - break; - } - } - } - - d->rendererControl->setProperty("overlayEnabled", !obscured); - } - - if (d->rendererControl->property("overlayEnabled").toBool()) { - QTransform transform = painter->combinedTransform(); - QRect overlayRect = transform.mapRect(d->boundingRect).toRect(); - - d->rendererControl->setProperty("overlayGeometry", overlayRect); - QMetaObject::invokeMethod(d->rendererControl, "repaintOverlay"); - - painter->fillRect(d->boundingRect, - d->rendererControl->property("colorKey").value<QColor>()); - } else -#endif //ENABLE_OVERLAY - { - if (d->surface && d->surface->isActive()) { - d->surface->paint(painter, d->boundingRect, d->sourceRect); - d->surface->setReady(true); - } - } -} - -/* - \reimp - - \internal -*/ -QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value) -{ - return QGraphicsItem::itemChange(change, value); -} - -/* - \internal -*/ -void QGraphicsVideoItem::timerEvent(QTimerEvent *event) -{ - QGraphicsObject::timerEvent(event); -} - -#include "moc_qgraphicsvideoitem.cpp" -QT_END_NAMESPACE diff --git a/src/plugins/audiocapture/audiocapturesession.cpp b/src/plugins/audiocapture/audiocapturesession.cpp index e4a9688e8..7ed3313d8 100644 --- a/src/plugins/audiocapture/audiocapturesession.cpp +++ b/src/plugins/audiocapture/audiocapturesession.cpp @@ -206,10 +206,6 @@ QDir AudioCaptureSession::defaultDir() const { QStringList dirCandidates; -#if defined(Q_WS_MAEMO_6) - dirCandidates << QLatin1String("/home/user/MyDocs"); -#endif - dirCandidates << QDir::home().filePath("Documents"); dirCandidates << QDir::home().filePath("My Documents"); dirCandidates << QDir::homePath(); diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro index 3a5fcc02f..d214d61c6 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.pro +++ b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -52,16 +52,6 @@ SOURCES += \ $$PWD/camerabincapturebufferformat.cpp \ $$PWD/camerabininfocontrol.cpp -maemo6 { - HEADERS += \ - $$PWD/camerabuttonlistener_meego.h - - SOURCES += \ - $$PWD/camerabuttonlistener_meego.cpp - - CONFIG += have_gst_photography -} - qtConfig(gstreamer_photography) { DEFINES += HAVE_GST_PHOTOGRAPHY diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp index d4570b8b1..8b3e10546 100644 --- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp +++ b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp @@ -57,11 +57,7 @@ QList<QVideoFrame::PixelFormat> CameraBinCaptureBufferFormat::supportedBufferFor { //the exact YUV format is unknown with camerabin until the first capture is requested return QList<QVideoFrame::PixelFormat>() - << QVideoFrame::Format_Jpeg -#ifdef Q_WS_MAEMO_6 - << QVideoFrame::Format_UYVY -#endif - ; + << QVideoFrame::Format_Jpeg; } QVideoFrame::PixelFormat CameraBinCaptureBufferFormat::bufferFormat() const diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.h b/src/plugins/gstreamer/camerabin/camerabinexposure.h index a7de86627..0435569d4 100644 --- a/src/plugins/gstreamer/camerabin/camerabinexposure.h +++ b/src/plugins/gstreamer/camerabin/camerabinexposure.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef CAMERABINEXPOSURECONTROL_MAEMO_H -#define CAMERABINEXPOSURECONTROL_MAEMO_H +#ifndef CAMERABINEXPOSURECONTROL_H +#define CAMERABINEXPOSURECONTROL_H #include <qcamera.h> #include <qcameraexposurecontrol.h> @@ -72,4 +72,4 @@ private: QT_END_NAMESPACE -#endif // CAMERABINEXPOSURECONTROL_MAEMO_H +#endif // CAMERABINEXPOSURECONTROL_H diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp index 2be4e345a..3fbd1a60e 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp @@ -73,20 +73,11 @@ #endif #include <private/qgstreamervideowindow_p.h> #include <private/qgstreamervideorenderer_p.h> - -#if defined(Q_WS_MAEMO_6) && defined(__arm__) -#include "qgstreamergltexturerenderer.h" -#endif - #include <private/qmediaserviceprovider_p.h> #include <QtCore/qdebug.h> #include <QtCore/qprocess.h> -#if defined(Q_WS_MAEMO_6) -#include "camerabuttonlistener_meego.h" -#endif - QT_BEGIN_NAMESPACE CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent): @@ -119,17 +110,9 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa if (m_videoInputDevice->deviceCount()) m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice())); -#if defined(Q_WS_MAEMO_6) && defined(__arm__) && defined(HAVE_WIDGETS) - m_videoRenderer = new QGstreamerGLTextureRenderer(this); -#else m_videoRenderer = new QGstreamerVideoRenderer(this); -#endif -#ifdef Q_WS_MAEMO_6 - m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink"); -#else m_videoWindow = new QGstreamerVideoWindow(this); -#endif // If the GStreamer video sink is not available, don't provide the video window control since // it won't work anyway. if (!m_videoWindow->videoSink()) { @@ -156,10 +139,6 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa m_metaDataControl = new CameraBinMetaData(this); connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)), m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>))); - -#if defined(Q_WS_MAEMO_6) - new CameraButtonListener(this); -#endif } CameraBinService::~CameraBinService() diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h index 41398087d..ca0b22761 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.h +++ b/src/plugins/gstreamer/camerabin/camerabinsession.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef CAMERABINCAPTURESESSION_MAEMO_H -#define CAMERABINCAPTURESESSION_MAEMO_H +#ifndef CAMERABINCAPTURESESSION_H +#define CAMERABINCAPTURESESSION_H #include <qmediarecordercontrol.h> @@ -288,4 +288,4 @@ public: QT_END_NAMESPACE -#endif // CAMERABINCAPTURESESSION_MAEMO_H +#endif // CAMERABINCAPTURESESSION_H diff --git a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp deleted file mode 100644 index 0516f338b..000000000 --- a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "camerabuttonlistener_meego.h" - -#include <QtWidgets/qapplication.h> -#include <QtGui/qevent.h> -#include <QtWidgets/qwidget.h> -#include <QtCore/qdebug.h> - -QT_BEGIN_NAMESPACE - -CameraButtonListener::CameraButtonListener(QObject *parent) : - QObject(parent), - m_focusPressed(false), - m_shutterPressed(false) -{ - m_keys = new MeeGo::QmKeys(this); - connect(m_keys, SIGNAL(keyEvent(MeeGo::QmKeys::Key,MeeGo::QmKeys::State)), - this, SLOT(handleQmKeyEvent(MeeGo::QmKeys::Key,MeeGo::QmKeys::State))); -} - -CameraButtonListener::~CameraButtonListener() -{ -} - -void CameraButtonListener::handleQmKeyEvent(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state) -{ - if (key == MeeGo::QmKeys::Camera) { - QWidget *window = QApplication::focusWidget(); - - bool focusPressed = (state == MeeGo::QmKeys::KeyHalfDown) || - (state == MeeGo::QmKeys::KeyDown); - - if (m_focusPressed != focusPressed) { - m_focusPressed = focusPressed; - if (window) { - QApplication::postEvent(window, - new QKeyEvent(focusPressed ? QEvent::KeyPress : QEvent::KeyRelease, - Qt::Key_CameraFocus, - Qt::NoModifier)); - } - } - - bool shutterPressed = (state == MeeGo::QmKeys::KeyDown); - if (m_shutterPressed != shutterPressed) { - m_shutterPressed = shutterPressed; - if (window) { - QApplication::postEvent(window, - new QKeyEvent(shutterPressed ? QEvent::KeyPress : QEvent::KeyRelease, - Qt::Key_Camera, - Qt::NoModifier)); - } - } - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h deleted file mode 100644 index 776640ed4..000000000 --- a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef CAMERABUTTONLISTENER_MEEGO_H -#define CAMERABUTTONLISTENER_MEEGO_H - -#include <QtCore/qobject.h> -#include <qmsystem2/qmkeys.h> - -QT_BEGIN_NAMESPACE - -class CameraButtonListener : public QObject -{ - Q_OBJECT -public: - CameraButtonListener(QObject *parent = 0); - ~CameraButtonListener(); - -private slots: - void handleQmKeyEvent(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state); - -private: - MeeGo::QmKeys *m_keys; - bool m_focusPressed; - bool m_shutterPressed; -}; - -QT_END_NAMESPACE - -#endif // CAMERABUTTONLISTENER_MEEGO_H diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp index 5f45567cc..abb58c963 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp @@ -51,23 +51,12 @@ QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent) { QList<QByteArray> codecCandidates; -#if defined(Q_WS_MAEMO_6) - codecCandidates << "audio/AAC" << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM" - << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC"; -#else codecCandidates << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM" << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC"; -#endif -#if defined(Q_WS_MAEMO_6) - m_elementNames["audio/AMR"] = "nokiaamrnbenc"; - m_elementNames["audio/AMR-WB"] = "nokiaamrwbenc"; - m_elementNames["audio/AAC"] = "nokiaaacenc"; -#else m_elementNames["audio/mpeg"] = "lamemp3enc"; m_elementNames["audio/AMR"] = "amrnbenc"; m_elementNames["audio/AMR-WB"] = "amrwbenc"; -#endif m_elementNames["audio/vorbis"] = "vorbisenc"; m_elementNames["audio/speex"] = "speexenc"; diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp index 7b216b63b..958204803 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp @@ -330,10 +330,6 @@ QDir QGstreamerRecorderControl::defaultDir() const { QStringList dirCandidates; -#if defined(Q_WS_MAEMO_6) - dirCandidates << QLatin1String("/home/user/MyDocs"); -#endif - if (m_session->captureMode() & QGstreamerCaptureSession::Video) dirCandidates << QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); else diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index 9ecd9b79c..3e7286e51 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -239,14 +239,6 @@ void QGstreamerPlayerControl::playOrPause(QMediaPlayer::State newState) setMedia(m_currentResource, m_stream); } -#ifdef Q_WS_MAEMO_6 - //this is a work around for the gstreamer bug, - //should be remove once it get fixed - if (newState == QMediaPlayer::PlayingState && m_mediaStatus == QMediaPlayer::InvalidMedia) { - setMedia(m_currentResource, m_stream); - } -#endif - if (m_mediaStatus == QMediaPlayer::EndOfMedia && m_pendingSeekPosition == -1) { m_pendingSeekPosition = 0; } diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp index f233a487f..ed88821c7 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -56,10 +56,6 @@ #include <private/qgstreamervideowindow_p.h> #include <private/qgstreamervideorenderer_p.h> -#if defined(Q_WS_MAEMO_6) && defined(__arm__) -#include "private/qgstreamergltexturerenderer.h" -#endif - #if defined(HAVE_MIR) && defined (__arm__) #include "private/qgstreamermirtexturerenderer_p.h" #endif @@ -92,20 +88,14 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent): m_streamsControl = new QGstreamerStreamsControl(m_session,this); m_availabilityControl = new QGStreamerAvailabilityControl(m_control->resources(), this); -#if defined(Q_WS_MAEMO_6) && defined(__arm__) - m_videoRenderer = new QGstreamerGLTextureRenderer(this); -#elif defined(HAVE_MIR) && defined (__arm__) +#if defined(HAVE_MIR) && defined (__arm__) m_videoRenderer = new QGstreamerMirTextureRenderer(this, m_session); #else m_videoRenderer = new QGstreamerVideoRenderer(this); #endif -#ifdef Q_WS_MAEMO_6 - m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink"); -#else m_videoWindow = new QGstreamerVideoWindow(this); -#endif - // If the GStreamer video sink is not available, don't provide the video window control since + // If the GStreamer video sink is not available, don't provide the video window control since // it won't work anyway. if (!m_videoWindow->videoSink()) { delete m_videoWindow; diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index ed07e4054..09b74148e 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -155,10 +155,6 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) if (m_playbin) { //GST_PLAY_FLAG_NATIVE_VIDEO omits configuration of ffmpegcolorspace and videoscale, //since those elements are included in the video output bin when necessary. -#ifdef Q_WS_MAEMO_6 - int flags = GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO | - GST_PLAY_FLAG_NATIVE_VIDEO | GST_PLAY_FLAG_NATIVE_AUDIO; -#else int flags = GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO; QByteArray envFlags = qgetenv("QT_GSTREAMER_PLAYBIN_FLAGS"); if (!envFlags.isEmpty()) { @@ -168,7 +164,6 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) flags |= GST_PLAY_FLAG_NATIVE_VIDEO; #endif } -#endif g_object_set(G_OBJECT(m_playbin), "flags", flags, NULL); GstElement *audioSink = gst_element_factory_make("autoaudiosink", "audiosink"); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index b0c5101b6..b355094e6 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -55,7 +55,7 @@ unix:!mac:!android { # v4l is turned off because it is not supported in Qt 5 # qtConfig(linux_v4l) { - # !maemo*:SUBDIRS += v4l + # SUBDIRS += v4l # } } |