Home · All Classes · All Functions ·

Multimedia

Warning: The camera support classes are in a technology preview state. They are in development and subject to change.

Multimedia provides a set of APIs that allow the developer to play, record and manage a collection of media content. It is dependent on the QtMultimedia API. This API is planned to replace Phonon at a later stage.

Overview

This library will require Qt 4.6.

This API delivers an easy to use interface to multimedia functions whether the developer wants to show an image, a video, record sound or play a multimedia stream.

There are several benefits from that this API brings to Qt. Firstly, the developer can now implement fundamental multimedia functions with minimal code, mostly because they are already implemented. Also there is a great deal of flexibility with the source or generated multimedia. The source file does not need to be local to the device, it could be streamed from a remote location and identified by a URL. Many different codecs are supported 'out of the box'.

The supplied examples give a good idea at the ease of use of the API. When the supporting user interface code is ignored we can see that functionality is immediately available with minimal code.

Audio

Looking at the Audio Recorder example we see that by creating a QMediaRecorder object that is initialized with a newly created QAudioCaptureSource object we can now perform all the core actions necessary to record a sound source.

To initialize the objects we create a QAudioCaptureSource object. This will have a list of available devices to choose from so that we can identify the origin of the audio data. We then use the capture source object to initialize a QMediaRecorder object

        audiosource = new QAudioCaptureSource;
        capture = new QMediaRecorder(audiosource);

The API now allows us to discover available devices and codecs as shown in the example. To actually do the recording we merely have to call the record() function, and to stop call the stop() function. Saving to a file is done simply by calling QMediaRecorder::setOutputLocation() before starting to record.

With a handful of functions and two classes we can implement a sound recording application, excluding the supporting user interface code.

Video

Support for the camera is not included in this release but will be part of a future update.

For playing and manipulating video sources the API enables us to easily implement a player application. If we examine the Player example we see that the implementation of a simple media player requires a QMediaPlayer object, which is used to initialize a QMediaPlaylist object.

        player = new QMediaPlayer;
        playlist = new QMediaPlaylist(player);

To display the playing video file we need a QVideoWidget object. However, instead of using a QVideoWidget object directly the Player example has a VideoWidget class that inherits from QVideoWidget so that functions can be added to go to full screen display, either on a double click or on a particular keypress.

Radio

QRadioTunerControl is a pure virtual base class that will be the basis for any platform specific radio device control. When the functions are implemented the developer will be able to quickly produce an application that supports the typical uses of an FM radio including tuning, volume, start, stop and various other controls.

Examples

Record a Sound Source

AudioRecorder is a demonstration of the discovery of the supported devices and codecs and the use of recording functions in the QMediaRecorder class.

Play a Media File

The Player example is a simple multimedia player. Select a video file to play, stop, pause, show in fullscreen or manipulate various image attributes using the Color Options button.

Slide Show

The Slide Show shows the use of the QMediaImageViewer and QVideoWidget classes.

Reference documentation

Main classes

QAudioCaptureSourceInterface to query and select an audio input endpoint
QAudioEncoderSettingsSet of audio encoder settings
QGraphicsVideoItemGraphics item which display video produced by a QMediaObject
QMediaContentAccess to the resources relating to a media content
QMediaImageViewerMeans of viewing image media
QMediaObjectCommon base for multimedia objects
QMediaPlayerAllows the playing of a media source
QMediaPlaylistList of media content to play
QMediaRecorderUsed for the recording of media content
QMediaResourceDescription of a media resource
QMediaStreamsControlMedia stream selection control
QMediaTimeIntervalRepresents a time interval with integer precision
QMediaTimeRangeRepresents a set of zero or more disjoint time intervals
QRadioTunerInterface to the systems analog radio device
QStillImageCaptureUsed for the recording of media content
QVideoWidgetWidget which presents video produced by a media object
QtMediaContains miscellaneous identifiers used throughout the Qt Media library

Classes for service implementers.

QAudioEncoderControlAccess to the settings of a media service that performs audio encoding
QAudioEndpointSelectorAudio endpoint selector media control
QImageEncoderControlAccess to the settings of a media service that performs image encoding
QImageProcessingControlAbstract class for controling image processing parameters, like white balance, contrast, saturation, sharpening and denoising
QMediaContainerControlAccess to the output container format of a QMediaService
QMediaControlBase interface for media service controls
QMediaPlayerControlAccess to the media playing functionality of a QMediaService
QMediaPlaylistControlAccess to the playlist functionality of a QMediaService
QMediaRecorderControlAccess to the recording functionality of a QMediaService
QMediaServiceCommon base class for media service implementations
QMediaServiceProviderHintDescribes what is required of a QMediaService
QMediaStreamsControlMedia stream selection control
QMetaDataControlAccess to the meta-data of a QMediaService's media
QRadioTunerControlAccess to the radio tuning functionality of a QMediaService
QVideoDeviceControlVideo device selector media control
QVideoEncoderControlAccess to the settings of a media service that performs video encoding
QVideoOutputControlMeans of selecting the active video output control
QVideoRendererControlControl for rendering to a video surface
QVideoWidgetControlMedia control which implements a video widget
QVideoWindowControlMedia control for rendering video to a window


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Mobility Project 1.0.0