return QAbstractVideoSurface::start(format);
}
+ void stop()
+ {
+ m_item->stop();
+ QAbstractVideoSurface::stop();
+ }
+
virtual bool present(const QVideoFrame &frame)
{
if (!frame.isValid()) {
void QDeclarativeVideoOutput::present(const QVideoFrame &frame)
{
+ m_frameMutex.lock();
m_frame = frame;
+ m_frameMutex.unlock();
+
update();
}
+void QDeclarativeVideoOutput::stop()
+{
+ present(QVideoFrame());
+}
+
/*!
\qmlproperty enumeration VideoOutput::fillMode
{
QSGVideoNode *videoNode = static_cast<QSGVideoNode *>(oldNode);
+ QMutexLocker lock(&m_frameMutex);
+
if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) {
#ifdef DEBUG_VIDEOITEM
qDebug() << "updatePaintNode: deleting old video node because frame format changed...";
#include <QtMultimedia/qmediaobject.h>
#include <QtCore/qsharedpointer.h>
+#include <QtCore/qmutex.h>
#include "qsgvideonode_p.h"
};
void present(const QVideoFrame &frame);
+ void stop();
friend class QSGVideoItemSurface;
QSize m_nativeSize;
QRectF m_boundingRect;
QRectF m_sourceRect;
+
+ QMutex m_frameMutex;
};
QT_END_NAMESPACE
#include "qsgvideonode_rgb.h"
#include <QtDeclarative/qsgtexturematerial.h>
#include <QtDeclarative/qsgmaterial.h>
+#include <QtCore/qmutex.h>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
#include <QtOpenGL/qglshaderprogram.h>
}
void setVideoFrame(const QVideoFrame &frame) {
+ QMutexLocker lock(&m_frameMutex);
m_frame = frame;
}
{
QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions();
+ QMutexLocker lock(&m_frameMutex);
if (m_frame.isValid() && m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
if (m_textureSize != m_frame.size()) {
if (!m_textureSize.isEmpty())
}
QVideoFrame m_frame;
+ QMutex m_frameMutex;
QSize m_textureSize;
QVideoSurfaceFormat m_format;
GLuint m_textureId;