diff options
author | Venugopal Shivashankar <venugopal.shivashankar@nokia.com> | 2012-07-19 15:44:36 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-25 15:00:59 +0200 |
commit | f930e088fca4150ed61b1bfca0ec2ad139743a67 (patch) | |
tree | c3b709c0bbb8236e7ab8daea59ff82abb2d591bd /src/multimedia/doc/src/examples | |
parent | ef144b647f82634eec4d96bb141d1a46044cbd77 (diff) |
Moved doc under src to fall in-line with the new modular structure
Change-Id: Ia2933baa1f0eaf82b5c2a626cb3661ee087049e3
Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
Diffstat (limited to 'src/multimedia/doc/src/examples')
-rw-r--r-- | src/multimedia/doc/src/examples/audiodevices.qdoc | 43 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/audioengine.qdoc | 39 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/audioinput.qdoc | 36 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/audiooutput.qdoc | 38 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/audiorecorder.qdoc | 104 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/camera.qdoc | 80 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/declarative-camera.qdoc | 69 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/declarative-radio.qdoc | 35 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/player.qdoc | 96 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/qmlvideo.qdoc | 148 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/qmlvideofx.qdoc | 223 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/spectrum.qdoc | 36 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc | 43 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/videographicsitem.qdoc | 36 | ||||
-rw-r--r-- | src/multimedia/doc/src/examples/videowidget.qdoc | 36 |
15 files changed, 1062 insertions, 0 deletions
diff --git a/src/multimedia/doc/src/examples/audiodevices.qdoc b/src/multimedia/doc/src/examples/audiodevices.qdoc new file mode 100644 index 000000000..1b2885450 --- /dev/null +++ b/src/multimedia/doc/src/examples/audiodevices.qdoc @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** 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 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 + the configuration for the various audio devices available on the device + or machine. This is done using the QtMobility Multimedia API. + + \image audiodevices.png + +*/ + + diff --git a/src/multimedia/doc/src/examples/audioengine.qdoc b/src/multimedia/doc/src/examples/audioengine.qdoc new file mode 100644 index 000000000..24067cf65 --- /dev/null +++ b/src/multimedia/doc/src/examples/audioengine.qdoc @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** 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 audioengine + \title AudioEngine Example + \ingroup audioengine_examples + \brief The Audio Engine example demonstrates 3D sound control using + the QtAudioEngine API. + + \image audioengine.png + +*/ + + diff --git a/src/multimedia/doc/src/examples/audioinput.qdoc b/src/multimedia/doc/src/examples/audioinput.qdoc new file mode 100644 index 000000000..9a0ec5ee4 --- /dev/null +++ b/src/multimedia/doc/src/examples/audioinput.qdoc @@ -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 audioinput + \title Audio Input Example + \ingroup audio_examples + \brief The Audio Input Example shows the use of the QAudioInput class. + +*/ + + diff --git a/src/multimedia/doc/src/examples/audiooutput.qdoc b/src/multimedia/doc/src/examples/audiooutput.qdoc new file mode 100644 index 000000000..988d489c5 --- /dev/null +++ b/src/multimedia/doc/src/examples/audiooutput.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** 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 audiooutput + \title Audio Output Example + \ingroup audio_examples + \brief The Audio Output Example show the use of the QAudioOutput API. + + + +*/ + + diff --git a/src/multimedia/doc/src/examples/audiorecorder.qdoc b/src/multimedia/doc/src/examples/audiorecorder.qdoc new file mode 100644 index 000000000..25fe07973 --- /dev/null +++ b/src/multimedia/doc/src/examples/audiorecorder.qdoc @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** 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 audiorecorder + \title Audio Recorder Example + \ingroup audio_examples + \brief The Audio Recorder Example shows how to create a simple audio recorder. + + 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 + bitrate. Finally, the output file can be selected and recording can be + started. + + The lists are setup using the \l{QAudioRecorder::audioInputs()}{audioInputs()}, + \l{QAudioRecorder::supportedAudioCodecs()}{supportedAudioCodecs()}, + \l{QAudioRecorder::supportedContainers()}{supportedContainers()}, + \l{QAudioRecorder::supportedContainers()}{supportedContainers()}, and + \l{QAudioRecorder::supportedAudioSampleRates()}{supportedAudioSampleRates()} + methods. The quality slider is setup from 0 (zero) to + \l{QtMultimedia::VeryHighQuality} with a default value of + \l{QtMultimedia::NormalQuality}, while the bitrates are hardcoded + into the list. + + \image audiorecorder.png + + To record audio we simply create a QAudioRecorder object. + + \code + audioRecorder = new QAudioRecorder(this); + \endcode + + And setup the lists as described above. The text on the record and pause + buttons are toggled depending on the \l{QMediaRecorder::State}{state} of + the \c audioRecorder object. This means that if the state is + \l{QMediaRecorder::StoppedState} then the button text will be "Record" and + "Pause". In \l{QMediaRecorder::RecordingState} the record button will have + the text "Stop", and in \l{QMediaRecorder::PausedState} the pause button + will have the text "Resume". + + Pressing the buttons will also result in a toggle based on the state. If + recording is stopped, then pressing the record button will setup the + \l{QAudioEncoderSettings} based on the values of the selection lists, + will set the encoding settings and container on the \c audioRecorder + object, and start recording using the + \l{QMediaRecorder::record()}{record()} method. + + \code + QAudioEncoderSettings settings; + settings.setCodec(boxValue(ui->audioCodecBox).toString()); + settings.setSampleRate(boxValue(ui->sampleRateBox).toInt()); + settings.setBitRate(boxValue(ui->bitrateBox).toInt()); + settings.setQuality(QtMultimedia::EncodingQuality(ui->qualitySlider->value())); + settings.setEncodingMode(ui->constantQualityRadioButton->isChecked() ? + QtMultimedia::ConstantQualityEncoding : + QtMultimedia::ConstantBitRateEncoding); + + QString container = boxValue(ui->containerBox).toString(); + + audioRecorder->setEncodingSettings(settings, QVideoEncoderSettings(), container); + audioRecorder->record(); + \endcode + + While recording, the status bar of the application is updated with duration information + from the \l{QMediaRecorder::durationChanged()}{durationChanged} signal from the + \c audioRecorder object. + + \code + ui->statusbar->showMessage(tr("Recorded %1 sec").arg(duration / 1000)); + \endcode + + + + +*/ + + diff --git a/src/multimedia/doc/src/examples/camera.qdoc b/src/multimedia/doc/src/examples/camera.qdoc new file mode 100644 index 000000000..bce7747fb --- /dev/null +++ b/src/multimedia/doc/src/examples/camera.qdoc @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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 camera +\title Camera Example +\ingroup camera_examples +\brief The Camera Example shows how to use the API to capture a still image +or video. + + + +The Camera Example demonstrates how you can use QtMultimedia to implement +some basic Camera functionality to take still images and record video clips +with audio. + +A Camera class is created that will act as our Camera. It has a user interface, +control functions, setting values and a means of defining the location where +the image or video clip is to be saved. It will also store the image and video +settings. + +The Camera class contains an instance of \l {QCamera}, the API class interface to +the hardware. It also has an instance of \l {QCameraImageCapture} to take still images +and an instance of \l {QMediaRecorder} to record video. It also contains the user +interface object. + +The Camera constructor does some basic initialization. The camera object is +set to '0', the user interface is initialized and UI signal are connected to +slots that react to the triggering event. However, most of the work is done when +the \e{setCamera()} function is called, passing in a \l {QByteArray}. + +\e{setCamera()} sets up various connections between the user interface and the functionality +of the Camera class using signals and slots. It also instantiates and initializes the \l {QCamera}, +\l {QCameraImageCapture} and \l {QMediaRecorder} objects mentioned above. The still +and video recording visual tabs are enabled and finally the +\l {QCamera::start()}{start()} function of the \l{QCamera} object is called. + +Now that the camera is ready for user commands it waits for a suitable event. +Such an event will be the key press of either the \l {Qt::Key_CameraFocus} or +\l {Qt::Key_Camera} buttons on the application window. Camera focus will +simply display the viewfinder and lock the camera settings. Key_Camera will +either call \e{takeImage()} if the \l {QCamera::captureMode()}{captureMode()} +is QCamera::CaptureStillImage, or if the capture mode is for video then one +of two actions will occur. If the recording state shows that we are currently +recording then the \e{stop()} function is called resulting in a call to +\l {QCamera::stop()}, whereas if we are not recording then a video recording +is started with a call to \l {QMediaRecorder::record()}. + +\image camera-example.png + +*/ + + diff --git a/src/multimedia/doc/src/examples/declarative-camera.qdoc b/src/multimedia/doc/src/examples/declarative-camera.qdoc new file mode 100644 index 000000000..7219e85da --- /dev/null +++ b/src/multimedia/doc/src/examples/declarative-camera.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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 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. + +\image qml-camera.png + +This example demonstrates how to use the Qt Multimedia QML API to access +camera functions. It shows how to change settings and to capture images. + +Most of the QML code supports the user interface for this application with the +camera types being mostly found in \e {declarative-camera.qml} and +\e {CaptureControls.qml}. + +In \e {declarative-camera.qml} the \l Camera is initialized with an id +of \e {camera}, a photo preview is setup, states are implemented for image +preview or capture and \l CaptureControls is initialized. The initial +\e state is \e PhotoCapture. \l CameraCapture includes a handler, \e onImageCaptured, +for the \l {imageCaptured} signal. The handler sets up the application to process +the preview including a change in the user interface state. The \l PhotoPreview +becomes visible with any key press being picked up by the handler +in PhotoPreview and returning the state to \e PhotoCapture. + +\e CaptureControls, which is implemented in \e {CaptureControls.qml}, +generates a column on the right hand side of the screen which includes control +buttons for \e focus (not initially visible), \e {capture}, \e {flash modes}, +\e {white balance}, \e {exposure compensation}, and if a preview is +available a \e {preview} button. The last button exits from the application. + +When the Capture button is pressed the \e onClicked handler calls +\l {Camera::captureImage()}{captureImage()} + + + + + + + +*/ diff --git a/src/multimedia/doc/src/examples/declarative-radio.qdoc b/src/multimedia/doc/src/examples/declarative-radio.qdoc new file mode 100644 index 000000000..d56379fc2 --- /dev/null +++ b/src/multimedia/doc/src/examples/declarative-radio.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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 declarative-radio + \title Declarative Radio Example + + +*/ + + diff --git a/src/multimedia/doc/src/examples/player.qdoc b/src/multimedia/doc/src/examples/player.qdoc new file mode 100644 index 000000000..b35a74c97 --- /dev/null +++ b/src/multimedia/doc/src/examples/player.qdoc @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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 player + \title Media Player Example + \ingroup video_examples + + + This example creates a simple multimedia player. We can play audio and + or video files using various codecs. + + The example uses a QMediaPlayer object passed into a QVideoWidget to + control the video output. To give the application playlist capability + we also use a QPlayList object. + + To activate the various functions such as play and stop on the dialog + we connect clicked() signals to slots that emit the play() and stop() + signals and in turn which we connect to the play() and stop() slots in + QMediaPlayer. + + \code + connect(controls, SIGNAL(play()), player, SLOT(play())); + connect(controls, SIGNAL(pause()), player, SLOT(pause())); + connect(controls, SIGNAL(stop()), player, SLOT(stop())); + \endcode + + We can get the volume (and set our user interface representation) + + \code + controls->setVolume(player->volume()); + \endcode + + and we can make widget 'volume' changes change the volume + + \code + connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); + \endcode + + The example also allows us to change various video properties by means + of the QVideoWidget object. We can go to Full Screen mode with a single + button click, and back again. Or if we press the "Color Options" dialog + button we can have access to more subtle influences. The dialog has a + set of sliders so that we can change the brightness, contrast, hue and + saturation of the video being watched. The connect() statements are in + pairs so that changes to either the user interface widget (the relevant + slider) or the QVideoWidget object will update the other object. + + \code + connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget, + SLOT(setBrightness(int))); + connect(videoWidget, SIGNAL(brightnessChanged(int)), + brightnessSlider, SLOT(setValue(int))); + + connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget, + SLOT(setContrast(int))); + connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider, + SLOT(setValue(int))); + + connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget, + SLOT(setHue(int))); + connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider, + SLOT(setValue(int))); + + connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget, + SLOT(setSaturation(int))); + connect(videoWidget, SIGNAL(saturationChanged(int)), + saturationSlider, SLOT(setValue(int))); + \endcode + +*/ + diff --git a/src/multimedia/doc/src/examples/qmlvideo.qdoc b/src/multimedia/doc/src/examples/qmlvideo.qdoc new file mode 100644 index 000000000..47afeb905 --- /dev/null +++ b/src/multimedia/doc/src/examples/qmlvideo.qdoc @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** 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 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} +items. + +\section1 Overview + +This example demonstrates the various manipulations (move; resize; rotate; +change aspect ratio) which can be applied to QML \l{VideoOutput} items. + +It also shows how native code can be combined with QML to implement more +advanced functionality - in this case, C++ code is used to calculate the QML +frame rate. This value is rendered in QML in a semi-transparent item +overlaid on the video content. + +The following image shows the application executing the video-overlay scene, +which creates a dummy overlay item (just a semi-transparent \l{Rectangle}), +which moves across the \l{VideoOutput} item. + +\image qmlvideo-overlay.png + +\section1 Application structure + +The \l{video/qmlvideo/qml/qmlvideo/main.qml} file creates a UI which includes +the following items: + +\list + \li Two \l{video/qmlvideo/qml/qmlvideo/Button.qml}{Button} instances, each + of which displays a filename, and can be used to launch a + \l{video/qmlvideo/qml/qmlvideo/FileBrowser.qml}{FileBrowser} + \li An exit \l{video/qmlvideo/qml/qmlvideo/Button.qml}{Button} + \li A \l{video/qmlvideo/qml/qmlvideo/SceneSelectionPanel.qml}{SceneSelectionPanel}, + which is a flickable list displaying the available scenes + \li At the lower left, an item which displays the QML repainting rate - the + upper number is the instantaneous frame rate and the lower number is the + average over the past second. +\endlist + +\image qmlvideo-menu.png + +Each scene in the flickable list is implemented in its own QML file - for +example the video-basic scene (which just displays a static \l{VideoOutput} +in the center of the screen) is implemented in the +\l{video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic.qml} file. As you +can see from the code, this makes use of a type of inheritance: a +\l{video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic} item ... + +\quotefromfile video/qmlvideo/qml/qmlvideo/VideoBasic.qml +\skipto import +\printuntil /^\}/ + +... is-a +\l{video/qmlvideo/qml/qmlvideo/SceneBasic.qml}{SceneBasic} ... + +\quotefromfile examples/video/qmlvideo/qml/qmlvideo/SceneBasic.qml +\skipto import +\printuntil contentType +\dots +\skipto Content +\printuntil content +\dots +\skipto } +\printuntil /^\}/ + +... which is-a +\l{video/qmlvideo/qml/qmlvideo/Scene.qml}{Scene}: + +\quotefromfile video/qmlvideo/qml/qmlvideo/Scene.qml +\skipto import +\printuntil root +\dots +\skipto property QtObject content +\printuntil content +\dots +\skipto Button +\printuntil /^\}/ + +\l{video/qmlvideo/qml/qmlvideo/SceneBasic.qml}{SceneBasic} describes the +structure and behaviour of the scene, but is agnostic of the type of content +which will be displayed - this is abstracted by +\l{video/qmlvideo/qml/qmlvideo/Content.qml}{Content}. + +This pattern allows us to define a particular use case (in this case, simply +display a static piece of content), and then instantiate that use case for +both video content +(\l{video/qmlvideo/qml/qmlvideo/VideoBasic.qml}{VideoBasic}) and cameracontent +(\l{video/qmlvideo/qml/qmlvideo/CameraBasic.qml}{CameraBasic}). This approach +is used to implement many of the other scenes - for example, "repeatedly slide +the content from left to right and back again" is implemented by +\l{video/qmlvideo/qml/qmlvideo/SceneMove.qml}{SceneMove}, on which +\l{video/qmlvideo/qml/qmlvideo/VideoMove.qml}{VideoMove} and +\l{video/qmlvideo/qml/qmlvideo/CameraMove.qml}{CameraMove} are based. + +Depending on the value of the contentType property in the top-level scene +instance, the embedded +\l{video/qmlvideo/qml/qmlvideo/Content.qml}{Content} item creates either a +\l{MediaPlayer} or a \l{Camera} item. + +\section1 Calculating and displaying QML painting rate + +\input examples/video-qml-paint-rate.qdocinc + +All that remains is to connect the afterRendering() signal of the QQuickView +object to a JavaScript function, which will eventually call frequencyItem.notify(): + +\quotefromfile video/qmlvideo/main.cpp +\skipto QmlApplicationViewer +\printuntil ; +\dots +\skipto QQuickItem +\printuntil ; +\dots +\skipto QObject::connect +\printuntil SLOT(qmlFramePainted())); + +*/ + diff --git a/src/multimedia/doc/src/examples/qmlvideofx.qdoc b/src/multimedia/doc/src/examples/qmlvideofx.qdoc new file mode 100644 index 000000000..da713f36b --- /dev/null +++ b/src/multimedia/doc/src/examples/qmlvideofx.qdoc @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** 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 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 \l {ShaderEffect} +can be used to apply postprocessing effects, expressed in \c GLSL, to video +and camera viewfinder content. + +\section1 Overview + +This example shows how a \l {ShaderEffectItem} can be used to apply +postprocessing effects, expressed in GLSL, to QML \l {VideoOutput} items. + +It also shows how native code can be combined with QML to implement more +advanced functionality - in this case, C++ code is used to calculate the QML +frame rate. This value is rendered in QML in a semi-transparent item +overlaid on the video content. + +Finally, this application demonstrates the use of different top-level QML +files to handle different physical screen sizes. On small-screen devices, +menus are by default hidden, and only appear when summoned by a gesture. +Large-screen devices show a more traditional layout in which menus are +displayed around the video content pane. + +The following screenshots show shader effects being applied. In each case, +the effect is implemented using a fragment shader. + +Here we see an edge detection algorithm being applied to a video clip +(\l{http://orange.blender.org/}{Elephant's Dream from blender.org}). +\image qmlvideofx-video-edgedetection.png + +This image shows a page curl effect, applied to the same video clip. +\image qmlvideofx-video-pagecurl.png + +Here we see a 'glow' effect (edge detection plus colour quantization) being +applied to the camera viewfinder. +\image qmlvideofx-camera-glow.png + +This image shows a 'lens magnification' effect applied to the viewfinder. +\image qmlvideofx-camera-magnify.png + +The application includes many more effects than the ones shown here - look +for Effect*.qml files in the list above to see the full range. + +\section1 Application structure + +Shader effects can be applied to video or viewfinder content using +\l{ShaderEffectItem}, as shown in the following example, which applies +a wiggly effect to the content: + +\code +import QtQuick 2.0 +import QtMultimedia 5.0 + +Rectangle { + width: 300 + height: 300 + color: "black" + + MediaPlayer { + id: mediaPlayer + source: "test.mp4" + playing: true + } + + VideoOutput { + id: video + anchors.fill: parent + source: mediaPlayer + } + + ShaderEffect { + property variant source: ShaderEffectSource { sourceItem: video; hideSource: true } + property real wiggleAmount: 0.005 + anchors.fill: video + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform sampler2D source; + uniform highp float wiggleAmount; + void main(void) + { + highp vec2 wiggledTexCoord = qt_TexCoord0; + wiggledTexCoord.s += sin(4.0 * 3.141592653589 * wiggledTexCoord.t) * wiggleAmount; + gl_FragColor = texture2D(source, wiggledTexCoord.st); + } + " + } +} +\endcode + +In this application, the usage of the \l{ShaderEffect} and \l{VideoOutput} +types is a bit more complicated, for the following reasons: + +\list + \li Each effect can be applied to either a \l{VideoOutput} or an + \l{Image} item, so the type of the source item must be abstracted away + from the effect implementation + \li For some effects (such as the edge detection and glow examples shown in + the screenshots above), the transformation is applied only to pixels to + the left of a dividing line - this allows the effect to be easily + compared with the untransformed image on the right + \li Most effects have one or more parameters which can be modified by the + user - these are controlled by sliders in the UI which are connected + to uniform values passed into the GLSL code +\endlist + +The abstraction of source item type is achieved by the +\l{video/qmlvideofx/qml/qmlvideofx/Content.qml}{Content}, which uses a +\l{Loader} to create either a \l{MediaPlayer}, \l{Camera} or \l{Image}: + +\quotefromfile video/qmlvideofx/qml/qmlvideofx/Content.qml +\skipto import +\printuntil { +\dots +\skipto Loader { +\printuntil } +\dots +\skipto function openImage +\printuntil "ContentImage.qml" +\skipto contentLoader.item.source +\printuntil path +\skipto } +\printuntil } +\skipto function openVideo +\printuntil "ContentVideo.qml" +\skipto contentLoader.item.mediaSource +\printuntil path +\skipto } +\printuntil } +\skipto function openCamera +\printuntil "ContentCamera.qml" +\skipto } +\printuntil } +\skipto /^\}/ +\printuntil } + +Each effect is implemented as a QML item which is based on the +\l{video/qmlvideofx/qml/qmlvideofx/Effect.qml}{Effect}, which in turn +is based on the \l{ShaderEffect}: + +\quotefromfile video/qmlvideofx/qml/qmlvideofx/Effect.qml +\skipto import +\printuntil /^\}/ + +The interface of the \l Effect allows for derived effects to specify the +number of parameters which they support (and therefore the number of sliders +which should be displayed), and whether a vertical dividing line should be drawn +between transformed and untransformed image regions. As an example, here is the +implementation of the pixelation effect. As you can see, the pixelation effect +supports one parameter (which controls the pixelation granularity), and states +that the divider should be displayed. + +\quotefromfile video/qmlvideofx/qml/qmlvideofx/EffectPixelate.qml +\skipto import +\printuntil /^\}/ + +The main.qml file shows a +\l{video/qmlvideofx/qml/qmlvideofx/FileOpen.qml}{FileOpen}, which allows +the user to select the input source and an +\l{video/qmlvideofx/qml/qmlvideofx/EffectSelectionPanel.qml}{EffectSelectionPanel} +item, which lists each of the available shader effects. As described above, a +\l{video/qmlvideofx/qml/qmlvideofx/Content.qml}{Content} item is used to load the +appropriate input and effect type. A +\l{video/qmlvideofx/qml/qmlvideofx/Divider.qml}{Divider} item draws the +vertical dividing line, which can be dragged left / right by the user. Finally, +a \l{video/qmlvideofx/qml/qmlvideofx/ParameterPanel.qml}{ParameterPanel} item +renders the sliders corresponding to each effect parameter. + +Here is the source selection menu: +\image qmlvideofx-source-menu.png + +And here is the effect selection menu: +\image qmlvideofx-effects-menu.png + +\section1 Calculating and displaying QML painting rate + +\input examples/video-qml-paint-rate.qdocinc + +All that remains is to connect the afterRendering() signal of the QQuickView +object to a JavaScript function, which will eventually call frequencyItem.notify(): + +\quotefromfile video/qmlvideofx/main.cpp +\skipto QmlApplicationViewer +\printuntil ; +\dots +\skipto QQuickItem +\printuntil ; +\dots +\skipto QObject::connect +\printuntil SLOT(qmlFramePainted())); + +*/ + diff --git a/src/multimedia/doc/src/examples/spectrum.qdoc b/src/multimedia/doc/src/examples/spectrum.qdoc new file mode 100644 index 000000000..504cccefc --- /dev/null +++ b/src/multimedia/doc/src/examples/spectrum.qdoc @@ -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 spectrum + \title Spectrum Example + \ingroup audio_examples + \brief The Spectrum Example uses a combination multimedia APIs to process microphone input. + +*/ + + diff --git a/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc b/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc new file mode 100644 index 000000000..84098e241 --- /dev/null +++ b/src/multimedia/doc/src/examples/video-qml-paint-rate.qdocinc @@ -0,0 +1,43 @@ +The QML painting rate is calculated by the FrequencyMonitor class, which +turns a stream of events (received via the notify() slot), into an +instantaneous and an averaged frequency: + +\quotefromfile video/snippets/frequencymonitor/frequencymonitor.h +\skipto class FrequencyMonitor : public QObject +\printuntil Q_OBJECT +\skipto Q_PROPERTY(qreal instantaneousFrequency +\printuntil averageFrequencyChanged) +\skipto public +\printuntil : +\dots +\skipto static void qmlRegisterType +\printuntil ; +\skipto public slots +\printuntil notify(); +\skipto }; +\printline }; + +The FrequencyMonitor class is exposed to QML like this + +\quotefromfile video/snippets/frequencymonitor/frequencymonitordeclarative.cpp +\skipto FrequencyMonitor::qmlRegisterType +\printuntil } + +and its data is displayed by defining a QML item called FrequencyItem, like this: + +\quotefromfile video/snippets/frequencymonitor/qml/frequencymonitor/FrequencyItem.qml +\skipto import FrequencyMonitor +\printuntil id: root +\dots +\skipto function notify +\printuntil id: monitor +\skipto onAverageFrequencyChanged +\printuntil { +\skipto averageFrequencyText +\printuntil /^\}/ + +The result looks like this: + +\image video-qml-paint-rate.png + + diff --git a/src/multimedia/doc/src/examples/videographicsitem.qdoc b/src/multimedia/doc/src/examples/videographicsitem.qdoc new file mode 100644 index 000000000..7bbc01ff0 --- /dev/null +++ b/src/multimedia/doc/src/examples/videographicsitem.qdoc @@ -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. + +*/ diff --git a/src/multimedia/doc/src/examples/videowidget.qdoc b/src/multimedia/doc/src/examples/videowidget.qdoc new file mode 100644 index 000000000..345fdea2b --- /dev/null +++ b/src/multimedia/doc/src/examples/videowidget.qdoc @@ -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 + +*/ |