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.
Public Member Functions | |
---|---|
~C3GPCompose () | |
IMPORT_C TInt | Complete () |
IMPORT_C C3GPCompose * | NewL () |
IMPORT_C C3GPCompose * | NewL ( TInt , TInt ) |
IMPORT_C TInt | Open ( T3GPFileFormatType , const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, const TDesC &, TUint ) |
IMPORT_C TInt | Open ( T3GPFileFormatType , const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile &, TUint ) |
IMPORT_C TInt | Open ( T3GPFileFormatType , const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile64 &, TUint ) |
IMPORT_C TInt | SetUserData ( T3GPUdtaLocation , const TDesC8 &) |
IMPORT_C TInt | WriteAudioFrames (const TDesC8 &, TUint ) |
IMPORT_C TInt | WriteVideoFrame (const TDesC8 &, TUint , TBool ) |
IMPORT_C TInt | WriteVideoFrame (const TDesC8 &, TUint , TBool , const T3GPFrameDependencies &) |
Private Member Functions | |
---|---|
C3GPCompose ( TInt , TInt ) | |
mp4_u32 | Mp4Type (const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *) |
void | Panic ( TInt ) |
void | Reset () |
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 ) |
Private Attributes | |
---|---|
TBool | iDuplicateFileHandleCreated |
RFile64 | iFile |
MP4Handle | iHandler |
TBool | iHasAudio |
TBool | iHasVideo |
TInt | iMediaWriteBufferSize |
TInt | iWriteBufferMaxCount |
C3GPCompose | ( | TInt | aMediaWriteBufferSize = 0, |
TInt | aWriteBufferMaxCount = 0 | ||
) | [private] |
IMPORT_C | ~C3GPCompose | ( | ) |
Destructor Deletes all objects and releases all resource owned by this instance.
IMPORT_C TInt | Complete | ( | ) |
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.
mp4_u32 | Mp4Type | ( | const T3GPVideoPropertiesBase * | aVideo, |
const T3GPAudioPropertiesBase * | aAudio | |||
) | [private] |
const T3GPVideoPropertiesBase * aVideo | |
const T3GPAudioPropertiesBase * aAudio |
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
IMPORT_C C3GPCompose * | NewL | ( | TInt | aMediaWriteBufferSize, |
TInt | aWriteBufferMaxCount | |||
) | [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.
IMPORT_C TInt | Open | ( | T3GPFileFormatType | aFileFormat, |
const T3GPVideoPropertiesBase * | aVideo, | |||
const T3GPAudioPropertiesBase * | aAudio, | |||
const TDesC & | aFilename, | |||
TUint | aFlags = 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.
T3GPFileFormatType aFileFormat | Specifies the file format in which the data will be created. Refer to T3GPFileFormatType for supported file format types. |
const T3GPVideoPropertiesBase * aVideo | Specifies 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 * aAudio | Specifies 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 & aFilename | A full path name of the file to save the data to. An empty path is not allowed. |
TUint aFlags = E3GPNoFlag | Optional flags for composing preferences. Refer to T3GPComposeFlag for supported flags. The combined use of flags is acceptable. For example: E3GPLongClip | E3GPMetaDataLast |
IMPORT_C TInt | Open | ( | T3GPFileFormatType | aFileFormat, |
const T3GPVideoPropertiesBase * | aVideo, | |||
const T3GPAudioPropertiesBase * | aAudio, | |||
RFile & | aFile, | |||
TUint | aFlags = 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.
T3GPFileFormatType aFileFormat | Specifies the file format in which the data will be created. Refer to T3GPFileFormatType for supported file format types. |
const T3GPVideoPropertiesBase * aVideo | Specifies 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 * aAudio | Specifies 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 & aFile | File handle of the file to save the data to. E3GPMetaDataLast needs to be set for aFlags when this is used. |
TUint aFlags = E3GPNoFlag | Optional flags for composing preferences. Refer to T3GPComposeFlag for supported flags. The combined use of flags is acceptable. For example: E3GPLongClip | E3GPMetaDataLast |
IMPORT_C TInt | Open | ( | T3GPFileFormatType | aFileFormat, |
const T3GPVideoPropertiesBase * | aVideo, | |||
const T3GPAudioPropertiesBase * | aAudio, | |||
RFile64 & | aFile, | |||
TUint | aFlags = 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.
T3GPFileFormatType aFileFormat | Specifies the file format in which the data will be created. Refer to T3GPFileFormatType for supported file format types. |
const T3GPVideoPropertiesBase * aVideo | Specifies 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 * aAudio | Specifies 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 & aFile | File handle of the file to save the data to. E3GPMetaDataLast needs to be set for aFlags when this is used. |
TUint aFlags = E3GPNoFlag | Optional flags for composing preferences. Refer to T3GPComposeFlag for supported flags. The combined use of flags is acceptable. For example: E3GPLongClip | E3GPMetaDataLast |
TInt | SetAmrAudioProperties | ( | const T3GPAudioPropertiesBase * | aAudio | ) | [private] |
const T3GPAudioPropertiesBase * aAudio |
TInt | SetAvcVideoProperties | ( | const T3GPVideoPropertiesBase * | aVideo | ) | [private] |
const T3GPVideoPropertiesBase * aVideo |
TInt | SetComposeFlag | ( | T3GPFileFormatType | aFileFormat, |
TUint | aFlag | |||
) | [private] |
T3GPFileFormatType aFileFormat | |
TUint aFlag |
TInt | SetComposeProperties | ( | const T3GPVideoPropertiesBase * | aVideo, |
const T3GPAudioPropertiesBase * | aAudio, | |||
T3GPFileFormatType | aFileFormat, | |||
TUint | aFlag | |||
) | [private] |
const T3GPVideoPropertiesBase * aVideo | |
const T3GPAudioPropertiesBase * aAudio | |
T3GPFileFormatType aFileFormat | |
TUint aFlag |
TInt | SetH263VideoProperties | ( | const T3GPVideoPropertiesBase * | aVideo | ) | [private] |
const T3GPVideoPropertiesBase * aVideo |
TInt | SetMPeg4VideoProperties | ( | const T3GPVideoPropertiesBase * | aVideo | ) | [private] |
const T3GPVideoPropertiesBase * aVideo |
TInt | SetMpeg4AudioProperties | ( | const T3GPAudioPropertiesBase * | aAudio | ) | [private] |
const T3GPAudioPropertiesBase * aAudio |
TInt | SetQcelpAudioProperties | ( | const T3GPAudioPropertiesBase * | aAudio | ) | [private] |
const T3GPAudioPropertiesBase * aAudio |
IMPORT_C TInt | SetUserData | ( | T3GPUdtaLocation | aLocation, |
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)."
T3GPUdtaLocation aLocation | Specifies the location of user information to be written. Refer to T3GPUdtaLocation for possible values. |
const TDesC8 & aBuffer | The descriptor containing the user information to write into file. |
IMPORT_C TInt | WriteAudioFrames | ( | const TDesC8 & | aBuffer, |
TUint | aDuration | |||
) |
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.
IMPORT_C TInt | WriteVideoFrame | ( | const TDesC8 & | aBuffer, |
TUint | aDuration, | |||
TBool | aKeyFrame | |||
) |
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.
IMPORT_C TInt | WriteVideoFrame | ( | const TDesC8 & | aBuffer, |
TUint | aDuration, | |||
TBool | aKeyFrame, | |||
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.
const TDesC8 & aBuffer | The descriptor containing the video frame data to be written. |
TUint aDuration | Duration of video frame in timescale, see T3GPVideoPropertiesBase. |
TBool aKeyFrame | ETrue to indicate whether this frame is a key frame. EFalse otherwise. |
const T3GPFrameDependencies & aDependencies | This specifies the current frame's dependency information. The information will be supplied into the SDTP box. See T3GPFrameDependencies. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.