The QCameraImageCapture class is used for the recording of media content. More...
#include <QCameraImageCapture>
Inherits: QObject and QMediaBindableInterface.
This class was introduced in Qt Mobility 1.1.
enum | CaptureDestination { CaptureToFile, CaptureToBuffer } |
flags | CaptureDestinations |
enum | DriveMode { SingleImageCapture } |
enum | Error { NoError, NotReadyError, ResourceError, NotSupportedFeatureError, FormatError, OutOfSpaceError } |
QCameraImageCapture ( QMediaObject * mediaObject, QObject * parent = 0 ) | |
~QCameraImageCapture () | |
QtMultimediaKit::AvailabilityError | availabilityError () const |
QVideoFrame::PixelFormat | bufferFormat () const |
CaptureDestinations | captureDestination () const |
QImageEncoderSettings | encodingSettings () const |
Error | error () const |
QString | errorString () const |
QString | imageCodecDescription ( const QString & codec ) const |
bool | isAvailable () const |
bool | isCaptureDestinationSupported ( CaptureDestinations destination ) const |
bool | isReadyForCapture () const |
void | setBufferFormat ( QVideoFrame::PixelFormat format ) |
void | setCaptureDestination ( CaptureDestinations destination ) |
void | setEncodingSettings ( const QImageEncoderSettings & settings ) |
QList<QVideoFrame::PixelFormat> | supportedBufferFormats () const |
QStringList | supportedImageCodecs () const |
QList<QSize> | supportedResolutions ( const QImageEncoderSettings & settings = QImageEncoderSettings(), bool * continuous = 0 ) const |
virtual QMediaObject * | mediaObject () const |
void | cancelCapture () |
int | capture ( const QString & file = QString() ) |
void | bufferFormatChanged ( QVideoFrame::PixelFormat format ) |
void | captureDestinationChanged ( QCameraImageCapture::CaptureDestinations destination ) |
void | error ( int id, QCameraImageCapture::Error error, const QString & errorString ) |
void | imageAvailable ( int id, const QVideoFrame & buffer ) |
void | imageCaptured ( int id, const QImage & preview ) |
void | imageExposed ( int id ) |
void | imageMetadataAvailable ( int id, QtMultimediaKit::MetaData key, const QVariant & value ) |
void | imageMetadataAvailable ( int id, const QString & key, const QVariant & value ) |
void | imageSaved ( int id, const QString & fileName ) |
void | readyForCaptureChanged ( bool ready ) |
virtual bool | setMediaObject ( QMediaObject * mediaObject ) |
The QCameraImageCapture class is used for the recording of media content.
The QCameraImageCapture class is a high level images recording class. It's not intended to be used alone but for accessing the media recording functions of other media objects, like QCamera.
camera = new QCamera; viewfinder = new QCameraViewfinder(); viewfinder->show(); camera->setViewfinder(viewfinder); recorder = new QMediaRecorder(camera); imageCapture = new QCameraImageCapture(camera); camera->setCaptureMode(QCamera::CaptureStillImage); camera->start(); //on half pressed shutter button camera->searchAndLock(); //on shutter button pressed imageCapture->capture(); //on shutter button released camera->unlock();
See also QCamera.
The CaptureDestinations type is a typedef for QFlags<CaptureDestination>. It stores an OR combination of CaptureDestination values.
Constant | Value | Description |
---|---|---|
QCameraImageCapture::SingleImageCapture | 0 | Drive mode is capturing a single picture. |
Constant | Value | Description |
---|---|---|
QCameraImageCapture::NoError | 0 | No Errors. |
QCameraImageCapture::NotReadyError | 1 | The service is not ready for capture yet. |
QCameraImageCapture::ResourceError | 2 | Device is not ready or not available. |
QCameraImageCapture::NotSupportedFeatureError | 4 | Device does not support stillimages capture. |
QCameraImageCapture::FormatError | 5 | Current format is not supported. |
QCameraImageCapture::OutOfSpaceError | 3 | No space left on device. |
Indicates the service is ready to capture a an image immediately.
This property was introduced in Qt Mobility 1.1.
Access functions:
bool | isReadyForCapture () const |
Notifier signal:
void | readyForCaptureChanged ( bool ready ) |
Constructs a media recorder which records the media produced by mediaObject.
The parent is passed to QMediaObject.
Destroys images capture object.
Returns the availability error code.
This function was introduced in Qt Mobility 1.1.
Returns the buffer image capture format being used.
This function was introduced in Qt Mobility 1.2.
See also setBufferFormat(), supportedBufferCaptureFormats(), and setBufferCaptureFormat().
Signal emitted when the buffer format for the buffer image capture has changed.
This function was introduced in Qt Mobility 1.2.
Cancel incomplete capture requests. Already captured and queused for proicessing images may be discarded.
This function was introduced in Qt Mobility 1.1.
Capture the image and save it to file. This operation is asynchronous in majority of cases, followed by signals QCameraImageCapture::imageCaptured(), QCameraImageCapture::imageSaved() or QCameraImageCapture::error().
If an empty file is passed, the camera backend choses the default location and naming scheme for photos on the system, if only file name without full path is specified, the image will be saved to the default directory, with a full path reported with imageCaptured() and imageSaved() signals.
QCameraImageCapture::capture returns the capture Id parameter, used with imageExposed(), imageCaptured() and imageSaved() signals.
This function was introduced in Qt Mobility 1.1.
Returns the image capture destination being used.
This function was introduced in Qt Mobility 1.2.
See also isCaptureDestinationSupported() and setCaptureDestination().
Signal emitted when the capture destination has changed.
This function was introduced in Qt Mobility 1.2.
Returns the image encoder settings being used.
This function was introduced in Qt Mobility 1.1.
See also setEncodingSettings().
Returns the current error state.
This function was introduced in Qt Mobility 1.1.
See also errorString().
Signals that the capture request id has failed with an error and errorString description.
This function was introduced in Qt Mobility 1.1.
Returns a string describing the current error state.
This function was introduced in Qt Mobility 1.1.
See also error().
Signal emitted when the frame with request id is available as buffer.
This function was introduced in Qt Mobility 1.2.
Signal emitted when the frame with request id was captured, but not processed and saved yet. Frame preview can be displayed to user.
This function was introduced in Qt Mobility 1.1.
Returns a description of an image codec.
This function was introduced in Qt Mobility 1.1.
Signal emitted when the frame with request id was exposed.
This function was introduced in Qt Mobility 1.1.
Signals that a metadata for an image with request id is available. This signal is emitted for metadata value with a key listed in QtMultimediaKit::MetaData enum.
This signal is emitted between imageExposed and imageSaved signals.
This function was introduced in Qt Mobility 1.2.
Signals that a metadata for an image with request id is available. This signal is emitted for extended metadata value with a key not listed in QtMultimediaKit::MetaData enum.
This signal is emitted between imageExposed and imageSaved signals.
This function was introduced in Qt Mobility 1.2.
Signal emitted when the frame with request id was saved to fileName.
This function was introduced in Qt Mobility 1.1.
Returns true if the images capture service ready to use.
This function was introduced in Qt Mobility 1.1.
Returns true if the image capture destination is supported; otherwise returns false.
This function was introduced in Qt Mobility 1.2.
See also captureDestination() and setCaptureDestination().
Reimplemented from QMediaBindableInterface::mediaObject().
This function was introduced in Qt Mobility 1.1.
See also setMediaObject().
Signals that a camera's ready for capture state has changed.
This function was introduced in Qt Mobility 1.1.
See also bufferFormat().
Sets the capture destination to be used.
This function was introduced in Qt Mobility 1.2.
See also isCaptureDestinationSupported() and captureDestination().
Sets the image encoding settings.
If some parameters are not specified, or null settings are passed, the encoder choose the default encoding parameters.
This function was introduced in Qt Mobility 1.1.
See also encodingSettings().
Reimplemented from QMediaBindableInterface::setMediaObject().
This function was introduced in Qt Mobility 1.1.
See also mediaObject().
Returns the list of supported buffer image capture formats.
This function was introduced in Qt Mobility 1.1.
See also bufferFormat() and setBufferFormat().
Returns a list of supported image codecs.
This function was introduced in Qt Mobility 1.1.
Returns a list of resolutions images can be encoded at.
If non null image settings parameter is passed, the returned list is reduced to resolution supported with partial settings like image codec or quality applied.
If the encoder supports arbitrary resolutions within the supported range, *continuous is set to true, otherwise *continuous is set to false.
This function was introduced in Qt Mobility 1.1.
See also QImageEncoderSettings::resolution().
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.