Completing Composition

This tutorial describes how to complete the composing of a 3GP, 3G2 or MP4 file.

Purpose

To make sure all data added into the 3GP Composer is committed into the output, you need to complete composition. The purpose of this tutorial is to show you how to complete composition.

Required background

The 3GP Library Overview introduces the 3GP Composer.

Introduction

You must use the C3GPCompose::Complete() function to commit data to the output file. The output is only guaranteed to be valid, after you call C3GPCompose::Complete().

If you want to use the 3GP Composer again, you can re-initialise it by calling one of the C3GPCompose::Open() functions. If you do not require the 3GP Composer again, you should destroy the C3GPCompose instance after you call C3GPCompose::Complete().

Using Complete()

The following tasks are covered in this tutorial:

Completing composition

To complete the composing process:

  • Call C3GPCompose::Complete():

    IMPORT_C TInt Complete();

    If an error occurs when the data is committed into the output file, an error code is returned by the C3GPCompose::Complete() function. Regardless of the result, the 3GP Composer closes the output file before C3GPCompose::Complete() returns.

Example

The following example shows you how to complete the composing process:

CMyApp::WriteFileL(const TDesC& aFile)
    {
    ...
    // set up composer as shown in Setting up a 3GP Composer and Adding Data to a 3GP Composer. 
    ...
    User::LeaveIfError(composer->Complete());
    ...
    }