Creating and Preparing a Video Recorder

This tutorial describes how to get started with the video recorder utility.

Purpose

The purpose of this tutorial is to show you how to create a new video recorder utility and prepare it for recording video data.

Required Background

The Video Client Overview introduces the video client utilities.

Introduction

The video recorder utility is used to record video clips to files, descriptors or URLs and manipulate embedded meta data. This functionality is implemented by the CVideoRecorderUtility class.

Using Video Recorder Utility

Creating a Utility Object

The high level steps to create a video recorder utility object are shown here:

  • You can create an object of this utility class using the CVideoRecorderUtility::NewL function. Some video formats also allow storing of audio data. To facilitate this feature, the class contains audio functions that can manipulate audio data.

    void CRecordVideo::ConstructL()
        {
        iVideoRecordUtility = CVideoRecorderUtility::NewL(*this);
        }

Opening a Recording Device

The high level steps to open a recording device are shown here:

  1. Certain parameters like, the handle to the camera, the controller UID, video format and the codecs to use for video and audio need to be specified for recording. This is shown in the range of open statements shown below based on where you want to save the video clip:

    • CVideoRecorderUtility::OpenFileL: This function stores the recorded video clip in a file.

      void OpenFileL(const TDesC& aFileName, TInt aCameraHandle, TUid aControllerUid, 
      TUid aVideoFormat, TFourCC aVideoType=KFourCCNULL, TFourCC aAudioType=KFourCCNULL);
      

      Note: There is also another method to save a video clip to a file. It is strongly recommended to use this method.

      OpenFileL(const TMMSource& aSource, TUid aControllerUid);

      Where aSource is a filename or an open handle to a file where the video clip has to be saved and aControllerUid is an optionally specified plugin. If specified, it will force the video player to use the controller with the given UID. If no controller plugin is specified, this function searches through a list of all available plugins and attempts to use each one until successful or the end of the list is reached.

    • CVideoRecorderUtility::OpenDesL: This function stores the recorded video clip in a descriptor.

      void OpenDesL(TDes8& aDescriptor, TInt aCameraHandle, TUid aControllerUid, 
      TUid aVideoFormat,TFourCC aVideoType=KFourCCNULL, TFourCC aAudioType=KFourCCNULL);
      
    • CVideoRecorderUtility::OpenUrlL: This function stores the recorded video clip in a URL.

      void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, TInt aCameraHandle, TUid
       aControllerUid, TUid aVideoFormat, TFourCC aVideoType=KFourCCNULL, TFourCC aAudioType=KFourCCNULL);
  2. Once the opening of the recording device is complete, successfully or otherwise, the callback function MVideoRecorderUtilityObserver::MvruoOpenComplete() is called. This notifies the client whether the video clip was successfully opened or not.

Preparing to Record

The high level steps to prepare to record video are shown here:

  1. Once the camera is ready and the video clip is opened successfully, call the CVideoRecorderUtility::Prepare() function. This function prepares the record controller for use.

  2. When the preparation of the record controller is complete, successfully or otherwise, a callback function MVideoRecorderUtilityObserver::MvruoPrepareComplete is called to notify that the video recorder is ready to record.