同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Defines format-related APIs.
For example, you use this module to define custom data types and to initialize, create, destroy the muxer and demuxer, and set their parameters. Also, you can read demuxer data frames, select demuxer tracks, add muxer tracks, and write data frames into a container.
Since:
1.0
Version:
1.0
Defines the data frame, which is used for data transferring. |
|
Defines a structure for configuring and obtaining dynamic parameters. |
URL_LEN 4096 |
Indicates the pointer to the callback handle for listening the muxer. |
FormatInit (void) |
|
FormatDeInit (void) |
|
FormatDemuxerCreate (const FormatSource *source, void **handle) |
|
FormatDemuxerSetParameter (const void *handle, int32_t trackId, const ParameterItem *metaData, int32_t metaDataCnt) |
|
FormatDemuxerGetParameter (const void *handle, int32_t trackId, ParameterItem *metaData) |
|
FormatDemuxerSetCallBack (void *handle, const FormatCallback *callBack) |
|
FormatDemuxerSetBufferConfig (void *handle, const FormatBufferSetting *setting) |
|
FormatDemuxerGetBufferConfig (const void *handle, FormatBufferSetting *setting) |
|
FormatDemuxerPrepare (void *handle) |
|
FormatDemuxerGetFileInfo (void *handle, FileInfo *info) |
|
FormatDemuxerSelectTrack (const void *handle, int32_t programId, int32_t trackId) |
|
FormatDemuxerUnselectTrack (const void *handle, int32_t programId, int32_t trackId) |
Unselects a specified media track from which the demuxer reads data frames. |
FormatDemuxerStart (void *handle) |
|
FormatDemuxerGetSelectedTrack (const void *handle, int32_t *programId, int32_t trackId[], int32_t *nums) |
Obtains the ID of the media track selected by the demuxer for output. |
FormatDemuxerReadFrame (const void *handle, FormatFrame *frame, int32_t timeOutMs) |
|
FormatDemuxerFreeFrame (void *handle, FormatFrame *frame) |
|
FormatDemuxerSeek (const void *handle, int32_t streamIndex, int64_t timeStampUs, FormatSeekMode mode) |
|
FormatDemuxerStop (void *handle) |
|
FormatDemuxerDestory (void *handle) |
|
FormatMuxerCreate (void **handle, FormatOutputConfig *outputConfig) |
|
FormatMuxerDestory (const void *handle) |
Destroys a muxer and release its resources created by calling FormatMuxerCreate. |
FormatMuxerAddTrack (void *handle, const TrackSource *trackSource) |
Adds a media track source for the muxer. For details about track sources, see TrackSource. |
FormatMuxerSetCallBack (void *handle, const FormatCallback *callBack) |
Sets a callback for the muxer. For details about the callback, see FormatCallback. |
FormatMuxerSetOrientation (void *handle, int degrees) |
|
FormatMuxerSetLocation (const void *handle, int latitude, int longitude) |
Sets the geographical information for the output file of the muxer. |
FormatMuxerSetMaxFileSize (void *handle, int64_t bytes) |
Sets the maximum size (in bytes) for the output file of the muxer. |
FormatMuxerSetMaxFileDuration (void *handle, int64_t durationUs) |
|
FormatMuxerSetFileSplitDuration (const void *handle, ManualSplitType type, int64_t timestampUs, uint32_t durationUs) |
|
FormatMuxerStart (void *handle) |
|
FormatMuxerWriteFrame (const void *handle, const FormatFrame *frameData) |
|
FormatMuxerSetNextOutputFile (const void *handle, int32_t fd) |
|
FormatMuxerStop (const void *handle, bool block) |
Stops the muxer that was started by calling FormatMuxerStart. |
FormatMuxerSetParameter (void *handle, int32_t trackId, const ParameterItem *item, int32_t itemNum) |
|
FormatMuxerGetParameter (void *handle, int32_t trackId, ParameterItem *item, int32_t itemNum) |
#define FORMAT_INVALID_PROGRAM_ID -1
Description:
Indicates an invalid program ID.
#define FORMAT_INVALID_TRACK_ID -1
Description:
Indicates an invalid track ID.
#define FORMAT_LANGUAGE_LEN 4
Description:
Indicates the number of characters contained in the language description.
#define FORMAT_MAX_LANGUAGE_NUM 4
Description:
Indicates the number of languages in the subtitle file.
#define FORMAT_TITLE_LEN 64
Description:
Indicates the number of title characters.
#define URL_LEN 4096
Description:
Indicates the URL length.
typedef void* [CALLBACK_HANDLE](Format.md#gab928f39c359734527bda3fd160f89331)
Description:
Indicates the pointer to the callback handle for listening the muxer.
enum [AudioSampleFmt](Format.md#gadf0700999998f587f0017c4d02977b22)
Description:
Enumerates audio sampling formats.
AUDIO_SAMPLE_FMT_S8 | |
AUDIO_SAMPLE_FMT_S16 | |
AUDIO_SAMPLE_FMT_S24 | |
AUDIO_SAMPLE_FMT_S32 | |
AUDIO_SAMPLE_FMT_FLOAT |
enum [CodecFormat](Format.md#gaf7ed135f15d4b218d41705bac0122ba7)
Description:
Enumerates audio, video, and image encoding formats.
CODEC_H264 | |
CODEC_H265 | |
CODEC_JPEG | |
CODEC_AAC | |
CODEC_G711A | |
CODEC_G711U | |
CODEC_PCM | |
CODEC_MP3 | |
CODEC_BUT |
enum [DataFlags](Format.md#gacff079fdf8427c743f9197ea5be33a7f)
Description:
Enumerates flags of raw stream data.
enum [FormatErrorType](Format.md#ga31e7fcf42722fa15e4e5489c2fef9092)
Description:
Enumerates callback error types.
enum [FormatInfoType](Format.md#ga6f00342925d3d5e586c76f8695985cad)
Description:
Enumerates types of callback information.
MUXER_INFO_MAX_DURATION_APPROACHING |
The capturing duration is reaching the threshold specified by FormatMuxerSetMaxFileDuration. This information is reported when only one second or 10% is left to reach the allowed duration. |
MUXER_INFO_MAX_FILESIZE_APPROACHING |
The captured file size is reaching the threshold specified by FormatMuxerSetMaxFileSize. This information is reported when only 100 KB or 10% is left to reach the allowed size. |
MUXER_INFO_MAX_DURATION_REACHED |
The capturing duration reached the threshold specified by FormatMuxerSetMaxFileDuration, and the capturing is ended. If the file is set by a file descriptor, the caller needs to close the file. |
MUXER_INFO_MAX_FILESIZE_REACHED |
The captured file size reached the threshold specified by FormatMuxerSetMaxFileSize, and the capturing is ended. If the file is set by a file descriptor, the caller needs to close the file. |
MUXER_INFO_NEXT_OUTPUT_FILE_STARTED | |
MUXER_INFO_FILE_SPLIT_FINISHED | |
MUXER_INFO_FILE_START_TIME_MS | |
DEMUXER_INFO_PREPARED |
The prepare function is asynchronously executed. This information is reported after the execution is complete. |
DEMUXER_INFO_SEEK_COMPLETE |
The seek function is asynchronously executed. This information is reported after the execution is complete. |
DEMUXER_INFO_NETWORK_DISCONNECTED | |
DEMUXER_INFO_NETWORK_RECONNECTED |
The network is automatically reconnected during network playback. |
enum [FormatSeekMode](Format.md#ga14aa9d18a71eff4a0b70f748f0377c94)
Description:
Enumerates seek modes.
enum [FrameType](Format.md#gad495a9f61af7fff07d7e97979d1ab854)
Description:
Enumerates data frame types.
FRAME_TYPE_NONE |
Unknown type, which can be used for transport stream (TS) packets |
FRAME_TYPE_AUDIO | |
FRAME_TYPE_VIDEO | |
FRAME_TYPE_IMAGE | |
FRAME_TYPE_SUB | |
FRAME_TYPE_DATA | |
FRAME_TYPE_BUT |
enum [KeyType](Format.md#gaab0feaba617470cb4aa830dc5935238c)
Description:
Enumerates key types used for setting and obtaining parameters.
KEY_TYPE_MIME | |
KEY_TYPE_HTTP_HEADERS | |
KEY_TYPE_LANGUAGE |
Track language, which is usually the language of audio and subtitles. The value type is cstring. |
KEY_TYPE_PRE_CACHE |
enum [ManualSplitType](Format.md#ga10d9833450f29129d249c41d9acb4bc4)
Description:
Enumerates manual split types for the muxer.
enum [OutputFormat](Format.md#gaeb712c6c6c0a8af0dfd79f451ecb9277)
Description:
Enumerates output file formats.
OUTPUT_FORMAT_MPEG_4 | |
OUTPUT_FORMAT_TS | |
OUTPUT_FORMAT_THREE_GPP | |
OUTPUT_FORMAT_HEIF | |
OUTPUT_FORMAT_OGG | |
OUTPUT_FORMAT_INVALID |
enum [OutputType](Format.md#ga4e0517338e6c4a31a2addafc06d4f3a3)
Description:
Enumerates muxer output types.
OUTPUT_TYPE_FD | |
OUTPUT_TYPE_URI | |
OUTPUT_TYPE_INVALID |
enum [SourceType](Format.md#ga3ae727773c367ac1041d72ac770a0ab1)
Description:
Enumerates types of the demuxer data source.
SOURCE_TYPE_FD | |
SOURCE_TYPE_URI | |
SOURCE_TYPE_STREAM | |
SOURCE_TYPE_BUT |
enum [SubtitleFormat](Format.md#gadac45ce4731516c262292c15433439b3)
Description:
Enumerates subtitle file formats.
FORMAT_SUB_ASS | |
FORMAT_SUB_LRC | |
FORMAT_SUB_SRT | |
FORMAT_SUB_SMI | |
FORMAT_SUB_SUB | |
FORMAT_SUB_TXT | |
FORMAT_SUB_HDMV_PGS | |
FORMAT_SUB_DVB_SUB | |
FORMAT_SUB_DVD_SUB | |
FORMAT_SUB_TTML | |
FORMAT_SUB_WEBVTT | |
FORMAT_SUB_BUTT |
enum [SubtitleFrameType](Format.md#ga43b7f046e365a89697272d850b0517b7)
Description:
Enumerates subtitle frame types.
HI_SVR_SUBTITLE_BITMAP | |
HI_SVR_SUBTITLE_TEXT |
enum [TrackSourceType](Format.md#ga953bc46f95d7b2d8866838d792f8f6aa)
Description:
Enumerates types of the muxer source track.
TRACK_SOURCE_TYPE_VIDEO | |
TRACK_SOURCE_TYPE_AUDIO | |
TRACK_SOURCE_TYPE_DATA | |
TRACK_SOURCE_TYPE_INVALID |
enum [TrackType](Format.md#gad80740dd555f7d3688d2c4d9f44d3b04)
Description:
Enumerates track types.
TRACK_TYPE_VIDEO | |
TRACK_TYPE_AUDIO | |
TRACK_TYPE_IMAGE | |
TRACK_TYPE_SUB | |
TRACK_TYPE_DATA | |
TRACK_TYPE_BUT |
void FormatDeInit (void )
Description:
Deinitializes the format.
You can call this function to deinitialize the demuxer and muxer. This function works in pair with FormatInit.
int32_t FormatDemuxerCreate (const [FormatSource](FormatSource.md) * source, void ** handle )
Description:
Creates a demuxer component and returns its context handle.
This function returns the demuxer context handle without probing the container format or obtaining stream information.
Parameters:
source | Indicates the pointer to the format source of the demuxer. For details, see FormatSource. |
handle | Indicates the double pointer to the demuxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerDestory (void * handle)
Description:
Destroys demuxer resources.
This function works in pair with FormatDemuxerCreate. If you do not call this function, resource leakage may occur.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerFreeFrame (void * handle, [FormatFrame](FormatFrame.md) * frame )
Description:
Frees data frames.
You can call this function to free the data frames obtained by calling FormatDemuxerReadFrame.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
frame | Indicates the pointer to the data structure FormatFrame. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerGetBufferConfig (const void * handle, [FormatBufferSetting](FormatBufferSetting.md) * setting )
Description:
Obtains the buffer information of the demuxer.
If there is a buffer mechanism in the demuxer, you can call this function to obtain the maximum buffer size and time.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
setting | Indicates the pointer to the maximum demuxer buffer size and time, as defined in FormatBufferSetting. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerGetFileInfo (void * handle, [FileInfo](FileInfo.md) * info )
Description:
Obtains the attributes of a media file.
The attributes contain file, program, and stream attributes. This function should be called after FormatDemuxerPrepare is called.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
info | Indicates the pointer to the source attributes, as defined in FileInfo. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerGetParameter (const void * handle, int32_t trackId, [ParameterItem](ParameterItem.md) * metaData )
Description:
Obtains demuxer attributes.
You can call this function to obtain the HTTP header, HTTP referer, and other extension items for the demuxer after FormatDemuxerCreate is called. The demuxer will store the value in the metaData based on the key.If the demuxer has allocated memory for the metaData to store the value, the caller should manually free the memory.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
trackId | Identifies the track. If the value is an invalid value (-1), this parameter identifies the file or program. |
metaData | Indicates the pointer to the buffer for storing the parameters values that the demuxer has searched for based on the input key. For details, see ParameterItem. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerGetSelectedTrack (const void * handle, int32_t * programId, int32_t trackId[], int32_t * nums )
Description:
Obtains the ID of the media track selected by the demuxer for output.
The demuxer automatically selects the default program and its media tracks. However, if the program and media tracks have changed after FormatDemuxerSelectTrack and FormatDemuxerUnselectTrack are called, you can obtain the currently selected program and media tracks by calling this function (FormatDemuxerGetSelectedTrack.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerPrepare (void * handle)
Description:
Makes preparations for the demuxer.
This function triggers the demuxer to probe the media file container format and parse stream information. You can obtain media file attributes only after this function is called.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerReadFrame (const void * handle, [FormatFrame](FormatFrame.md) * frame, int32_t timeOutMs )
Description:
Reads data frames.
After the data frames are read, you need to call FormatDemuxerFreeFame to free them.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
frame | Indicates the pointer to the data structure FormatFrame. |
timeOutMs | Indicates the time required for waiting data frame read. The value 0 indicates that data frames are immediately read without any wait. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerSeek (const void * handle, int32_t streamIndex, int64_t timeStampUs, [FormatSeekMode](Format.md#ga14aa9d18a71eff4a0b70f748f0377c94) mode )
Description:
Seeks for a specified position for the demuxer.
After being started, the demuxer seeks for a specified position to read data frames. You can specify the position close to the time specified by streamIndex.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
streamIndex | Identifies the stream in the media file. |
timeStampUs | Indicates the target position, in microseconds. |
mode | Indicates the seek mode, as defined in FormatSeekMode. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerSelectTrack (const void * handle, int32_t programId, int32_t trackId )
Description:
Selects a specified media track.
The media tracks to select must belong to the same program. If you do not call this function, the default media tracks of the default program are selected. If programId is valid but trackId is invalid, the default media track of the specified program is used.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
programId | Identifies the program. |
trackId | Identifies the media track. If a valid value is passed, the media track must belong to the specified program. If an invalid value is passed, the default media track of the specified program is used. If multiple audio tracks are specified, the player determines which audio track to use. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerSetBufferConfig (void * handle, const [FormatBufferSetting](FormatBufferSetting.md) * setting )
Description:
Sets buffer information for the demuxer.
If there is a buffer mechanism in the demuxer, you can call this function to set the maximum buffer size and time. Alternatively, you can disable the buffer mechanism by setting the buffer size and time to 0 in the setting parameter. If there is no buffer mechanism or the default setting is retained, you can skip this function.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
setting | Indicates the pointer to the maximum demuxer buffer size and time, as defined in FormatBufferSetting. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerSetCallBack (void * handle, const [FormatCallback](FormatCallback.md) * callBack )
Description:
Sets a callback for the demuxer.
The callback will be invoked to notify the upper layer of internal events of the demuxer.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
callBack | Indicates the pointer to the callback, as defined in FormatCallback. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerSetParameter (const void * handle, int32_t trackId, const [ParameterItem](ParameterItem.md) * metaData, int32_t metaDataCnt )
Description:
Sets demuxer attributes.
You can call this function to set the HTTP header, HTTP referer, and other extension items for the demuxer after FormatDemuxerCreate is called.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
trackId | Identifies the track. If the value is an invalid value (-1), this parameter identifies the file or program. |
metaData | Indicates the pointer to an array of key-value pairs representing parameter names and values. For details, see ParameterItem. |
metaDataCnt | Indicates the number of key-value pairs in the array. This parameter works in pair with metaData. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerStart (void * handle)
Description:
Starts the demuxer.
After being started, the caller can read data frames from the demuxer. This function should be called after FormatDemuxerPrepare is called.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerStop (void * handle)
Description:
Stops the demuxer from working.
After this function is called, the demuxer cannot resume decapsulation.
Parameters:
handle | Indicates the pointer to the demuxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatDemuxerUnselectTrack (const void * handle, int32_t programId, int32_t trackId )
Description:
Unselects a specified media track from which the demuxer reads data frames.
The demuxer can read all media tracks of the default program. You can call this function to unselect all or certain tracks of a specified program that the demuxer is expected not to read. If trackId is invalid, the demuxer will read none of the tracks of the specified program.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
void FormatInit (void )
Description:
Initializes the format.
You can call this function to initialize the demuxer and muxer. This function should always be called before other format-specific functions, and it can be called only once within a process.
int32_t FormatMuxerAddTrack (void * handle, const [TrackSource](TrackSource.md) * trackSource )
Description:
Adds a media track source for the muxer. For details about track sources, see TrackSource.
This function must be called after FormatMuxerCreate is successfully called and before FormatMuxerStart is called.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
trackSource | Indicates the pointer to the track source. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerCreate (void ** handle, [FormatOutputConfig](FormatOutputConfig.md) * outputConfig )
Description:
Creates a muxer and returns its context handle.
Parameters:
handle | Indicates the double pointer to the muxer context handle. |
outputConfig | Indicates the pointer to the muxer output configuration, as defined in FormatOutputConfig. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerDestory (const void * handle)
Description:
Destroys a muxer and release its resources created by calling FormatMuxerCreate.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerGetParameter (void * handle, int32_t trackId, [ParameterItem](ParameterItem.md) * item, int32_t itemNum )
Description:
Obtains muxer attributes.
This is an extended function that can be used to obtain muxer or track attributes. The demuxer then obtains the muxer attributes based on the key contained in item.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
trackId | Identifies the media track. If the value is FORMAT_INVALID_TRACK_ID, this function obtains the muxer attributes. |
item | Indicates the pointer to the items carrying muxer attributes. You can specify multiple items at a time in this parameter, which works in pair with itemNum. |
itemNum | Indicates the number of attributes set at a time. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value if any requested attribute fails to be obtained or is not found.
int32_t FormatMuxerSetCallBack (void * handle, const [FormatCallback](FormatCallback.md) * callBack )
Description:
Sets a callback for the muxer. For details about the callback, see FormatCallback.
This function should be called after FormatMuxerCreate is successfully called.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
FormatCallback | Indicates the pointer to the muxer callback to set. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetFileSplitDuration (const void * handle, [ManualSplitType](Format.md#ga10d9833450f29129d249c41d9acb4bc4) type, int64_t timestampUs, uint32_t durationUs )
Description:
Manually splits a file.
This function can be called after FormatMuxerStart is called. Once this function is called, the file is split based on the manual split type. After manual split is complete, file split will proceed to use the initially set split type. You can call this function again only after the MUXER_INFO_FILE_SPLIT_FINISHED event is reported.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetLocation (const void * handle, int latitude, int longitude )
Description:
Sets the geographical information for the output file of the muxer.
This function should be called after FormatMuxerCreate is successfully called.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
latitude | Indicates the latitude, within the range [-90,90]. |
longitude | Indicates the longitude, within the range [-180,180]. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetMaxFileDuration (void * handle, int64_t durationUs )
Description:
Sets the maximum duration (in seconds) for the output file.
You need to call this function before calling FormatMuxerStart. If the maximum duration you set is valid and capturing is approaching 90% of that duration or the remaining duration is 1s, the message MUXER_INFO_MAX_DURATION_APPROACHING is reported via OnInfo of FormatCallback. If the output file has been set by calling FormatMuxerCreate, you need to call FormatMuxerSetNextOutputFile to set the next output file. Otherwise, the current output file will be overwritten when the capturing reaches the maximum duration you set.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetMaxFileSize (void * handle, int64_t bytes )
Description:
Sets the maximum size (in bytes) for the output file of the muxer.
This function should be called after FormatMuxerCreate is successfully called.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetNextOutputFile (const void * handle, int32_t fd )
Description:
Sets the descriptor for the next output file.
If FormatMuxerCreate is successfully called and the file descriptor involved is valid, you can call this function (FormatMuxerSetNextOutputFile) upon receiving the message MUXER_INFO_MAX_FILESIZE_APPROACHING or MUXER_INFO_MAX_DURATION_APPROACHING.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
fd | Indicates the file descriptor to set. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetOrientation (void * handle, int degrees )
Description:
Sets the orientation of the video track for the muxer.
This function should be called after FormatMuxerAddTrack is successfully called. The following degrees are supported: 0, 90, 180, and 270.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
degrees | Indicates the clockwise angle of the video track. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerSetParameter (void * handle, int32_t trackId, const [ParameterItem](ParameterItem.md) * item, int32_t itemNum )
Description:
Sets muxer attributes.
This is an extended function that can be used to add MP4-dedicated boxes and tags (such as exif).
Parameters:
handle | Indicates the pointer to the muxer context handle. |
trackId | Identifies the media track. If the value is FORMAT_INVALID_TRACK_ID, this function sets the muxer attributes. |
item | Indicates the pointer to the items carrying muxer attributes. You can specify multiple items at a time in this parameter, which works in pair with itemNum. |
itemNum | Indicates the number of attributes set at a time. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerStart (void * handle)
Description:
Starts the muxer.
You can call this function to encapsulate media data after the muxer is created, media tracks are added, and related parameters are set.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerStop (const void * handle, bool block )
Description:
Stops the muxer that was started by calling FormatMuxerStart.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t FormatMuxerWriteFrame (const void * handle, const [FormatFrame](FormatFrame.md) * frameData )
Description:
Writes data frames into the muxer.
This function should be called after FormatMuxerCreate is successfully called.
Parameters:
handle | Indicates the pointer to the muxer context handle. |
frameData | Indicates the pointer to the data structure FormatFrame. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。