X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavformat%2Favformat.h;h=4c1b18e0028e89137f9fc640835dd0db076f93a5;hb=95a72aed764aa8a08c56ba0e8cf5153f5b769222;hp=f9f4d725f5dd3764086e1dce94f21ec6c6b509e5;hpb=f761d4967053352f9b95ac2bc2505ea06d25a2a0;p=ffmpeg diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f9f4d725f5d..4c1b18e0028 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -930,6 +930,9 @@ typedef struct AVStream { * Decoding: duration of the stream, in stream time base. * If a source file does not specify a duration, but does specify * a bitrate, this value will be estimated from bitrate and file size. + * + * Encoding: May be set by the caller before avformat_write_header() to + * provide a hint to the muxer about the estimated duration. */ int64_t duration; @@ -1002,12 +1005,14 @@ typedef struct AVStream { * All fields below this line are not part of the public API. They * may not be used outside of libavformat and can be changed and * removed at will. - * New public fields should be added right above. + * Internal note: be aware that physically removing these fields + * will break ABI. Replace removed fields with dummy fields, and + * add new fields to AVStreamInternal. ***************************************************************** */ /** - * Stream information used internally by av_find_stream_info() + * Stream information used internally by avformat_find_stream_info() */ #define MAX_STD_TIMEBASES (30*12+30+3+6) struct { @@ -1059,7 +1064,7 @@ typedef struct AVStream { int probe_packets; /** - * Number of frames that have been demuxed during av_find_stream_info() + * Number of frames that have been demuxed during avformat_find_stream_info() */ int codec_info_nb_frames; @@ -1198,6 +1203,12 @@ typedef struct AVStream { */ int inject_global_side_data; + /***************************************************************** + * All fields above this line are not part of the public API. + * Fields below are part of the public API and ABI again. + ***************************************************************** + */ + /** * String containing paris of key and values describing recommended encoder configuration. * Paris are separated by ','. @@ -1646,7 +1657,7 @@ typedef struct AVFormatContext { /** * Audio preload in microseconds. * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user via AVOptions (NO direct access) + * - encoding: Set by user * - decoding: unused */ int audio_preload; @@ -1654,7 +1665,7 @@ typedef struct AVFormatContext { /** * Max chunk time in microseconds. * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user via AVOptions (NO direct access) + * - encoding: Set by user * - decoding: unused */ int max_chunk_duration; @@ -1662,7 +1673,7 @@ typedef struct AVFormatContext { /** * Max chunk size in bytes * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user via AVOptions (NO direct access) + * - encoding: Set by user * - decoding: unused */ int max_chunk_size; @@ -1671,14 +1682,14 @@ typedef struct AVFormatContext { * forces the use of wallclock timestamps as pts/dts of packets * This has undefined results in the presence of B frames. * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) + * - decoding: Set by user */ int use_wallclock_as_timestamps; /** * avio flags, used to force AVIO_FLAG_DIRECT. * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) + * - decoding: Set by user */ int avio_flags; @@ -1686,34 +1697,34 @@ typedef struct AVFormatContext { * The duration field can be estimated through various ways, and this field can be used * to know how the duration was estimated. * - encoding: unused - * - decoding: Read by user via AVOptions (NO direct access) + * - decoding: Read by user */ enum AVDurationEstimationMethod duration_estimation_method; /** * Skip initial bytes when opening stream * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) + * - decoding: Set by user */ int64_t skip_initial_bytes; /** * Correct single timestamp overflows * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) + * - decoding: Set by user */ unsigned int correct_ts_overflow; /** * Force seeking to any (also non key) frames. * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) + * - decoding: Set by user */ int seek2any; /** * Flush the I/O context after each packet. - * - encoding: Set by user via AVOptions (NO direct access) + * - encoding: Set by user * - decoding: unused */ int flush_packets; @@ -1723,14 +1734,14 @@ typedef struct AVFormatContext { * The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes * the format. * - encoding: unused - * - decoding: set by avformat, read by user via av_format_get_probe_score() (NO direct access) + * - decoding: set by avformat, read by user */ int probe_score; /** * number of bytes to read maximally to identify format. * - encoding: unused - * - decoding: set by user through AVOPtions (NO direct access) + * - decoding: set by user */ int format_probesize; @@ -1738,7 +1749,7 @@ typedef struct AVFormatContext { * ',' separated list of allowed decoders. * If NULL then all are allowed * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) + * - decoding: set by user */ char *codec_whitelist; @@ -1746,7 +1757,7 @@ typedef struct AVFormatContext { * ',' separated list of allowed demuxers. * If NULL then all are allowed * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) + * - decoding: set by user */ char *format_whitelist; @@ -1768,7 +1779,7 @@ typedef struct AVFormatContext { * Forced video codec. * This allows forcing a specific decoder, even when there are multiple with * the same codec_id. - * Demuxing: Set by user via av_format_set_video_codec (NO direct access). + * Demuxing: Set by user */ AVCodec *video_codec; @@ -1776,7 +1787,7 @@ typedef struct AVFormatContext { * Forced audio codec. * This allows forcing a specific decoder, even when there are multiple with * the same codec_id. - * Demuxing: Set by user via av_format_set_audio_codec (NO direct access). + * Demuxing: Set by user */ AVCodec *audio_codec; @@ -1784,7 +1795,7 @@ typedef struct AVFormatContext { * Forced subtitle codec. * This allows forcing a specific decoder, even when there are multiple with * the same codec_id. - * Demuxing: Set by user via av_format_set_subtitle_codec (NO direct access). + * Demuxing: Set by user */ AVCodec *subtitle_codec; @@ -1792,7 +1803,7 @@ typedef struct AVFormatContext { * Forced data codec. * This allows forcing a specific decoder, even when there are multiple with * the same codec_id. - * Demuxing: Set by user via av_format_set_data_codec (NO direct access). + * Demuxing: Set by user */ AVCodec *data_codec; @@ -1816,15 +1827,13 @@ typedef struct AVFormatContext { /** * Output timestamp offset, in microseconds. - * Muxing: set by user via AVOptions (NO direct access) + * Muxing: set by user */ int64_t output_ts_offset; /** * dump format separator. * can be ", " or "\n " or anything else - * Code outside libavformat should access this field using AVOptions - * (NO direct access). * - muxing: Set by user. * - demuxing: Set by user. */ @@ -1861,7 +1870,7 @@ typedef struct AVFormatContext { /** * ',' separated list of allowed protocols. * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) + * - decoding: set by user */ char *protocol_whitelist; @@ -1896,11 +1905,22 @@ typedef struct AVFormatContext { /** * ',' separated list of disallowed protocols. * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) + * - decoding: set by user */ char *protocol_blacklist; + + /** + * The maximum number of streams. + * - encoding: unused + * - decoding: set by user + */ + int max_streams; } AVFormatContext; +/** + * Accessors for some AVFormatContext fields. These used to be provided for ABI + * compatibility, and do not need to be used anymore. + */ int av_format_get_probe_score(const AVFormatContext *s); AVCodec * av_format_get_video_codec(const AVFormatContext *s); void av_format_set_video_codec(AVFormatContext *s, AVCodec *c); @@ -2048,6 +2068,21 @@ const AVClass *avformat_get_class(void); */ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); +/** + * Wrap an existing array as stream side data. + * + * @param st stream + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * st. + * @param size side information size + * @return zero on success, a negative AVERROR code on failure. On failure, + * the stream is unchanged and the data remains owned by the caller. + */ +int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + /** * Allocate new information from stream. *