Setting up a 3GP Composer

This tutorial describes how to set up a 3GP Composer.

Purpose

The purpose of this tutorial is to show you how to set up a 3GP Composer to write (compose) a 3GP, 3G2 or MP4 file.

Required background

The 3GP Library Overview introduces the 3GP Composer.

Introduction

The C3GPCompose class lets you write 3GP, 3G2 and MP4 files. You can specify the location of the output file by supplying a file path or an opened file handle.

Using a 3GP Composer

The following tasks are covered in this tutorial:

  1. Creating an instance of a 3GP Composer

  2. Initialising a 3GP Composer for reading 3GP, 3G2 or MP4 data.

Creating an instance of a 3GP Composer

Create an instance of a 3GP Composer by calling one of the overloads of C3GPCompose::NewL():

  • To use the default buffer size and buffer count, call C3GPCompose::NewL():

    static IMPORT_C C3GPCompose *NewL();
  • To set the size of the buffer and the maximum buffer count, call C3GPCompose::NewL(TInt, TInt) and set aMediaWriteBufferSize to be the write buffer size and aWriteBufferMaxCount to be the maximum buffer count:

    static IMPORT_C C3GPCompose *NewL(TInt aMediaWriteBufferSize, TInt aWriteBufferMaxCount);

Initialising a 3GP Composer for writing 3GP, 3G2 or MP4 data

Initialise the 3GP Composer for writing data by calling one of the overloads of C3GPCompose::Open():

Note: You can use any combination of one video type and one audio type to compose your 3GP, 3G2 and MP4 files.

Example

The following example shows you how to compose a 3GP file with H263 video and AMR NB audio:

CMyApp::WriteFileL(const TDesC& aFile)
    {
    ...
    // create an instance of a 3GP Composer
    C3GPCompose* composer = C3GPCompose::NewL();
    CleanupStack::PushL(composer);

    // set up a 3GP Composer
    T3GPVideoPropertiesH263 video(...);
    T3GPAudioPropertiesAmr audio(...);
    User::LeaveIfError(composer->Open(E3GP3GP, &video, &audio, aFile));    
    ...
    }