summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorJonas Rabbe <jonas.rabbe@nokia.com>2012-04-03 15:55:55 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-05 03:54:02 +0200
commitc532850fd1f55b563930ad6e178e30cf560ee532 (patch)
tree818e0cb5a8fe04193101ba72c15a38243b0e0157 /doc/src/snippets
parente908790a6a8b6cc779e5ec24ec94f6caf00d354e (diff)
Updated a lot of minor fixes to the docs and removed warnings from qdoc
Change-Id: Ib7fd75fb93c038f9e8fa9d71b6ad01fb27b97622 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/multimedia-snippets/video.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/doc/src/snippets/multimedia-snippets/video.cpp b/doc/src/snippets/multimedia-snippets/video.cpp
index 007b73558..5ab5ed03a 100644
--- a/doc/src/snippets/multimedia-snippets/video.cpp
+++ b/doc/src/snippets/multimedia-snippets/video.cpp
@@ -48,10 +48,63 @@
#include "qvideowindowcontrol.h"
#include "qgraphicsvideoitem.h"
#include "qmediaplaylist.h"
+#include "qvideosurfaceformat.h"
#include <QFormLayout>
#include <QGraphicsView>
+//! [Derived Surface]
+class MyVideoSurface : public QAbstractVideoSurface
+{
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(
+ QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const
+ {
+ Q_UNUSED(handleType);
+
+ // Return the formats you will support
+ return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB565;
+ }
+
+ bool present(const QVideoFrame &frame)
+ {
+ Q_UNUSED(frame);
+ // Handle the frame and do your processing
+
+ return true;
+ }
+};
+//! [Derived Surface]
+
+//! [Video producer]
+class MyVideoProducer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QAbstractVideoSurface *videoSurface WRITE setVideoSurface)
+
+public:
+ void setVideoSurface(QAbstractVideoSurface *surface)
+ {
+ m_surface = surface;
+ m_surface->start(m_format);
+ }
+
+ // ...
+
+public slots:
+ void onNewVideoContentReceived(const QVideoFrame &frame)
+ {
+ if (m_surface)
+ m_surface->present(frame);
+ }
+
+private:
+ QAbstractVideoSurface *m_surface;
+ QVideoSurfaceFormat m_format;
+};
+
+//! [Video producer]
+
+
class VideoExample : public QObject {
Q_OBJECT
public:
@@ -98,6 +151,12 @@ void VideoExample::VideoWidget()
playlist->setCurrentIndex(1);
player->play();
//! [Video widget]
+
+ player->stop();
+
+ //! [Setting surface in player]
+ player->setVideoOutput(myVideoSurface);
+ //! [Setting surface in player]
}
void VideoExample::VideoWidgetControl()