# Format - [Overview](#section343241842165623) - [Summary](#section394624958165623) - [Files](#files) - [Data Structures](#nested-classes) - [Macros](#define-members) - [Typedefs](#typedef-members) - [Enumerations](#enum-members) - [Functions](#func-members) - [Details](#section1693197691165623) - [Macro Definition](#section935031532165623) - [FORMAT\_INVALID\_PROGRAM\_ID](#gab4007b017f1edad143959af034e32bf7) - [FORMAT\_INVALID\_TRACK\_ID](#ga62037bb16334896e1bb6d35a71618881) - [FORMAT\_LANGUAGE\_LEN](#gaa70508bb1089c99f9aa3d59fcbdfa8eb) - [FORMAT\_MAX\_LANGUAGE\_NUM](#gac2d2d077edb8e9bb9f85ab6350015c5b) - [FORMAT\_TITLE\_LEN](#gadb635fac84a9d62e99c69e75d4de85c3) - [URL\_LEN](#ga1ac54dd3b9b49c1800b5f502a87650be) - [Typedef](#section545940743165623) - [CALLBACK\_HANDLE](#gab928f39c359734527bda3fd160f89331) - [Enumeration Type](#section1904403459165623) - [AudioSampleFmt](#gadf0700999998f587f0017c4d02977b22) - [CodecFormat](#gaf7ed135f15d4b218d41705bac0122ba7) - [DataFlags](#gacff079fdf8427c743f9197ea5be33a7f) - [FormatErrorType](#ga31e7fcf42722fa15e4e5489c2fef9092) - [FormatInfoType](#ga6f00342925d3d5e586c76f8695985cad) - [FormatSeekMode](#ga14aa9d18a71eff4a0b70f748f0377c94) - [FrameType](#gad495a9f61af7fff07d7e97979d1ab854) - [KeyType](#gaab0feaba617470cb4aa830dc5935238c) - [ManualSplitType](#ga10d9833450f29129d249c41d9acb4bc4) - [OutputFormat](#gaeb712c6c6c0a8af0dfd79f451ecb9277) - [OutputType](#ga4e0517338e6c4a31a2addafc06d4f3a3) - [SourceType](#ga3ae727773c367ac1041d72ac770a0ab1) - [SubtitleFormat](#gadac45ce4731516c262292c15433439b3) - [SubtitleFrameType](#ga43b7f046e365a89697272d850b0517b7) - [TrackSourceType](#ga953bc46f95d7b2d8866838d792f8f6aa) - [TrackType](#gad80740dd555f7d3688d2c4d9f44d3b04) - [Function](#section1772238272165623) - [FormatDeInit\(\)](#gabb574933ebb4f3d1d2ed299e79aeee2c) - [FormatDemuxerCreate\(\)](#ga183fbc31f2c9877ef56464abcccef374) - [FormatDemuxerDestory\(\)](#ga98fd9a5a5d1ffd275fc46f898ca08413) - [FormatDemuxerFreeFrame\(\)](#ga291b805de194c695b72eb5ad721103d5) - [FormatDemuxerGetBufferConfig\(\)](#ga565cbb52c95a95aab4dcc957fe998b5f) - [FormatDemuxerGetFileInfo\(\)](#gad807d61c65e89629c7eed8f97426fd5a) - [FormatDemuxerGetParameter\(\)](#ga6c2a1aa9fdf1db8e2f14a3a92ffa23d5) - [FormatDemuxerGetSelectedTrack\(\)](#gab6ef68051ee2ed0015e721bedb1af61c) - [FormatDemuxerPrepare\(\)](#gacfcf40d869a48125bd67d17f8a4fc3ce) - [FormatDemuxerReadFrame\(\)](#ga7b20e1b88413d20a348d7f796917cd94) - [FormatDemuxerSeek\(\)](#gad53f1e848f3c2e0c8fa056a312b2ed6c) - [FormatDemuxerSelectTrack\(\)](#ga1d9cb94614e207def34f13eaa16ef2b7) - [FormatDemuxerSetBufferConfig\(\)](#gad2a15f3fa640f3f9e8e684d71b3a12cb) - [FormatDemuxerSetCallBack\(\)](#ga9ef126fc3132b556d49a275799e7753b) - [FormatDemuxerSetParameter\(\)](#ga92d859ba4745ce26b94595daaa40462d) - [FormatDemuxerStart\(\)](#ga08544b1ba3373bf5cb211586e8195673) - [FormatDemuxerStop\(\)](#ga8a693d8be0b4b688d99e513608884e91) - [FormatDemuxerUnselectTrack\(\)](#gaf5fd5bab9613d133827054f157d5520e) - [FormatInit\(\)](#gae10a50c8f3de6e54ee0dc3937f755920) - [FormatMuxerAddTrack\(\)](#ga94e9ab3e534b69a358b7cc16e4f79b78) - [FormatMuxerCreate\(\)](#ga9c390276cb90f4753c32af5aa5c600ad) - [FormatMuxerDestory\(\)](#gaa41d46cef6d5e81c85614edbf824d803) - [FormatMuxerGetParameter\(\)](#ga67dd7361dedf335496afef19d54e4138) - [FormatMuxerSetCallBack\(\)](#ga108cd7e319ade568f71890d57585f153) - [FormatMuxerSetFileSplitDuration\(\)](#ga6eed6b5e7522e102f2d79d0dd33fd2a9) - [FormatMuxerSetLocation\(\)](#ga967ba14fa1231eed2942b87a09deb953) - [FormatMuxerSetMaxFileDuration\(\)](#gae931061d822c4ffe447e9ba40a991597) - [FormatMuxerSetMaxFileSize\(\)](#ga6f3ba422c9bbca4c1d5a7a3fe85dd9b9) - [FormatMuxerSetNextOutputFile\(\)](#gaa936b56996294d76977537267fef058c) - [FormatMuxerSetOrientation\(\)](#ga96fc57913c3202d2d23704c69d660be5) - [FormatMuxerSetParameter\(\)](#gad4335ebaa7c165b885a00fe61aae0cd9) - [FormatMuxerStart\(\)](#ga9a2af831a6f4a63dc85d2c23b5c7c81b) - [FormatMuxerStop\(\)](#ga66a3a5a1ec6d01fcbd6339f7eee1151b) - [FormatMuxerWriteFrame\(\)](#ga82037d271e77da206e16582e774ee048) ## **Overview** **Description:** 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 ## **Summary** ## Files
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) |
| AUDIO_SAMPLE_FMT_S8 | |
| AUDIO_SAMPLE_FMT_S16 | |
| AUDIO_SAMPLE_FMT_S24 | |
| AUDIO_SAMPLE_FMT_S32 | |
| AUDIO_SAMPLE_FMT_FLOAT |
| CODEC_H264 | |
| CODEC_H265 | |
| CODEC_JPEG | |
| CODEC_AAC | |
| CODEC_G711A | |
| CODEC_G711U | |
| CODEC_PCM | |
| CODEC_MP3 | |
| CODEC_BUT |
| 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. |
| 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 |
| 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 |
| OUTPUT_FORMAT_MPEG_4 | |
| OUTPUT_FORMAT_TS | |
| OUTPUT_FORMAT_THREE_GPP | |
| OUTPUT_FORMAT_HEIF | |
| OUTPUT_FORMAT_OGG | |
| OUTPUT_FORMAT_INVALID |
| OUTPUT_TYPE_FD | |
| OUTPUT_TYPE_URI | |
| OUTPUT_TYPE_INVALID |
| SOURCE_TYPE_FD | |
| SOURCE_TYPE_URI | |
| SOURCE_TYPE_STREAM | |
| SOURCE_TYPE_BUT |
| 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 |
| HI_SVR_SUBTITLE_BITMAP | |
| HI_SVR_SUBTITLE_TEXT |
| TRACK_SOURCE_TYPE_VIDEO | |
| TRACK_SOURCE_TYPE_AUDIO | |
| TRACK_SOURCE_TYPE_DATA | |
| TRACK_SOURCE_TYPE_INVALID |
| TRACK_TYPE_VIDEO | |
| TRACK_TYPE_AUDIO | |
| TRACK_TYPE_IMAGE | |
| TRACK_TYPE_SUB | |
| TRACK_TYPE_DATA | |
| TRACK_TYPE_BUT |
| 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. |
| handle | Indicates the pointer to the demuxer context handle. |
| handle | Indicates the pointer to the demuxer context handle. |
| frame | Indicates the pointer to the data structure FormatFrame. |
| 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. |
| handle | Indicates the pointer to the demuxer context handle. |
| info | Indicates the pointer to the source attributes, as defined in FileInfo. |
| 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. |
| handle | Indicates the pointer to the demuxer context handle. |
| 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. |
| 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. |
| 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. |
| 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. |
| handle | Indicates the pointer to the demuxer context handle. |
| callBack | Indicates the pointer to the callback, as defined in FormatCallback. |
| 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. |
| handle | Indicates the pointer to the demuxer context handle. |
| handle | Indicates the pointer to the demuxer context handle. |
| handle | Indicates the pointer to the muxer context handle. |
| trackSource | Indicates the pointer to the track source. |
| handle | Indicates the double pointer to the muxer context handle. |
| outputConfig | Indicates the pointer to the muxer output configuration, as defined in FormatOutputConfig. |
| handle | Indicates the pointer to the muxer context handle. |
| 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. |
| handle | Indicates the pointer to the muxer context handle. |
| FormatCallback | Indicates the pointer to the muxer callback to set. |
| 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]. |
| handle | Indicates the pointer to the muxer context handle. |
| fd | Indicates the file descriptor to set. |
| handle | Indicates the pointer to the muxer context handle. |
| degrees | Indicates the clockwise angle of the video track. |
| 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. |
| handle | Indicates the pointer to the muxer context handle. |
| handle | Indicates the pointer to the muxer context handle. |
| frameData | Indicates the pointer to the data structure FormatFrame. |