Commit 1a4d0d41 authored by Val Doroshchuk's avatar Val Doroshchuk

Add hole punching

parent b7cb7917
......@@ -31,7 +31,7 @@ src/gstreamer/qtgstreamerversion.h
QtGstreamer.version*
*-config*
config.*
.qmake*
.qmake.cache
.pch
uic_*
*_wrapper.sh
......
load(qt_build_config)
MODULE_VERSION = 5.12.0
......@@ -355,5 +355,13 @@ QVariantMap QGstreamerMediaPlayer::textStreamProperties(int i)
return d->session ? d->session->textStreamProperties(i) : QVariantMap();
}
void QGstreamerMediaPlayer::set(const QString &elementName, const QVariantMap& map)
{
Q_D(QGstreamerMediaPlayer);
if (d->session)
d->session->setGstProperties(elementName, map);
}
#include "moc_qgstreamermediaplayer.cpp"
QT_END_NAMESPACE
......@@ -101,6 +101,8 @@ public:
void setTextStream(int i);
Q_INVOKABLE QVariantMap textStreamProperties(int i);
Q_INVOKABLE void set(const QString &elementName, const QVariantMap& map);
Q_SIGNALS:
void sourceChanged();
void mediaObjectChanged();
......
TEMPLATE = subdirs
SUBDIRS += video
/****************************************************************************
**
** Copyright (C) 2018 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 "qtransparentvideobackend.h"
#include <private/qdeclarativevideooutput_render_p.h>
#include <private/qquickwindow_p.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qdeclarativevideooutput_p.h>
class QTransparentVideoRendererBackend : public QDeclarativeVideoRendererBackend
{
public:
QTransparentVideoRendererBackend(QDeclarativeVideoOutput *parent)
: QDeclarativeVideoRendererBackend(parent)
{}
void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &changeData) override;
QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) override;
private:
QSGContext *m_context = nullptr;
};
void QTransparentVideoRendererBackend::itemChange(QQuickItem::ItemChange change,
const QQuickItem::ItemChangeData &changeData)
{
Q_UNUSED(change);
if (!changeData.window)
return;
m_context = static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(changeData.window))->context->sceneGraphContext();
QSurfaceFormat fmt = changeData.window->requestedFormat();
if (fmt.alphaBufferSize() != 8) {
fmt.setAlphaBufferSize(8);
changeData.window->setFormat(fmt);
}
}
QSGNode *QTransparentVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
QQuickItem::UpdatePaintNodeData *data)
{
Q_UNUSED(data);
if (!m_context)
return nullptr;
QSGInternalRectangleNode *rect = static_cast<QSGInternalRectangleNode *>(oldNode);
if (!rect)
rect = m_context->createInternalRectangleNode();
rect->setColor(QColor(0, 0, 0, 0));
rect->setRect(QRectF(0, 0, q->width(), q->height()));
rect->update();
return rect;
}
QDeclarativeVideoBackend *QTransparentVideoNodeBackend::create(QDeclarativeVideoOutput *parent)
{
return parent->punchHole() ? new QTransparentVideoRendererBackend(parent) : nullptr;
}
/****************************************************************************
**
** Copyright (C) 2018 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 QTRANSPARENTVIDEOBACKEND_H
#define QTRANSPARENTVIDEOBACKEND_H
#include <private/qdeclarativevideooutput_backend_p.h>
QT_BEGIN_NAMESPACE
class QTransparentVideoNodeBackend : public QObject, public QDeclarativeVideoBackendFactoryInterface
{
Q_OBJECT
Q_INTERFACES(QDeclarativeVideoBackendFactoryInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.declarativevideobackendfactory/5.2" FILE "transparentvideobackend.json")
public:
QDeclarativeVideoBackend *create(QDeclarativeVideoOutput *parent) override;
};
QT_END_NAMESPACE
#endif
{
"Keys": ["transparentvideobackend"],
"Services": ["declarativevideobackend"]
}
TARGET = transparentvideobackend
QT += qtmultimediaquicktools-private quick-private
HEADERS += \
qtransparentvideobackend.h
SOURCES += \
qtransparentvideobackend.cpp
PLUGIN_TYPE = video/declarativevideobackend
PLUGIN_EXTENDS = quick
PLUGIN_CLASS_NAME = QTransparentVideoNodeBackend
load(qt_plugin)
TEMPLATE = subdirs
SUBDIRS += transparentvideobackend
......@@ -9,3 +9,7 @@ qtHaveModule(quick):qtConfig(opengl) {
SUBDIRS += \
src_imports
}
src_plugins.subdir = plugins
SUBDIRS += src_plugins
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment