Using
the Encoded H264 Video Frames to Capture Video
This topic describes how to use the encoded H264 video frames in
the Ecam video capture function to capture the video data.
The H264 video
encoder provides a new, high quality video data encoding format for Ecam.
Ecam allows the device to capture video frames which are encoded in the H264
format. The Ecam video capture function supports the H264 video capture format
by default. You can select the H264 video capture format when preparing video
capture.
-
Call the
CCamera::CCameraVideoCaptureControl::NewL(CCamera
&,MCaptureVideoObserver &)
function to create an object
that maps the exported call to an internal object of the
MCameraVideoCaptureControl
function.
-
Pass a handle to the
MCameraVideoCaptureControl
function.
This implementation creates a handle to the
CCamera::CCameraVideoCaptureControl
object
by the active
CCamera
during the construction phase.
The
CCameraVideoCaptureControl
object makes an internal
call to the
CCamera::CustomInterface(TUid)
function of
the active
CCamera
implementation. The
CustomInterface()
function
passes a UID
KECamMCameraVideoCaptureControlUid
value for
the
CCamera
implementation.
The
CCamera
implementation creates the concrete implementation
of the
MCameraVideoCaptureControl
function and passes back
a handle to the
CCameraVideoCaptureControl
object.
-
Call the
MCaptureVideoObserver
function to notify
when the video capture operations are ready.
-
Call
CCamera::CCameraVideoCaptureControl::GetVideoCaptureSupportInfoL(TInt
&)const
to identify which video capture modes are supported
by the
CCamera
implementation.
-
Call the
CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters::SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::TVideoCaptureType)
function to set the desired video capture mode as the
EClientVideoCapture
or
EDirectVideoCapture
mode.
-
Set the value of
CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters::iFormat
to
the
EFormatEncodedH264
value for the
CCamera
implementation.
This
CCamera
implementation supports the H264 video encoding
data format.
-
Prepare video capture by using the
CCamera::CCameraVideoCaptureControl::PrepareVideoCapture(const
TPrepareVideoParameters &)
asynchronous function. The
PrepareVideoCapture()
function
performs setup and allocation of memory before calling the
StartVideoCapture()
function,
in order to keep minimum latency of the
PrepareVideoCapture()
function.
-
Notify the Ecam client to complete the video capture preparation using
the
KUidECamEventVideoCaptureControlPrepareComplete
event.
-
Call the
CCamera::CCameraVideoCaptureControl::StartVideoCaptureL()
function
to start video capture.
-
Call the
CCamera::CCameraVideoCaptureControl::PauseVideoCapture()
function
to pause the on-going video capture.
-
Call the
CCamera::CCameraVideoCaptureControl::GetPrepareVideoParametersL(TPrepareVideoParameters
&)const
function to retrieve the current prepare video parameters.
The current video capture type is retrieved by the
CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters::VideoCaptureType()const
function.
-
Call the
CCamera::CCameraVideoCaptureControl::ResumeVideoCaptureL()
function
to resume the on-going video capture.
-
Call the
CCamera::CCameraVideoCaptureControl::StopVideoCapture()
function
to stop video capture.
-
Call the
CCamera::CCameraVideoCaptureControl::ReleaseVideoResource()()
function
to release the video resource, which is allocated while performing the
PrepareVideoCapture()
function.
-
If an error occurs while performing video capture, call the
MCaptureVideoObserver::DirectVideoCaptureFailed(TInt)
function. Any video capture operation is stopped.
Example
The following example code snippet illustrates
video capture using H264 encoding:
CCamera* camera = NULL;
MCameraObserver2* observer2 = NULL;
CCamera::CCameraVideoCaptureControl* videocapture = NULL;
MCaptureVideoObserver* videoObserver = NULL;
camera = CCamera::New2L(*observer2, 0, 0);
videocapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoObserver);
CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters prepareVideoParameters;
TInt supportedDVCType = -1;
// To retrieve the supported video capture mode
videocapture->GetVideoCaptureSupportInfoL(supportedDVCType);
// To set the video capture mode, if supported by the CCamera implementation
prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture);
// To set encoding for the H264 video data format
prepareVideoParameters.iFormat = CCamera::EFormatEncodedH264;
// To set aspect ratio for the chosen H264 video format
prepareVideoParameters.iPixelAspectRatio = CCamera::CCameraAdvancedSettings::EEPixelAspect40To33;
videocapture->PrepareVideoCapture(prepareVideoParameters);
videocapture->StartVideoCaptureL();
videocapture->StopVideoCapture();
CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters retrievedVideoParam;
videocapture->GetPrepareVideoParametersL(retrievedVideoParam);
CCamera::CCameraVideoCaptureControl::TVideoCaptureType retrievedVideoCaptureType;
retrievedVideoCaptureType = retrievedVideoParam.VideoCaptureType();
Related information
Camera Preset
Support
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.