C3GPCompose Class Reference

class C3GPCompose : public CBase

The 3GP composer accepts H.263 /H.264 / MPEG-4 / AVC video, and AMR / MPEG-4 AAC / QCELP audio as input to create a 3GP / 3G2 / MP4 file.

Inherits from

Public Member Functions
~C3GPCompose()
IMPORT_C TIntComplete()
IMPORT_C C3GPCompose *NewL()
IMPORT_C C3GPCompose *NewL(TInt, TInt)
IMPORT_C TIntOpen(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, const TDesC &, TUint)
IMPORT_C TIntOpen(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile &, TUint)
IMPORT_C TIntOpen(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile64 &, TUint)
IMPORT_C TIntSetUserData(T3GPUdtaLocation, const TDesC8 &)
IMPORT_C TIntWriteAudioFrames(const TDesC8 &, TUint)
IMPORT_C TIntWriteVideoFrame(const TDesC8 &, TUint, TBool)
IMPORT_C TIntWriteVideoFrame(const TDesC8 &, TUint, TBool, const T3GPFrameDependencies &)
Private Member Functions
C3GPCompose(TInt, TInt)
mp4_u32 Mp4Type(const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *)
voidPanic(TInt)
voidReset()
TInt SetAmrAudioProperties(const T3GPAudioPropertiesBase *)
TInt SetAvcVideoProperties(const T3GPVideoPropertiesBase *)
TInt SetComposeFlag(T3GPFileFormatType, TUint)
TInt SetComposeProperties(const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, T3GPFileFormatType, TUint)
TInt SetH263VideoProperties(const T3GPVideoPropertiesBase *)
TInt SetMPeg4VideoProperties(const T3GPVideoPropertiesBase *)
TInt SetMpeg4AudioProperties(const T3GPAudioPropertiesBase *)
TInt SetQcelpAudioProperties(const T3GPAudioPropertiesBase *)
TInt SymbianOSError(MP4Err)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
TBool iDuplicateFileHandleCreated
RFile64 iFile
MP4HandleiHandler
TBool iHasAudio
TBool iHasVideo
TInt iMediaWriteBufferSize
TInt iWriteBufferMaxCount

Constructor & Destructor Documentation

C3GPCompose(TInt, TInt)

C3GPCompose(TIntaMediaWriteBufferSize = 0,
TIntaWriteBufferMaxCount = 0
)[private]

Parameters

TInt aMediaWriteBufferSize = 0
TInt aWriteBufferMaxCount = 0

~C3GPCompose()

IMPORT_C~C3GPCompose()

Destructor Deletes all objects and releases all resource owned by this instance.

Member Functions Documentation

Complete()

IMPORT_C TIntComplete()

This function completes the composing operation. It frees the memory allocated by the library instance and closes the output file.

It is necessary to call this function before the output file is guaranteed to be a valid output file even though the file may exist prior to the call.

The composer can be reused again after this call, following another call to C3GPCompose::Open to re-initialise the composer.

If C3GPCompose::Complete is called before the composer is initialised, it will be ignored and KErrNone is returned.

Although during destruction of C3GPCompose, this function will be automatically called, and no error code will be returned. Therefore, when destroying the Composer object that you have used to compose a file, you should ensure that data is committed to the file by invoking C3GPCompose::Complete before destroying the Composer object.

Mp4Type(const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *)

mp4_u32 Mp4Type(const T3GPVideoPropertiesBase *aVideo,
const T3GPAudioPropertiesBase *aAudio
)[private]

Parameters

const T3GPVideoPropertiesBase * aVideo
const T3GPAudioPropertiesBase * aAudio

NewL()

IMPORT_C C3GPCompose *NewL()[static]

Create an instance of 3GP composer using default buffer count and size.

The default values for buffer count and size are as follow: Write Buffer Size is 2048 Write Buffer Max Count is 15

leave
KErrGeneral General error.
leave
KErrNoMemory Out of memory.
panic
C3GPCompose KErrAbort if clients do not a CActiveScheduler installed already.

NewL(TInt, TInt)

IMPORT_C C3GPCompose *NewL(TIntaMediaWriteBufferSize,
TIntaWriteBufferMaxCount
)[static]

Create an instance of 3GP composer, and let the user set a count limit and size of internal buffer for composition.

The default values for buffer count and size are as follow: Write Buffer Size is 2048 Write Buffer Max Count is 15

An increase of the buffer count and size will lead to a decrease of file I/O activities, thereby, improves the performance of the 3GP Composer at the expense of higher memory usage.

leave
KErrGeneral General error.
leave
KErrNoMemory Out of memory.
panic
C3GPCompose KErrAbort if clients do not a CActiveScheduler installed already.
panic
C3GPCompose KErrArgument if Write Buffer Size is less or equal to 0 or Write Buffer Max Count is less than 6.

Parameters

TInt aMediaWriteBufferSizeSize of media data file output buffer (in bytes).
TInt aWriteBufferMaxCountMaximum number of buffers (both media and meta) allowed before file output changes to synchronous (by default file writing is asynchronous operation). A minimum value of 6 is enforced.

Open(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, const TDesC &, TUint)

IMPORT_C TIntOpen(T3GPFileFormatTypeaFileFormat,
const T3GPVideoPropertiesBase *aVideo,
const T3GPAudioPropertiesBase *aAudio,
const TDesC &aFilename,
TUintaFlags = E3GPNoFlag
)

This function initialises the 3GP composer for writing 3GP/3G2/MP4 data into a file. Any combination of one video and one audio type is acceptable.

Note: Ownership of aVideo and aAudio remains with the caller. Both aVideo and aAudio are ready for deletion after C3GPCompose::Open returns.

Parameters

T3GPFileFormatType aFileFormatSpecifies the file format in which the data will be created. Refer to T3GPFileFormatType for supported file format types.
const T3GPVideoPropertiesBase * aVideoSpecifies the video stream to be used for video data. The input data given will be inserted into 3GP file headers and is ready to be disposed when C3GPCompose::Open returns. See Video Properties Classes. If aVideo is NULL, audio-only file will be composed.
const T3GPAudioPropertiesBase * aAudioSpecifies the audio stream to be used for audio data. The input data given will be inserted into 3GP file headers and is ready to be disposed when C3GPCompose::Open returns. See Audio Properties Classes. If aAudio is NULL, video-only file will be composed.
const TDesC & aFilenameA full path name of the file to save the data to. An empty path is not allowed.
TUint aFlags = E3GPNoFlagOptional flags for composing preferences. Refer to T3GPComposeFlag for supported flags. The combined use of flags is acceptable. For example: E3GPLongClip | E3GPMetaDataLast

Open(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile &, TUint)

IMPORT_C TIntOpen(T3GPFileFormatTypeaFileFormat,
const T3GPVideoPropertiesBase *aVideo,
const T3GPAudioPropertiesBase *aAudio,
RFile &aFile,
TUintaFlags = E3GPNoFlag
)

This function initialises the 3GP composer for writing 3GP/3G2/MP4 data into a file. Any combination of one video and one audio type is acceptable.

Note: E3GPMetaDataLast will be defaulted in aFlags if file handle is used for the initialisation of the 3GP composer.

Note: Ownership of aVideo and aAudio remains with the caller. Both aVideo and aAudio are ready for deletion after C3GPCompose::Open returns.

Parameters

T3GPFileFormatType aFileFormatSpecifies the file format in which the data will be created. Refer to T3GPFileFormatType for supported file format types.
const T3GPVideoPropertiesBase * aVideoSpecifies the video stream to be used for video data. The input data given will be inserted into 3GP file headers and is ready to be disposed when C3GPCompose::Open returns. See Video Properties Classes. If aVideo is NULL, audio-only file will be composed.
const T3GPAudioPropertiesBase * aAudioSpecifies the audio stream to be used for audio data. The input data given will be inserted into 3GP file headers and is ready to be disposed when C3GPCompose::Open returns. See Audio Properties Classes. If aAudio is NULL, video-only file will be composed.
RFile & aFileFile handle of the file to save the data to. E3GPMetaDataLast needs to be set for aFlags when this is used.
TUint aFlags = E3GPNoFlagOptional flags for composing preferences. Refer to T3GPComposeFlag for supported flags. The combined use of flags is acceptable. For example: E3GPLongClip | E3GPMetaDataLast

Open(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile64 &, TUint)

IMPORT_C TIntOpen(T3GPFileFormatTypeaFileFormat,
const T3GPVideoPropertiesBase *aVideo,
const T3GPAudioPropertiesBase *aAudio,
RFile64 &aFile,
TUintaFlags = E3GPNoFlag
)

This function initialises the 3GP composer for writing 3GP/3G2/MP4 data into a file. Any combination of one video and one audio type is acceptable.

Note: E3GPMetaDataLast will be defaulted in aFlags if file handle is used for the initialisation of the 3GP composer.

Note: Ownership of aVideo and aAudio remains with the caller. Both aVideo and aAudio are ready for deletion after C3GPCompose::Open returns.

Parameters

T3GPFileFormatType aFileFormatSpecifies the file format in which the data will be created. Refer to T3GPFileFormatType for supported file format types.
const T3GPVideoPropertiesBase * aVideoSpecifies the video stream to be used for video data. The input data given will be inserted into 3GP file headers and is ready to be disposed when C3GPCompose::Open returns. See Video Properties Classes. If aVideo is NULL, audio-only file will be composed.
const T3GPAudioPropertiesBase * aAudioSpecifies the audio stream to be used for audio data. The input data given will be inserted into 3GP file headers and is ready to be disposed when C3GPCompose::Open returns. See Audio Properties Classes. If aAudio is NULL, video-only file will be composed.
RFile64 & aFileFile handle of the file to save the data to. E3GPMetaDataLast needs to be set for aFlags when this is used.
TUint aFlags = E3GPNoFlagOptional flags for composing preferences. Refer to T3GPComposeFlag for supported flags. The combined use of flags is acceptable. For example: E3GPLongClip | E3GPMetaDataLast

Panic(TInt)

voidPanic(TIntaPanic)[private, static]

Parameters

TInt aPanic

Reset()

voidReset()[private]

SetAmrAudioProperties(const T3GPAudioPropertiesBase *)

TInt SetAmrAudioProperties(const T3GPAudioPropertiesBase *aAudio)[private]

Parameters

const T3GPAudioPropertiesBase * aAudio

SetAvcVideoProperties(const T3GPVideoPropertiesBase *)

TInt SetAvcVideoProperties(const T3GPVideoPropertiesBase *aVideo)[private]

Parameters

const T3GPVideoPropertiesBase * aVideo

SetComposeFlag(T3GPFileFormatType, TUint)

TInt SetComposeFlag(T3GPFileFormatTypeaFileFormat,
TUintaFlag
)[private]

Parameters

T3GPFileFormatType aFileFormat
TUint aFlag

SetComposeProperties(const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, T3GPFileFormatType, TUint)

TInt SetComposeProperties(const T3GPVideoPropertiesBase *aVideo,
const T3GPAudioPropertiesBase *aAudio,
T3GPFileFormatTypeaFileFormat,
TUintaFlag
)[private]

Parameters

const T3GPVideoPropertiesBase * aVideo
const T3GPAudioPropertiesBase * aAudio
T3GPFileFormatType aFileFormat
TUint aFlag

SetH263VideoProperties(const T3GPVideoPropertiesBase *)

TInt SetH263VideoProperties(const T3GPVideoPropertiesBase *aVideo)[private]

Parameters

const T3GPVideoPropertiesBase * aVideo

SetMPeg4VideoProperties(const T3GPVideoPropertiesBase *)

TInt SetMPeg4VideoProperties(const T3GPVideoPropertiesBase *aVideo)[private]

Parameters

const T3GPVideoPropertiesBase * aVideo

SetMpeg4AudioProperties(const T3GPAudioPropertiesBase *)

TInt SetMpeg4AudioProperties(const T3GPAudioPropertiesBase *aAudio)[private]

Parameters

const T3GPAudioPropertiesBase * aAudio

SetQcelpAudioProperties(const T3GPAudioPropertiesBase *)

TInt SetQcelpAudioProperties(const T3GPAudioPropertiesBase *aAudio)[private]

Parameters

const T3GPAudioPropertiesBase * aAudio

SetUserData(T3GPUdtaLocation, const TDesC8 &)

IMPORT_C TIntSetUserData(T3GPUdtaLocationaLocation,
const TDesC8 &aBuffer
)

Writes a buffer containing whole atom to inside of user data atom (UDTA) defined in aLocation.

The buffer should contain an atom of structure that conforms to the definition of a "full box" as specified in ISO/IEC 14496-12:2003: "Information technology Coding of audio-visual objects Part 12: ISO base media file format."

For more information on user data atoms, see Section 8 Asset Information of "3GPP TS 26.244 version 6.1.0 3GP file format (Rel 6)."

panic
C3GPCompose KErrArgument if the location of user information is not of T3GPUdtaLocation.

Parameters

T3GPUdtaLocation aLocationSpecifies the location of user information to be written. Refer to T3GPUdtaLocation for possible values.
const TDesC8 & aBufferThe descriptor containing the user information to write into file.

SymbianOSError(MP4Err)

TInt SymbianOSError(MP4ErraError)[private]

Parameters

MP4Err aError

WriteAudioFrames(const TDesC8 &, TUint)

IMPORT_C TIntWriteAudioFrames(const TDesC8 &aBuffer,
TUintaDuration
)

This function writes audio frames into the output file or buffer. The data is available in the 3GP output file only after calling C3GPCompose::Complete. C3GPCompose::Complete should be called exactly once when all audio and video data has been inserted into the library.

For MPEG-4 audio: This function writes one MPEG audio frame to the 3GP file.

For other audio types: This function writes a number of audio frames to the 3GP file specified during composer setup in the input parameter aAudio when calling C3GPCompose::Open. All audio frames inserted with one function call will be placed inside one sample in the resulting file.

Note: Only the last call can have a different number of frames if the number is less than the number of frames per sample specified during composer setup.

T3GPAudioPropertiesAmr T3GPAudioPropertiesQcelp

Parameters

const TDesC8 & aBufferThe descriptor containing the audio data to be written.
TUint aDurationDuration of audio frames in timescale, see T3GPAudioPropertiesBase

WriteVideoFrame(const TDesC8 &, TUint, TBool)

IMPORT_C TIntWriteVideoFrame(const TDesC8 &aBuffer,
TUintaDuration,
TBoolaKeyFrame
)

This function writes one video frame to the output file or buffer.

The frames must be inserted according to their causal sequence. Because the library doesn't analyze the video bit stream, frames are inserted into the 3GP file in the same order as they are entered with this function. Therefore, the frames will not be retrieved from the resulting 3GP file or buffer correctly if they are not in proper order.

A frame inserted with this function call will result in one 3GP sample and one 3GP chunk.

The current frame's dependency information which is using default values (E3GPDependencyUnknown & E3GPRedundancyUnknown) is inserted.

The data is available in the output file only after calling C3GPCompose::Complete. C3GPCompose::Complete should be called exactly once when all audio and video data has been inserted into the library.

Parameters

const TDesC8 & aBufferThe descriptor containing the video frame data to be written.
TUint aDurationDuration of video frame in timescale, see T3GPVideoPropertiesBase.
TBool aKeyFrameETrue to indicate whether this frame is a key frame. EFalse otherwise.

WriteVideoFrame(const TDesC8 &, TUint, TBool, const T3GPFrameDependencies &)

IMPORT_C TIntWriteVideoFrame(const TDesC8 &aBuffer,
TUintaDuration,
TBoolaKeyFrame,
const T3GPFrameDependencies &aDependencies
)

This function sets the current frame's dependency information to SDTP box and writes one video frame to the output file.

The frames must be inserted according to their causal sequence. Because the library doesn't analyze the video bit stream, frames are inserted into the 3GP file in the same order as they are entered with this function. Therefore, the frames will not be retrieved from the resulting 3GP file or buffer correctly if they are not in proper order.

A frame inserted with this function call will result in one 3GP sample and one 3GP chunk.

The data is available in the output file only after calling C3GPCompose::Complete. C3GPCompose::Complete should be called exactly once when all audio and video data has been inserted into the library.

Parameters

const TDesC8 & aBufferThe descriptor containing the video frame data to be written.
TUint aDurationDuration of video frame in timescale, see T3GPVideoPropertiesBase.
TBool aKeyFrameETrue to indicate whether this frame is a key frame. EFalse otherwise.
const T3GPFrameDependencies & aDependenciesThis specifies the current frame's dependency information. The information will be supplied into the SDTP box. See T3GPFrameDependencies.

Member Data Documentation

TBool iDuplicateFileHandleCreated

TBool iDuplicateFileHandleCreated[private]

RFile64 iFile

RFile64 iFile[private]

MP4Handle iHandler

MP4HandleiHandler[private]

TBool iHasAudio

TBool iHasAudio[private]

TBool iHasVideo

TBool iHasVideo[private]

TInt iMediaWriteBufferSize

TInt iMediaWriteBufferSize[private]

TInt iWriteBufferMaxCount

TInt iWriteBufferMaxCount[private]