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>
This commit is contained in:
Jonas Rabbe
2012-04-03 15:55:55 +10:00
committed by Qt by Nokia
parent e908790a6a
commit c532850fd1
68 changed files with 476 additions and 318 deletions

View File

@@ -7,7 +7,15 @@ win32:!win32-g++ {
unixstyle = true
}
QDOC = $$QT.core.bins/qdoc3
system(which qdoc) {
QDOC = qdoc
} else {
exists($$QT.core.bins/qdoc3) {
QDOC = $$QT.core.bins/qdoc3
} else {
warning("No qdoc executable found.")
}
}
ONLINE_CONF = $$PWD/qtmultimedia.qdocconf
DITA_CONF = $$PWD/qtmultimedia-dita.qdocconf

View File

@@ -34,7 +34,7 @@
Qt Multimedia offers a range of audio classes, covering both low and
high level approaches to audio input, output and processing. In
addition to traditional audio usage, the \l {QtAudioEngine}{Qt AudioEngine}
addition to traditional audio usage, the \l {QtAudioEngine Overview}{Qt AudioEngine}
QML classes offers high level 3D positional audio for QML applications.
See that documentation for more information.
@@ -73,7 +73,7 @@ sounds. These classes allow you to specify a WAV format file which can
then be played with low latency when necessary. Both QSoundEffect and the
SoundEffect element have essentially the same API.
You can adjust the number of \l {QSoundEffect::setLoops()}{loops} a sound effect is played, as well as
You can adjust the number of \l {QSoundEffect::loops}{loops} a sound effect is played, as well as
the \l {QSoundEffect::setVolume()}{volume} (or \l {QSoundEffect::setMuted()}{muting}) of the effect.
For older, Qt 4.x based applications \l QSound is also available. Applications
@@ -135,36 +135,22 @@ Here's an example of installing a probe during recording:
There are both C++ and QML examples available.
C++ Examples:
\section2 C++ Examples
\section2 Record a Sound Source
\annotatedlist audio_examples
\l{audiorecorder}{AudioRecorder} is a demonstration of the discovery of
the supported devices and codecs and the use of recording functions in the
QAudioRecorder class.
\section2 QML Examples
\list
\li \l audiodevices
\li \l audioinput
\li \l audiooutput
\li \l audiorecorder
\li \l spectrum
\endlist
QML Examples:
[TBD]
\section1 Reference Documentation
\section2 Audio Classes
\section2 C++ Classes
\annotatedlist multimedia_audio
\section2 QML Elements
\list
\li \l Audio
\li \l MediaPlayer
\endlist
\annotatedlist multimedia_audio_qml
*/

View File

@@ -195,7 +195,7 @@ There are a number of settings that affect the amount of light that hits the
camera sensor, and hence the quality of the resulting image. The \l QCameraExposure
class allows you to adjust these settings. You can use this class to implement
some techniques like High Dynamic Range (HDR) photos by locking the exposure
parameters (with \l {QCamera::lock()}), or motion blur by setting slow shutter speeds
parameters (with \l {QCamera::searchAndLock()}), or motion blur by setting slow shutter speeds
with small apertures.
The main settings for automatic image taking are the \l {QCameraExposure::ExposureMode}{exposure mode}
@@ -213,13 +213,14 @@ the hardware may also double as a torch (typically when the flash is LED based,
a xenon or other bulb). See also the \l {Torch} QML element for an easy to use API for
torch functionality.
\target camera_image_processing
\section3 Image processing
The QCameraImageProcessing class lets you adjust the image processing
part of the pipeline. This includes the \l {QCameraImageCapture::WhiteBalanceMode}{white balance}
(or color temperature), \l {QCameraImageCapture::contrast()}{contrast},
\l {QCameraImageCapture::saturation()}{saturation}, \l {QCameraImageCapture::setSharpening()}{sharpening}
and \l {QCameraImageCapture::setDenoisingLevel()}{denoising}. Most cameras support automatic settings
part of the pipeline. This includes the \l {QCameraImageProcessing::WhiteBalanceMode}{white balance}
(or color temperature), \l {QCameraImageProcessing::contrast()}{contrast},
\l {QCameraImageProcessing::saturation()}{saturation}, \l {QCameraImageProcessing::setSharpeningLevel()}{sharpening}
and \l {QCameraImageProcessing::setDenoisingLevel()}{denoising}. Most cameras support automatic settings
for all of these, so you shouldn't need to adjust them unless the user wants a specific setting.
If you're taking a series of images (for example, to stitch them together for
@@ -240,20 +241,17 @@ autoexposure or white balance cancellation can be done by calling
There are both C++ and QML examples available.
C++ Examples:
\list
\li \l Camera
\endlist
\section2 C++ Examples
QML Examples:
\list
\li \l declarative-camera
\li \l qmlvideofx
\endlist
\annotatedlist camera_examples
\section2 QML Examples
\annotatedlist camera_examples_qml
\section1 Reference Documentation
\section2 Camera Classes
\section2 C++ Classes
\annotatedlist multimedia_camera

View File

@@ -28,24 +28,24 @@
/*!
\page changes.html
\title Changes in QtMultimedia
\brief A description of changes in this version of QtMultimedia
\title Changes in Qt Multimedia
\brief A description of changes in this version of Qt Multimedia
The QtMultimedia module in Qt 5 is a combination of the QtMultimedia module
in Qt 4.x and the QtMultimediaKit module of QtMobility. It replaces both
of these modules by combining the code. If you've previously used QtMultimedia
The Qt Multimedia module in Qt 5 is a combination of the Qt Multimedia module
in Qt 4.x and the Qt Multimedia Kit module of Qt Mobility. It replaces both
of these modules by combining the code. If you've previously used Qt Multimedia
there are not too many changes required for existing code, but there are some
larger changes required for porting code that used QtMultimediaKit (most notably
the namespace and header file prefix has changed, and the QMake pro file changes
needed to enable QtMultimedia).
larger changes required for porting code that used Qt Multimedia Kit (most notably
the namespace and header file prefix has changed, and the qmake pro file changes
needed to enable Qt Multimedia).
One other change of note is that widget related classes (like \l QVideoWidget)
are now in a new library (QtMultimediaWidgets).
are now in a new library (Qt Multimedia Widgets).
\section1 New features in 5.0
There are a number of new features in QtMultimedia 5.0:
There are a number of new features in Qt Multimedia 5.0:
\list
\li Expanded QML API
\li New \l QAudioRecorder class
@@ -60,7 +60,7 @@ There are a number of new features in QtMultimedia 5.0:
\section1 Removed features
A number of classes or features previously offered in QtMultimedia or QtMultimediaKit have
A number of classes or features previously offered in Qt Multimedia or Qt Multimedia Kit have
been removed.
\table 70%
@@ -75,7 +75,7 @@ been removed.
\section1 Changed features
A number of classes previously offered in QtMultimedia or QtMultimediaKit have
A number of classes previously offered in Qt Multimedia or Qt Multimedia Kit have
changed in ways that may affect previously written code. There may be other
changes (like new features) that will not affect previously written code, and
they are documented elsewhere.
@@ -85,7 +85,7 @@ they are documented elsewhere.
\li Changed feature
\li Notes
\row
\li QMake .pro file changes
\li qmake .pro file changes
\li If you've used QtMultimediaKit in the past, you needed to put
\code
CONFIG += mobility
@@ -102,25 +102,25 @@ they are documented elsewhere.
if you need to use the widget classes.
\row
\li Namespace changes
\li For QtMultimediaKit the majority of the classes were in the
\li For Qt Multimedia Kit the majority of the classes were in the
normal Qt namespace (usually nothing, unless built specially). There
was a QtMultimediaKit namespace for several enumerations. This namespace
has now changed to QtMultimedia, so if you've used one of the
was a Qt Multimedia Kit namespace for several enumerations. This namespace
has now changed to Qt Multimedia, so if you've used one of the
\c SupportEstimate, \c EncodingQuality, \c EncodingMode or \c AvailabilityError
enumerations you'll need to change your code. In fact, running a global
search and replace on QtMultimediaKit (to replace it with QtMultimedia) will
search and replace on \c QtMultimediaKit (to replace it with \c QtMultimedia) will
go a long way with porting your code.
\row
\li Meta-data enumeration changes
\li In QtMultimediaKit the available meta-data keys were in an enumeration
in the QtMultimediaKit namespace. These meta-data keys have been changed
to string literals in the QtMultimedia::MetaData namespace - generally your
\li In Qt Multimedia Kit the available meta-data keys were in an enumeration
in the \c QtMultimediaKit namespace. These meta-data keys have been changed
to string literals in the \c {QtMultimedia::MetaData} namespace - generally your
source code will mostly be compatible unless you have created variables or
parameters with the QtMultimedia::MetaData type - you should replace these
with QStrings.
parameters with the \c {QtMultimedia::MetaData} type - you should replace these
with \c QString.
\row
\li Meta-data method changes
\li In QtMultimediaKit the available meta-data was split between methods to
\li In Qt Multimedia Kit the available meta-data was split between methods to
access standard, pre-defined keys, and methods to access extensible free
form key meta-data. These have been combined into a single method to
access meta-data given a string key, and a list of pre-defined keys. If
@@ -128,10 +128,10 @@ they are documented elsewhere.
to change your code to combine the standard and extended metadata methods.
\row
\li Qt Metatype registration
\li In QtMultimedia 5.0 we've tried to make sure that we register any classes
\li In Qt Multimedia 5.0 we've tried to make sure that we register any classes
or types that would be useful to use in cross process signals or in
QVariants. If you've previously added Q_DECLARE_METATYPE macros for any
QtMultimedia class you will probably need to remove them.
Qt Multimedia class you will probably need to remove them.
\row
\li Video QML element
\li If you've previously used the Video QML element you may be excited
@@ -140,7 +140,7 @@ they are documented elsewhere.
together for more flexible and advanced use cases.
\row
\li QSoundEffect
\li The SoundEffect QML element was public and accessible in QtMultimedaKit,
\li The SoundEffect QML element was public and accessible in Qt Multimeda Kit,
and now the C++ version is also available. If you managed to use the
private class previously, you'll need to update your code.
\row

View File

@@ -28,7 +28,8 @@
/*!
\example audiodevices
\title Audio Devices Example
\ingroup audio_examples
\brief The Audio Devices example shows the application of the audio devices APIs
This example shows how to create a simple application to list and test

View File

@@ -28,7 +28,8 @@
/*!
\example audioinput
\title Audio Input Example
\ingroup audio_examples
\brief The Audio Input Example shows the use of the QAudioInput class.
*/

View File

@@ -28,7 +28,8 @@
/*!
\example audiooutput
\title Audio Output Example
\ingroup audio_examples
\brief The Audio Output Example show the use of the QAudioOutput API.

View File

@@ -28,11 +28,11 @@
/*!
\example audiorecorder
\title Audio Recorder Example
\ingroup audio_examples
\brief The Audio Recorder Example shows how to create a simple audio recorder.
This example shows how to create a simple audio recorder using the Qt
Multimedia API.
It demonstrates the discovery of the supported devices and codecs and the use
of recording functions in the QAudioRecorder class.
We display a window for the user to select the appropriate audio input,
codec, container, and sample rate. Allow a setting of either quality or

View File

@@ -31,6 +31,7 @@
\example camera
\title Camera Example
\ingroup camera_examples
\brief The Camera Example shows how to use the API to capture a still image
or video.

View File

@@ -28,6 +28,7 @@
/*!
\example declarative-camera
\title QML Camera Example
\ingroup camera_examples_qml
\brief The Camera Example shows how to use the API to capture a still image
or video.
@@ -43,7 +44,7 @@ Camera elements being mostly found in \e {declarative-camera.qml} and
\e {CaptureControls.qml}.
In \e {declarative-camera.qml} the Camera element is initialized with an id
of \e {camera }, a photo preview is setup, states are implemented for image
of \e {camera}, a photo preview is setup, states are implemented for image
preview or capture and a CaptureControls element is initialized. The initial
\e state is \e PhotoCapture. The camera element includes a handler, \e onImageCaptured,
for the \l {imageCaptured} signal. The handler sets up the application to process

View File

@@ -28,6 +28,7 @@
/*!
\example player
\title Media Player Example
\ingroup video_examples
This example creates a simple multimedia player. We can play audio and

View File

@@ -28,6 +28,7 @@
/*!
\example video/qmlvideo
\title QML Video Example
\ingroup video_examples_qml
\brief The QML Video Example demonstrates the various manipulations (move;
resize; rotate; change aspect ratio) which can be applied to QML \l{VideoOutput}

View File

@@ -28,10 +28,12 @@
/*!
\example video/qmlvideofx
\title QML Video Shader Effects Example
\ingroup video_examples_qml
\ingroup camera_examples_qml
\brief The QML Video Shader Effects Example shows how the \l {ShaderEffect}
element can be used to apply postprocessing effects, expressed in GLSL, to QML
\l {VideoOutput} items.
element can be used to apply postprocessing effects, expressed in \c GLSL, to video
and camera viewfinder content.
\section1 Overview

View File

@@ -28,7 +28,8 @@
/*!
\example spectrum
\title Spectrum Example
\ingroup audio_examples
\brief The Spectrum Example uses a combination multimedia APIs to process microphone input.
*/

View File

@@ -0,0 +1,36 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example videographicsitem
\title Video Graphics Item Example
\ingroup video_examples
\brief This example demonstrates how to make a simple video player using the QMediaPlayer
and QVideoGraphicsItem classes in the Graphics View framework.
*/

View File

@@ -0,0 +1,36 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example videowidget
\title Video Widget Example
\ingroup video_examples
\brief This example demonstrates how to make a simple video player using the QMediaPlayer
and QVideoWidget classes
*/

View File

@@ -27,13 +27,13 @@
/*!
\page multimediaoverview.html
\title Qt Multimedia
\title Multimedia Overview
\brief A set of APIs for working with audio, video, radio and camera devices.
\ingroup technology-apis
\section1 Multimedia Overview
\section1 Overview
\section2 Features
@@ -114,12 +114,12 @@ For some quick recipes for specific tasks, look at the overviews above and consu
\li QMediaPlayer, QAbstractVideoSurface, QVideoFrame
\row
\li Listening to the radio
\li \l radio, \l declarative-radio
\li \l declarative-radio
\li \l Radio, \l RadioData
\li QRadioTuner, QRadioData
\row
\li Accessing camera viewfinder
\li \l camera, \l declarative-camera
\li \l {Camera Example}{camera}, \l declarative-camera
\li \l Camera, \l VideoOutput
\li QCamera, QVideoWidget, QGraphicsVideoItem
\row
@@ -129,22 +129,21 @@ For some quick recipes for specific tasks, look at the overviews above and consu
\li QCamera, QAbstractVideoSurface, QVideoFrame
\row
\li Capturing photos
\li \l camera, \l declarative-camera
\li \l {Camera Example}{camera}, \l declarative-camera
\li \l Camera
\li QCamera, QCameraImageCapture
\row
\li Capturing movies
\li \l camera, \l declarative-camera
\li \l {Camera Example}{camera}, \l declarative-camera
\li \l Camera
\li QCamera, QMediaRecorder
\endtable
\section1 Multimedia Limitations
\section1 Limitations
In many cases the Qt Multimedia APIs build upon the multimedia framework of the underlying system.
This can mean that support for various codec or containers can vary between machines,
depending on what the end user has installed. See \l {Multimedia Platform Support} for more
information on what frameworks are used and what this can mean.
depending on what the end user has installed.
\section1 Advanced Usage
@@ -154,8 +153,8 @@ see \l{Multimedia Backend Development}.
\section1 Changes from previous versions
If you've previously used QtMultimedia in Qt 4.x, or used QtMultimediaKit in QtMobility, please see
\l {Changes in QtMultimedia} for more information on what has changed, and what you might need to
If you've previously used Qt Multimedia in Qt 4.x, or used Qt Multimedia Kit in Qt Mobility, please see
\l {Changes in Qt Multimedia} for more information on what has changed, and what you might need to
change when porting code.
\section1 Reference Documentation

View File

@@ -28,36 +28,42 @@
/*!
\title Multimedia Backend Development
\page multimediabackend.html
\brief Information for implementing a new multimedia backend.
\ingroup mobility
\tableofcontents
\section1 Multimedia Backend Development
\section1 Overview
In some cases the available cross-platform Multimedia APIs or implementations are not sufficient,
or not immediately available on a certain platform. In some cases the multimedia
implementation on a platform might expose certain extra properties or functionality
that other platforms do not, or a finer degree of control might be possible. For these
cases, it is possible to use extended controls directly.
A multimedia backend provides the glue between platform specific libraries, and
Qt Multimedia. In some cases the available cross-platform Multimedia APIs or
implementations are not sufficient, or not immediately available on a certain
platform. Alternatively, the multimedia implementation on a platform might expose
certain extra properties or functionality that other platforms do not, or a finer
degree of control might be possible. For these cases, it is possible to use
extended controls directly.
In addition, if you plan to port the Qt Multimedia APIs to a new platform, you do
this by implementing certain control and service classes, as detailed below.
\section1 Extending the API
For the developer who wishes to extend the functionality of the Multimedia
classes there are several classes of particular importance. The default
classes are QMediaService, QMediaServiceProvider and QMediaControl.
For the developer who wishes to extend the functionality of the Qt Multimedia
classes there are several classes of particular importance. The classes
providing default functionality are QMediaService, QMediaServiceProvider and
QMediaControl.
Basically, the idea is that to use the Multimedia API you would use these
three classes or classes derived from them as follows
to extend the Multimedia API you would use the following three classes or
classes derived from them.
\list
\li \l QMediaServiceProvider is used by the top level client class to request a service. The top level class knowing what kind of service it needs.
\li \l QMediaServiceProvider is used by the top level client class to
request a service. The top level class knowing what kind of service it needs.
\li \l QMediaService provides a service and when asked by the top level object, say a component, will return a QMediaControl object.
\li \l QMediaService provides a service and when asked by the top level
object, say a component, will return a QMediaControl object.
\li \l QMediaControl allows the control of the service using a known interface.
\endlist
@@ -71,15 +77,15 @@ MyMediaService, and the MyMediaControl to manipulate the media service.
The MyPlayer object calls MyServiceProvider::requestService() to get an
instance of MyMediaService. Then the MyPlayer object calls this service
object it has just received and calling \l {QMediaService::requestControl()}{requestControl()}
it will receive the control object derived from QMediaControl. Now we have
all the parts necessary for our media application. We have the service
it will receive the control object derived from QMediaControl.
Now we have all the parts necessary for our media application. We have the service
provider, the service it provides and the control used to manipulate the
service. Since our MyPlayer object has instances of the service and its
control then it would be possible for these to be used by associated classes
that could do additional actions, perhaps with their own control since the
parameter to requestControl() is a c-type string, \e {const char *}, for the
interface.
parameter to requestControl() is a zero-terminated string, \e {const char *},
for the interface.
\section2 Adding a Media Service Provider

View File

@@ -129,72 +129,26 @@
\li Signal
\li Description
\row
\li \l{Audio::onStarted}{onStarted}
\li Called when playback has been started.
\li \l{Audio::playing}{playing}
\li Called when playback is started, or when resumed from paused state.
\row
\li \l{Audio::onResumed}{onResumed}
\li Called when playback is resumed from the paused state.
\row
\li \l{Audio::onPaused}{onPaused}
\li \l{Audio::paused}{paused}
\li Called when playback is paused.
\row
\li \l{Audio::onStopped}{onStopped}
\li \l{Audio::stopped}{stopped}
\li Called when playback is stopped.
\row
\li \l{Audio::onError}{onError}
\li \l{Audio::error}{error}
\li Called when the specified error occurs.
\endtable
\section2 Camera
The \l Camera element in the plugin enables still image capture using
QML. The element has methods for starting and stopping the camera, capturing
the image, camera settings and many signals indicating critical events.
The follow code is taken from the \l {QML Camera Example}. This snippet
shows the setting up of the \l Camera element
\qml
Camera {
id: camera
x : 0
y : 0
width : 640
height : 480
focus : visible //to receive focus and capture key events
//captureResolution : "640x480"
flashMode: stillControls.flashMode
whiteBalanceMode: stillControls.whiteBalance
exposureCompensation: stillControls.exposureCompensation
onImageCaptured : {
photoPreview.source = preview
stillControls.previewAvailable = true
cameraUI.state = "PhotoPreview"
}
}
\endqml
Notice that the slot for the \l {Camera::imageCaptured()}{imageCaptured()}
signal is implemented in \e onImageCaptured. However, this code only
changes some state information to allow previewing.
The capture call itself is part of the implementation of the button
that the user presses to take the image. It uses a call to
\l {Camera::captureImage()}{captureImage()}:
\qml
CameraButton {
text: "Capture"
onClicked: camera.captureImage()
}
\endqml
The \l Camera element enables still image and video capture using
QML. The element has a number of properties that help setting it up.
The details of using the Camera element are described in further details
in the \l {Camera Overview} and in the corresponding reference documentation.
\section2 Video
@@ -258,31 +212,6 @@
For a complete description of this element, see \l SoundEffect
\section2 Camera
Adding access to the camera viewfinder, and capturing images is possible by using the \l Camera element. You can adjust capture settings
including white balance, exposure compensation and flash mode, and control zoom.
\qml
import QtQuick 2.0
import QtMultimedia 5.0
Camera {
focus : visible // to receive focus and capture key events when visible
flashMode: Camera.FlashRedEyeReduction
whiteBalanceMode: Camera.WhiteBalanceFlash
exposureCompensation: -1.0
onImageCaptured : {
photoPreview.source = preview // Show the preview in an Image element
}
}
\endqml
For a complete description of this element, see \l Camera, and look at the \l {declarative-camera}{QML Camera Example}.
\section1 Multimedia QML Elements
\annotatedlist multimedia_qml

View File

@@ -27,8 +27,8 @@
/*!
\qmlmodule QtMultimedia 5
\title QtMultimedia 5.0
\brief The QML import for QtMultimedia
\title QML import for multimedia
\brief The import for the QML elements in the Qt Multimedia module
\section1 Overview

View File

@@ -78,15 +78,12 @@ current frequency inside the band.
\section1 Reference documentation
\section2 Radio C++ Classes
\section2 C++ Classes
\annotatedlist multimedia_radio
\section2 QML Elements
\list
\li \l Radio
\li \l RadioData
\endlist
\annotatedlist multimedia_radio_qml
*/

View File

@@ -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()

View File

@@ -57,7 +57,7 @@ And an example with QGraphicsVideoItem:
You can use the \l VideoOutput QML element to render content that is
provided by either a \l MediaPlayer element or a \l Camera element.
The VideoOutput element is a visual element that can be transformed
or acted upon by shaders (as the \l {qmlvideofx} example shows), while
or acted upon by shaders (as the \l {QML Video Shader Effects Example} shows), while
all media decoding and playback control is handled by the MediaPlayer
element.
@@ -76,7 +76,16 @@ The \l QVideoFrame class encapsulates a video frame and allows the
contents to be mapped into system memory for manipulation or
processing, while deriving a class from \l QAbstractVideoSurface
allows you to receive these frames from \l QMediaPlayer and
\l QCamera. Several of the built in Qt classes offer this functionality
\l QCamera.
\snippet doc/src/snippets/multimedia-snippets/video.cpp Derived Surface
and with an instance of this surface, \c myVideoSurface, you can set
the surface as the \l {QMediaPlayer::setVideoOutput()}{video output} for QMediaPlayer.
\snippet doc/src/snippets/multimedia-snippets/video.cpp Setting surface in player
Several of the built in Qt classes offer this functionality
as well, so if you decode video in your application, you can present
it to classes that offer a \l QVideoRendererControl class, and in QML
you can set a custom object for the source of the \l VideoOutput element
@@ -85,6 +94,12 @@ set it's internal video surface to) or a readable \c mediaObject property
with a QMediaObject derived class that implements the \l QVideoRendererControl
interface.
The following snippet shows a class that has a writable \c videoSurface property
and receives frames through a public slot \c onNewVideoContentReceived(). These
frames are then presented on the surface set in \c setVideoSurface().
\snippet doc/src/snippets/multimedia-snippets/video.cpp Video producer
\section2 Recording video
You can use the \l QMediaRecorder class in conjunction with other
classes to record video to disk. Primarily this is used with
@@ -108,31 +123,22 @@ Here's an example of installing a video probe while recording the camera:
There are both C++ and QML examples available.
C++ Examples:
\list
\li \l video
\li \l videographicsitem
\li \l videowidget
\endlist
\section2 C++ Examples
QML Examples:
\list
\li \l qmlvideo
\li \l qmlvideofx
\endlist
\annotatedlist video_examples
\section2 QML Examples
\annotatedlist video_examples_qml
\section1 Reference Documentation
\section2 Video Classes
\section2 C++ Classes
\annotatedlist multimedia_video
\section2 QML Elements
\list
\li \l MediaPlayer
\li \l VideoOutput
\li \l Video
\endlist
\annotatedlist multimedia_video_qml
*/