diff options
Diffstat (limited to 'src/qtmultimediaquicktools/qdeclarativevideooutput.cpp')
-rw-r--r-- | src/qtmultimediaquicktools/qdeclarativevideooutput.cpp | 76 |
1 files changed, 69 insertions, 7 deletions
diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp index 9a9256868..c638b3065 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2012 Research In Motion -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Toolkit. ** @@ -11,9 +11,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -24,8 +24,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -262,6 +262,12 @@ bool QDeclarativeVideoOutput::createBackend(QMediaService *service) m_backend->updateGeometry(); } + if (m_backend) { + m_backend->clearFilters(); + for (int i = 0; i < m_filters.count(); ++i) + m_backend->appendFilter(m_filters[i]); + } + return backendAvailable; } @@ -795,6 +801,12 @@ void QDeclarativeVideoOutput::itemChange(QQuickItem::ItemChange change, m_backend->itemChange(change, changeData); } +void QDeclarativeVideoOutput::releaseResources() +{ + if (m_backend) + m_backend->releaseResources(); +} + void QDeclarativeVideoOutput::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_UNUSED(newGeometry); @@ -809,4 +821,54 @@ void QDeclarativeVideoOutput::geometryChanged(const QRectF &newGeometry, const Q _q_updateGeometry(); } +/*! + \qmlproperty list<object> QtMultimedia::VideoOutput::filters + + This property holds the list of video filters that are run on the video + frames. The order of the filters in the list matches the order in which + they will be invoked on the video frames. The objects in the list must be + instances of a subclass of QAbstractVideoFilter. + + \sa QAbstractVideoFilter +*/ + +QQmlListProperty<QAbstractVideoFilter> QDeclarativeVideoOutput::filters() +{ + return QQmlListProperty<QAbstractVideoFilter>(this, 0, filter_append, filter_count, filter_at, filter_clear); +} + +void QDeclarativeVideoOutput::filter_append(QQmlListProperty<QAbstractVideoFilter> *property, QAbstractVideoFilter *value) +{ + QDeclarativeVideoOutput *self = static_cast<QDeclarativeVideoOutput *>(property->object); + self->m_filters.append(value); + if (self->m_backend) + self->m_backend->appendFilter(value); +} + +int QDeclarativeVideoOutput::filter_count(QQmlListProperty<QAbstractVideoFilter> *property) +{ + QDeclarativeVideoOutput *self = static_cast<QDeclarativeVideoOutput *>(property->object); + return self->m_filters.count(); +} + +QAbstractVideoFilter *QDeclarativeVideoOutput::filter_at(QQmlListProperty<QAbstractVideoFilter> *property, int index) +{ + QDeclarativeVideoOutput *self = static_cast<QDeclarativeVideoOutput *>(property->object); + return self->m_filters.at(index); +} + +void QDeclarativeVideoOutput::filter_clear(QQmlListProperty<QAbstractVideoFilter> *property) +{ + QDeclarativeVideoOutput *self = static_cast<QDeclarativeVideoOutput *>(property->object); + self->m_filters.clear(); + if (self->m_backend) + self->m_backend->clearFilters(); +} + +void QDeclarativeVideoOutput::_q_invalidateSceneGraph() +{ + if (m_backend) + m_backend->invalidateSceneGraph(); +} + QT_END_NAMESPACE |