diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-32B58425-81AC-59D6-A17F-21BD06ACB658.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-32B58425-81AC-59D6-A17F-21BD06ACB658.dita Tue Mar 30 11:56:28 2010 +0100 @@ -0,0 +1,25 @@ + + + + + +Adding Data to a 3GP Composer

This tutorial describes how to add data to a 3GP Composer.

Purpose

To write a 3GP, 3G2 or MP4 file, you need to add data to a 3GP Composer. The purpose of this tutorial is to show you how to add the data to the 3GP Composer.

Required background

The 3GP Library Overview introduces the 3GP Composer.

Introduction

You can add the following types of data:

  • Video frames

  • Audio frames

  • User data, such as copyright information.

Note: After adding your data, you must call C3GPCompose::Complete() to commit the data to the output file. The data is only available in the output file after calling C3GPCompose::Complete(). For more information, see Completing Composition.

Using data

The following tasks are covered in this tutorial:

  • Writing a video frame

  • Writing audio frames

  • Writing user data

Writing a video frame

To write a video frame to the output file, call one of the overloads of C3GPCompose::WriteVideoFrame():

  • To use the default frame dependency information, call C3GPCompose::WriteVideoFrame(const TDesC8 &, TUint, + TBool):

    IMPORT_C TInt WriteVideoFrame(const TDesC8 &aBuffer, TUint aDuration, TBool aKeyFrame);

    The default values for frame dependency information are E3GPDependencyUnknown and E3GPRedundancyUnknown. For more information, see T3GPFrameDependencies.

  • To specify your own frame dependency information, call C3GPCompose::WriteVideoFrame(const TDesC8&, TUint, + TBool):

    IMPORT_C TInt WriteVideoFrame(const TDesC8 &aBuffer, TUint aDuration, TBool aKeyFrame, const T3GPFrameDependencies &aDependencies);

    Frame dependency information lets you define dependencies between video frames. For more information, see T3GPFrameDependencies.

Note: You must write each video frame in the correct order. Video frames are retrieved from the output file in the same order that the frames are written using C3GPCompose::WriteVideoFrame().

Writing audio frames

To write audio frames to the output file:

  • Call C3GPCompose::WriteAudioFrames(const TDesC8 &, + TUint):

    IMPORT_C TInt WriteAudioFrames(const TDesC8 &aBuffer, TUint aDuration);

    Note: Depending on the audio type, you can use C3GPCompose::WriteAudioFrames() to write either one or a number of audio frames:

    • For MPEG-4 audio, C3GPCompose::WriteAudioFrames() writes one MPEG audio frame to the output file.

    • For other audio types, C3GPCompose::WriteAudioFrames() writes a number of audio frames to the output file. The number of audio frames is specified in the aAudio input parameter when you call C3GPCompose::Open(). For more information, see Setting up a 3GP Composer.

Writing user data

To write user data:

  • Call C3GPCompose::SetUserData(T3GPUdtaLocation, const + TDesC8&) and set the aBuffer parameter to be a descriptor containing the user information to write and aLocation to be its location:

    IMPORT_C TInt SetUserData(T3GPUdtaLocation aLocation, const TDesC8 &aBuffer);
Example

The following example shows you how to add video, audio and user data to a 3GP Composer:

CMyApp::WriteFileL(const TDesC& aFile) + { + ... + // set up composer as described in Setting up a 3GP Composer. + ... + User::LeaveIfError(composer->WriteVideoFrame(...)); + User::LeaveIfError(composer->WriteAudioFrames(...)); + User::LeaveIfError(composer->SetUserData(...)); + ... + }
See also

Setting up a 3GP Composer

Completing Composition

\ No newline at end of file