Symbian3/SDK/Source/GUID-F690DAC8-688B-5BD7-88DF-0CB3D4ACDCFF.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-F690DAC8-688B-5BD7-88DF-0CB3D4ACDCFF"><title> Capturing Video</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial describes how to capture video using the Ecam API. </p> <section><title>Purpose</title> <p>This purpose of this tutorial is to show you how to capture video using the Ecam API. </p> <p><b>Required Background</b> </p> <p>The <xref href="GUID-80EC80E2-E197-50F7-B1FD-720A00AC3B4D.dita">Onboard Camera Overview</xref> introduces the camera utilities. </p> <p><b>Introduction</b> </p> <p>The Video Capture Control allows the client to capture videos. The client can create histogram, snapshot and image processing object specific to video capture. It can start, stop, pause, resume and stop the video capture operations. </p> <p><b>Setup and Configuration Requirements</b> </p> <p>The following are the setup and configuration requirements you need to follow before video capture implementation: </p> <ul><li id="GUID-19C583A4-413F-519A-B2B2-2800F0E454E3"><p>Make sure that you provide a concrete implementation for the <xref href="GUID-2818623D-A8AF-3670-AF7F-5194185D7382.dita"><apiname>McameraVideoCaptureControl</apiname></xref> interface class, which provides the video capture functionality. </p> </li> <li id="GUID-E8DAF0D4-7440-5CC0-83CD-55ECF57C34DD"><p>Client needs to implement the <xref href="GUID-AD4944AA-1C8D-3332-A5BC-4439A0E030C1.dita"><apiname>McaptureVideoObserver</apiname></xref> observer class. The observer methods are called by the implementation when the video capture operations are ready to be notified accordingly. </p> </li> </ul> </section> <section><title>Using Video Capture </title> <p>The following tasks will be covered during video capture implementation: </p> <ul><li id="GUID-55ABCB13-5C9B-5D2F-9D33-B8969B41BAE6"><p>Create a class pointer using a <xref href="GUID-ADBCEC33-BD3C-330C-902C-1BF1AF896D2C.dita#GUID-ADBCEC33-BD3C-330C-902C-1BF1AF896D2C/GUID-6155BC91-5331-3667-A25D-863020C84233"><apiname>CcameraVideoCaptureControl::NewL()</apiname></xref> factory method. </p> <p>This class maps the exported call to an internal object of class <xref href="GUID-2818623D-A8AF-3670-AF7F-5194185D7382.dita"><apiname>McameraVideoCaptureControl</apiname></xref>. </p> </li> <li id="GUID-051037F8-A45A-5682-9445-E81FECE6D29E"><p>Pass a pointer to <xref href="GUID-2818623D-A8AF-3670-AF7F-5194185D7382.dita"><apiname>McameraVideoCaptureControl</apiname></xref> object to the <xref href="GUID-ADBCEC33-BD3C-330C-902C-1BF1AF896D2C.dita"><apiname>CcameraVideoCaptureControl</apiname></xref> object by the active camera during the construction phase. </p> </li> <li id="GUID-396899E9-0BED-5B69-B1E8-B745DADB571B"><p>Get this pointer using a call to <xref href="GUID-4E8A5141-5E4A-322A-9892-8DC49D04986E.dita#GUID-4E8A5141-5E4A-322A-9892-8DC49D04986E/GUID-1F537D7D-5451-3834-869D-3092A4773B83"><apiname>Ccamera::CustomInterface()</apiname></xref> with UID value <xref href="GUID-9C8C3F85-A459-3C07-BF5F-D583726F2FF7.dita"><apiname>KECamMCameraVideoCaptureControlUid</apiname></xref>. </p> </li> <li id="GUID-0C4E4577-8D1C-5A02-8070-1381502F6038"><p>Use <xref href="GUID-7FAEB878-52B1-3A54-9607-69AE09AB8AEB.dita"><apiname>MCaptureVideoObserver</apiname></xref> class methods, when the video capture operations are ready to be notified accordingly. </p> </li> <li id="GUID-E92F4F3B-AC92-5B34-851D-B518E64AA620"><p>Use <xref href="GUID-5FD7C489-DB00-360E-B0D1-41CB44F2E294.dita#GUID-5FD7C489-DB00-360E-B0D1-41CB44F2E294/GUID-31034113-5053-332B-A8FA-34EC0C2DD334"><apiname>CCamVideoCaptureControl::PrepareVideoCapture</apiname></xref> API to initialize the settings for video capture. If video is not supported, then the method will exit with the <codeph>KerrNotSupported</codeph> error message. </p> </li> <li id="GUID-8BF47E42-A140-541F-8680-BEF227F444CA"><p>Prepare for video capture using <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-A6F5FDF5-7C7D-35DF-8F00-740CEF430BEC"><apiname>CCamera::CCameraVideoCaptureControl::PrepareVideoCapture</apiname></xref> asynchronous method. This performs setup and allocation of memory prior to calling <xref href="GUID-86AECED6-39D8-370F-813A-2C777B786C70.dita"><apiname>StartVideoCapture</apiname></xref> method to keep the latency of that method to a minimum. </p> </li> <li id="GUID-F608EAD3-D2B4-5D18-8AB9-909F116B4E1B"><p>Notify the client about completing the preparation for video capture using <xref href="GUID-203BEBE6-F7B8-30EA-824B-AA45B88304E1.dita"><apiname>KUidECamEventVideoCaptureControlPrepareComplete</apiname></xref> event. </p> </li> <li id="GUID-A57E28A4-2CCD-5621-B2D5-9D286196869F"><p>Start video capture using <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-301E3CE4-3869-36DB-B572-E46B7C18BCE0"><apiname>CCamera::CCameraVideoCaptureControl::StartVideoCaptureL</apiname></xref> method. </p> </li> <li id="GUID-53E8D5A1-053E-5A33-A4F8-131CBE2A68F3"><p>Check if camera supports embedded still capture feature using <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-F8482663-5325-3065-8F24-61476453A151"><apiname>CCamera::CCameraVideoCaptureControl::GetEmbeddedStillCaptureSupportInfoL</apiname></xref> method. Capturing still image while video is being captured is referred as embedded still capture. </p> </li> <li id="GUID-4E3C5C41-80F9-5AAC-806E-33EDBDE62AC1"><p>Sets the state to check if embedded still image capture state is enabled using <xref href="GUID-007358AE-9795-33EB-A3BE-4788D309135D.dita#GUID-007358AE-9795-33EB-A3BE-4788D309135D/GUID-51BFB3F9-DC90-3819-A5C3-2C3FD8EFFF97"><apiname>CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters::SetEmbeddedStillCaptureState</apiname></xref> method. </p> </li> <li id="GUID-66610441-E054-5704-999A-097BCB23568D"><p>Use <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-A1799994-FBD8-3AEC-9CBA-E593D2D6B036"><apiname>CCamera::CCameraVideoCaptureControl::PauseVideoCapture</apiname></xref> call to pause the ongoing video capture. </p> </li> <li id="GUID-C426DA42-D8ED-5702-A13D-6786B0B45849"><p>Use <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-E6FFBDA2-B38E-3703-B606-7DF313BDFAA8"><apiname>CCamera::CCameraVideoCaptureControl::ResumeVideoCaptureL</apiname></xref> to resume the ongoing video capture. </p> </li> <li id="GUID-BDE3DD51-7778-5021-BC72-26644B5BE651"><p>Use <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-07FA4DF6-4531-3734-ABEA-FAF0DD324B5F"><apiname>CCamera::CCameraVideoCaptureControl::StopVideoCapture</apiname></xref> to stop video capture. </p> </li> <li id="GUID-BFCA4131-01D8-539F-A0E6-5C363BFC2F62"><p>Release the video resource that was allocated during <xref href="GUID-ECB7D755-0767-3346-9268-65900661CC64.dita"><apiname>PrepareVideoCapture</apiname></xref> using <xref href="GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460.dita#GUID-D74635DE-C5D8-3A9A-ABDD-8324D8EFF460/GUID-D02BE8BF-F0D4-3703-AFA0-AE53BFCFBBC6"><apiname>CCamera::CCameraVideoCaptureControl::ReleaseVideoResource</apiname></xref> method. </p> </li> </ul> <p> <b>Note</b>: </p> <ul><li id="GUID-820BCF11-C839-5EDF-9353-3D00129A39DB"><p> <xref href="GUID-BAFF01BC-405C-37B2-8AC3-F96CF756C300.dita#GUID-BAFF01BC-405C-37B2-8AC3-F96CF756C300/GUID-CFBDB434-0198-3171-9DEC-97A8B7CCAE9B"><apiname>McameraObserver2::VideoBufferReady</apiname></xref> will not be used with the class <xref href="GUID-ADBCEC33-BD3C-330C-902C-1BF1AF896D2C.dita"><apiname>CcameraVideoCaptureControl</apiname></xref>. </p> </li> </ul> <p>The following example code snippets illustrate the <b>video capture control </b> implementation. </p> <codeblock id="GUID-09A6BD59-5FD6-552F-B83F-A9B6BBED3E74" xml:space="preserve">CCamVideoCaptureControl* CCamVideoCaptureControl::NewL(CCamUnitTestPlugin&amp; aOwner);

CCamVideoCaptureControl* self = new(ELeave) CCamVideoCaptureControl(aOwner);

static_cast&lt;MCameraVideoCaptureControl*&gt;(CCamVideoCaptureControl::NewL(static_cast&lt;CCamUnitTestPlugin&amp;&gt;(*this)));

TAny* advSettingObject;
advSettingObject = CCamera::CustomInterface(aInterfaceUid);

CCamVideoCaptureControl::PrepareVideoCapture(CCamera::EFormatFbsBitmapColor16M,setFrameSizeIndex,setFrameRateIndex,KNumberOfBuffersToUse,KNumberOfFramesPerBuffer);

MCaptureVideoObserver* iCaptureVideoObserver;
iCaptureVideoObserver-&gt;VideoBufferReady(NULL, KErrNotSupported);</codeblock> </section> </conbody><related-links><link href="GUID-9DE1CE5D-F148-5A7E-908A-DDD57A32C629.dita"><linktext>Camera API</linktext> </link> <link href="GUID-9014ED9B-B0A0-5C95-9C5B-7D2F658C757F.dita"><linktext>Accessing and Power Control of
                Camera</linktext> </link> <link href="GUID-FAB548CF-24EB-52D1-A7A1-9446BA67C7A5.dita"><linktext>Camera Preset Support</linktext> </link> <link href="GUID-DA26D246-D74A-529F-9F81-11B45669103F.dita"><linktext>Capturing Image</linktext> </link> </related-links></concept>