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.
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 &) |
Constructor & Destructor Documentation
C3GPCompose(TInt, TInt)
C3GPCompose | ( | TInt | aMediaWriteBufferSize = 0, |
| TInt | aWriteBufferMaxCount = 0 |
| ) | [private] |
Parameters
TInt aMediaWriteBufferSize = 0 | |
TInt aWriteBufferMaxCount = 0 | |
~C3GPCompose()
Destructor Deletes all objects and releases all resource owned by this instance.
Member Functions Documentation
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.
Mp4Type(const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *)
NewL()
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)
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 aMediaWriteBufferSize | Size of media data file output buffer (in bytes). |
TInt aWriteBufferMaxCount | Maximum 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)
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 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 |
Open(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile &, TUint)
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 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 |
Open(T3GPFileFormatType, const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, RFile64 &, TUint)
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 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 |
Panic(TInt)
void | Panic | ( | TInt | aPanic | ) | [private, static] |
SetAmrAudioProperties(const T3GPAudioPropertiesBase *)
SetAvcVideoProperties(const T3GPVideoPropertiesBase *)
SetComposeFlag(T3GPFileFormatType, TUint)
SetComposeProperties(const T3GPVideoPropertiesBase *, const T3GPAudioPropertiesBase *, T3GPFileFormatType, TUint)
SetH263VideoProperties(const T3GPVideoPropertiesBase *)
SetMPeg4VideoProperties(const T3GPVideoPropertiesBase *)
SetMpeg4AudioProperties(const T3GPAudioPropertiesBase *)
SetQcelpAudioProperties(const T3GPAudioPropertiesBase *)
SetUserData(T3GPUdtaLocation, const TDesC8 &)
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 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. |
WriteAudioFrames(const TDesC8 &, TUint)
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 & aBuffer | The descriptor containing the audio data to be written. |
TUint aDuration | Duration of audio frames in timescale, see T3GPAudioPropertiesBase |
WriteVideoFrame(const TDesC8 &, TUint, TBool)
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 & 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. |
WriteVideoFrame(const TDesC8 &, TUint, TBool, const T3GPFrameDependencies &)
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 & 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. |
Member Data Documentation
TBool
iDuplicateFileHandleCreated
TBool
| iDuplicateFileHandleCreated | [private] |
MP4Handle iHandler
MP4Handle | iHandler | [private] |
TInt
iMediaWriteBufferSize
TInt
| iMediaWriteBufferSize | [private] |
TInt
iWriteBufferMaxCount
TInt
| iWriteBufferMaxCount | [private] |
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.