sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @deprecated sl@0: */ sl@0: sl@0: #ifndef _MP4LIB_H sl@0: #define _MP4LIB_H sl@0: sl@0: #define MP4Handle mp4_i32* sl@0: sl@0: #include sl@0: #include sl@0: #include <3gplibrary/mp4config.h> sl@0: sl@0: /** sl@0: Provides async parse read observer. sl@0: */ sl@0: class M3GPMP4LibAsyncObserver sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Informs the client about asyncronous parse audio frames operation completion. sl@0: sl@0: @param aError Error code. sl@0: @param aAudioSize Size of the returned audio frames (in bytes). sl@0: @param aTimeStamp Audio frame presentation time in milliseconds from the sl@0: beginning of the audio sequence. sl@0: @param aReturnedFrames Number of frames returned, or 0 if not known. sl@0: @param aTimestamp2 Audio frame presentation time in timescale from the sl@0: beginning of the audio sequence sl@0: sl@0: */ sl@0: virtual void M3GPMP4LibAudioFramesAvailable(MP4Err aError, sl@0: mp4_u32 aAudioSize, sl@0: mp4_u32 aTimeStamp, sl@0: mp4_u32 aReturnedFrames, sl@0: mp4_u32 aTimestamp2) = 0; sl@0: sl@0: /** sl@0: Informs the client about asyncronous parse video frame operation completion. sl@0: sl@0: @param aError Error code. sl@0: @param aFrameSize Size of the returned frame (in bytes). sl@0: @param aTimeStamp Video frame presentation time in milliseconds from the sl@0: beginning of the video sequence sl@0: @param aKeyFrame Returns MP4TRUE if the current frame is a key frame (intra), sl@0: otherwise the value is MP4FALSE sl@0: @param aTimestamp2 Video frame presentation time in timescale from the beginning sl@0: of the video sequence sl@0: sl@0: */ sl@0: virtual void M3GPMP4LibVideoFrameAvailable(MP4Err aError, sl@0: mp4_u32 aFrameSize, sl@0: mp4_u32 aTimeStamp, sl@0: mp4_bool aKeyFrame, sl@0: mp4_u32 aTimestamp2) = 0; sl@0: }; sl@0: sl@0: /** sl@0: This class provides async temporary file deleting observer. sl@0: */ sl@0: class M3GPMP4LibAsyncTempFileRemoverObserver sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Informs the client about unused temporary file that can be deleted. sl@0: @param tempFileName Name of the temporary file that can be deleted. sl@0: Ownership of the file name memory buffer is transferred. sl@0: */ sl@0: virtual void M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName ) = 0; sl@0: sl@0: }; sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: sl@0: /** sl@0: Error codes returned by the library sl@0: */ sl@0: enum sl@0: { sl@0: /** Success */ sl@0: MP4_OK, sl@0: /** Generic error */ sl@0: MP4_ERROR, sl@0: /** Library can't allocate memory */ sl@0: MP4_OUT_OF_MEMORY, sl@0: /** MP4 library needs more data before the sl@0: requested information can be returned */ sl@0: MP4_NOT_AVAILABLE, sl@0: /** The library has been opened with the input in a file */ sl@0: MP4_FILE_MODE, sl@0: /** The input is not streamable */ sl@0: MP4_NOT_STREAMABLE, sl@0: /** Frame of requested type is not available */ sl@0: MP4_NO_REQUESTED_FRAME, sl@0: /** Requested frame doesn't fit into the given buffer */ sl@0: MP4_BUFFER_TOO_SMALL, sl@0: /** No more video frames left */ sl@0: MP4_END_OF_VIDEO, sl@0: /** Can't seek to requested position */ sl@0: MP4_CANT_SEEK, sl@0: /** Error in file handling */ sl@0: MP4_FILE_ERROR, sl@0: /** Input stream is invalid */ sl@0: MP4_INVALID_INPUT_STREAM, sl@0: /** Frame doesn't exist (previous frame was last) */ sl@0: MP4_NO_FRAME, sl@0: /** Illegal type */ sl@0: MP4_INVALID_TYPE, sl@0: /** Timescale has not been set */ sl@0: MP4_TIMESCALE_NOT_SET, sl@0: /** Error writing metadata */ sl@0: MP4_METADATA_ERROR, sl@0: /** No video in input stream */ sl@0: MP4_NO_VIDEO, sl@0: /** No audio in input stream */ sl@0: MP4_NO_AUDIO, sl@0: /** Output buffer has not been initialized for buffer writing */ sl@0: MP4_NO_OUTPUT_BUFFER, sl@0: /** Not enough space in output buffer to write to */ sl@0: MP4_OUTPUT_BUFFER_TOO_SMALL, sl@0: /** No UDTA data found */ sl@0: MP4_UDTA_NOT_FOUND sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Possible data source types sl@0: */ sl@0: enum sl@0: { sl@0: /** Data is read from an RFile64 handle */ sl@0: MP4_SOURCE_RFILE, sl@0: /** Data is read via the CAF */ sl@0: MP4_SOURCE_CAF, sl@0: }; sl@0: sl@0: /** sl@0: Possible input/output values for audio/video type sl@0: */ sl@0: sl@0: /** No audio or video */ sl@0: #define MP4_TYPE_NONE 0x0000 sl@0: /** Video Type. MPEG-4 video (MPEG-4 Part 2) - Simple and Advance Simple Profiles */ sl@0: #define MP4_TYPE_MPEG4_VIDEO 0x0001 sl@0: /** Audio Type. MPEG-4 audio (MPEG-4 Part 3) */ sl@0: #define MP4_TYPE_MPEG4_AUDIO 0x0002 sl@0: /** Video Type. H263 Profile 0 */ sl@0: #define MP4_TYPE_H263_PROFILE_0 0x0004 sl@0: /** Video Type. H263 Profile 3 */ sl@0: #define MP4_TYPE_H263_PROFILE_3 0x0008 sl@0: /** Audio Type. AMR NB */ sl@0: #define MP4_TYPE_AMR_NB 0x0010 sl@0: /** Audio Type. AMR WB */ sl@0: #define MP4_TYPE_AMR_WB 0x0020 sl@0: /** Type not supported */ sl@0: #define MP4_TYPE_UNSUPPORTED 0x0040 sl@0: /** AVC baseline (MPEG-4 Part 10) */ sl@0: #define MP4_TYPE_AVC_PROFILE_BASELINE 0x0080 sl@0: /** AVC main (MPEG-4 Part 10) */ sl@0: #define MP4_TYPE_AVC_PROFILE_MAIN 0x0100 sl@0: /** AVC extended (MPEG-4 Part 10) */ sl@0: #define MP4_TYPE_AVC_PROFILE_EXTENDED 0x0200 sl@0: /** QCELP 13K additions */ sl@0: #define MP4_TYPE_QCELP_13K 0x0400 sl@0: /** AVC high (MPEG-4 Part 10) */ sl@0: #define MP4_TYPE_AVC_PROFILE_HIGH 0x0800 sl@0: sl@0: /** sl@0: Flags used by composer sl@0: */ sl@0: /** No special setup */ sl@0: #define MP4_FLAG_NONE 0x0000 sl@0: /** Meta data is placed at end of file */ sl@0: #define MP4_FLAG_METADATALAST 0x0001 sl@0: /** Collect metadata in files instead of storing it in memory */ sl@0: #define MP4_FLAG_LONGCLIP 0x0002 sl@0: /** Generate a 3G2 File instead of a 3GP File */ sl@0: #define MP4_FLAG_GENERATE_3G2 0x0004 sl@0: /** Generate a MP4 File instead of a 3GP File */ sl@0: #define MP4_FLAG_GENERATE_MP4 0x0008 sl@0: /** Use large output buffers for writing */ sl@0: #define MP4_FLAG_LARGEFILEBUFFER 0x0010 sl@0: sl@0: sl@0: /** Size of buf in MP4HandleStruct must be at least 128 bytes */ sl@0: #define TMPBUFSIZE 128 sl@0: /** Duration of one AMR frame is 20 ms */ sl@0: #define AUDIO_FRAME_DURATION 20 sl@0: sl@0: #define MP4FALSE (mp4_bool)0 sl@0: #define MP4TRUE (mp4_bool)1 sl@0: sl@0: /** sl@0: Possible locations for user data atom (UDTA) sl@0: */ sl@0: /** No user data */ sl@0: #define MP4_UDTA_NONE 0x0000 sl@0: /** User data resides within the Movie Box */ sl@0: #define MP4_UDTA_MOOV 0x0001 sl@0: /** User data resides within the Track Box for video */ sl@0: #define MP4_UDTA_VIDEOTRAK 0x0002 sl@0: /** User data resides within the Track Box for audio */ sl@0: #define MP4_UDTA_AUDIOTRAK 0x0004 sl@0: sl@0: /** sl@0: Initializes the MP4 composing operation. The instance handle of the library is sl@0: set by the function. sl@0: sl@0: The possible values of type parameter are sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_NONE sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: In addition, any combination of one video and one audio type are sl@0: possible. For example sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB sl@0: sl@0: The output file is placed in the current working directory if no path is sl@0: specified. The type of filename is dependent on the architecture. When sl@0: compiling in Symbian OS, this is a unicode string. sl@0: sl@0: sl@0: @param handle MP4 library handle sl@0: @param filename Name of the output MP4 file sl@0: @param type Type of the output file sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_FILE_ERROR Error opening file sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeOpen(MP4Handle *handle, MP4FileName filename, mp4_u32 type); sl@0: sl@0: /** sl@0: This function initializes the MP4 composing operation. The instance sl@0: handle of the library is set by the function. sl@0: sl@0: The possible values of type parameter are sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_NONE sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: In addition, any combination of one video and one audio type are possible. For example sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB sl@0: sl@0: The output is placed in the buffer given as argument. sl@0: Size of composed data is in composedSize variable. sl@0: sl@0: @param handle MP4 library handle sl@0: @param type Type of the output file sl@0: @param composeBuffer Buffer to write to. sl@0: @param composedSize Size of composed data. sl@0: sl@0: @return sl@0: MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_FILE_ERROR Error opening file sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: MP4_NO_OUTPUT_BUFFER No composed buffer sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeOpenToBuffer(MP4Handle *handle, mp4_u32 type, mp4_u8* composeBuffer, mp4_u32 *composedSize); sl@0: sl@0: /** sl@0: This function initializes the MP4 composing operation to existing file handle. The instance sl@0: handle of the library is set by the function. sl@0: sl@0: NOTE: MP4_FLAG_METADATALAST must be defined in MP4ComposeSetFlags if MP4ComposeOpenFileHandle is used! sl@0: sl@0: The possible values of type parameter are sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_NONE sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: In addition, any combination of one video and one audio type are possible. For example sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB sl@0: sl@0: The output file is placed in the current working directory if no path is sl@0: specified. The type of filename is dependent on the architecture. When sl@0: compiling in Symbian OS, this is a unicode string. sl@0: sl@0: @param handle MP4 library handle sl@0: @param composedfile File handle to output file sl@0: @param metadataTempDrive If MP4ComposeSetFlags() is configured to use temporary files for metadata sl@0: (MP4_FLAG_LONGCLIP) this is way to tell library which drive to use for sl@0: temporary files. sl@0: @param type Type of the output file sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_FILE_ERROR Error opening file sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeOpenFileHandle(MP4Handle *handle, RFile *composedfile, TDriveNumber metadataTempDrive, mp4_u32 type); sl@0: sl@0: /** sl@0: This function initializes the MP4 composing operation to existing file handle. The instance sl@0: handle of the library is set by the function. sl@0: sl@0: NOTE: MP4_FLAG_METADATALAST must be defined in MP4ComposeSetFlags if MP4ComposeOpenFileHandle is used! sl@0: sl@0: The possible values of type parameter are sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_NONE sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: In addition, any combination of one video and one audio type are possible. For example sl@0: sl@0: MP4_TYPE_H263_PROFILE_0 | MP4_TYPE_AMR_NB sl@0: sl@0: The output file is placed in the current working directory if no path is sl@0: specified. The type of filename is dependent on the architecture. When sl@0: compiling in Symbian OS, this is a unicode string. sl@0: sl@0: @param handle MP4 library handle sl@0: @param composedfile File handle to output file sl@0: @param metadataTempDrive If MP4ComposeSetFlags() is configured to use temporary files for metadata sl@0: (MP4_FLAG_LONGCLIP) this is way to tell library which drive to use for sl@0: temporary files. sl@0: @param type Type of the output file sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_FILE_ERROR Error opening file sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeOpenFileHandle64(MP4Handle *handle, RFile64 *composedfile, TDriveNumber metadataTempDrive, mp4_u32 type); sl@0: sl@0: /** sl@0: This function closes the MP4 composing operation. It frees the memory sl@0: allocated by the library instance and closes the output MP4 file. sl@0: sl@0: It is necessary to call this function before the output file is sl@0: guaranteed to be a valid MP4 file even though the file may exist prior to sl@0: the call. sl@0: sl@0: The library handle is not valid after this call. sl@0: sl@0: @param handle MP4 library handle sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_METADATA_ERROR Metadata could not be written sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeClose(MP4Handle handle); sl@0: sl@0: /** sl@0: This function is used to inform the MP4 library about the video data. The sl@0: data given to the library is inserted into the MP4 file headers. sl@0: sl@0: The parameter timescale indicates the timescale of the video data sl@0: to be inserted. Timescale tells how many units of time pass in one second. sl@0: sl@0: Note: Timescale should be chosen so that the duration of each sample is sl@0: an integer. Timescale should also be chosen so that the duration sl@0: of the presentation fits into 32 bits. sl@0: sl@0: @param handle MP4 library handle sl@0: @param timescale Timescale of video sl@0: @param width Video width sl@0: @param height Video height sl@0: @param maxbitrate Maximum bitrate of video sl@0: @param avgbitrate Average bitrate of video sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeAddVideoDescription(MP4Handle handle, mp4_u32 timescale, mp4_u16 width, mp4_u16 height, mp4_u32 maxbitrate, mp4_u32 avgbitrate); sl@0: sl@0: /** sl@0: This function is used to inform the MP4 library about the audio data. The sl@0: data given to the library is inserted into the MP4 file headers. sl@0: sl@0: The parameter timescale indicates the timescale of the audio data sl@0: to be inserted. Timescale tells how many units of time pass in one second. sl@0: sl@0: Note: timescale must be smaller than 65536. sl@0: sl@0: Note: audioFramesPerSample and modeSet are needed only for AMR audio. sl@0: sl@0: @param handle MP4 library handle sl@0: @param timescale Timescale of audio sl@0: @param audioFramesPerSample AMR frames per sample sl@0: @param modeSet AMR mode set sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeAddAudioDescription(MP4Handle handle, mp4_u32 timescale, mp4_u8 audioFramesPerSample, mp4_u16 modeSet); sl@0: sl@0: /** sl@0: This function writes one video frame to the MP4 composer library. sl@0: sl@0: The frames must be inserted in causal order. Because the library doesn't sl@0: analyze the video bitstream, the frames can't be retrieved from the sl@0: resulting MP4 file correctly if they are not in proper order. sl@0: sl@0: The data is available in the MP4 output file only after calling sl@0: MP4ComposeClose. MP4ComposeClose is called exactly once when all audio sl@0: and video data has been inserted into the library. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer Video frame data sl@0: @param framesize Size of the video frame in bytes sl@0: @param duration Duration of video frame (in timescale, sl@0: see MP4ComposeAddVideoDescription) sl@0: @param keyframe Flag to indicate whether this frame is a keyframe sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_TIMESCALE_NOT_SET Timescale has not been set sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeWriteVideoFrame(MP4Handle handle, mp4_u8 *buffer, mp4_u32 framesize, mp4_u32 duration, mp4_bool keyframe); sl@0: sl@0: /** sl@0: This function writes audio frames to the MP4 composer library. The data is sl@0: available in the MP4 output file only after calling sl@0: MP4ComposeClose. MP4ComposeClose is called exactly once when all audio sl@0: and video data has been insrted into the library. sl@0: sl@0: For MPEG audio: sl@0: sl@0: This function writes one MPEG audio frame to the MP4 composer library. sl@0: sl@0: Note: numberofframes is meaningless with MPEG audio since only one frame sl@0: can be added with one call. sl@0: sl@0: For other audio types: sl@0: sl@0: This function writes a number of audio frames to the MP4 composer library. sl@0: All audio frames inserted with one function call will be placed inside sl@0: one audio sample in the resulting file. sl@0: sl@0: Note: Once this function is called with a certain numberofframes sl@0: parameter, it can't be changed. This is a limitation of the MP4 file sl@0: format. Only the last call can have a different number of frames if sl@0: their number is less than numberofframes. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer Audio data sl@0: @param bytestowrite Number of bytes of audio data in buffer sl@0: @param numberofframes Number of frames to write sl@0: @param duration Duration of audio frames (in timescale, sl@0: see MP4ComposeAddAudioDescription) sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_TIMESCALE_NOT_SET Timescale has not been set sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeWriteAudioFrames(MP4Handle handle, mp4_u8 *buffer, mp4_u32 bytestowrite, mp4_u32 numberofframes, mp4_u32 duration); sl@0: sl@0: /** sl@0: This function writes MPEG-4 or AVC video DecoderSpecificInfo data into the appropriate atom. sl@0: sl@0: If the video type is MPEG-4 the DecoderSpecificInfo will be written into the esds atom. If the sl@0: video type is AVC (any profile) the DecoderSpecificInfo will be written into the avcC atom. sl@0: sl@0: Note: This function needs to be called only when MPEG-4 or AVC video is used. sl@0: sl@0: @param handle MP4 library handle sl@0: @param info Buffer containing DecoderSpecificInfo sl@0: @param infosize Size of info in bytes sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeWriteVideoDecoderSpecificInfo(MP4Handle handle, mp4_u8 *info, mp4_u32 infosize); sl@0: sl@0: /** sl@0: This function writes MPEG audio DecoderSpecificInfo data into esds atom. sl@0: sl@0: Note: This function needs to be called only when MPEG audio is used. sl@0: sl@0: @param handle MP4 library handle sl@0: @param info Buffer containing DecoderSpecificInfo sl@0: @param infosize Size of info in bytes sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeWriteAudioDecoderSpecificInfo(MP4Handle handle, mp4_u8 *info, mp4_u32 infosize); sl@0: sl@0: /** sl@0: This function allows settings flags that modify the behaviour sl@0: of the library. Use binary OR to specify several flags. sl@0: sl@0: The following flags can be used: sl@0: sl@0: MP4_FLAG_NONE No special setup. sl@0: sl@0: MP4_FLAG_METADATALAST Write metadata last in the file without tmpfile. sl@0: Default is to write the metadata in the sl@0: beginning of the file. sl@0: sl@0: MP4_FLAG_LONGCLIP Collect metadata in files instead of collecting sl@0: it in memory if the amount is large. Only usable sl@0: in Symbian OS. sl@0: sl@0: MP4_FLAG_GENERATE_3G2 Generate a 3G2 File instead of a 3GP File. sl@0: If not set, then 3GP file is generated. sl@0: Generation of 3G2 file may be automatically set sl@0: during composition, based on the selection sl@0: of 3GPP2 specific codecs. sl@0: sl@0: MP4_FLAG_GENERATE_MP4 Generate a MP4 File instead of a 3GP File. sl@0: If not set, then 3GP file is generated. sl@0: Generation may be automatically set to 3GP sl@0: if codecs selected do not support MP4. sl@0: sl@0: MP4_FLAG_LARGEFILEBUFFER Use larger output buffers in file writing. sl@0: Non MP4_ARCH_WIN32 compilations only. sl@0: sl@0: Note: This function should be called after MP4ComposeOpen before sl@0: any other MP4Compose functions. sl@0: sl@0: Note: If MP4ComposeOpenFileHandle is used instead of MP4ComposeOpen the MP4_FLAG_METADATALAST must be defined. sl@0: sl@0: @param handle MP4 library handle sl@0: @param flags Flags to enable sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of Memory sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeSetFlags(MP4Handle handle, mp4_u32 flags); sl@0: sl@0: /** sl@0: This function initializes the MP4 parsing operation. The instance handle sl@0: of the library is set by the function. sl@0: sl@0: The filename parameter is used to specify the type of the input. If the sl@0: parameter is non-NULL, it is assumed to be the filename of the input MP4 sl@0: file. If the parameter is NULL, the library expects the input MP4 data to sl@0: be inserted by subsequent calls of MP4ParseWriteData. sl@0: sl@0: @param handle MP4 library handle sl@0: @param filename Name of the input MP4 file or NULL if the data is coming from sl@0: stream sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: MP4_FILE_ERROR Error opening file sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseOpen(MP4Handle *handle, MP4FileName filename); sl@0: sl@0: /** sl@0: This function initializes the MP4 parsing operation. The instance handle sl@0: of the library is set by the function. sl@0: sl@0: The RFile *inputfile parameter is pointer to valid file handle. sl@0: Library expects that file has been opened and will be closed outside of library. sl@0: sl@0: @param handle MP4 library handle sl@0: @param inputfile File handle to be parsed. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: MP4_FILE_ERROR; Error accessing file sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseOpenFileHandle(MP4Handle *handle, RFile *inputfile ); sl@0: sl@0: /** sl@0: This function initializes the MP4 parsing operation. The instance handle sl@0: of the library is set by the function. sl@0: sl@0: The RFile64 *inputfile parameter is pointer to valid file handle. sl@0: Library expects that file has been opened and will be closed outside of library. sl@0: sl@0: @param handle MP4 library handle sl@0: @param inputfile File handle to be parsed. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: MP4_FILE_ERROR; Error accessing file sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseOpenFileHandle64(MP4Handle *handle, RFile64 *inputfile ); sl@0: sl@0: /** sl@0: This function initializes the MP4 parsing operation. The instance handle sl@0: of the library is set by the function. sl@0: sl@0: The ContentAccess::CData *inputfile parameter is pointer to valid CAF object. sl@0: Library expects that file has been opened and will be closed outside of library. sl@0: sl@0: @param handle MP4 library handle sl@0: @param inputfile CAF data source handle to be parsed. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: MP4_FILE_ERROR; Error accessing file sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseOpenCAF(MP4Handle *handle, ContentAccess::CData *inputfile ); sl@0: sl@0: /** sl@0: This function closes the MP4 parsing operation. It frees the resources sl@0: allocated by the library instance. sl@0: sl@0: The library handle is not valid after this call. sl@0: sl@0: @param handle MP4 library handle sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseClose(MP4Handle handle); sl@0: sl@0: /** sl@0: This function returns parameters describing the video stream. It can be sl@0: called after enough data has been inserted into the library so that MP4 sl@0: headers containing the information can be read. If there is not enough sl@0: data, those functions return MP4_NOT_AVAILABLE and more data needs to be sl@0: inserted into the library by MP4ParseWriteData. sl@0: sl@0: The framerate parameter refers to the frame rate of the original video sl@0: material. sl@0: sl@0: The videotype parameter can be one of the following: sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: sl@0: Note: For timescale parameter, NULL can be specified if the caller sl@0: doesn't need the value. sl@0: sl@0: @param handle MP4 library handle sl@0: @param videolength Duration of video in milliseconds sl@0: @param framerate Frame rate of video (in Hz) sl@0: @param videotype Type of video stream sl@0: @param videowidth Width of video image measured in pixels sl@0: @param videoheight Height of video image measured in pixels sl@0: @param timescale Timescale of video track sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the sl@0: requested information can be returned sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_NO_VIDEO Input doesn't contain video track sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseRequestVideoDescription(MP4Handle handle, mp4_u32 *videolength, mp4_double *framerate, mp4_u32 *videotype, mp4_u32 *videowidth, mp4_u32 *videoheight, mp4_u32 *timescale); sl@0: sl@0: /** sl@0: This function returns parameters describing the audio stream. It can be sl@0: called after enough data has been inserted into the library so that MP4 sl@0: headers containing the information can be read. sl@0: sl@0: Note: framespersample parameter is set only when AMR type audio is used. sl@0: sl@0: Note: For timescale parameter, NULL can be specified if the caller sl@0: doesn't need the value. sl@0: sl@0: @param handle MP4 library handle sl@0: @param audiolength Duration of audio in milliseconds sl@0: @param audiotype Type of audio sl@0: @param framespersample Number of audio frames in each sample sl@0: @param timescale Timescale of audio track sl@0: @param averagebitrate Average bitrate of audio sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the sl@0: requested information can be returned sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_NO_AUDIO Input doesn't contain audio track sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseRequestAudioDescription(MP4Handle handle, mp4_u32 *audiolength, mp4_u32 *audiotype, mp4_u8 *framespersample, mp4_u32 *timescale, mp4_u32 *averagebitrate); sl@0: sl@0: /** sl@0: This function returns parameters describing the contents of the MP4 sl@0: file. It can be called after enough data has been inserted into the sl@0: library so that MP4 headers containing the information can be read. sl@0: sl@0: @param handle MP4 library handle sl@0: @param streamsize Length of the stream in bytes sl@0: @param streamaveragebitrate Average bitrate of the stream in bps sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the sl@0: requested information can be returned sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseRequestStreamDescription(MP4Handle handle, mp4_u32 *streamsize, mp4_u32 *streamaveragebitrate); sl@0: sl@0: /** sl@0: This function inserts MP4 data to the MP4 library. sl@0: sl@0: It is necessary to call this function only if the input filename has not sl@0: been given with MP4ParseOpen. Several functions can return sl@0: MP4_NOT_AVAILABLE if the library doesn't have enough data to return the sl@0: information that the caller requests. In that case, more data needs to be sl@0: inserted to the library before calling those functions again. sl@0: sl@0: This function makes a copy of the data inserted into the library so the sl@0: caller can use buffer for other purposes. If the function returns sl@0: MP4_OUT_OF_MEMORY, the buffer contents have not been copied into the sl@0: library and the caller needs to reduce the buffer size before calling sl@0: again. sl@0: sl@0: If bytestowrite argument is zero, it indicates that there would be no more sl@0: data to feed via this function. Such a function call MUST be done if a sl@0: complete 3GP/MP4 file is to be written to the library's internal memory. The sl@0: buffer argument may be inputted as NULL in such a case. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer Data to be written sl@0: @param bytestowrite Size of buffer in bytes sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Library can't allocate enough memory for the data sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseWriteData(MP4Handle handle, mp4_u8 *buffer, mp4_u32 bytestowrite); sl@0: sl@0: /** sl@0: This function returns the number of bytes that the library instance has sl@0: in its allocated buffers. sl@0: sl@0: The function is only valid when the filename is not provided when opening sl@0: the library. Zero is returned in bytes when in file mode. sl@0: sl@0: @see MP4ParseWriteData. sl@0: sl@0: @param handle MP4 library handle sl@0: @param bytes Number of allocated bytes in the library sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_FILE_MODE The library has been opened with the input in a file sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetBufferedBytes(MP4Handle handle, mp4_u32 *bytes); sl@0: sl@0: /** sl@0: This function returns the type of the next audio/video frame in the sl@0: stream. The type can be one of the following: sl@0: sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: The function is only valid when the input is streamable. sl@0: sl@0: When reading audio/video from an MP4 container in streaming mode, the sl@0: samples must be read from the container in the same order as they were sl@0: inserted in it. This function determines the type of the next sample and sl@0: based on this information the user can call either MP4ParseReadVideoFrame sl@0: or MP4ParseReadAudioFrames to fetch more data. sl@0: sl@0: @param handle MP4 library handle sl@0: @param type Type of the next frame sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_STREAMABLE The input is not streamable sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the sl@0: requested information can be returned sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_NO_FRAME Frame doesn't exist (previous frame was last) sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseNextFrameType(MP4Handle handle, mp4_u32 *type); sl@0: sl@0: /** sl@0: This function returns the size of the next frame of type type in bytes. sl@0: The frame type can be one of the following: sl@0: sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: @param handle MP4 library handle sl@0: @param type Type of the frame sl@0: @param framesize Size of the requested frame in bytes sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frames can be returned sl@0: MP4_NO_REQUESTED_FRAME Frame of requested type is not available sl@0: MP4_INVALID_TYPE Illegal type sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseNextFrameSize(MP4Handle handle, mp4_u32 type, mp4_u32 *framesize); sl@0: sl@0: /** sl@0: This function reads the next video frame from the MP4 file/stream and sl@0: returns it to the caller. sl@0: sl@0: Note: Next frame depends on the position in the input MP4 file. sl@0: MP4ParseSeek can be used to change the current position in the MP4 file. sl@0: sl@0: If the function returns MP4_NOT_AVAILABLE, the caller needs to call sl@0: MP4ParseWriteData to insert more data before calling again. sl@0: sl@0: framesize is returned even if buffer was too small to contain the data. sl@0: sl@0: Note: Specify NULL as timestamp2 if not interested in this parameter. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer Video frame is returned here sl@0: @param buffersize Size of the user allocated buffer (in bytes) sl@0: @param framesize Size of the frame that was returned (in bytes) sl@0: @param timestamp Video frame presentation time in milliseconds from the sl@0: beginning of the video sequence sl@0: @param keyframe Has a value of MP4TRUE if current frame is a keyframe sl@0: (intra) or MP4FALSE otherwise sl@0: @param timestamp2 Video frame presentation time in timescale from the sl@0: beginning of the video sequence sl@0: sl@0: @return MP4_OK Success sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frame can be returned sl@0: MP4_BUFFER_TOO_SMALL Requested frame doesn't fit into the given buffer sl@0: MP4_NO_FRAME Frame doesn't exist (previous frame was last) sl@0: MP4_ERROR Generic error sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseReadVideoFrame(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *framesize, mp4_u32 *timestamp, mp4_bool *keyframe, mp4_u32 *timestamp2); sl@0: sl@0: /** sl@0: This function reads DecoderSpecificInfo data from MPEG-4 or AVC metadata and sl@0: returns it to the caller. sl@0: sl@0: If the video type is MPEG-4 the DecoderSpecificInfo from the esds atom will be sl@0: returned. If the video type is AVC (any profile) the DecoderSpecificInfo from the sl@0: avcC atom will be returned. sl@0: sl@0: decspecinfosize is set even if buffer is too small to contain the data. sl@0: The function can be called with buffersize 0 to query the size of sl@0: DecoderSpecificInfo. sl@0: sl@0: Note: DecoderSpecificInfo is specific to MPEG-4 and AVC video. Therefore, sl@0: only MPEG-4 or AVC video streams contain this information. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer DecoderSpecificInfo is returned here sl@0: @param buffersize Size of the user allocated buffer (in bytes) sl@0: @param decspecinfosize Size of DecoderSpecificInfo is returned here sl@0: sl@0: @return MP4_OK Success sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frames can be returned sl@0: MP4_BUFFER_TOO_SMALL Requested data doesn't fit into the given buffer sl@0: MP4_ERROR Generic error sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseReadVideoDecoderSpecificInfo(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *decspecinfosize); sl@0: sl@0: /** sl@0: This function reads the audio frames that are stored in the current sl@0: audio sample from the MP4 file/stream and returns them to the caller. sl@0: sl@0: Note: Next frame depends on the position in the input MP4 file. sl@0: MP4ParseSeek can be used to change the current position in the sl@0: MP4 file. sl@0: sl@0: If the function returns MP4_NOT_AVAILABLE, the caller needs to call sl@0: MP4ParseWriteData to insert more data before calling again. sl@0: sl@0: audiosize is returned even if buffer was too small to contain the data. sl@0: sl@0: Note: returnedframes may differ from the correct value when accessing sl@0: the last audio sample. sl@0: sl@0: Note: Specify NULL as timestamp2 if not interested in this parameter. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer Audio frames are returned here sl@0: @param buffersize Size of the user allocated buffer (in bytes) sl@0: @param audiosize Size of the returned audio frames (in bytes) sl@0: @param timestamp Audio frame presentation time in milliseconds from the sl@0: beginning of the audio sequence sl@0: @param returnedframes Number of frames returned, or 0 if not known sl@0: @param timestamp2 Audio frame presentation time in timescale from the sl@0: beginning of the audio sequence sl@0: sl@0: @return MP4_OK Success sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frames can be returned sl@0: MP4_BUFFER_TOO_SMALL Requested frames don't fit into the given buffer sl@0: MP4_ERROR Generic error sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_NO_FRAME No more frames available sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseReadAudioFrames(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *audiosize, mp4_u32 *timestamp, mp4_u32 *returnedframes, mp4_u32 *timestamp2); sl@0: sl@0: /** sl@0: This function reads DecoderSpecificInfo data from MP4 metadata and sl@0: returns it to the caller. sl@0: sl@0: decspecinfosize is set even if buffer is too small to contain the data. sl@0: The function can be called with buffersize 0 to query the size of sl@0: DecoderSpecificInfo. sl@0: sl@0: Note: This function can be used for both MPEG-4 audio and AMR. sl@0: sl@0: @param handle MP4 library handle sl@0: @param buffer DecoderSpecificInfo is returned here sl@0: @param buffersize Size of the user allocated buffer (in bytes) sl@0: @param decspecinfosize Size of DecoderSpecificInfo is returned here sl@0: sl@0: @return MP4_OK Success sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frames can be returned sl@0: MP4_BUFFER_TOO_SMALL Requested data doesn't fit into the given buffer sl@0: MP4_ERROR Generic error sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseReadAudioDecoderSpecificInfo(MP4Handle handle, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *decspecinfosize); sl@0: sl@0: /** sl@0: Return the timestamp of the next video frame. This only works if the sl@0: input MP4 data is in a file. sl@0: sl@0: The function can be used to find out which frames have been coded to sl@0: optimize the input frame selection if video frame rate needs to be sl@0: modified. sl@0: sl@0: When this function call returns MP4_END_OF_VIDEO, there are no more video sl@0: frames left in the MP4 file and the timestamp returned with the previous sl@0: call was the timestamp of the last video frame. sl@0: sl@0: Note: User must call MP4ParseSeek() to seek to the correct position sl@0: after calls of this function. Otherwise the current position is sl@0: undetermined. sl@0: sl@0: Note: Specify NULL as timestamp2 if this value is not needed. sl@0: sl@0: @param handle MP4 library handle sl@0: @param timestamp Timestamp in milliseconds is returned here sl@0: @param timestamp2 Timestamp in timescale is returned here sl@0: sl@0: @return MP4_OK Success sl@0: MP4_END_OF_VIDEO No more video frames left sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the sl@0: requested information can be returned sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetNextVideoTimestamp(MP4Handle handle, mp4_u32 *timestamp, mp4_u32 *timestamp2); sl@0: sl@0: /** sl@0: This function determines whether the input MP4 stream is streamable, sl@0: i.e. the media data is arranged in such a manner that playback can be sl@0: started without downloading the entire stream. sl@0: sl@0: @param handle MP4 library handle sl@0: sl@0: @return MP4_OK The file is streamable sl@0: MP4_NOT_STREAMABLE The file is not streamable sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: information can be returned sl@0: MP4_ERROR Generic error sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseIsStreamable(MP4Handle handle); sl@0: sl@0: /** sl@0: This function seeks to the position specified by position parameter in sl@0: the input MP4 file. The function can be called only if the input MP4 data sl@0: is in a file and the file name has been specified with MP4ParseOpen sl@0: function call. sl@0: sl@0: The position is considered to be from the start of the presentation time sl@0: line in the MP4 file. Thus audio and video positions can't be given sl@0: separately. sl@0: sl@0: The function will set current audio and video positions in the following sl@0: manner: sl@0: sl@0: If there is only audio in the file, the current position will be set to sl@0: the audio frame at or just before the given position. sl@0: sl@0: If there is only video in the file and keyframe is MP4FALSE, the current sl@0: position will be set to the video frame at or just before the given sl@0: position. If keyframe is set to MP4TRUE, the current position will be set sl@0: to the first keyframe at or before current position. sl@0: sl@0: If there are both audio and video in the file, video is first positioned sl@0: as explained above and then audio is seeked to the closest position in sl@0: relation to video. sl@0: sl@0: @param handle MP4 library handle sl@0: @param position Position to seek to in milliseconds in the MP4 sl@0: presentation time line sl@0: @param audioPosition Position of audio after seek (in milliseconds) sl@0: @param videoPosition Position of video after seek (in milliseconds) sl@0: @param keyframe If set to MP4TRUE, the 1st video keyframe before given sl@0: point will be seeked to. If set to MP4FALSE, the first sl@0: video frame before given point will be seeked to. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_CANT_SEEK Can't seek to requested position sl@0: sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseSeek(MP4Handle handle, mp4_u32 position, mp4_u32 *audioPosition, mp4_u32 *videoPosition, mp4_bool keyframe); sl@0: sl@0: /** sl@0: This function determines whether the next frame of type type is sl@0: available. sl@0: sl@0: The frame type can be one of the following: sl@0: sl@0: MP4_TYPE_MPEG4_VIDEO sl@0: MP4_TYPE_MPEG4_AUDIO sl@0: MP4_TYPE_H263_PROFILE_0 sl@0: MP4_TYPE_H263_PROFILE_3 sl@0: MP4_TYPE_AMR_NB sl@0: MP4_TYPE_AMR_WB sl@0: MP4_TYPE_AVC_PROFILE_BASELINE sl@0: MP4_TYPE_AVC_PROFILE_MAIN sl@0: MP4_TYPE_AVC_PROFILE_EXTENDED sl@0: MP4_TYPE_AVC_PROFILE_HIGH sl@0: MP4_TYPE_QCELP_13K sl@0: sl@0: @param handle MP4 library handle sl@0: @param type Type of the frame sl@0: sl@0: @return MP4_OK Frame is available sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frames can be returned sl@0: MP4_NO_REQUESTED_FRAME Frame of requested type is not available sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseIsFrameAvailable(MP4Handle handle, mp4_u32 type); sl@0: sl@0: /** sl@0: Return the largest position in a file that has been accessed or the latest accessed sl@0: absolute byte location of the stream. sl@0: sl@0: Note: The function returns a valid position after one audio or video sl@0: sample has been read. sl@0: sl@0: @param handle MP4 library handle sl@0: @param position Result is returned here sl@0: sl@0: @return MP4_OK Success sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetLastPosition(MP4Handle handle, mp4_u32 *position); sl@0: sl@0: /** sl@0: Return the largest position in a file that has been accessed or the latest accessed sl@0: absolute byte location of the stream. sl@0: sl@0: Note: The function returns a valid position after one audio or video sl@0: sample has been read. sl@0: sl@0: @param handle MP4 library handle sl@0: @param position Result is returned here sl@0: sl@0: @return MP4_OK Success sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetLastPosition64(MP4Handle handle, mp4_u64 *position); sl@0: sl@0: /** sl@0: Return the number of video frames. sl@0: sl@0: @param handle MP4 library handle sl@0: @param numberOfFrames Result is returned here sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetNumberOfVideoFrames(MP4Handle handle, mp4_u32 *numberOfFrames); sl@0: sl@0: /** sl@0: Return video frame size. sl@0: sl@0: @param handle MP4 library handle sl@0: @param index Index of video frame sl@0: @param frameSize Result is returned here sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetVideoFrameSize(MP4Handle handle, mp4_u32 index, mp4_u32 *frameSize); sl@0: sl@0: /** sl@0: Return video frame start time. sl@0: sl@0: @param handle MP4 library handle sl@0: @param index Index of video frame sl@0: @param timestamp Result is returned here sl@0: @param timestampms Result in milliseconds sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetVideoFrameStartTime(MP4Handle handle, mp4_u32 index, mp4_u32 *timestamp, mp4_u32 *timestampms); sl@0: sl@0: /** sl@0: Return video frame type. sl@0: sl@0: @param handle MP4 library handle sl@0: @param index Index of video frame sl@0: @param frametype Result is returned here sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetVideoFrameType(MP4Handle handle, mp4_u32 index, mp4_bool *frametype); sl@0: sl@0: /** sl@0: Return the video sample entry index of the next video frame to be read. sl@0: sl@0: The smallest index value is 1. sl@0: sl@0: @param handle MP4 library handle sl@0: @param videosampleentryindex Visual SampleEntry index of the next video frame to be read. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetVideoSampleEntryIndex(MP4Handle handle, mp4_u32 *videosampleentryindex); sl@0: sl@0: /** sl@0: Return the audio sample entry index of the next audio frame to be read. sl@0: sl@0: The smallest index value is 1. sl@0: sl@0: @param handle MP4 library handle sl@0: @param audiosampleentryindex Visual SampleEntry index of the next audio frame to be read. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetAudioSampleEntryIndex(MP4Handle handle, mp4_u32 *audiosampleentryindex); sl@0: sl@0: /** sl@0: This function sets the storage mode of QCELP 13K sl@0: qcelpStorageMode = 0 ...QCELP will be registered using QCELPSampleEntry Box (Default) sl@0: qcelpStorageMode = 1 ...QCELP will be registered using MP4AudioDescription Box sl@0: sl@0: Note: This function needs to be called only when QCLEP 13K is used and when it is going to sl@0: be stored registered using the MP4AudioDescription Box. sl@0: sl@0: @param handle MP4 library handle sl@0: @param qcelpStorageMode Decoder configuration registration mode of QCELP 13K Codec sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeSetQCELPStorageMode(MP4Handle handle, mp4_u8 qcelpStorageMode); sl@0: sl@0: /** sl@0: Return the decoder configuration registration mode of QCELP 13K Codec. sl@0: sl@0: qcelpStorageMode = 0 QCELP is registered using QCELPSampleEntry Box (Default) sl@0: qcelpStorageMode = 1 QCELP is registered using MP4AudioDescription Box sl@0: sl@0: @param handle MP4 library handle sl@0: @param qcelpStorageMode Decoder configuration registration mode of QCELP 13K Codec sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetQCELPStorageMode(MP4Handle handle, mp4_u8 *qcelpStorageMode); sl@0: sl@0: /** sl@0: This function gets the frame infoparameters from star index to number of elements in array from that index, sl@0: properties obtained are startTime, frameType and frameSize. sl@0: sl@0: Important Note:--- The number of elements allocated in the array should be equal to the sizeofarray sl@0: sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param startindex Index from where to start getting information for the array sl@0: @param sizeofarray number of elements that exist in the allocated frame array sl@0: @param aFrameInfoArray Array of Structures of frame parameters sl@0: sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NO_OUTPUT_BUFFER Output buffer pointer uninitialized sl@0: */ sl@0: extern IMPORT_C MP4Err MP4GetVideoFrameProperties(MP4Handle apihandle,mp4_u32 startindex,mp4_u32 sizeofarray,TFrameInfoParameters* aFrameInfoArray); sl@0: sl@0: /** sl@0: This function sets properties of composed video clip. sl@0: sl@0: Setup details in TVideoClipProperties struct: sl@0: sl@0: mp4_u32 iH263Level level of H.263 sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param aVideoClipProperties Setup info struct. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeSetVideoClipProperties(MP4Handle apihandle, const TVideoClipProperties& aVideoClipProperties); sl@0: sl@0: /** sl@0: This function gets properties of parsed video clip. sl@0: sl@0: Returned details in TVideoClipProperties struct: sl@0: sl@0: mp4_u32 iH263Level level of H.263 sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param aVideoClipProperties Filled info struct. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetVideoClipProperties(MP4Handle apihandle, TVideoClipProperties& aVideoClipProperties); sl@0: sl@0: /** sl@0: Retrieve an atom of given type from user data atom (UDTA) to the given buffer. sl@0: sl@0: Note: on return parameters contain following information: sl@0: udtaLocation Hash of all locations in file that contain UDTA atom. sl@0: MP4_UDTA_NONE | MP4_UDTA_MOOV | MP4_UDTA_VIDEOTRAK | MP4_UDTA_AUDIOTRAK sl@0: buffer Buffer containing asked atom. sl@0: bufferSize Size of atom written in buffer. If buffer is too small for atom variable contains needed size. sl@0: atomIndex Count of same subatom type in this UDTA. Starts from 0 (zero) index. sl@0: sl@0: @param handle MP4 library handle sl@0: @param udtaLocation Location of UDTA atom inside file. sl@0: @param udtaAtomType Type of atom to be read from UDTA. sl@0: Hex value of 4 chars representing atom type defined in standard. sl@0: For example: 0x7469746c //'titl' - title for the media atom sl@0: 0x61757468 //'auth' - author of the media atom sl@0: 0x676e7265 //'gnre' - genre (category and style) of the media atom sl@0: @param buffer Buffer to write atom to. sl@0: @param bufferSize Size of given buffer. sl@0: @param atomIndex Index of atom if UDTA contains multiple subatoms of same asked udtaAtomType. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUTPUT_BUFFER_TOO_SMALL Buffer to write atom to is too small, required size in buffersize argument. sl@0: MP4_INVALID_TYPE Asked udtaLocation is invalid. sl@0: MP4_NOT_AVAILABLE UDTA or wanted subatom is not available in asked location. sl@0: MP4_CANT_SEEK Can't seek to UDTA atom location. sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetUserDataAtom(MP4Handle handle, sl@0: mp4_u8& udtaLocation, sl@0: mp4_u32 udtaAtomType, sl@0: mp4_u8* buffer, sl@0: mp4_u32& bufferSize, sl@0: mp4_u32& atomIndex ); sl@0: sl@0: /** sl@0: Writes a buffer containing whole atom to inside of user data atom (UDTA) defined in udtaLocation. sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param udtaLocation Location of UDTA atom inside file. sl@0: MP4_UDTA_MOOV | MP4_UDTA_VIDEOTRAK | MP4_UDTA_AUDIOTRAK sl@0: @param buffer Buffer to write atom from. sl@0: @param bufferSize Size of buffer. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of memory sl@0: MP4_INVALID_TYPE Asked udtaLocation is invalid. sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeSetUserDataAtom(MP4Handle apihandle, sl@0: mp4_u8& udtaLocation, sl@0: mp4_u8* buffer, sl@0: mp4_u32& bufferSize ); sl@0: sl@0: /** sl@0: Sets internal buffer sizes to 3GPMP4Lib. Usage optional. sl@0: Must be used after MP4ComposeSetFlags when composing. sl@0: sl@0: Defaults for composing (with MP4_FLAG_LARGEFILEBUFFER): sl@0: sl@0: mediaWriteBufferSize: 2048, (2*65536) sl@0: writeBufferMaxCount: 15 sl@0: sl@0: Default for parsing: sl@0: readBufferSize: 8k sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param mediaWriteBufferSize Size of media data file output buffers (bytes). sl@0: 0 to use default internal value. sl@0: @param writeBufferMaxCount Max amount of buffers (both media and meta) before file output changes sl@0: to synchronous (by default file writing is asynchronous operation). sl@0: 0 to use default internal value. sl@0: Min value 6. sl@0: @param readBufferSize Size of file read buffer. 0 to use default internal value. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of Memory error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4SetCustomFileBufferSizes( MP4Handle apihandle, sl@0: mp4_u32 mediaWriteBufferSize, sl@0: mp4_u32 writeBufferMaxCount, sl@0: mp4_u32 readBufferSize ); sl@0: sl@0: /** sl@0: This function gets the next frame's dependency information from SDTP box. sl@0: sl@0: Return values of each parameter can be the following: sl@0: aDependsOn: sl@0: 0: the dependency of this sample is unknown; sl@0: 1: this sample does depend on others (not an I picture); sl@0: 2: this sample does not depend on others (I picture); sl@0: sl@0: aIsDependedOn: sl@0: 0: the dependency of other samples on this sample is unknown; sl@0: 1: other samples depend on this one (not disposable); sl@0: 2: no other sample depends on this one (disposable); sl@0: sl@0: aHasRedundancy: sl@0: 0: it is unknown whether there is redundant coding in this sample; sl@0: 1: there is redundant coding in this sample; sl@0: 2: there is no redundant coding in this sample; sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param aDependsOn Defines whether current frame is I-frame (2), isn't I-frame (1) or if it only sl@0: can be found out by using MP4ParseReadVideoFrame()-method (0). sl@0: @param aIsDependentOn Defined the dependency of other frames on this one sl@0: @param aHasRedundancy Defined the existence of redundant coding in this frame sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_NOT_AVAILABLE Metadata not available sl@0: MP4_INVALID_INPUT_STREAM Error in reading metadata sl@0: MP4_NO_OUTPUT_BUFFER Output buffer uninitialized sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseNextVideoFrameDependencies(MP4Handle apihandle, mp4_u8* aDependsOn, mp4_u8* aIsDependentOn, mp4_u8* aHasRedundancy); sl@0: sl@0: /** sl@0: This function sets the next frame's dependency information to SDTP box. sl@0: sl@0: NOTE: This function should be called before MP4ComposeWriteVideoFrame for each frame. Otherwise sl@0: default values are inserted for the missing frames (0 = unknown). sl@0: sl@0: Possible values for each parameter are the following: sl@0: aDependsOn: sl@0: 0: the dependency of this sample is unknown; sl@0: 1: this sample does depend on others (not an I picture); sl@0: 2: this sample does not depend on others (I picture); sl@0: 3: reserved, DO NOT USE sl@0: sl@0: aIsDependedOn: sl@0: 0: the dependency of other samples on this sample is unknown; sl@0: 1: other samples depend on this one (not disposable); sl@0: 2: no other sample depends on this one (disposable); sl@0: 3: reserved, DO NOT USE sl@0: sl@0: aHasRedundancy: sl@0: 0: it is unknown whether there is redundant coding in this sample; sl@0: 1: there is redundant coding in this sample; sl@0: 2: there is no redundant coding in this sample; sl@0: 3: reserved, DO NOT USE sl@0: sl@0: @param apihandle MP4 library handle sl@0: @param aDependsOn Defines whether current frame is I-frame (2), isn't I-frame (1) or if it only sl@0: can be found out by using MP4ParseReadVideoFrame()-method (0). sl@0: @param aIsDependentOn Defines the dependency of other frames on this one sl@0: @param aHasRedundancy Defines the existence of redundant coding in this frame sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ComposeWriteNextVideoFrameDependencies(MP4Handle apihandle, mp4_u8 aDependsOn, mp4_u8 aIsDependentOn, mp4_u8 aHasRedundancy); sl@0: sl@0: /** sl@0: This function reads the audio frames asynchronously that are stored in the current sl@0: audio sample from the MP4 file and returns them to the caller. sl@0: sl@0: Note: Only one async parse audio or video frame(s) operation can be ongoing at any given time. sl@0: sl@0: Note: Observer notification only comes if called function returns MP4_OK. sl@0: If given buffer is too small MP4_BUFFER_TOO_SMALL is returned and buffersize contains needed sl@0: size for audio frame. sl@0: sl@0: When feeding in parsed clip as memory buffers if the function returns MP4_NOT_AVAILABLE, sl@0: the client needs to call MP4ParseWriteData to insert more data before calling this method again. sl@0: sl@0: @param handle MP4 library handle sl@0: @param aObserver Observer designed to receive notification of Asynchronous event completion sl@0: @param buffer Buffer that audio frames are written to. sl@0: @param buffersize Size of the user allocated buffer (in bytes). In MP4_BUFFER_TOO_SMALL error case contains sl@0: needed size for memory buffer. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frames can be returned sl@0: MP4_BUFFER_TOO_SMALL Requested frames don't fit into the given buffer sl@0: MP4_ERROR Generic error sl@0: MP4_FILE_ERROR Async operation is not for buffer mode sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_NO_FRAME No more frames available sl@0: MP4_OUT_OF_MEMORY Out of Memory. sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseReadAudioFramesAsync(MP4Handle handle, M3GPMP4LibAsyncObserver* aObserver, mp4_u8 *buffer, mp4_u32* buffersize ); sl@0: sl@0: /** sl@0: This function reads the next video frame from the MP4 file and returns it to the caller. sl@0: sl@0: Note: Only one async parse audio or video frame(s) operation can be ongoing at any given time. sl@0: sl@0: Note: Observer notification only comes if called function returns MP4_OK. sl@0: If given buffer is too small MP4_BUFFER_TOO_SMALL is returned and buffersize contains needed sl@0: size for video frame. sl@0: sl@0: When feeding in parsed clip as memory buffers if the function returns MP4_NOT_AVAILABLE, sl@0: the client needs to call MP4ParseWriteData to insert more data before calling this method again. sl@0: sl@0: @param handle MP4 library handle sl@0: @param aObserver Observer designed to receive notification of Asynchronous event completion sl@0: @param buffer Video frame is returned here sl@0: @param buffersize Size of the user allocated buffer (in bytes). In MP4_BUFFER_TOO_SMALL error case contains sl@0: needed size for memory buffer. sl@0: sl@0: @return MP4_OK Success sl@0: MP4_NOT_AVAILABLE MP4 library needs more data before the requested sl@0: frame can be returned sl@0: MP4_BUFFER_TOO_SMALL Requested frame doesn't fit into the given buffer sl@0: MP4_NO_FRAME Frame doesn't exist (previous frame was last) sl@0: MP4_ERROR Generic error sl@0: MP4_OUT_OF_MEMORY Out of Memory sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_FILE_ERROR Async operation is not for buffer mode sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseReadVideoFrameAsync(MP4Handle handle, M3GPMP4LibAsyncObserver* aObserver, mp4_u8* buffer, mp4_u32* buffersize ); sl@0: sl@0: /** sl@0: This function sets async temporary file deleting observer. Meta data temporary file removing can be done sl@0: on background to improve video recording stopping. sl@0: sl@0: @param handle MP4 library handle sl@0: @param aObserver Temorary file deleting observer sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: */ sl@0: sl@0: extern IMPORT_C MP4Err MP4ComposeSetTempFileRemoverObserver(MP4Handle *handle, M3GPMP4LibAsyncTempFileRemoverObserver *aObserver); sl@0: sl@0: /** sl@0: This function cancels the outstanding asynchronous read audio/video frame request. sl@0: sl@0: No callback function will be called. sl@0: sl@0: Note: As only one asynchronous parse audio or video frame(s) operation can be ongoing at any given time, sl@0: this function can be used to cancel audio or video read request. If this is called without any outstanding sl@0: request, nothing happens. sl@0: sl@0: @param handle MP4 library handle sl@0: sl@0: @see MP4ParseReadVideoFrameAsync sl@0: @see MP4ParseReadAudioFramesAsync sl@0: */ sl@0: extern IMPORT_C void MP4CancelReadFrame(MP4Handle handle); sl@0: sl@0: /** sl@0: Fetches ID32 data location. sl@0: * sl@0: * Parameters: sl@0: * sl@0: @param handle MP4 library handle sl@0: @param location Returns ID32 data location sl@0: sl@0: @return MP4_OK Success sl@0: MP4_ERROR Generic error sl@0: MP4_INVALID_INPUT_STREAM MP4 stream is invalid sl@0: MP4_NOT_AVAILABLE Metadata, META atom or ID32 atom is not available sl@0: */ sl@0: extern IMPORT_C MP4Err MP4ParseGetID32Location(MP4Handle apihandle, mp4_u32& location); sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: sl@0: sl@0: #endif sl@0: // End of File