Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
This small tutorial covers the case where you want your camera device to be accessable in Qt Extended, in particular the camera application can then make use of this plugin.
Limitations: Video capture including JPEG image capture is not yet implemented by the camera application. Controlable features (e.g brightness, saturation) is also not made use of in the application.
Please note: It is recommended to look at the implementation of the greenphone and Qvfb webcam plugins under their respective directories in $SOURCE_PATH/src/plugins/cameras/ for reference. Certain features such as video capture are not implemented.
Device cameras are implemented through a thin interface wrapper and exposed through the plugin mechanism, the API is available and documented in the qtopiavideo libraries.
The main class is QCameraDevice, it can be queried for supported interfaces allowing Previewing of camera data (e.g in a view finder ), Still Shot capture or Video capture. Implementors overide this class and provide the Interfaces that they want to for their device.
Users take this and call methods on these interfaces in an intuitive way.
Camera implementors must overide QCameraDevice and provide the interfaces they support to the user. They must then wrap it up in a plugin mechanism using QCameraDevicePlugin. The code goes in $BUILD_DIR/devices/{your_device}/src/plugins/cameras/{your_camera_name}. Please see the documentation and greenphone/qvfb plugins for reference.
Camera Devices are made queryable using the QCameraDeviceLoader class
QCameraDeviceLoader *loader = QCameraDeviceLoader::instance();
QCameraDevice* device = loader->deviceWithOrientation(QCameraDevice::BackFacing);
// or
QList<QCameraDevice*> devices = loader->allAvailableCameras();
...
Preview (or view finder data) is available using the class QCameraPreviewCapture.
QCameraPreviewCapture *preview; connect(preview, SIGNAL(frameReady(QVideoFrame)), this, SLOT(useFrame(QVideoFrame))) preview->start(...) //start preview data flow .. preview->stop(); //stop preview data flow
Still data is usually (but no neccesarily) for high resolution photos.
QCameraStillCapture *still; connect(still, SIGNAL(imageReady(...)), this, SLOT(imageReadyForUse(...))); //received image data connect(still, SIGNAL(notifyPreSnap()), this, SLOT(imageAboutToBeTaken())); //be notified just before the image is actually taken still->takeStillImage(...); //take still image
Still data can be compressed (e.g JPEG) or raw pixel format encoded (e.g RGB, YUV data) The two cases are handled as follows: For raw pixel data the complete image is returned in the signal imageReady(...) For compressed data, a flag bool complete in the imageReady() signal indicates if there is more data available. If there is more data is should be appended to the existing image data until complete is true ).
Video data must be sent as raw bitstreams without container information. Examples of are mpeg4 and h.263
QCameraVideoCapture *video; video->start(...); //start recording // ... //Use the QIODevice interface to be read video data // ... video->stop(); //stop recording
See also QCameraDevice, QtopiaCamera, QtopiaVideo, QCameraDevicePlugin, QCameraDeviceLoader, QCameraPreviewCapture, QCameraStillCapture, and QCameraVideoCapture.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |