3rdparty: Update ffmpeg to 8.0

This commit is contained in:
JordanTheToaster 2025-05-18 08:59:32 +01:00 committed by Ty
parent 26fcbc712e
commit 73a4d258a9
55 changed files with 3973 additions and 816 deletions

View File

@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@ -158,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@ -267,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest

2235
3rdparty/ffmpeg/Changelog vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@ configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
Specifically, the GPL parts of FFmpeg are:
- libpostproc
- optional x86 optimization in the files
- `libavcodec/x86/flac_dsp_gpl.asm`
- `libavcodec/x86/idct_mmx.c`
@ -45,7 +44,6 @@ Specifically, the GPL parts of FFmpeg are:
- `vf_owdenoise.c`
- `vf_perspective.c`
- `vf_phase.c`
- `vf_pp.c`
- `vf_pp7.c`
- `vf_pullup.c`
- `vf_repeatfields.c`

View File

@ -1 +1 @@
ffmpeg-7.0.2 from https://ffmpeg.org/releases/ffmpeg-7.0.2.tar.xz
ffmpeg-8.0 from https://ffmpeg.org/releases/ffmpeg-8.0.tar.xz

View File

@ -187,17 +187,6 @@ struct AVCodecParameters;
* @{
*/
#if FF_API_BUFFER_MIN_SIZE
/**
* @ingroup lavc_encoding
* minimum encoding buffer size
* Used to avoid some checks during header writing.
* @deprecated Unused: avcodec_receive_packet() does not work
* with preallocated packet buffers.
*/
#define AV_INPUT_BUFFER_MIN_SIZE 16384
#endif
/**
* @ingroup lavc_encoding
*/
@ -234,18 +223,9 @@ typedef struct RcOverride{
* Use qpel MC.
*/
#define AV_CODEC_FLAG_QPEL (1 << 4)
#if FF_API_DROPCHANGED
/**
* Don't output frames whose parameters differ from first
* decoded frame in stream.
*
* @deprecated callers should implement this functionality in their own code
*/
#define AV_CODEC_FLAG_DROPCHANGED (1 << 5)
#endif
/**
* Request the encoder to output reconstructed frames, i.e.\ frames that would
* be produced by decoding the encoded bistream. These frames may be retrieved
* be produced by decoding the encoded bitstream. These frames may be retrieved
* by calling avcodec_receive_frame() immediately after a successful call to
* avcodec_receive_packet().
*
@ -419,6 +399,12 @@ typedef struct RcOverride{
*/
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3)
/**
* Decoding only.
* Do not apply picture enhancement layers, export them instead.
*/
#define AV_CODEC_EXPORT_DATA_ENHANCEMENTS (1 << 4)
/**
* The decoder will keep a reference to the frame and may reuse it later.
*/
@ -509,16 +495,21 @@ typedef struct AVCodecContext {
int flags2;
/**
* some codecs need / can use extradata like Huffman tables.
* MJPEG: Huffman tables
* rv10: additional flags
* MPEG-4: global headers (they can be in the bitstream or here)
* The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
* than extradata_size to avoid problems if it is read with the bitstream reader.
* The bytewise contents of extradata must not depend on the architecture or CPU endianness.
* Must be allocated with the av_malloc() family of functions.
* - encoding: Set/allocated/freed by libavcodec.
* - decoding: Set/allocated/freed by user.
* Out-of-band global headers that may be used by some codecs.
*
* - decoding: Should be set by the caller when available (typically from a
* demuxer) before opening the decoder; some decoders require this to be
* set and will fail to initialize otherwise.
*
* The array must be allocated with the av_malloc() family of functions;
* allocated size must be at least AV_INPUT_BUFFER_PADDING_SIZE bytes
* larger than extradata_size.
*
* - encoding: May be set by the encoder in avcodec_open2() (possibly
* depending on whether the AV_CODEC_FLAG_GLOBAL_HEADER flag is set).
*
* After being set, the array is owned by the codec and freed in
* avcodec_free_context().
*/
uint8_t *extradata;
int extradata_size;
@ -559,23 +550,6 @@ typedef struct AVCodecContext {
*/
AVRational framerate;
#if FF_API_TICKS_PER_FRAME
/**
* For some codecs, the time base is closer to the field rate than the frame rate.
* Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
* if no telecine is used ...
*
* Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
*
* @deprecated
* - decoding: Use AVCodecDescriptor.props & AV_CODEC_PROP_FIELDS
* - encoding: Set AVCodecContext.framerate instead
*
*/
attribute_deprecated
int ticks_per_frame;
#endif
/**
* Codec delay.
*
@ -1175,6 +1149,10 @@ typedef struct AVCodecContext {
* this callback and filled with the extra buffers if there are more
* buffers than buf[] can hold. extended_buf will be freed in
* av_frame_unref().
* Decoders will generally initialize the whole buffer before it is output
* but it can in rare error conditions happen that uninitialized data is passed
* through. \important The buffers returned by get_buffer* should thus not contain sensitive
* data.
*
* If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
* avcodec_default_get_buffer2() instead of providing buffers allocated by
@ -1538,6 +1516,7 @@ typedef struct AVCodecContext {
#define FF_DCT_MMX 3
#define FF_DCT_ALTIVEC 5
#define FF_DCT_FAAN 6
#define FF_DCT_NEON 7
/**
* IDCT algorithm, see FF_IDCT_* below.
@ -1637,165 +1616,29 @@ typedef struct AVCodecContext {
* See the AV_PROFILE_* defines in defs.h.
*/
int profile;
#if FF_API_FF_PROFILE_LEVEL
/** @deprecated The following defines are deprecated; use AV_PROFILE_*
* in defs.h instead. */
#define FF_PROFILE_UNKNOWN -99
#define FF_PROFILE_RESERVED -100
#define FF_PROFILE_AAC_MAIN 0
#define FF_PROFILE_AAC_LOW 1
#define FF_PROFILE_AAC_SSR 2
#define FF_PROFILE_AAC_LTP 3
#define FF_PROFILE_AAC_HE 4
#define FF_PROFILE_AAC_HE_V2 28
#define FF_PROFILE_AAC_LD 22
#define FF_PROFILE_AAC_ELD 38
#define FF_PROFILE_MPEG2_AAC_LOW 128
#define FF_PROFILE_MPEG2_AAC_HE 131
#define FF_PROFILE_DNXHD 0
#define FF_PROFILE_DNXHR_LB 1
#define FF_PROFILE_DNXHR_SQ 2
#define FF_PROFILE_DNXHR_HQ 3
#define FF_PROFILE_DNXHR_HQX 4
#define FF_PROFILE_DNXHR_444 5
#define FF_PROFILE_DTS 20
#define FF_PROFILE_DTS_ES 30
#define FF_PROFILE_DTS_96_24 40
#define FF_PROFILE_DTS_HD_HRA 50
#define FF_PROFILE_DTS_HD_MA 60
#define FF_PROFILE_DTS_EXPRESS 70
#define FF_PROFILE_DTS_HD_MA_X 61
#define FF_PROFILE_DTS_HD_MA_X_IMAX 62
#define FF_PROFILE_EAC3_DDP_ATMOS 30
#define FF_PROFILE_TRUEHD_ATMOS 30
#define FF_PROFILE_MPEG2_422 0
#define FF_PROFILE_MPEG2_HIGH 1
#define FF_PROFILE_MPEG2_SS 2
#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
#define FF_PROFILE_MPEG2_MAIN 4
#define FF_PROFILE_MPEG2_SIMPLE 5
#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
#define FF_PROFILE_H264_BASELINE 66
#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
#define FF_PROFILE_H264_MAIN 77
#define FF_PROFILE_H264_EXTENDED 88
#define FF_PROFILE_H264_HIGH 100
#define FF_PROFILE_H264_HIGH_10 110
#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
#define FF_PROFILE_H264_HIGH_422 122
#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_STEREO_HIGH 128
#define FF_PROFILE_H264_HIGH_444 144
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_CAVLC_444 44
#define FF_PROFILE_VC1_SIMPLE 0
#define FF_PROFILE_VC1_MAIN 1
#define FF_PROFILE_VC1_COMPLEX 2
#define FF_PROFILE_VC1_ADVANCED 3
#define FF_PROFILE_MPEG4_SIMPLE 0
#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
#define FF_PROFILE_MPEG4_CORE 2
#define FF_PROFILE_MPEG4_MAIN 3
#define FF_PROFILE_MPEG4_N_BIT 4
#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
#define FF_PROFILE_MPEG4_HYBRID 8
#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
#define FF_PROFILE_VP9_0 0
#define FF_PROFILE_VP9_1 1
#define FF_PROFILE_VP9_2 2
#define FF_PROFILE_VP9_3 3
#define FF_PROFILE_HEVC_MAIN 1
#define FF_PROFILE_HEVC_MAIN_10 2
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
#define FF_PROFILE_HEVC_REXT 4
#define FF_PROFILE_HEVC_SCC 9
#define FF_PROFILE_VVC_MAIN_10 1
#define FF_PROFILE_VVC_MAIN_10_444 33
#define FF_PROFILE_AV1_MAIN 0
#define FF_PROFILE_AV1_HIGH 1
#define FF_PROFILE_AV1_PROFESSIONAL 2
#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
#define FF_PROFILE_SBC_MSBC 1
#define FF_PROFILE_PRORES_PROXY 0
#define FF_PROFILE_PRORES_LT 1
#define FF_PROFILE_PRORES_STANDARD 2
#define FF_PROFILE_PRORES_HQ 3
#define FF_PROFILE_PRORES_4444 4
#define FF_PROFILE_PRORES_XQ 5
#define FF_PROFILE_ARIB_PROFILE_A 0
#define FF_PROFILE_ARIB_PROFILE_C 1
#define FF_PROFILE_KLVA_SYNC 0
#define FF_PROFILE_KLVA_ASYNC 1
#define FF_PROFILE_EVC_BASELINE 0
#define FF_PROFILE_EVC_MAIN 1
#endif
/**
* Encoding level descriptor.
* - encoding: Set by user, corresponds to a specific level defined by the
* codec, usually corresponding to the profile level, if not specified it
* is set to FF_LEVEL_UNKNOWN.
* is set to AV_LEVEL_UNKNOWN.
* - decoding: Set by libavcodec.
* See AV_LEVEL_* in defs.h.
*/
int level;
#if FF_API_FF_PROFILE_LEVEL
/** @deprecated The following define is deprecated; use AV_LEVEL_UNKOWN
* in defs.h instead. */
#define FF_LEVEL_UNKNOWN -99
#endif
#if FF_API_CODEC_PROPS
/**
* Properties of the stream that gets decoded
* - encoding: unused
* - decoding: set by libavcodec
*/
attribute_deprecated
unsigned properties;
#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004
#endif
/**
* Skip loop filtering for selected frames.
@ -1884,8 +1727,13 @@ typedef struct AVCodecContext {
* For SUBTITLE_ASS subtitle type, it should contain the whole ASS
* [Script Info] and [V4+ Styles] section, plus the [Events] line and
* the Format line following. It shouldn't include any Dialogue line.
* - encoding: Set/allocated/freed by user (before avcodec_open2())
* - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
*
* - encoding: May be set by the caller before avcodec_open2() to an array
* allocated with the av_malloc() family of functions.
* - decoding: May be set by libavcodec in avcodec_open2().
*
* After being set, the array is owned by the codec and freed in
* avcodec_free_context().
*/
int subtitle_header_size;
uint8_t *subtitle_header;
@ -2071,7 +1919,7 @@ typedef struct AVCodecContext {
* - encoding: may be set by user before calling avcodec_open2() for
* encoder configuration. Afterwards owned and freed by the
* encoder.
* - decoding: unused
* - decoding: may be set by libavcodec in avcodec_open2().
*/
AVFrameSideData **decoded_side_data;
int nb_decoded_side_data;
@ -2369,24 +2217,6 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
*/
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
#if FF_API_AVCODEC_CLOSE
/**
* Close a given AVCodecContext and free all the data associated with it
* (but not the AVCodecContext itself).
*
* Calling this function on an AVCodecContext that hasn't been opened will free
* the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
* codec. Subsequent calls will do nothing.
*
* @deprecated Do not use this function. Use avcodec_free_context() to destroy a
* codec context (either open or closed). Opening and closing a codec context
* multiple times is not supported anymore -- use multiple codec contexts
* instead.
*/
attribute_deprecated
int avcodec_close(AVCodecContext *avctx);
#endif
/**
* Free all allocated data in the given subtitle struct.
*
@ -2690,6 +2520,36 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
enum AVPixelFormat hw_pix_fmt,
AVBufferRef **out_frames_ref);
enum AVCodecConfig {
AV_CODEC_CONFIG_PIX_FORMAT, ///< AVPixelFormat, terminated by AV_PIX_FMT_NONE
AV_CODEC_CONFIG_FRAME_RATE, ///< AVRational, terminated by {0, 0}
AV_CODEC_CONFIG_SAMPLE_RATE, ///< int, terminated by 0
AV_CODEC_CONFIG_SAMPLE_FORMAT, ///< AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE
AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0}
AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED
AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED
};
/**
* Retrieve a list of all supported values for a given configuration type.
*
* @param avctx An optional context to use. Values such as
* `strict_std_compliance` may affect the result. If NULL,
* default values are used.
* @param codec The codec to query, or NULL to use avctx->codec.
* @param config The configuration to query.
* @param flags Currently unused; should be set to zero.
* @param out_configs On success, set to a list of configurations, terminated
* by a config-specific terminator, or NULL if all
* possible values are supported.
* @param out_num_configs On success, set to the number of elements in
*out_configs, excluding the terminator. Optional.
*/
int avcodec_get_supported_config(const AVCodecContext *avctx,
const AVCodec *codec, enum AVCodecConfig config,
unsigned flags, const void **out_configs,
int *out_num_configs);
/**
@ -3040,7 +2900,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
*
* @note for encoders, this function will only do something if the encoder
* declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder
* will drain any remaining packets, and can then be re-used for a different
* will drain any remaining packets, and can then be reused for a different
* stream (as opposed to sending a null frame which will leave the encoder
* in a permanent EOF state after draining). This can be desirable if the
* cost of tearing down and replacing the encoder instance is high.
@ -3075,8 +2935,8 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
/**
* @return a positive value if s is open (i.e. avcodec_open2() was called on it
* with no corresponding avcodec_close()), 0 otherwise.
* @return a positive value if s is open (i.e. avcodec_open2() was called on it),
* 0 otherwise.
*/
int avcodec_is_open(AVCodecContext *s);

View File

@ -80,21 +80,6 @@
*/
#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
#if FF_API_SUBFRAMES
/**
* Codec can output multiple frames per AVPacket
* Normally demuxers return one frame at a time, demuxers which do not do
* are connected to a parser to split what they return into proper frames.
* This flag is reserved to the very rare category of codecs which have a
* bitstream that cannot be split into frames without timeconsuming
* operations like full decoding. Demuxers carrying such bitstreams thus
* may return multiple frames in a packet. This has many disadvantages like
* prohibiting stream copy in many cases thus it should only be considered
* as a last resort.
*/
#define AV_CODEC_CAP_SUBFRAMES (1 << 8)
#endif
/**
* Codec is experimental and is thus avoided in favor of non experimental
* encoders
@ -205,10 +190,19 @@ typedef struct AVCodec {
*/
int capabilities;
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
/**
* Deprecated codec capabilities.
*/
attribute_deprecated
const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config()
attribute_deprecated
const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config()
attribute_deprecated
const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config()
attribute_deprecated
const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config()
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
@ -226,7 +220,9 @@ typedef struct AVCodec {
/**
* Array of supported channel layouts, terminated with a zeroed layout.
* @deprecated use avcodec_get_supported_config()
*/
attribute_deprecated
const AVChannelLayout *ch_layouts;
} AVCodec;

View File

@ -206,7 +206,9 @@ enum AVCodecID {
AV_CODEC_ID_BMV_VIDEO,
AV_CODEC_ID_VBLE,
AV_CODEC_ID_DXTORY,
#if FF_API_V408_CODECID
AV_CODEC_ID_V410,
#endif
AV_CODEC_ID_XWD,
AV_CODEC_ID_CDXL,
AV_CODEC_ID_XBM,
@ -254,8 +256,10 @@ enum AVCodecID {
AV_CODEC_ID_012V,
AV_CODEC_ID_AVUI,
AV_CODEC_ID_TARGA_Y216,
#if FF_API_V408_CODECID
AV_CODEC_ID_V308,
AV_CODEC_ID_V408,
#endif
AV_CODEC_ID_YUV4,
AV_CODEC_ID_AVRN,
AV_CODEC_ID_CPIA,
@ -322,6 +326,11 @@ enum AVCodecID {
AV_CODEC_ID_RTV1,
AV_CODEC_ID_VMIX,
AV_CODEC_ID_LEAD,
AV_CODEC_ID_DNXUC,
AV_CODEC_ID_RV60,
AV_CODEC_ID_JPEGXL_ANIM,
AV_CODEC_ID_APV,
AV_CODEC_ID_PRORES_RAW,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
@ -416,6 +425,8 @@ enum AVCodecID {
AV_CODEC_ID_ADPCM_IMA_MOFLEX,
AV_CODEC_ID_ADPCM_IMA_ACORN,
AV_CODEC_ID_ADPCM_XMD,
AV_CODEC_ID_ADPCM_IMA_XBOX,
AV_CODEC_ID_ADPCM_SANYO,
/* AMR */
AV_CODEC_ID_AMR_NB = 0x12000,
@ -543,6 +554,8 @@ enum AVCodecID {
AV_CODEC_ID_AC4,
AV_CODEC_ID_OSQ,
AV_CODEC_ID_QOA,
AV_CODEC_ID_LC3,
AV_CODEC_ID_G728,
/* subtitle codecs */
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
@ -572,6 +585,7 @@ enum AVCodecID {
AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
AV_CODEC_ID_TTML,
AV_CODEC_ID_ARIB_CAPTION,
AV_CODEC_ID_IVTV_VBI,
/* other specific kind of codecs (generally used for attachments) */
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
@ -588,6 +602,8 @@ enum AVCodecID {
AV_CODEC_ID_TIMED_ID3,
AV_CODEC_ID_BIN_DATA,
AV_CODEC_ID_SMPTE_2038,
AV_CODEC_ID_LCEVC,
AV_CODEC_ID_SMPTE_436M_ANC,
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it

View File

@ -148,7 +148,7 @@ typedef struct AVCodecParameters {
* durations. Should be set to { 0, 1 } when some frames have differing
* durations or if the value is not known.
*
* @note This field correponds to values that are stored in codec-level
* @note This field corresponds to values that are stored in codec-level
* headers and is typically overridden by container/transport-layer
* timestamps, when available. It should thus be used only as a last resort,
* when no higher-level timing information is available.

View File

@ -73,6 +73,7 @@
#define AV_PROFILE_AAC_HE_V2 28
#define AV_PROFILE_AAC_LD 22
#define AV_PROFILE_AAC_ELD 38
#define AV_PROFILE_AAC_USAC 41
#define AV_PROFILE_MPEG2_AAC_LOW 128
#define AV_PROFILE_MPEG2_AAC_HE 131
@ -159,6 +160,7 @@
#define AV_PROFILE_HEVC_MAIN_10 2
#define AV_PROFILE_HEVC_MAIN_STILL_PICTURE 3
#define AV_PROFILE_HEVC_REXT 4
#define AV_PROFILE_HEVC_MULTIVIEW_MAIN 6
#define AV_PROFILE_HEVC_SCC 9
#define AV_PROFILE_VVC_MAIN_10 1
@ -183,6 +185,9 @@
#define AV_PROFILE_PRORES_4444 4
#define AV_PROFILE_PRORES_XQ 5
#define AV_PROFILE_PRORES_RAW 0
#define AV_PROFILE_PRORES_RAW_HQ 1
#define AV_PROFILE_ARIB_PROFILE_A 0
#define AV_PROFILE_ARIB_PROFILE_C 1
@ -192,6 +197,14 @@
#define AV_PROFILE_EVC_BASELINE 0
#define AV_PROFILE_EVC_MAIN 1
#define AV_PROFILE_APV_422_10 33
#define AV_PROFILE_APV_422_12 44
#define AV_PROFILE_APV_444_10 55
#define AV_PROFILE_APV_444_12 66
#define AV_PROFILE_APV_4444_10 77
#define AV_PROFILE_APV_4444_12 88
#define AV_PROFILE_APV_400_10 99
#define AV_LEVEL_UNKNOWN -99
@ -323,6 +336,20 @@ typedef struct AVProducerReferenceTime {
int flags;
} AVProducerReferenceTime;
/**
* RTCP SR (Sender Report) information
*
* The received sender report information for an RTSP
* stream, exposed as AV_PKT_DATA_RTCP_SR side data.
*/
typedef struct AVRTCPSenderReport {
uint32_t ssrc; ///< Synchronization source identifier
uint64_t ntp_timestamp; ///< NTP time when the report was sent
uint32_t rtp_timestamp; ///< RTP time when the report was sent
uint32_t sender_nb_packets; ///< Total number of packets sent
uint32_t sender_nb_bytes; ///< Total number of bytes sent (excluding headers or padding)
} AVRTCPSenderReport;
/**
* Encode extradata length to a buffer. Used by xiph codecs.
*

View File

@ -59,10 +59,6 @@ enum AVPacketSideDataType {
* An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
* @code
* u32le param_flags
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
* s32le channel_count
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
* u64le channel_layout
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
* s32le sample_rate
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
@ -146,7 +142,7 @@ enum AVPacketSideDataType {
AV_PKT_DATA_CPB_PROPERTIES,
/**
* Recommmends skipping the specified number of samples
* Recommends skipping the specified number of samples
* @code
* u32le number of samples to skip from start of this packet
* u32le number of samples to skip from end of this packet
@ -330,6 +326,42 @@ enum AVPacketSideDataType {
*/
AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,
/**
* The number of pixels to discard from the top/bottom/left/right border of the
* decoded frame to obtain the sub-rectangle intended for presentation.
*
* @code
* u32le crop_top
* u32le crop_bottom
* u32le crop_left
* u32le crop_right
* @endcode
*/
AV_PKT_DATA_FRAME_CROPPING,
/**
* Raw LCEVC payload data, as a uint8_t array, with NAL emulation
* bytes intact.
*/
AV_PKT_DATA_LCEVC,
/**
* This side data contains information about the reference display width(s)
* and reference viewing distance(s) as well as information about the
* corresponding reference stereo pair(s), i.e., the pair(s) of views to be
* displayed for the viewer's left and right eyes on the reference display
* at the reference viewing distance.
* The payload is the AV3DReferenceDisplaysInfo struct defined in
* libavutil/tdrdi.h.
*/
AV_PKT_DATA_3D_REFERENCE_DISPLAYS,
/**
* Contains the last received RTCP SR (Sender Report) information
* in the form of the AVRTCPSenderReport struct.
*/
AV_PKT_DATA_RTCP_SR,
/**
* The number of side data types.
* This is not part of the public API/ABI in the sense that it may
@ -341,8 +373,6 @@ enum AVPacketSideDataType {
AV_PKT_DATA_NB
};
#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
/**
* This structure stores auxiliary information for decoding, presenting, or
* otherwise processing the coded stream. It is typically exported by demuxers
@ -351,11 +381,11 @@ enum AVPacketSideDataType {
*
* Global side data is handled as follows:
* - During demuxing, it may be exported through
* @ref AVStream.codecpar.side_data "AVStream's codec parameters", which can
* @ref AVCodecParameters.coded_side_data "AVStream's codec parameters", which can
* then be passed as input to decoders through the
* @ref AVCodecContext.coded_side_data "decoder context's side data", for
* initialization.
* - For muxing, it can be fed through @ref AVStream.codecpar.side_data
* - For muxing, it can be fed through @ref AVCodecParameters.coded_side_data
* "AVStream's codec parameters", typically the output of encoders through
* the @ref AVCodecContext.coded_side_data "encoder context's side data", for
* initialization.
@ -863,6 +893,13 @@ int av_packet_make_writable(AVPacket *pkt);
*/
void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
/**
* Allocate an AVContainerFifo instance for AVPacket.
*
* @param flags currently unused
*/
struct AVContainerFifo *av_container_fifo_alloc_avpacket(unsigned flags);
/**
* @}
*/

View File

@ -93,28 +93,6 @@ typedef struct AVVDPAUContext {
AVVDPAU_Render2 render2;
} AVVDPAUContext;
#if FF_API_VDPAU_ALLOC_GET_SET
/**
* @brief allocation function for AVVDPAUContext
*
* Allows extending the struct without breaking API/ABI
* @deprecated use av_vdpau_bind_context() instead
*/
attribute_deprecated
AVVDPAUContext *av_alloc_vdpaucontext(void);
/**
* @deprecated render2 is public and can be accessed directly
*/
attribute_deprecated
AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
/**
* @deprecated render2 is public and can be accessed directly
*/
attribute_deprecated
void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
#endif
/**
* Associate a VDPAU device with a codec context for hardware acceleration.
* This function is meant to be called from the get_format() codec callback,
@ -155,17 +133,6 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
uint32_t *width, uint32_t *height);
#if FF_API_VDPAU_ALLOC_GET_SET
/**
* Allocate an AVVDPAUContext.
*
* @return Newly-allocated AVVDPAUContext or NULL on failure.
* @deprecated use av_vdpau_bind_context() instead
*/
attribute_deprecated
AVVDPAUContext *av_vdpau_alloc_context(void);
#endif
/** @} */
#endif /* AVCODEC_VDPAU_H */

View File

@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 3
#define LIBAVCODEC_VERSION_MINOR 11
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -25,7 +25,7 @@
* Libavcodec version macros.
*/
#define LIBAVCODEC_VERSION_MAJOR 61
#define LIBAVCODEC_VERSION_MAJOR 62
/**
* FF_API_* defines may be placed below to indicate public API that will be
@ -37,15 +37,19 @@
* at once through the bump. This improves the git bisect-ability of the change.
*/
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_SUBFRAMES (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_TICKS_PER_FRAME (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_DROPCHANGED (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_AVFFT (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove the OMX encoder on next major bump
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic decoder on next-next major bump
#define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 63)
#endif /* AVCODEC_VERSION_MAJOR_H */

View File

@ -146,8 +146,8 @@
* consumed). The calling program can handle such unrecognized options as it
* wishes, e.g.
* @code
* AVDictionaryEntry *e;
* if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
* const AVDictionaryEntry *e;
* if ((e = av_dict_iterate(options, NULL))) {
* fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
* abort();
* }
@ -459,7 +459,7 @@ typedef struct AVProbeData {
#define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1)
#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension
#define AVPROBE_SCORE_MIME 75 ///< score for file mime type
#define AVPROBE_SCORE_MIME_BONUS 30 ///< score added for matching mime type
#define AVPROBE_SCORE_MAX 100 ///< maximum score
#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
@ -470,8 +470,7 @@ typedef struct AVProbeData {
/**
* The muxer/demuxer is experimental and should be used with caution.
*
* - demuxers: will not be selected automatically by probing, must be specified
* explicitly.
* It will not be selected automatically, and must be specified explicitly.
*/
#define AVFMT_EXPERIMENTAL 0x0004
#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */
@ -485,9 +484,6 @@ typedef struct AVProbeData {
#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */
#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */
#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */
#if FF_API_ALLOW_FLUSH
#define AVFMT_ALLOW_FLUSH 0x10000 /**< @deprecated: Just send a NULL packet if you want to flush a muxer. */
#endif
#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly
increasing timestamps, but they must
still be monotonic */
@ -713,6 +709,11 @@ typedef struct AVIndexEntry {
* The video stream contains still images.
*/
#define AV_DISPOSITION_STILL_IMAGE (1 << 20)
/**
* The video stream contains multiple layers, e.g. stereoscopic views (cf. H.264
* Annex G/H, or HEVC Annex F).
*/
#define AV_DISPOSITION_MULTILAYER (1 << 21)
/**
* @return The AV_DISPOSITION_* flag corresponding to disp or a negative error
@ -842,38 +843,6 @@ typedef struct AVStream {
*/
AVPacket attached_pic;
#if FF_API_AVSTREAM_SIDE_DATA
/**
* An array of side data that applies to the whole stream (i.e. the
* container does not allow it to change between packets).
*
* There may be no overlap between the side data in this array and side data
* in the packets. I.e. a given side data is either exported by the muxer
* (demuxing) / set by the caller (muxing) in this array, then it never
* appears in the packets, or the side data is exported / sent through
* the packets (always in the first packet where the value becomes known or
* changes), then it does not appear in this array.
*
* - demuxing: Set by libavformat when the stream is created.
* - muxing: May be set by the caller before avformat_write_header().
*
* Freed by libavformat in avformat_free_context().
*
* @deprecated use AVStream's @ref AVCodecParameters.coded_side_data
* "codecpar side data".
*/
attribute_deprecated
AVPacketSideData *side_data;
/**
* The number of elements in the AVStream.side_data array.
*
* @deprecated use AVStream's @ref AVCodecParameters.nb_coded_side_data
* "codecpar side data".
*/
attribute_deprecated
int nb_side_data;
#endif
/**
* Flags indicating events happening on the stream, a combination of
* AVSTREAM_EVENT_FLAG_*.
@ -957,7 +926,7 @@ typedef struct AVStream {
* the sixth @ref AVStreamGroup.streams "stream" in the group is "512,512",
* etc.
*
* The following is an example of a canvas with overlaping tiles:
* The following is an example of a canvas with overlapping tiles:
*
* +-----------+
* | %%%%% |
@ -1077,13 +1046,52 @@ typedef struct AVStreamGroupTileGrid {
* final image before presentation.
*/
int height;
/**
* Additional data associated with the grid.
*
* Should be allocated with av_packet_side_data_new() or
* av_packet_side_data_add(), and will be freed by avformat_free_context().
*/
AVPacketSideData *coded_side_data;
/**
* Amount of entries in @ref coded_side_data.
*/
int nb_coded_side_data;
} AVStreamGroupTileGrid;
/**
* AVStreamGroupLCEVC is meant to define the relation between video streams
* and a data stream containing LCEVC enhancement layer NALUs.
*
* No more than one stream of @ref AVCodecParameters.codec_type "codec_type"
* AVMEDIA_TYPE_DATA shall be present, and it must be of
* @ref AVCodecParameters.codec_id "codec_id" AV_CODEC_ID_LCEVC.
*/
typedef struct AVStreamGroupLCEVC {
const AVClass *av_class;
/**
* Index of the LCEVC data stream in AVStreamGroup.
*/
unsigned int lcevc_index;
/**
* Width of the final stream for presentation.
*/
int width;
/**
* Height of the final image for presentation.
*/
int height;
} AVStreamGroupLCEVC;
enum AVStreamGroupParamsType {
AV_STREAM_GROUP_PARAMS_NONE,
AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT,
AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION,
AV_STREAM_GROUP_PARAMS_TILE_GRID,
AV_STREAM_GROUP_PARAMS_LCEVC,
};
struct AVIAMFAudioElement;
@ -1125,6 +1133,7 @@ typedef struct AVStreamGroup {
struct AVIAMFAudioElement *iamf_audio_element;
struct AVIAMFMixPresentation *iamf_mix_presentation;
struct AVStreamGroupTileGrid *tile_grid;
struct AVStreamGroupLCEVC *lcevc;
} params;
/**
@ -1411,7 +1420,7 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input.
#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the filling code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible
#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted
@ -1425,9 +1434,6 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_BITEXACT 0x0400
#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
#if FF_API_LAVF_SHORTEST
#define AVFMT_FLAG_SHORTEST 0x100000 ///< Stop muxing when the shortest stream stops.
#endif
#define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as requested by the muxer
/**
@ -1439,7 +1445,7 @@ typedef struct AVFormatContext {
*
* @note this is \e not used for determining the \ref AVInputFormat
* "input format"
* @sa format_probesize
* @see format_probesize
*/
int64_t probesize;
@ -1664,9 +1670,11 @@ typedef struct AVFormatContext {
int use_wallclock_as_timestamps;
/**
* Skip duration calcuation in estimate_timings_from_pts.
* Skip duration calculation in estimate_timings_from_pts.
* - encoding: unused
* - decoding: set by user
*
* @see duration_probesize
*/
int skip_estimate_duration_from_pts;
@ -1729,7 +1737,7 @@ typedef struct AVFormatContext {
*
* Demuxing only, set by the caller before avformat_open_input().
*
* @sa probesize
* @see probesize
*/
int format_probesize;
@ -1765,7 +1773,7 @@ typedef struct AVFormatContext {
/**
* IO repositioned flag.
* This is set by avformat when the underlaying IO context read pointer
* This is set by avformat when the underlying IO context read pointer
* is repositioned, for example when doing byte based seeking.
* Demuxers can use the flag to detect such changes.
*/
@ -1861,40 +1869,23 @@ typedef struct AVFormatContext {
/**
* A callback for closing the streams opened with AVFormatContext.io_open().
*
* Using this is preferred over io_close, because this can return an error.
* Therefore this callback is used instead of io_close by the generic
* libavformat code if io_close is NULL or the default.
*
* @param s the format context
* @param pb IO context to be closed and freed
* @return 0 on success, a negative AVERROR code on failure
*/
int (*io_close2)(struct AVFormatContext *s, AVIOContext *pb);
/**
* Maximum number of bytes read from input in order to determine stream durations
* when using estimate_timings_from_pts in avformat_find_stream_info().
* Demuxing only, set by the caller before avformat_find_stream_info().
* Can be set to 0 to let avformat choose using a heuristic.
*
* @see skip_estimate_duration_from_pts
*/
int64_t duration_probesize;
} AVFormatContext;
/**
* This function will cause global side data to be injected in the next packet
* of each stream as well as after any subsequent seek.
*
* @note global side data is always available in every AVStream's
* @ref AVCodecParameters.coded_side_data "codecpar side data" array, and
* in a @ref AVCodecContext.coded_side_data "decoder's side data" array if
* initialized with said stream's codecpar.
* @see av_packet_side_data_get()
*/
void av_format_inject_global_side_data(AVFormatContext *s);
#if FF_API_GET_DUR_ESTIMATE_METHOD
/**
* Returns the method used to set ctx->duration.
*
* @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE.
* @deprecated duration_estimation_method is public and can be read directly.
*/
attribute_deprecated
enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx);
#endif
/**
* @defgroup lavf_core Core functions
* @ingroup libavf
@ -2072,57 +2063,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const struct AVCodec *c);
*/
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st);
#if FF_API_AVSTREAM_SIDE_DATA
/**
* 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.
* @deprecated use av_packet_side_data_add() with the stream's
* @ref AVCodecParameters.coded_side_data "codecpar side data"
*/
attribute_deprecated
int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
uint8_t *data, size_t size);
/**
* Allocate new information from stream.
*
* @param stream stream
* @param type desired side information type
* @param size side information size
*
* @return pointer to fresh allocated data or NULL otherwise
* @deprecated use av_packet_side_data_new() with the stream's
* @ref AVCodecParameters.coded_side_data "codecpar side data"
*/
attribute_deprecated
uint8_t *av_stream_new_side_data(AVStream *stream,
enum AVPacketSideDataType type, size_t size);
/**
* Get side information from stream.
*
* @param stream stream
* @param type desired side information type
* @param size If supplied, *size will be set to the size of the side data
* or to zero if the desired side data is not present.
*
* @return pointer to data if present or NULL otherwise
* @deprecated use av_packet_side_data_get() with the stream's
* @ref AVCodecParameters.coded_side_data "codecpar side data"
*/
attribute_deprecated
uint8_t *av_stream_get_side_data(const AVStream *stream,
enum AVPacketSideDataType type, size_t *size);
#endif
AVProgram *av_new_program(AVFormatContext *s, int id);
/**
@ -2231,7 +2171,7 @@ int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt,
* which case an AVFormatContext is allocated by this
* function and written into ps.
* Note that a user-supplied AVFormatContext will be freed
* on failure.
* on failure and its pointer set to NULL.
* @param url URL of the stream to open.
* @param fmt If non-NULL, this parameter forces a specific input format.
* Otherwise the format is autodetected.
@ -2240,7 +2180,8 @@ int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt,
* On return this parameter will be destroyed and replaced with
* a dict containing options that were not found. May be NULL.
*
* @return 0 on success, a negative AVERROR on failure.
* @return 0 on success; on failure: frees ps, sets its pointer to NULL,
* and returns a negative AVERROR.
*
* @note If you want to use custom IO, preallocate the format context and set its pb field.
*/
@ -3030,6 +2971,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
int avformat_queue_attached_pictures(AVFormatContext *s);
#if FF_API_INTERNAL_TIMING
enum AVTimebaseSource {
AVFMT_TBCF_AUTO = -1,
AVFMT_TBCF_DECODER,
@ -3040,25 +2982,20 @@ enum AVTimebaseSource {
};
/**
* Transfer internal timing information from one stream to another.
*
* This function is useful when doing stream copy.
*
* @param ofmt target output format for ost
* @param ost output stream which needs timings copy and adjustments
* @param ist reference input stream to copy timings from
* @param copy_tb define from where the stream codec timebase needs to be imported
* @deprecated do not call this function
*/
attribute_deprecated
int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
AVStream *ost, const AVStream *ist,
enum AVTimebaseSource copy_tb);
/**
* Get the internal codec timebase from a stream.
*
* @param st input stream to extract the timebase from
* @deprecated do not call this function
*/
attribute_deprecated
AVRational av_stream_get_codec_timebase(const AVStream *st);
#endif
/**
* @}

View File

@ -31,7 +31,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 1
#define LIBAVFORMAT_VERSION_MINOR 3
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

View File

@ -29,7 +29,7 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 61
#define LIBAVFORMAT_VERSION_MAJOR 62
/**
* FF_API_* defines may be placed below to indicate public API that will be
@ -41,12 +41,11 @@
* at once through the bump. This improves the git bisect-ability of the change.
*
*/
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_ALLOW_FLUSH (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_AVSTREAM_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 63)
#define FF_API_GET_DUR_ESTIMATE_METHOD (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_INTERNAL_TIMING (LIBAVFORMAT_VERSION_MAJOR < 63)
#define FF_API_NO_DEFAULT_TLS_VERIFY (LIBAVFORMAT_VERSION_MAJOR < 63)
#define FF_API_R_FRAME_RATE 1

View File

@ -159,9 +159,11 @@
#if defined(__GNUC__) || defined(__clang__)
# define av_builtin_constant_p __builtin_constant_p
# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
# define av_scanf_format(fmtpos, attrpos) __attribute__((__format__(__scanf__, fmtpos, attrpos)))
#else
# define av_builtin_constant_p(x) 0
# define av_printf_format(fmtpos, attrpos)
# define av_scanf_format(fmtpos, attrpos)
#endif
#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)

View File

@ -31,6 +31,7 @@
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
#endif
#include "attributes.h"
#include "log.h"
#include "macros.h"
@ -75,4 +76,48 @@
*/
void av_assert0_fpu(void);
/**
* Asserts that are used as compiler optimization hints depending
* upon ASSERT_LEVEL and NBDEBUG.
*
* Undefined behaviour occurs if execution reaches a point marked
* with av_unreachable() or if a condition used with av_assume()
* is false.
*
* The condition used with av_assume() should not have side-effects
* and should be visible to the compiler.
*/
#if defined(ASSERT_LEVEL) ? ASSERT_LEVEL > 0 : !defined(HAVE_AV_CONFIG_H) && !defined(NDEBUG)
#define av_unreachable(msg) \
do { \
av_log(NULL, AV_LOG_PANIC, \
"Reached supposedly unreachable code at %s:%d: %s\n", \
__FILE__, __LINE__, msg); \
abort(); \
} while (0)
#define av_assume(cond) av_assert0(cond)
#else
#if AV_GCC_VERSION_AT_LEAST(4, 5) || AV_HAS_BUILTIN(__builtin_unreachable)
#define av_unreachable(msg) __builtin_unreachable()
#elif defined(_MSC_VER)
#define av_unreachable(msg) __assume(0)
#elif __STDC_VERSION__ >= 202311L
#include <stddef.h>
#define av_unreachable(msg) unreachable()
#else
#define av_unreachable(msg) ((void)0)
#endif
#if AV_HAS_BUILTIN(__builtin_assume)
#define av_assume(cond) __builtin_assume(cond)
#elif defined(_MSC_VER)
#define av_assume(cond) __assume(cond)
#else
#define av_assume(cond) do { \
if (!(cond)) \
av_unreachable(); \
} while (0)
#endif
#endif
#endif /* AVUTIL_AVASSERT_H */

View File

@ -419,7 +419,7 @@ int av_match_list(const char *name, const char *list, char separator);
* See libc sscanf manual for more information.
* Locale-independent sscanf implementation.
*/
int av_sscanf(const char *string, const char *format, ...);
int av_sscanf(const char *string, const char *format, ...) av_scanf_format(2, 3);
/**
* @}

View File

@ -41,7 +41,6 @@
* @li @ref lavd "libavdevice" special devices muxing/demuxing library
* @li @ref lavu "libavutil" common utility library
* @li @ref lswr "libswresample" audio resampling, format conversion and mixing
* @li @ref lpp "libpostproc" post processing library
* @li @ref libsws "libswscale" color conversion and scaling library
*
* @section ffmpeg_versioning Versioning and compatibility
@ -314,6 +313,7 @@ static inline void *av_x_if_null(const void *p, const void *x)
return (void *)(intptr_t)(p ? p : x);
}
#if FF_API_OPT_INT_LIST
/**
* Compute the length of an integer list.
*
@ -322,6 +322,7 @@ static inline void *av_x_if_null(const void *p, const void *x)
* @param list pointer to the list
* @return length of the list, in elements, not counting the terminator
*/
attribute_deprecated
unsigned av_int_list_length_for_size(unsigned elsize,
const void *list, uint64_t term) av_pure;
@ -334,6 +335,7 @@ unsigned av_int_list_length_for_size(unsigned elsize,
*/
#define av_int_list_length(list, term) \
av_int_list_length_for_size(sizeof(*(list)), list, term)
#endif
/**
* Return the fractional representation of the internal time base.

View File

@ -34,16 +34,10 @@
#include "config.h"
#if ARCH_AARCH64
# include "aarch64/bswap.h"
#elif ARCH_ARM
#if ARCH_ARM
# include "arm/bswap.h"
#elif ARCH_AVR32
# include "avr32/bswap.h"
#elif ARCH_RISCV
# include "riscv/bswap.h"
#elif ARCH_SH4
# include "sh4/bswap.h"
#elif ARCH_X86
# include "x86/bswap.h"
#endif

View File

@ -45,7 +45,7 @@
*/
enum AVChannel {
///< Invalid channel index
/// Invalid channel index
AV_CHAN_NONE = -1,
AV_CHAN_FRONT_LEFT,
AV_CHAN_FRONT_RIGHT,
@ -79,6 +79,13 @@ enum AVChannel {
AV_CHAN_BOTTOM_FRONT_CENTER,
AV_CHAN_BOTTOM_FRONT_LEFT,
AV_CHAN_BOTTOM_FRONT_RIGHT,
AV_CHAN_SIDE_SURROUND_LEFT, ///< +90 degrees, Lss, SiL
AV_CHAN_SIDE_SURROUND_RIGHT, ///< -90 degrees, Rss, SiR
AV_CHAN_TOP_SURROUND_LEFT, ///< +110 degrees, Lvs, TpLS
AV_CHAN_TOP_SURROUND_RIGHT, ///< -110 degrees, Rvs, TpRS
AV_CHAN_BINAURAL_LEFT = 61,
AV_CHAN_BINAURAL_RIGHT,
/** Channel is empty can be safely skipped. */
AV_CHAN_UNUSED = 0x200,
@ -195,6 +202,12 @@ enum AVChannelOrder {
#define AV_CH_BOTTOM_FRONT_CENTER (1ULL << AV_CHAN_BOTTOM_FRONT_CENTER )
#define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT )
#define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT )
#define AV_CH_SIDE_SURROUND_LEFT (1ULL << AV_CHAN_SIDE_SURROUND_LEFT )
#define AV_CH_SIDE_SURROUND_RIGHT (1ULL << AV_CHAN_SIDE_SURROUND_RIGHT )
#define AV_CH_TOP_SURROUND_LEFT (1ULL << AV_CHAN_TOP_SURROUND_LEFT )
#define AV_CH_TOP_SURROUND_RIGHT (1ULL << AV_CHAN_TOP_SURROUND_RIGHT )
#define AV_CH_BINAURAL_LEFT (1ULL << AV_CHAN_BINAURAL_LEFT )
#define AV_CH_BINAURAL_RIGHT (1ULL << AV_CHAN_BINAURAL_RIGHT )
/**
* @}
@ -227,17 +240,20 @@ enum AVChannelOrder {
#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_5POINT1POINT2 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_5POINT1POINT2_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_CUBE (AV_CH_LAYOUT_QUAD|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
#define AV_CH_LAYOUT_5POINT1POINT4_BACK (AV_CH_LAYOUT_5POINT1POINT2_BACK|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
#define AV_CH_LAYOUT_5POINT1POINT4_BACK (AV_CH_LAYOUT_5POINT1POINT2|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
#define AV_CH_LAYOUT_7POINT1POINT2 (AV_CH_LAYOUT_7POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_7POINT1POINT4_BACK (AV_CH_LAYOUT_7POINT1POINT2|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
#define AV_CH_LAYOUT_7POINT2POINT3 (AV_CH_LAYOUT_7POINT1POINT2|AV_CH_TOP_BACK_CENTER|AV_CH_LOW_FREQUENCY_2)
#define AV_CH_LAYOUT_9POINT1POINT4_BACK (AV_CH_LAYOUT_7POINT1POINT4_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_9POINT1POINT6 (AV_CH_LAYOUT_9POINT1POINT4_BACK|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT)
#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_BINAURAL (AV_CH_BINAURAL_LEFT|AV_CH_BINAURAL_RIGHT)
#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
#define AV_CH_LAYOUT_22POINT2 (AV_CH_LAYOUT_7POINT1POINT4_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY_2|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_CENTER|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_BOTTOM_FRONT_CENTER|AV_CH_BOTTOM_FRONT_LEFT|AV_CH_BOTTOM_FRONT_RIGHT)
#define AV_CH_LAYOUT_22POINT2 (AV_CH_LAYOUT_9POINT1POINT6|AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY_2|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_CENTER|AV_CH_TOP_BACK_CENTER|AV_CH_BOTTOM_FRONT_CENTER|AV_CH_BOTTOM_FRONT_LEFT|AV_CH_BOTTOM_FRONT_RIGHT)
#define AV_CH_LAYOUT_7POINT1_TOP_BACK AV_CH_LAYOUT_5POINT1POINT2_BACK
@ -291,7 +307,7 @@ typedef struct AVChannelCustom {
* - with a constructor function, such as av_channel_layout_default(),
* av_channel_layout_from_mask() or av_channel_layout_from_string().
*
* The channel layout must be unitialized with av_channel_layout_uninit()
* The channel layout must be uninitialized with av_channel_layout_uninit()
*
* Copying an AVChannelLayout via assigning is forbidden,
* av_channel_layout_copy() must be used instead (and its return value should
@ -349,7 +365,7 @@ typedef struct AVChannelLayout {
*
* map[i].name may be filled with a 0-terminated string, in which case
* it will be used for the purpose of identifying the channel with the
* convenience functions below. Otherise it must be zeroed.
* convenience functions below. Otherwise it must be zeroed.
*/
AVChannelCustom *map;
} u;
@ -401,6 +417,7 @@ typedef struct AVChannelLayout {
#define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
#define AV_CHANNEL_LAYOUT_5POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2)
#define AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2_BACK)
#define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
#define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)
@ -409,7 +426,9 @@ typedef struct AVChannelLayout {
#define AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT1POINT4_BACK)
#define AV_CHANNEL_LAYOUT_7POINT2POINT3 AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT2POINT3)
#define AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(14, AV_CH_LAYOUT_9POINT1POINT4_BACK)
#define AV_CHANNEL_LAYOUT_9POINT1POINT6 AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_9POINT1POINT6)
#define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
#define AV_CHANNEL_LAYOUT_BINAURAL AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_BINAURAL)
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)
#define AV_CHANNEL_LAYOUT_22POINT2 AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)
@ -679,6 +698,16 @@ int av_channel_layout_check(const AVChannelLayout *channel_layout);
*/
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1);
/**
* Return the order if the layout is n-th order standard-order ambisonic.
* The presence of optional extra non-diegetic channels at the end is not taken
* into account.
*
* @param channel_layout input channel layout
* @return the order of the layout, a negative error code otherwise.
*/
int av_channel_layout_ambisonic_order(const AVChannelLayout *channel_layout);
/**
* The conversion must be lossless.
*/

View File

@ -42,12 +42,14 @@
#include "attributes.h"
#include "error.h"
#include "macros.h"
#include "mem.h"
#include "version.h"
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
# include "internal.h"
#else
# include "mem.h"
#endif /* HAVE_AV_CONFIG_H */
//rounded division & shift
@ -121,9 +123,6 @@
#ifndef av_clip_uintp2
# define av_clip_uintp2 av_clip_uintp2_c
#endif
#ifndef av_mod_uintp2
# define av_mod_uintp2 av_mod_uintp2_c
#endif
#ifndef av_sat_add32
# define av_sat_add32 av_sat_add32_c
#endif
@ -148,6 +147,9 @@
#ifndef av_clipd
# define av_clipd av_clipd_c
#endif
#ifndef av_zero_extend
# define av_zero_extend av_zero_extend_c
#endif
#ifndef av_popcount
# define av_popcount av_popcount_c
#endif
@ -251,7 +253,7 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a)
*/
static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
{
if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
if ((a+UINT64_C(0x80000000)) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
else return (int32_t)a;
}
@ -263,7 +265,7 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
*/
static av_always_inline av_const int av_clip_intp2_c(int a, int p)
{
if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
if (((unsigned)a + (1U << p)) & ~((2U << p) - 1))
return (a >> 31) ^ ((1 << p) - 1);
else
return a;
@ -277,21 +279,35 @@ static av_always_inline av_const int av_clip_intp2_c(int a, int p)
*/
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
{
if (a & ~((1<<p) - 1)) return (~a) >> 31 & ((1<<p) - 1);
if (a & ~((1U<<p) - 1)) return (~a) >> 31 & ((1U<<p) - 1);
else return a;
}
/**
* Clear high bits from an unsigned integer starting with specific bit position
* @param a value to clip
* @param p bit position to clip at
* @param p bit position to clip at. Must be between 0 and 31.
* @return clipped value
*/
static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
static av_always_inline av_const unsigned av_zero_extend_c(unsigned a, unsigned p)
{
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if (p > 31) abort();
#endif
return a & ((1U << p) - 1);
}
#if FF_API_MOD_UINTP2
#ifndef av_mod_uintp2
# define av_mod_uintp2 av_mod_uintp2_c
#endif
attribute_deprecated
static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
{
return av_zero_extend_c(a, p);
}
#endif
/**
* Add two signed 32-bit values with saturation.
*

View File

@ -22,6 +22,7 @@
#define AVUTIL_CPU_H
#include <stddef.h>
#include "version.h"
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
@ -71,6 +72,8 @@
#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
#define AV_CPU_FLAG_DOTPROD (1 << 8)
#define AV_CPU_FLAG_I8MM (1 << 9)
#define AV_CPU_FLAG_SVE (1 <<10)
#define AV_CPU_FLAG_SVE2 (1 <<11)
#define AV_CPU_FLAG_SETEND (1 <<16)
#define AV_CPU_FLAG_MMI (1 << 0)
@ -82,14 +85,24 @@
// RISC-V extensions
#define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank)
#if FF_API_RISCV_FD_ZBA
#define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP)
#define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP)
#endif
#define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */
#define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */
#define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */
#define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's
#define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations
#if FF_API_RISCV_FD_ZBA
#define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations
#endif
#define AV_CPU_FLAG_RV_ZVBB (1 << 9) ///< Vector basic bit-manipulations
#define AV_CPU_FLAG_RV_MISALIGNED (1 <<10) ///< Fast misaligned accesses
#define AV_CPU_FLAG_RVB (1 <<11) ///< B (bit manipulations)
// WASM extensions
#define AV_CPU_FLAG_SIMD128 (1 << 0)
/**
* Return the flags which specify extensions supported by the CPU.

View File

@ -81,8 +81,12 @@ typedef struct AVColorPrimariesDesc {
} AVColorPrimariesDesc;
/**
* Function pointer representing a double -> double transfer function that performs
* an EOTF transfer inversion. This function outputs linear light.
* Function pointer representing a double -> double transfer function that
* performs either an OETF transfer function, or alternatively an inverse EOTF
* function (in particular, for SMPTE ST 2084 / PQ). This function inputs
* linear light, and outputs gamma encoded light.
*
* See ITU-T H.273 for more information.
*/
typedef double (*av_csp_trc_function)(double);
@ -110,7 +114,7 @@ const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries
* @see enum AVColorPrimaries
* @param prm A description of the colorspace gamut
* @return The enum constant associated with this gamut, or
* AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified.
* AVCOL_PRI_UNSPECIFIED if no clear match can be identified.
*/
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm);
@ -143,6 +147,44 @@ double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc);
*/
av_csp_trc_function av_csp_trc_func_from_id(enum AVColorTransferCharacteristic trc);
/**
* Returns the mathematical inverse of the corresponding TRC function.
*/
av_csp_trc_function av_csp_trc_func_inv_from_id(enum AVColorTransferCharacteristic trc);
/**
* Function pointer representing an ITU EOTF transfer for a given reference
* display configuration.
*
* @param Lw The white point luminance of the display, in nits (cd/m^2).
* @param Lb The black point luminance of the display, in nits (cd/m^2).
*/
typedef void (*av_csp_eotf_function)(double Lw, double Lb, double c[3]);
/**
* Returns the ITU EOTF corresponding to a given TRC. This converts from the
* signal level [0,1] to the raw output display luminance in nits (cd/m^2).
* This is done per channel in RGB space, except for AVCOL_TRC_SMPTE428, which
* assumes CIE XYZ in- and output.
*
* @return A pointer to the function implementing the given TRC, or NULL if no
* such function is defined.
*
* @note In general, the resulting function is defined (wherever possible) for
* out-of-range values, even though these values do not have a physical
* meaning on the given display. Users should clamp inputs (or outputs)
* if this behavior is not desired.
*
* This is also the case for functions like PQ, which are defined over an
* absolute signal range independent of the target display capabilities.
*/
av_csp_eotf_function av_csp_itu_eotf(enum AVColorTransferCharacteristic trc);
/**
* Returns the mathematical inverse of the corresponding EOTF.
*/
av_csp_eotf_function av_csp_itu_eotf_inv(enum AVColorTransferCharacteristic trc);
/**
* @}
*/

View File

@ -82,6 +82,7 @@
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
delimiter is added, the strings are simply concatenated. */
#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
#define AV_DICT_DEDUP 128 /**< If inserting a value that already exists for a key, do nothing. Only relevant with AV_DICT_MULTIKEY. */
/**
* @}
*/
@ -224,7 +225,7 @@ void av_dict_free(AVDictionary **m);
* @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
*
* @param[in] m The dictionary
* @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
* @param[out] buffer Pointer to buffer that will be allocated with string containing entries.
* Buffer must be freed by the caller when is no longer needed.
* @param[in] key_val_sep Character used to separate key from value
* @param[in] pairs_sep Character used to separate two pairs from each other

View File

@ -29,7 +29,9 @@
#include <stdint.h>
#include <stddef.h>
#include "rational.h"
#include "csp.h"
/*
* DOVI configuration
@ -44,6 +46,7 @@
* uint8_t el_present_flag
* uint8_t bl_present_flag
* uint8_t dv_bl_signal_compatibility_id
* uint8_t dv_md_compression, the compression method in use
* @endcode
*
* @note The struct must be allocated with av_dovi_alloc() and
@ -58,8 +61,16 @@ typedef struct AVDOVIDecoderConfigurationRecord {
uint8_t el_present_flag;
uint8_t bl_present_flag;
uint8_t dv_bl_signal_compatibility_id;
uint8_t dv_md_compression;
} AVDOVIDecoderConfigurationRecord;
enum AVDOVICompression {
AV_DOVI_COMPRESSION_NONE = 0,
AV_DOVI_COMPRESSION_LIMITED = 1,
AV_DOVI_COMPRESSION_RESERVED = 2,
AV_DOVI_COMPRESSION_EXTENDED = 3,
};
/**
* Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its
* fields to default values.
@ -89,6 +100,8 @@ typedef struct AVDOVIRpuDataHeader {
uint8_t spatial_resampling_filter_flag;
uint8_t el_spatial_resampling_filter_flag;
uint8_t disable_residual_flag;
uint8_t ext_mapping_idc_0_4; /* extended base layer inverse mapping indicator */
uint8_t ext_mapping_idc_5_7; /* reserved */
} AVDOVIRpuDataHeader;
enum AVDOVIMappingMethod {
@ -147,6 +160,7 @@ typedef struct AVDOVIDataMapping {
uint32_t num_x_partitions;
uint32_t num_y_partitions;
AVDOVINLQParams nlq[3]; /* per component */
uint16_t nlq_pivots[2];
} AVDOVIDataMapping;
/**
@ -186,6 +200,132 @@ typedef struct AVDOVIColorMetadata {
uint16_t source_diagonal;
} AVDOVIColorMetadata;
typedef struct AVDOVIDmLevel1 {
/* Per-frame brightness metadata */
uint16_t min_pq;
uint16_t max_pq;
uint16_t avg_pq;
} AVDOVIDmLevel1;
typedef struct AVDOVIDmLevel2 {
/* Usually derived from level 8 (at different levels) */
uint16_t target_max_pq;
uint16_t trim_slope;
uint16_t trim_offset;
uint16_t trim_power;
uint16_t trim_chroma_weight;
uint16_t trim_saturation_gain;
int16_t ms_weight;
} AVDOVIDmLevel2;
typedef struct AVDOVIDmLevel3 {
uint16_t min_pq_offset;
uint16_t max_pq_offset;
uint16_t avg_pq_offset;
} AVDOVIDmLevel3;
typedef struct AVDOVIDmLevel4 {
uint16_t anchor_pq;
uint16_t anchor_power;
} AVDOVIDmLevel4;
typedef struct AVDOVIDmLevel5 {
/* Active area definition */
uint16_t left_offset;
uint16_t right_offset;
uint16_t top_offset;
uint16_t bottom_offset;
} AVDOVIDmLevel5;
typedef struct AVDOVIDmLevel6 {
/* Static HDR10 metadata */
uint16_t max_luminance;
uint16_t min_luminance;
uint16_t max_cll;
uint16_t max_fall;
} AVDOVIDmLevel6;
typedef struct AVDOVIDmLevel8 {
/* Extended version of level 2 */
uint8_t target_display_index;
uint16_t trim_slope;
uint16_t trim_offset;
uint16_t trim_power;
uint16_t trim_chroma_weight;
uint16_t trim_saturation_gain;
uint16_t ms_weight;
uint16_t target_mid_contrast;
uint16_t clip_trim;
uint8_t saturation_vector_field[6];
uint8_t hue_vector_field[6];
} AVDOVIDmLevel8;
typedef struct AVDOVIDmLevel9 {
/* Source display characteristics */
uint8_t source_primary_index;
AVColorPrimariesDesc source_display_primaries;
} AVDOVIDmLevel9;
typedef struct AVDOVIDmLevel10 {
/* Target display characteristics */
uint8_t target_display_index;
uint16_t target_max_pq;
uint16_t target_min_pq;
uint8_t target_primary_index;
AVColorPrimariesDesc target_display_primaries;
} AVDOVIDmLevel10;
typedef struct AVDOVIDmLevel11 {
uint8_t content_type;
uint8_t whitepoint;
uint8_t reference_mode_flag;
uint8_t sharpness;
uint8_t noise_reduction;
uint8_t mpeg_noise_reduction;
uint8_t frame_rate_conversion;
uint8_t brightness;
uint8_t color;
} AVDOVIDmLevel11;
typedef struct AVDOVIDmLevel254 {
/* DMv2 info block, always present in samples with DMv2 metadata */
uint8_t dm_mode;
uint8_t dm_version_index;
} AVDOVIDmLevel254;
typedef struct AVDOVIDmLevel255 {
/* Debug block, not really used in samples */
uint8_t dm_run_mode;
uint8_t dm_run_version;
uint8_t dm_debug[4];
} AVDOVIDmLevel255;
/**
* Dolby Vision metadata extension block. Dynamic extension blocks may change
* from frame to frame, while static blocks are constant throughout the entire
* sequence.
*
* @note sizeof(AVDOVIDmData) is not part of the public API.
*/
typedef struct AVDOVIDmData {
uint8_t level; /* [1, 255] */
union {
AVDOVIDmLevel1 l1; /* dynamic */
AVDOVIDmLevel2 l2; /* dynamic, may appear multiple times */
AVDOVIDmLevel3 l3; /* dynamic */
AVDOVIDmLevel4 l4; /* dynamic */
AVDOVIDmLevel5 l5; /* dynamic */
AVDOVIDmLevel6 l6; /* static */
/* level 7 is currently unused */
AVDOVIDmLevel8 l8; /* dynamic, may appear multiple times */
AVDOVIDmLevel9 l9; /* dynamic */
AVDOVIDmLevel10 l10; /* static, may appear multiple times */
AVDOVIDmLevel11 l11; /* dynamic */
AVDOVIDmLevel254 l254; /* static */
AVDOVIDmLevel255 l255; /* static */
};
} AVDOVIDmData;
/**
* Combined struct representing a combination of header, mapping and color
* metadata, for attaching to frames as side data.
@ -202,6 +342,13 @@ typedef struct AVDOVIMetadata {
size_t header_offset; /* AVDOVIRpuDataHeader */
size_t mapping_offset; /* AVDOVIDataMapping */
size_t color_offset; /* AVDOVIColorMetadata */
size_t ext_block_offset; /* offset to start of ext blocks array */
size_t ext_block_size; /* size per element */
int num_ext_blocks; /* number of extension blocks */
/* static limit on num_ext_blocks, derived from bitstream limitations */
#define AV_DOVI_MAX_EXT_BLOCKS 32
} AVDOVIMetadata;
static av_always_inline AVDOVIRpuDataHeader *
@ -222,6 +369,19 @@ av_dovi_get_color(const AVDOVIMetadata *data)
return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset);
}
static av_always_inline AVDOVIDmData *
av_dovi_get_ext(const AVDOVIMetadata *data, int index)
{
return (AVDOVIDmData *)((uint8_t *) data + data->ext_block_offset +
data->ext_block_size * index);
}
/**
* Find an extension block with a given level, or NULL. In the case of
* multiple extension blocks, only the first is returned.
*/
AVDOVIDmData *av_dovi_find_level(const AVDOVIMetadata *data, uint8_t level);
/**
* Allocate an AVDOVIMetadata structure and initialize its
* fields to default values.

View File

@ -79,6 +79,7 @@
#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
#define AVERROR_HTTP_TOO_MANY_REQUESTS FFERRTAG(0xF8,'4','2','9')
#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')

View File

@ -26,10 +26,6 @@
#define AVUTIL_FIFO_H
#include <stddef.h>
#include <stdint.h>
#include "attributes.h"
#include "version.h"
/**
* @defgroup lavu_fifo AVFifo

View File

@ -22,7 +22,6 @@
#include <stddef.h>
#include <stdint.h>
#include "version.h"
#include "attributes.h"
/**

View File

@ -124,7 +124,7 @@ typedef struct AVFilmGrainAOMParams {
/**
* This structure describes how to handle film grain synthesis for codecs using
* the ITU-T H.274 Versatile suplemental enhancement information message.
* the ITU-T H.274 Versatile supplemental enhancement information message.
*
* @note The struct must be allocated as part of AVFilmGrainParams using
* av_film_grain_params_alloc(). Its size is not a part of the public ABI.
@ -136,43 +136,6 @@ typedef struct AVFilmGrainH274Params {
*/
int model_id;
#if FF_API_H274_FILM_GRAIN_VCS
/**
* TODO: On this ABI bump, please also re-order the fields in
* AVFilmGrainParams (see below)
*/
/**
* Specifies the bit depth used for the luma component.
*
* @deprecated use AVFilmGrainParams.bit_depth_luma.
*/
attribute_deprecated
int bit_depth_luma;
/**
* Specifies the bit depth used for the chroma components.
*
* @deprecated use AVFilmGrainParams.bit_depth_chroma.
*/
attribute_deprecated
int bit_depth_chroma;
/**
* Specifies the video signal characteristics.
*
* @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}.
*/
attribute_deprecated
enum AVColorRange color_range;
attribute_deprecated
enum AVColorPrimaries color_primaries;
attribute_deprecated
enum AVColorTransferCharacteristic color_trc;
attribute_deprecated
enum AVColorSpace color_space;
#endif
/**
* Specifies the blending mode used to blend the simulated film grain
* with the decoded images.
@ -249,18 +212,6 @@ typedef struct AVFilmGrainParams {
*/
uint64_t seed;
/**
* Additional fields may be added both here and in any structure included.
* If a codec's film grain structure differs slightly over another
* codec's, fields within may change meaning depending on the type.
*
* TODO: Move this to the end of the structure, at the next ABI bump.
*/
union {
AVFilmGrainAOMParams aom;
AVFilmGrainH274Params h274;
} codec;
/**
* Intended display resolution. May be 0 if the codec does not specify
* any restrictions.
@ -287,6 +238,15 @@ typedef struct AVFilmGrainParams {
int bit_depth_luma;
int bit_depth_chroma;
/**
* Additional fields may be added both here and in any structure included.
* If a codec's film grain structure differs slightly over another
* codec's, fields within may change meaning depending on the type.
*/
union {
AVFilmGrainAOMParams aom;
AVFilmGrainH274Params h274;
} codec;
} AVFilmGrainParams;
/**

View File

@ -96,7 +96,7 @@ enum AVFrameSideDataType {
*/
AV_FRAME_DATA_MOTION_VECTORS,
/**
* Recommmends skipping the specified number of samples. This is exported
* Recommends skipping the specified number of samples. This is exported
* only if the "skip_manual" AVOption is set in libavcodec.
* This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
* @code
@ -228,6 +228,32 @@ enum AVFrameSideDataType {
* encoding.
*/
AV_FRAME_DATA_VIDEO_HINT,
/**
* Raw LCEVC payload data, as a uint8_t array, with NAL emulation
* bytes intact.
*/
AV_FRAME_DATA_LCEVC,
/**
* This side data must be associated with a video frame.
* The presence of this side data indicates that the video stream is
* composed of multiple views (e.g. stereoscopic 3D content,
* cf. H.264 Annex H or H.265 Annex G).
* The data is an int storing the view ID.
*/
AV_FRAME_DATA_VIEW_ID,
/**
* This side data contains information about the reference display width(s)
* and reference viewing distance(s) as well as information about the
* corresponding reference stereo pair(s), i.e., the pair(s) of views to be
* displayed for the viewer's left and right eyes on the reference display
* at the reference viewing distance.
* The payload is the AV3DReferenceDisplaysInfo struct defined in
* libavutil/tdrdi.h.
*/
AV_FRAME_DATA_3D_REFERENCE_DISPLAYS,
};
enum AVActiveFormatDescription {
@ -255,6 +281,58 @@ typedef struct AVFrameSideData {
AVBufferRef *buf;
} AVFrameSideData;
enum AVSideDataProps {
/**
* The side data type can be used in stream-global structures.
* Side data types without this property are only meaningful on per-frame
* basis.
*/
AV_SIDE_DATA_PROP_GLOBAL = (1 << 0),
/**
* Multiple instances of this side data type can be meaningfully present in
* a single side data array.
*/
AV_SIDE_DATA_PROP_MULTI = (1 << 1),
/**
* Side data depends on the video dimensions. Side data with this property
* loses its meaning when rescaling or cropping the image, unless
* either recomputed or adjusted to the new resolution.
*/
AV_SIDE_DATA_PROP_SIZE_DEPENDENT = (1 << 2),
/**
* Side data depends on the video color space. Side data with this property
* loses its meaning when changing the video color encoding, e.g. by
* adapting to a different set of primaries or transfer characteristics.
*/
AV_SIDE_DATA_PROP_COLOR_DEPENDENT = (1 << 3),
/**
* Side data depends on the channel layout. Side data with this property
* loses its meaning when downmixing or upmixing, unless either recomputed
* or adjusted to the new layout.
*/
AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT = (1 << 4),
};
/**
* This struct describes the properties of a side data type. Its instance
* corresponding to a given type can be obtained from av_frame_side_data_desc().
*/
typedef struct AVSideDataDescriptor {
/**
* Human-readable side data description.
*/
const char *name;
/**
* Side data property flags, a combination of AVSideDataProps values.
*/
unsigned props;
} AVSideDataDescriptor;
/**
* Structure describing a single Region Of Interest.
*
@ -338,8 +416,7 @@ typedef struct AVRegionOfInterest {
* to the end with a minor bump.
*
* Fields can be accessed through AVOptions, the name string used, matches the
* C structure field name for fields accessible through AVOptions. The AVClass
* for AVFrame can be obtained from avcodec_get_frame_class()
* C structure field name for fields accessible through AVOptions.
*/
typedef struct AVFrame {
#define AV_NUM_DATA_POINTERS 8
@ -430,16 +507,6 @@ typedef struct AVFrame {
*/
int format;
#if FF_API_FRAME_KEY
/**
* 1 -> keyframe, 0-> not
*
* @deprecated Use AV_FRAME_FLAG_KEY instead
*/
attribute_deprecated
int key_frame;
#endif
/**
* Picture type of the frame.
*/
@ -511,32 +578,6 @@ typedef struct AVFrame {
*/
int repeat_pict;
#if FF_API_INTERLACED_FRAME
/**
* The content of the picture is interlaced.
*
* @deprecated Use AV_FRAME_FLAG_INTERLACED instead
*/
attribute_deprecated
int interlaced_frame;
/**
* If the content is interlaced, is top field displayed first.
*
* @deprecated Use AV_FRAME_FLAG_TOP_FIELD_FIRST instead
*/
attribute_deprecated
int top_field_first;
#endif
#if FF_API_PALETTE_HAS_CHANGED
/**
* Tell user application that palette has changed from previous frame.
*/
attribute_deprecated
int palette_has_changed;
#endif
/**
* Sample rate of the audio data.
*/
@ -606,6 +647,14 @@ typedef struct AVFrame {
* is interlaced.
*/
#define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4)
/**
* A decoder can use this flag to mark frames which were originally encoded losslessly.
*
* For coding bitstream formats which support both lossless and lossy
* encoding, it is sometimes possible for a decoder to determine which method
* was used when the bitsream was encoded.
*/
#define AV_FRAME_FLAG_LOSSLESS (1 << 5)
/**
* @}
*/
@ -642,18 +691,6 @@ typedef struct AVFrame {
*/
int64_t best_effort_timestamp;
#if FF_API_FRAME_PKT
/**
* reordered pos from the last AVPacket that has been input into the decoder
* - encoding: unused
* - decoding: Read by user.
* @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user
* data from packets to frames
*/
attribute_deprecated
int64_t pkt_pos;
#endif
/**
* metadata.
* - encoding: Set by user.
@ -674,20 +711,6 @@ typedef struct AVFrame {
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
#define FF_DECODE_ERROR_DECODE_SLICES 8
#if FF_API_FRAME_PKT
/**
* size of the corresponding packet containing the compressed
* frame.
* It is set to a negative value if unknown.
* - encoding: unused
* - decoding: set by libavcodec, read by user.
* @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user
* data from packets to frames
*/
attribute_deprecated
int pkt_size;
#endif
/**
* For hwaccel-format frames, this should be a reference to the
* AVHWFramesContext describing the frame.
@ -727,17 +750,13 @@ typedef struct AVFrame {
*/
/**
* AVBufferRef for internal use by a single libav* library.
* RefStruct reference for internal use by a single libav* library.
* Must not be used to transfer data between libraries.
* Has to be NULL when ownership of the frame leaves the respective library.
*
* Code outside the FFmpeg libs should never check or change the contents of the buffer ref.
*
* FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
* av_frame_copy_props() calls create a new reference with av_buffer_ref()
* for the target frame's private_ref field.
* Code outside the FFmpeg libs must never check or change private_ref.
*/
AVBufferRef *private_ref;
void *private_ref;
/**
* Channel layout of the audio data.
@ -842,9 +861,10 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
* cases.
*
* @param frame frame in which to store the new buffers.
* @param align Required buffer size alignment. If equal to 0, alignment will be
* chosen automatically for the current CPU. It is highly
* recommended to pass 0 here unless you know what you are doing.
* @param align Required buffer size and data pointer alignment. If equal to 0,
* alignment will be chosen automatically for the current CPU.
* It is highly recommended to pass 0 here unless you know what
* you are doing.
*
* @return 0 on success, a negative AVERROR on error.
*/
@ -992,6 +1012,12 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
*/
const char *av_frame_side_data_name(enum AVFrameSideDataType type);
/**
* @return side data descriptor corresponding to a given side data type, NULL
* when not available.
*/
const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type);
/**
* Free all side data entries and their contents, then zeroes out the
* values which the pointers are pointing to.
@ -1003,7 +1029,20 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type);
*/
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
/**
* Remove existing entries before adding new ones.
*/
#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0)
/**
* Don't add a new entry if another of the same type exists.
* Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop.
*/
#define AV_FRAME_SIDE_DATA_FLAG_REPLACE (1 << 1)
/**
* Create a new reference to the passed in buffer instead of taking ownership
* of it.
*/
#define AV_FRAME_SIDE_DATA_FLAG_NEW_REF (1 << 2)
/**
* Add new side data entry to an array.
@ -1016,15 +1055,43 @@ void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
* @param size size of the side data
* @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
*
* @return newly added side data on success, NULL on error. In case of
* AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
* AVFrameSideDataType will be removed before the addition is
* attempted.
* @return newly added side data on success, NULL on error.
* @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of
* matching AVFrameSideDataType will be removed before the addition
* is attempted.
* @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an
* entry of the same type already exists, it will be replaced instead.
*/
AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
enum AVFrameSideDataType type,
size_t size, unsigned int flags);
/**
* Add a new side data entry to an array from an existing AVBufferRef.
*
* @param sd pointer to array of side data to which to add another entry,
* or to NULL in order to start a new array.
* @param nb_sd pointer to an integer containing the number of entries in
* the array.
* @param type type of the added side data
* @param buf Pointer to AVBufferRef to add to the array. On success,
* the function takes ownership of the AVBufferRef and *buf is
* set to NULL, unless AV_FRAME_SIDE_DATA_FLAG_NEW_REF is set
* in which case the ownership will remain with the caller.
* @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
*
* @return newly added side data on success, NULL on error.
* @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of
* matching AVFrameSideDataType will be removed before the addition
* is attempted.
* @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an
* entry of the same type already exists, it will be replaced instead.
*
*/
AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd,
enum AVFrameSideDataType type,
AVBufferRef **buf, unsigned int flags);
/**
* Add a new side data entry to an array based on existing side data, taking
* a reference towards the contained AVBufferRef.
@ -1037,10 +1104,12 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
* for the buffer.
* @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
*
* @return negative error code on failure, >=0 on success. In case of
* AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
* AVFrameSideDataType will be removed before the addition is
* attempted.
* @return negative error code on failure, >=0 on success.
* @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of
* matching AVFrameSideDataType will be removed before the addition
* is attempted.
* @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an
* entry of the same type already exists, it will be replaced instead.
*/
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
const AVFrameSideData *src, unsigned int flags);
@ -1074,6 +1143,19 @@ const AVFrameSideData *av_frame_side_data_get(AVFrameSideData * const *sd,
nb_sd, type);
}
/**
* Remove and free all side data instances of the given type from an array.
*/
void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd,
enum AVFrameSideDataType type);
/**
* Remove and free all side data instances that match any of the given
* side data properties. (See enum AVSideDataProps)
*/
void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd,
int props);
/**
* @}
*/

View File

@ -83,7 +83,7 @@ typedef struct AVHDRVividColorToneMappingParams {
AVRational targeted_system_display_maximum_luminance;
/**
* This flag indicates that transfer the base paramter(for value of 1)
* This flag indicates that transfer the base parameter(for value of 1)
*/
int base_enable_flag;
@ -145,7 +145,7 @@ typedef struct AVHDRVividColorToneMappingParams {
int base_param_k3;
/**
* This flag indicates that delta mode of base paramter(for value of 1)
* This flag indicates that delta mode of base parameter(for value of 1)
*/
int base_param_Delta_enable_mode;
@ -158,7 +158,7 @@ typedef struct AVHDRVividColorToneMappingParams {
/**
* indicates 3Spline_enable_flag in the base parameter,
* This flag indicates that transfer three Spline of base paramter(for value of 1)
* This flag indicates that transfer three Spline of base parameter(for value of 1)
*/
int three_Spline_enable_flag;
@ -168,60 +168,6 @@ typedef struct AVHDRVividColorToneMappingParams {
*/
int three_Spline_num;
#if FF_API_HDR_VIVID_THREE_SPLINE
/**
* The mode of three Spline. the value shall be in the range
* of 0 to 3, inclusive.
* @deprecated Use three_spline instead
*/
attribute_deprecated
int three_Spline_TH_mode;
/**
* three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
* and in multiples of 1.0/255.
* @deprecated Use three_spline instead
*/
attribute_deprecated
AVRational three_Spline_TH_enable_MB;
/**
* 3Spline_TH_enable of three Spline.
* The value shall be in the range of 0.0 to 1.0, inclusive.
* and in multiples of 1.0/4095.
* @deprecated Use three_spline instead
*/
attribute_deprecated
AVRational three_Spline_TH_enable;
/**
* 3Spline_TH_Delta1 of three Spline.
* The value shall be in the range of 0.0 to 0.25, inclusive,
* and in multiples of 0.25/1023.
* @deprecated Use three_spline instead
*/
attribute_deprecated
AVRational three_Spline_TH_Delta1;
/**
* 3Spline_TH_Delta2 of three Spline.
* The value shall be in the range of 0.0 to 0.25, inclusive,
* and in multiples of 0.25/1023.
* @deprecated Use three_spline instead
*/
attribute_deprecated
AVRational three_Spline_TH_Delta2;
/**
* 3Spline_enable_Strength of three Spline.
* The value shall be in the range of 0.0 to 1.0, inclusive,
* and in multiples of 1.0/255.
* @deprecated Use three_spline instead
*/
attribute_deprecated
AVRational three_Spline_enable_Strength;
#endif
AVHDRVivid3SplineParams three_spline[2];
} AVHDRVividColorToneMappingParams;

View File

@ -38,6 +38,9 @@ enum AVHWDeviceType {
AV_HWDEVICE_TYPE_MEDIACODEC,
AV_HWDEVICE_TYPE_VULKAN,
AV_HWDEVICE_TYPE_D3D12VA,
AV_HWDEVICE_TYPE_AMF,
/* OpenHarmony Codec device */
AV_HWDEVICE_TYPE_OHCODEC,
};
/**
@ -560,7 +563,7 @@ enum {
* values indicate that it failed somehow.
*
* On failure, the destination frame will be left blank, except for the
* hw_frames_ctx/format fields thay may have been set by the caller - those will
* hw_frames_ctx/format fields they may have been set by the caller - those will
* be preserved as they were.
*
* @param dst Destination frame, to contain the mapping.

View File

@ -75,7 +75,7 @@ typedef struct AVOpenCLDeviceContext {
/**
* The default command queue for this device, which will be used by all
* frames contexts which do not have their own command queue. If not
* intialised by the user, a default queue will be created on the
* initialised by the user, a default queue will be created on the
* primary device.
*/
cl_command_queue command_queue;

View File

@ -25,8 +25,8 @@
* @file
* An API-specific header for AV_HWDEVICE_TYPE_QSV.
*
* This API does not support dynamic frame pools. AVHWFramesContext.pool must
* contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct.
* AVHWFramesContext.pool must contain AVBufferRefs whose data pointer points
* to a mfxFrameSurface1 struct.
*/
/**
@ -51,14 +51,36 @@ typedef struct AVQSVDeviceContext {
* This struct is allocated as AVHWFramesContext.hwctx
*/
typedef struct AVQSVFramesContext {
/**
* A pointer to a mfxFrameSurface1 struct
*
* It is available when nb_surfaces is non-zero.
*/
mfxFrameSurface1 *surfaces;
/**
* Number of frames in the pool
*
* It is 0 for dynamic frame pools or AVHWFramesContext.initial_pool_size
* for fixed frame pools.
*
* Note only oneVPL GPU runtime 2.9+ can support dynamic frame pools
* on d3d11va or vaapi
*/
int nb_surfaces;
/**
* A combination of MFX_MEMTYPE_* describing the frame pool.
*/
int frame_type;
/**
* A pointer to a mfxFrameInfo struct
*
* It is available when nb_surfaces is 0, all buffers allocated from the
* pool have the same mfxFrameInfo.
*/
mfxFrameInfo *info;
} AVQSVFramesContext;
#endif /* AVUTIL_HWCONTEXT_QSV_H */

View File

@ -90,8 +90,15 @@ CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pr
CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc);
/**
* Update a CVPixelBufferRef's metadata to based on an AVFrame.
* Returns 0 if no known equivalent was found.
* Set CVPixelBufferRef's metadata based on an AVFrame.
*
* Sets/unsets the CVPixelBuffer attachments to match as closely as possible the
* AVFrame metadata. To prevent inconsistent attachments, the attachments for properties
* that could not be matched or are unspecified in the given AVFrame are unset. So if
* any attachments already covered by AVFrame metadata need to be set to a specific
* value, this should happen after calling this function.
*
* Returns < 0 in case of an error.
*/
int av_vt_pixbuf_set_attachments(void *log_ctx,
CVPixelBufferRef pixbuf, const struct AVFrame *src);

View File

@ -26,9 +26,24 @@
#include "pixfmt.h"
#include "frame.h"
#include "hwcontext.h"
typedef struct AVVkFrame AVVkFrame;
typedef struct AVVulkanDeviceQueueFamily {
/* Queue family index */
int idx;
/* Number of queues in the queue family in use */
int num;
/* Queue family capabilities. Must be non-zero.
* Flags may be removed to indicate the queue family may not be used
* for a given purpose. */
VkQueueFlagBits flags;
/* Vulkan implementations are allowed to list multiple video queues
* which differ in what they can encode or decode. */
VkVideoCodecOperationFlagBitsKHR video_caps;
} AVVulkanDeviceQueueFamily;
/**
* @file
* API-specific header for AV_HWDEVICE_TYPE_VULKAN.
@ -48,9 +63,8 @@ typedef struct AVVulkanDeviceContext {
const VkAllocationCallbacks *alloc;
/**
* Pointer to the instance-provided vkGetInstanceProcAddr loading function.
* If NULL, will pick either libvulkan or libvolk, depending on libavutil's
* compilation settings, and set this field.
* Pointer to a vkGetInstanceProcAddr loading function.
* If unset, will dynamically load and use libvulkan.
*/
PFN_vkGetInstanceProcAddr get_proc_addr;
@ -98,28 +112,35 @@ typedef struct AVVulkanDeviceContext {
const char * const *enabled_dev_extensions;
int nb_enabled_dev_extensions;
#if FF_API_VULKAN_FIXED_QUEUES
/**
* Queue family index for graphics operations, and the number of queues
* enabled for it. If unavaiable, will be set to -1. Not required.
* enabled for it. If unavailable, will be set to -1. Not required.
* av_hwdevice_create() will attempt to find a dedicated queue for each
* queue family, or pick the one with the least unrelated flags set.
* Queue indices here may overlap if a queue has to share capabilities.
*/
attribute_deprecated
int queue_family_index;
attribute_deprecated
int nb_graphics_queues;
/**
* Queue family index for transfer operations and the number of queues
* enabled. Required.
*/
attribute_deprecated
int queue_family_tx_index;
attribute_deprecated
int nb_tx_queues;
/**
* Queue family index for compute operations and the number of queues
* enabled. Required.
*/
attribute_deprecated
int queue_family_comp_index;
attribute_deprecated
int nb_comp_queues;
/**
@ -127,7 +148,9 @@ typedef struct AVVulkanDeviceContext {
* If the device doesn't support such, queue_family_encode_index will be -1.
* Not required.
*/
attribute_deprecated
int queue_family_encode_index;
attribute_deprecated
int nb_encode_queues;
/**
@ -135,8 +158,11 @@ typedef struct AVVulkanDeviceContext {
* If the device doesn't support such, queue_family_decode_index will be -1.
* Not required.
*/
attribute_deprecated
int queue_family_decode_index;
attribute_deprecated
int nb_decode_queues;
#endif
/**
* Locks a queue, preventing other threads from submitting any command
@ -150,6 +176,17 @@ typedef struct AVVulkanDeviceContext {
* Similar to lock_queue(), unlocks a queue. Must only be called after locking.
*/
void (*unlock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index);
/**
* Queue families used. Must be preferentially ordered. List may contain
* duplicates.
*
* For compatibility reasons, all the enabled queue families listed above
* (queue_family_(tx/comp/encode/decode)_index) must also be included in
* this list until they're removed after deprecation.
*/
AVVulkanDeviceQueueFamily qf[64];
int nb_qf;
} AVVulkanDeviceContext;
/**
@ -160,11 +197,6 @@ typedef enum AVVkFrameFlags {
* device and tiling during av_hwframe_ctx_init(). */
AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
#if FF_API_VULKAN_CONTIGUOUS_MEMORY
/* DEPRECATED: does nothing. Replaced by multiplane images. */
AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1),
#endif
/* Disables multiplane images.
* This is required to export/import images from CUDA. */
AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE = (1ULL << 2),

View File

@ -64,10 +64,8 @@ typedef union {
#include "config.h"
#if ARCH_ARM
# include "arm/intreadwrite.h"
#elif ARCH_AVR32
# include "avr32/intreadwrite.h"
#if ARCH_AARCH64
# include "aarch64/intreadwrite.h"
#elif ARCH_MIPS
# include "mips/intreadwrite.h"
#elif ARCH_PPC
@ -543,9 +541,41 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
#if AV_HAVE_BIGENDIAN
# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
# define AV_RBA(s, p) AV_RN##s##A(p)
# define AV_WBA(s, p, v) AV_WN##s##A(p, v)
#else
# define AV_RLA(s, p) AV_RN##s##A(p)
# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
# define AV_RBA(s, p) av_bswap##s(AV_RN##s##A(p))
# define AV_WBA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
#endif
#ifndef AV_RL16A
# define AV_RL16A(p) AV_RLA(16, p)
#endif
#ifndef AV_WL16A
# define AV_WL16A(p, v) AV_WLA(16, p, v)
#endif
#ifndef AV_RB16A
# define AV_RB16A(p) AV_RBA(16, p)
#endif
#ifndef AV_WB16A
# define AV_WB16A(p, v) AV_WBA(16, p, v)
#endif
#ifndef AV_RL32A
# define AV_RL32A(p) AV_RLA(32, p)
#endif
#ifndef AV_WL32A
# define AV_WL32A(p, v) AV_WLA(32, p, v)
#endif
#ifndef AV_RB32A
# define AV_RB32A(p) AV_RBA(32, p)
#endif
#ifndef AV_WB32A
# define AV_WB32A(p, v) AV_WBA(32, p, v)
#endif
#ifndef AV_RL64A
@ -555,6 +585,13 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_WL64A(p, v) AV_WLA(64, p, v)
#endif
#ifndef AV_RB64A
# define AV_RB64A(p) AV_RBA(64, p)
#endif
#ifndef AV_WB64A
# define AV_WB64A(p, v) AV_WBA(64, p, v)
#endif
/*
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
* memory locations.

View File

@ -28,7 +28,7 @@
* Context structure for the Lagged Fibonacci PRNG.
* The exact layout, types and content of this struct may change and should
* not be accessed directly. Only its `sizeof()` is guaranteed to stay the same
* to allow easy instanciation.
* to allow easy instantiation.
*/
typedef struct AVLFG {
unsigned int state[64];
@ -73,7 +73,7 @@ static inline unsigned int av_mlfg_get(AVLFG *c){
* Get the next two numbers generated by a Box-Muller Gaussian
* generator using the random numbers issued by lfg.
*
* @param lfg pointer to the contex structure
* @param lfg pointer to the context structure
* @param out array where the two generated numbers are placed
*/
void av_bmg_get(AVLFG *lfg, double out[2]);

View File

@ -37,6 +37,7 @@ typedef enum {
AV_CLASS_CATEGORY_BITSTREAM_FILTER,
AV_CLASS_CATEGORY_SWSCALER,
AV_CLASS_CATEGORY_SWRESAMPLER,
AV_CLASS_CATEGORY_HWDEVICE,
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
@ -46,6 +47,15 @@ typedef enum {
AV_CLASS_CATEGORY_NB ///< not part of ABI/API
}AVClassCategory;
enum AVClassStateFlags {
/**
* Object initialization has finished and it is now in the 'runtime' stage.
* This affects e.g. what options can be set on the object (only
* AV_OPT_FLAG_RUNTIME_PARAM options can be set on initialized objects).
*/
AV_CLASS_STATE_INITIALIZED = (1 << 0),
};
#define AV_IS_INPUT_DEVICE(category) \
(((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
@ -77,7 +87,9 @@ typedef struct AVClass {
const char* (*item_name)(void* ctx);
/**
* a pointer to the first option specified in the class if any or NULL
* An array of options for the structure or NULL.
* When non-NULL, the array must be terminated by an option with a NULL
* name.
*
* @see av_set_default_options()
*/
@ -85,43 +97,50 @@ typedef struct AVClass {
/**
* LIBAVUTIL_VERSION with which this structure was created.
* This is used to allow fields to be added without requiring major
* version bumps everywhere.
* This is used to allow fields to be added to AVClass without requiring
* major version bumps everywhere.
*/
int version;
/**
* Offset in the structure where log_level_offset is stored.
* 0 means there is no such variable
* Offset in the structure where the log level offset is stored. The log
* level offset is an int added to the log level for logging with this
* object as the context.
*
* 0 means there is no such variable.
*/
int log_level_offset_offset;
/**
* Offset in the structure where a pointer to the parent context for
* logging is stored. For example a decoder could pass its AVCodecContext
* to eval as such a parent context, which an av_log() implementation
* to eval as such a parent context, which an ::av_log() implementation
* could then leverage to display the parent context.
* The offset can be NULL.
*
* When the pointer is NULL, or this offset is zero, the object is assumed
* to have no parent.
*/
int parent_log_context_offset;
/**
* Category used for visualization (like color)
* This is only set if the category is equal for all objects using this class.
* available since version (51 << 16 | 56 << 8 | 100)
* Category used for visualization (like color).
*
* Only used when ::get_category() is NULL. Use this field when all
* instances of this class have the same category, use ::get_category()
* otherwise.
*/
AVClassCategory category;
/**
* Callback to return the category.
* available since version (51 << 16 | 59 << 8 | 100)
* Callback to return the instance category. Use this callback when
* different instances of this class may have different categories,
* ::category otherwise.
*/
AVClassCategory (*get_category)(void* ctx);
/**
* Callback to return the supported/allowed ranges.
* available since version (52.12)
*/
int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
@ -139,11 +158,22 @@ typedef struct AVClass {
* @return AVClass for the next AVOptions-enabled child or NULL if there are
* no more such children.
*
* @note The difference between child_next and this is that child_next
* iterates over _already existing_ objects, while child_class_iterate
* iterates over _all possible_ children.
* @note The difference between ::child_next() and ::child_class_iterate()
* is that ::child_next() iterates over _actual_ children of an
* _existing_ object instance, while ::child_class_iterate() iterates
* over the classes of all _potential_ children of any possible
* instance of this class.
*/
const struct AVClass* (*child_class_iterate)(void **iter);
/**
* When non-zero, offset in the object to an unsigned int holding object
* state flags, a combination of AVClassStateFlags values. The flags are
* updated by the object to signal its state to the generic code.
*
* Added in version 59.41.100.
*/
int state_flags_offset;
} AVClass;
/**
@ -247,9 +277,9 @@ void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
* @param avcl A pointer to an arbitrary struct of which the first field is a
* pointer to an AVClass struct or NULL if general log.
* @param initial_level importance level of the message expressed using a @ref
* lavu_log_constants "Logging Constant" for the first occurance.
* lavu_log_constants "Logging Constant" for the first occurrence.
* @param subsequent_level importance level of the message expressed using a @ref
* lavu_log_constants "Logging Constant" after the first occurance.
* lavu_log_constants "Logging Constant" after the first occurrence.
* @param fmt The format string (printf-compatible) that specifies how
* subsequent arguments are converted to output.
* @param state a variable to keep trak of if a message has already been printed
@ -377,6 +407,16 @@ int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
*/
#define AV_LOG_PRINT_LEVEL 2
/**
* Include system time in log output.
*/
#define AV_LOG_PRINT_TIME 4
/**
* Include system date and time in log output.
*/
#define AV_LOG_PRINT_DATETIME 8
void av_log_set_flags(int arg);
int av_log_get_flags(void);

View File

@ -77,6 +77,15 @@ typedef struct AVMasteringDisplayMetadata {
*/
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
/**
* Allocate an AVMasteringDisplayMetadata structure and set its fields to
* default values. The resulting struct can be freed using av_freep().
*
* @return An AVMasteringDisplayMetadata filled with default values or NULL
* on failure.
*/
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size);
/**
* Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
*

View File

@ -278,7 +278,7 @@ int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int
/**
* Add a value to a timestamp.
*
* This function guarantees that when the same value is repeatly added that
* This function guarantees that when the same value is repeatedly added that
* no accumulation of rounding errors occurs.
*
* @param[in] ts Input timestamp

View File

@ -53,6 +53,16 @@
* question is allowed to access the field. This allows us to extend the
* semantics of those fields without breaking API compatibility.
*
* @section avoptions_scope Scope of AVOptions
*
* AVOptions is designed to support any set of multimedia configuration options
* that can be defined at compile-time. Although it is mainly used to expose
* FFmpeg options, you are welcome to adapt it to your own use case.
*
* No single approach can ever fully solve the problem of configuration,
* but please submit a patch if you believe you have found a problem
* that is best solved by extending AVOptions.
*
* @section avoptions_implement Implementing AVOptions
* This section describes how to add AVOptions capabilities to a struct.
*
@ -230,26 +240,99 @@
* before the file is actually opened.
*/
/**
* An option type determines:
* - for native access, the underlying C type of the field that an AVOption
* refers to;
* - for foreign access, the semantics of accessing the option through this API,
* e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or
* what format will av_opt_get()/av_opt_set() expect/produce.
*/
enum AVOptionType{
/**
* Underlying C type is unsigned int.
*/
AV_OPT_TYPE_FLAGS = 1,
/**
* Underlying C type is int.
*/
AV_OPT_TYPE_INT,
/**
* Underlying C type is int64_t.
*/
AV_OPT_TYPE_INT64,
/**
* Underlying C type is double.
*/
AV_OPT_TYPE_DOUBLE,
/**
* Underlying C type is float.
*/
AV_OPT_TYPE_FLOAT,
/**
* Underlying C type is a uint8_t* that is either NULL or points to a C
* string allocated with the av_malloc() family of functions.
*/
AV_OPT_TYPE_STRING,
/**
* Underlying C type is AVRational.
*/
AV_OPT_TYPE_RATIONAL,
AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length
/**
* Underlying C type is a uint8_t* that is either NULL or points to an array
* allocated with the av_malloc() family of functions. The pointer is
* immediately followed by an int containing the array length in bytes.
*/
AV_OPT_TYPE_BINARY,
/**
* Underlying C type is AVDictionary*.
*/
AV_OPT_TYPE_DICT,
/**
* Underlying C type is uint64_t.
*/
AV_OPT_TYPE_UINT64,
/**
* Special option type for declaring named constants. Does not correspond to
* an actual field in the object, offset must be 0.
*/
AV_OPT_TYPE_CONST,
AV_OPT_TYPE_IMAGE_SIZE, ///< offset must point to two consecutive integers
/**
* Underlying C type is two consecutive integers.
*/
AV_OPT_TYPE_IMAGE_SIZE,
/**
* Underlying C type is enum AVPixelFormat.
*/
AV_OPT_TYPE_PIXEL_FMT,
/**
* Underlying C type is enum AVSampleFormat.
*/
AV_OPT_TYPE_SAMPLE_FMT,
AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational
/**
* Underlying C type is AVRational.
*/
AV_OPT_TYPE_VIDEO_RATE,
/**
* Underlying C type is int64_t.
*/
AV_OPT_TYPE_DURATION,
/**
* Underlying C type is uint8_t[4].
*/
AV_OPT_TYPE_COLOR,
/**
* Underlying C type is int.
*/
AV_OPT_TYPE_BOOL,
/**
* Underlying C type is AVChannelLayout.
*/
AV_OPT_TYPE_CHLAYOUT,
/**
* Underlying C type is unsigned int.
*/
AV_OPT_TYPE_UINT,
/**
* May be combined with another regular option type to declare an array
@ -459,7 +542,7 @@ typedef struct AVOptionRanges {
*/
int nb_ranges;
/**
* Number of componentes.
* Number of components.
*/
int nb_components;
} AVOptionRanges;
@ -535,6 +618,12 @@ const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter);
*/
#define AV_OPT_ALLOW_NULL (1 << 2)
/**
* May be used with av_opt_set_array() to signal that new elements should
* replace the existing ones in the indicated range.
*/
#define AV_OPT_ARRAY_REPLACE (1 << 3)
/**
* Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than
* one component for certain option types.
@ -786,6 +875,10 @@ int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_
int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
/**
* @note Any old chlayout present is discarded and replaced with a copy of the new one. The
* caller still owns layout and is responsible for uninitializing it.
*/
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layout, int search_flags);
/**
* @note Any old dictionary present is discarded and replaced with a copy of the new one. The
@ -793,6 +886,7 @@ int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layo
*/
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags);
#if FF_API_OPT_INT_LIST
/**
* Set a binary option to an integer list.
*
@ -808,6 +902,57 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in
AVERROR(EINVAL) : \
av_opt_set_bin(obj, name, (const uint8_t *)(val), \
av_int_list_length(val, term) * sizeof(*(val)), flags))
#endif
/**
* Add, replace, or remove elements for an array option. Which of these
* operations is performed depends on the values of val and search_flags.
*
* @param start_elem Index of the first array element to modify; must not be
* larger than array size as returned by
* av_opt_get_array_size().
* @param nb_elems number of array elements to modify; when val is NULL,
* start_elem+nb_elems must not be larger than array size as
* returned by av_opt_get_array_size()
*
* @param val_type Option type corresponding to the type of val, ignored when val is
* NULL.
*
* The effect of this function will will be as if av_opt_setX()
* was called for each element, where X is specified by type.
* E.g. AV_OPT_TYPE_STRING corresponds to av_opt_set().
*
* Typically this should be the same as the scalarized type of
* the AVOption being set, but certain conversions are also
* possible - the same as those done by the corresponding
* av_opt_set*() function. E.g. any option type can be set from
* a string, numeric types can be set from int64, double, or
* rational, etc.
*
* @param val Array with nb_elems elements or NULL.
*
* When NULL, nb_elems array elements starting at start_elem are
* removed from the array. Any array elements remaining at the end
* are shifted by nb_elems towards the first element in order to keep
* the array contiguous.
*
* Otherwise (val is non-NULL), the type of val must match the
* underlying C type as documented for val_type.
*
* When AV_OPT_ARRAY_REPLACE is not set in search_flags, the array is
* enlarged by nb_elems, and the contents of val are inserted at
* start_elem. Previously existing array elements from start_elem
* onwards (if present) are shifted by nb_elems away from the first
* element in order to make space for the new elements.
*
* When AV_OPT_ARRAY_REPLACE is set in search_flags, the contents
* of val replace existing array elements from start_elem to
* start_elem+nb_elems (if present). New array size is
* max(start_elem + nb_elems, old array size).
*/
int av_opt_set_array(void *obj, const char *name, int search_flags,
unsigned int start_elem, unsigned int nb_elems,
enum AVOptionType val_type, const void *val);
/**
* @}
@ -847,12 +992,56 @@ int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_
int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
/**
* @param[out] layout The returned layout is a copy of the actual value and must
* be freed with av_channel_layout_uninit() by the caller
*/
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *layout);
/**
* @param[out] out_val The returned dictionary is a copy of the actual value and must
* be freed with av_dict_free() by the caller
*/
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val);
/**
* For an array-type option, get the number of elements in the array.
*/
int av_opt_get_array_size(void *obj, const char *name, int search_flags,
unsigned int *out_val);
/**
* For an array-type option, retrieve the values of one or more array elements.
*
* @param start_elem index of the first array element to retrieve
* @param nb_elems number of array elements to retrieve; start_elem+nb_elems
* must not be larger than array size as returned by
* av_opt_get_array_size()
*
* @param out_type Option type corresponding to the desired output.
*
* The array elements produced by this function will
* will be as if av_opt_getX() was called for each element,
* where X is specified by out_type. E.g. AV_OPT_TYPE_STRING
* corresponds to av_opt_get().
*
* Typically this should be the same as the scalarized type of
* the AVOption being retrieved, but certain conversions are
* also possible - the same as those done by the corresponding
* av_opt_get*() function. E.g. any option type can be retrieved
* as a string, numeric types can be retrieved as int64, double,
* or rational, etc.
*
* @param out_val Array with nb_elems members into which the output will be
* written. The array type must match the underlying C type as
* documented for out_type, and be zeroed on entry to this
* function.
*
* For dynamically allocated types (strings, binary, dicts,
* etc.), the result is owned and freed by the caller.
*/
int av_opt_get_array(void *obj, const char *name, int search_flags,
unsigned int start_elem, unsigned int nb_elems,
enum AVOptionType out_type, void *out_val);
/**
* @}
*/
@ -873,6 +1062,7 @@ int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDiction
*/
int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out);
int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out);
int av_opt_eval_uint (void *obj, const AVOption *o, const char *val, unsigned *uint_out);
int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out);
int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out);
int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out);
@ -881,6 +1071,7 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational
* @}
*/
#if FF_API_OPT_PTR
/**
* Gets a pointer to the requested field in a struct.
* This function allows accessing a struct even when its fields are moved or
@ -888,8 +1079,12 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational
*
* @returns a pointer to the field, it can be cast to the correct type and read
* or written to.
*
* @deprecated direct access to AVOption-exported fields is not supported
*/
attribute_deprecated
void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
#endif
/**
* Check if given option is set to its default value.
@ -929,6 +1124,7 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only.
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only.
#define AV_OPT_SERIALIZE_SEARCH_CHILDREN 0x00000004 ///< Serialize options in possible children of the given object.
/**
* Serialize object's options.
@ -941,7 +1137,7 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
* @param[in] obj AVClass object to serialize
* @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG)
* @param[in] flags combination of AV_OPT_SERIALIZE_* flags
* @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options.
* @param[out] buffer Pointer to buffer that will be allocated with string containing serialized options.
* Buffer must be freed by the caller when is no longer needed.
* @param[in] key_val_sep character used to separate key from value
* @param[in] pairs_sep character used to separate two pairs from each other
@ -971,7 +1167,7 @@ void av_opt_freep_ranges(AVOptionRanges **ranges);
*
* The result must be freed with av_opt_freep_ranges.
*
* @return number of compontents returned on success, a negative errro code otherwise
* @return number of components returned on success, a negative error code otherwise
*/
int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
@ -987,7 +1183,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags
*
* The result must be freed with av_opt_free_ranges.
*
* @return number of compontents returned on success, a negative errro code otherwise
* @return number of components returned on success, a negative error code otherwise
*/
int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);

View File

@ -398,12 +398,12 @@ enum AVPixelFormat {
AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian
AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian
AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4, 32bpp, VUYAVUYA...
AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA...
AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian
AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian
AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
AV_PIX_FMT_P012LE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, little-endian
AV_PIX_FMT_P012BE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, big-endian
@ -439,6 +439,66 @@ enum AVPixelFormat {
*/
AV_PIX_FMT_D3D12,
AV_PIX_FMT_AYUV, ///< packed AYUV 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV...
AV_PIX_FMT_UYVA, ///< packed UYVA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA...
AV_PIX_FMT_VYU444, ///< packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
AV_PIX_FMT_V30XBE, ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian
AV_PIX_FMT_V30XLE, ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian
AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian
AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian
AV_PIX_FMT_RGBA128BE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian
AV_PIX_FMT_RGBA128LE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian
AV_PIX_FMT_RGB96BE, ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., big-endian
AV_PIX_FMT_RGB96LE, ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., little-endian
AV_PIX_FMT_Y216BE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian
AV_PIX_FMT_Y216LE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, little-endian
AV_PIX_FMT_XV48BE, ///< packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined
AV_PIX_FMT_XV48LE, ///< packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined
AV_PIX_FMT_GBRPF16BE, ///< IEEE-754 half precision planer GBR 4:4:4, 48bpp, big-endian
AV_PIX_FMT_GBRPF16LE, ///< IEEE-754 half precision planer GBR 4:4:4, 48bpp, little-endian
AV_PIX_FMT_GBRAPF16BE, ///< IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, big-endian
AV_PIX_FMT_GBRAPF16LE, ///< IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, little-endian
AV_PIX_FMT_GRAYF16BE, ///< IEEE-754 half precision Y, 16bpp, big-endian
AV_PIX_FMT_GRAYF16LE, ///< IEEE-754 half precision Y, 16bpp, little-endian
/**
* HW acceleration through AMF. data[0] contain AMFSurface pointer
*/
AV_PIX_FMT_AMF_SURFACE,
AV_PIX_FMT_GRAY32BE, ///< Y , 32bpp, big-endian
AV_PIX_FMT_GRAY32LE, ///< Y , 32bpp, little-endian
AV_PIX_FMT_YAF32BE, ///< IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, big-endian
AV_PIX_FMT_YAF32LE, ///< IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, little-endian
AV_PIX_FMT_YAF16BE, ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, big-endian
AV_PIX_FMT_YAF16LE, ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, little-endian
AV_PIX_FMT_GBRAP32BE, ///< planar GBRA 4:4:4:4 128bpp, big-endian
AV_PIX_FMT_GBRAP32LE, ///< planar GBRA 4:4:4:4 128bpp, little-endian
AV_PIX_FMT_YUV444P10MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian
AV_PIX_FMT_YUV444P10MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian
AV_PIX_FMT_YUV444P12MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian
AV_PIX_FMT_YUV444P12MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian
AV_PIX_FMT_GBRP10MSBBE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, big-endian
AV_PIX_FMT_GBRP10MSBLE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, little-endian
AV_PIX_FMT_GBRP12MSBBE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
AV_PIX_FMT_GBRP12MSBLE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
AV_PIX_FMT_OHCODEC, /// hardware decoding through openharmony
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
};
@ -460,6 +520,7 @@ enum AVPixelFormat {
#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
#define AV_PIX_FMT_GRAY14 AV_PIX_FMT_NE(GRAY14BE, GRAY14LE)
#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
#define AV_PIX_FMT_GRAY32 AV_PIX_FMT_NE(GRAY32BE, GRAY32LE)
#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
@ -490,6 +551,9 @@ enum AVPixelFormat {
#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
#define AV_PIX_FMT_YUV444P10MSB AV_PIX_FMT_NE(YUV444P10MSBBE, YUV444P10MSBLE)
#define AV_PIX_FMT_YUV444P12MSB AV_PIX_FMT_NE(YUV444P12MSBBE, YUV444P12MSBLE)
#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
@ -499,17 +563,27 @@ enum AVPixelFormat {
#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
#define AV_PIX_FMT_GBRAP14 AV_PIX_FMT_NE(GBRAP14BE, GBRAP14LE)
#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
#define AV_PIX_FMT_GBRAP32 AV_PIX_FMT_NE(GBRAP32BE, GBRAP32LE)
#define AV_PIX_FMT_GBRP10MSB AV_PIX_FMT_NE(GBRP10MSBBE, GBRP10MSBLE)
#define AV_PIX_FMT_GBRP12MSB AV_PIX_FMT_NE(GBRP12MSBBE, GBRP12MSBLE)
#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
#define AV_PIX_FMT_GBRPF16 AV_PIX_FMT_NE(GBRPF16BE, GBRPF16LE)
#define AV_PIX_FMT_GBRAPF16 AV_PIX_FMT_NE(GBRAPF16BE, GBRAPF16LE)
#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE)
#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
#define AV_PIX_FMT_GRAYF16 AV_PIX_FMT_NE(GRAYF16BE, GRAYF16LE)
#define AV_PIX_FMT_GRAYF32 AV_PIX_FMT_NE(GRAYF32BE, GRAYF32LE)
#define AV_PIX_FMT_YAF16 AV_PIX_FMT_NE(YAF16BE, YAF16LE)
#define AV_PIX_FMT_YAF32 AV_PIX_FMT_NE(YAF32BE, YAF32LE)
#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
@ -531,8 +605,11 @@ enum AVPixelFormat {
#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE)
#define AV_PIX_FMT_Y212 AV_PIX_FMT_NE(Y212BE, Y212LE)
#define AV_PIX_FMT_Y216 AV_PIX_FMT_NE(Y216BE, Y216LE)
#define AV_PIX_FMT_XV30 AV_PIX_FMT_NE(XV30BE, XV30LE)
#define AV_PIX_FMT_XV36 AV_PIX_FMT_NE(XV36BE, XV36LE)
#define AV_PIX_FMT_XV48 AV_PIX_FMT_NE(XV48BE, XV48LE)
#define AV_PIX_FMT_V30X AV_PIX_FMT_NE(V30XBE, V30XLE)
#define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
@ -543,11 +620,15 @@ enum AVPixelFormat {
#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE)
#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE)
#define AV_PIX_FMT_RGBF16 AV_PIX_FMT_NE(RGBF16BE, RGBF16LE)
#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE)
#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
#define AV_PIX_FMT_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
#define AV_PIX_FMT_RGB96 AV_PIX_FMT_NE(RGB96BE, RGB96LE)
#define AV_PIX_FMT_RGBA128 AV_PIX_FMT_NE(RGBA128BE, RGBA128LE)
/**
* Chromaticity coordinates of the source primaries.
* These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.
@ -623,6 +704,9 @@ enum AVColorSpace {
AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
AVCOL_SPC_IPT_C2 = 15, ///< SMPTE ST 2128, IPT-C2
AVCOL_SPC_YCGCO_RE = 16, ///< YCgCo-R, even addition of bits
AVCOL_SPC_YCGCO_RO = 17, ///< YCgCo-R, odd addition of bits
AVCOL_SPC_NB ///< Not part of ABI
};

View File

@ -22,7 +22,7 @@
/**
* @file
* @ingroup lavu_math_rational
* Utilties for rational number calculation.
* Utilities for rational number calculation.
* @author Michael Niedermayer <michaelni@gmx.at>
*/

View File

@ -43,7 +43,7 @@ AVRC4 *av_rc4_alloc(void);
* @brief Initializes an AVRC4 context.
*
* @param d pointer to the AVRC4 context
* @param key buffer containig the key
* @param key buffer containing the key
* @param key_bits must be a multiple of 8
* @param decrypt 0 for encryption, 1 for decryption, currently has no effect
* @return zero on success, negative value otherwise

View File

@ -66,6 +66,28 @@ enum AVSphericalProjection {
* the position of the current video in a larger surface.
*/
AV_SPHERICAL_EQUIRECTANGULAR_TILE,
/**
* Video frame displays as a 180 degree equirectangular projection.
*/
AV_SPHERICAL_HALF_EQUIRECTANGULAR,
/**
* Video frame displays on a flat, rectangular 2D surface.
*/
AV_SPHERICAL_RECTILINEAR,
/**
* Fisheye projection (Apple).
* See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye
*/
AV_SPHERICAL_FISHEYE,
/**
* Parametric Immersive projection (Apple).
* See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/parametricimmersive
*/
AV_SPHERICAL_PARAMETRIC_IMMERSIVE,
};
/**

View File

@ -136,6 +136,11 @@ enum AVStereo3DType {
* @endcode
*/
AV_STEREO3D_COLUMNS,
/**
* Video is stereoscopic but the packing is unspecified.
*/
AV_STEREO3D_UNSPEC,
};
/**
@ -156,6 +161,31 @@ enum AVStereo3DView {
* Frame contains only the right view.
*/
AV_STEREO3D_VIEW_RIGHT,
/**
* Content is unspecified.
*/
AV_STEREO3D_VIEW_UNSPEC,
};
/**
* List of possible primary eyes.
*/
enum AVStereo3DPrimaryEye {
/**
* Neither eye.
*/
AV_PRIMARY_EYE_NONE,
/**
* Left eye.
*/
AV_PRIMARY_EYE_LEFT,
/**
* Right eye
*/
AV_PRIMARY_EYE_RIGHT,
};
/**
@ -185,6 +215,28 @@ typedef struct AVStereo3D {
* Determines which views are packed.
*/
enum AVStereo3DView view;
/**
* Which eye is the primary eye when rendering in 2D.
*/
enum AVStereo3DPrimaryEye primary_eye;
/**
* The distance between the centres of the lenses of the camera system,
* in micrometers. Zero if unset.
*/
uint32_t baseline;
/**
* Relative shift of the left and right images, which changes the zero parallax plane.
* Range is -1.0 to 1.0. Zero if unset.
*/
AVRational horizontal_disparity_adjustment;
/**
* Horizontal field of view, in degrees. Zero if unset.
*/
AVRational horizontal_field_of_view;
} AVStereo3D;
/**
@ -195,6 +247,14 @@ typedef struct AVStereo3D {
*/
AVStereo3D *av_stereo3d_alloc(void);
/**
* Allocate an AVStereo3D structure and set its fields to default values.
* The resulting struct can be freed using av_freep().
*
* @return An AVStereo3D filled with default values or NULL on failure.
*/
AVStereo3D *av_stereo3d_alloc_size(size_t *size);
/**
* Allocate a complete AVFrameSideData and add it to the frame.
*
@ -222,6 +282,42 @@ const char *av_stereo3d_type_name(unsigned int type);
*/
int av_stereo3d_from_name(const char *name);
/**
* Provide a human-readable name of a given stereo3d view.
*
* @param type The input stereo3d view value.
*
* @return The name of the stereo3d view value, or "unknown".
*/
const char *av_stereo3d_view_name(unsigned int view);
/**
* Get the AVStereo3DView form a human-readable name.
*
* @param name The input string.
*
* @return The AVStereo3DView value, or -1 if not found.
*/
int av_stereo3d_view_from_name(const char *name);
/**
* Provide a human-readable name of a given stereo3d primary eye.
*
* @param type The input stereo3d primary eye value.
*
* @return The name of the stereo3d primary eye value, or "unknown".
*/
const char *av_stereo3d_primary_eye_name(unsigned int eye);
/**
* Get the AVStereo3DPrimaryEye form a human-readable name.
*
* @param name The input string.
*
* @return The AVStereo3DPrimaryEye value, or -1 if not found.
*/
int av_stereo3d_primary_eye_from_name(const char *name);
/**
* @}
*/

View File

@ -50,7 +50,7 @@ enum AVTXType {
/**
* Standard MDCT with a sample data type of float, double or int32_t,
* respecively. For the float and int32 variants, the scale type is
* respectively. For the float and int32 variants, the scale type is
* 'float', while for the double variant, it's 'double'.
* If scale is NULL, 1.0 will be used as a default.
*

View File

@ -35,7 +35,7 @@
* Useful to check and match library version in order to maintain
* backward compatibility.
*
* The FFmpeg libraries follow a versioning sheme very similar to
* The FFmpeg libraries follow a versioning scheme very similar to
* Semantic Versioning (http://semver.org/)
* The difference is that the component called PATCH is called MICRO in FFmpeg
* and its value is reset to 100 instead of 0 to keep it above or equal to 100.
@ -72,13 +72,13 @@
/**
* @defgroup lavu_ver Version and Build diagnostics
*
* Macros and function useful to check at compiletime and at runtime
* Macros and function useful to check at compile time and at runtime
* which version of libavutil is in use.
*
* @{
*/
#define LIBAVUTIL_VERSION_MAJOR 59
#define LIBAVUTIL_VERSION_MAJOR 60
#define LIBAVUTIL_VERSION_MINOR 8
#define LIBAVUTIL_VERSION_MICRO 100
@ -105,13 +105,11 @@
* @{
*/
#define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61)
/**
* @}

View File

@ -49,8 +49,8 @@
* matrix). This is using the swr_alloc() function.
* @code
* SwrContext *swr = swr_alloc();
* av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0);
* av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
* av_opt_set_chlayout(swr, "in_chlayout", &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1, 0);
* av_opt_set_chlayout(swr, "out_chlayout", &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, 0);
* av_opt_set_int(swr, "in_sample_rate", 48000, 0);
* av_opt_set_int(swr, "out_sample_rate", 44100, 0);
* av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
@ -337,7 +337,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
* @}
*
* @name Low-level option setting functions
* These functons provide a means to set low-level options that is not possible
* These functions provide a means to set low-level options that is not possible
* with the AVOption API.
* @{
*/

View File

@ -26,6 +26,6 @@
* Libswresample version macros
*/
#define LIBSWRESAMPLE_VERSION_MAJOR 5
#define LIBSWRESAMPLE_VERSION_MAJOR 6
#endif /* SWRESAMPLE_VERSION_MAJOR_H */

View File

@ -1,4 +1,5 @@
/*
* Copyright (C) 2024 Niklas Haas
* Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
@ -61,36 +62,308 @@ const char *swscale_configuration(void);
*/
const char *swscale_license(void);
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
#define SWS_BICUBIC 4
#define SWS_X 8
#define SWS_POINT 0x10
#define SWS_AREA 0x20
#define SWS_BICUBLIN 0x40
#define SWS_GAUSS 0x80
#define SWS_SINC 0x100
#define SWS_LANCZOS 0x200
#define SWS_SPLINE 0x400
/**
* Get the AVClass for SwsContext. It can be used in combination with
* AV_OPT_SEARCH_FAKE_OBJ for examining options.
*
* @see av_opt_find().
*/
const AVClass *sws_get_class(void);
/******************************
* Flags and quality settings *
******************************/
typedef enum SwsDither {
SWS_DITHER_NONE = 0, /* disable dithering */
SWS_DITHER_AUTO, /* auto-select from preset */
SWS_DITHER_BAYER, /* ordered dither matrix */
SWS_DITHER_ED, /* error diffusion */
SWS_DITHER_A_DITHER, /* arithmetic addition */
SWS_DITHER_X_DITHER, /* arithmetic xor */
SWS_DITHER_NB, /* not part of the ABI */
} SwsDither;
typedef enum SwsAlphaBlend {
SWS_ALPHA_BLEND_NONE = 0,
SWS_ALPHA_BLEND_UNIFORM,
SWS_ALPHA_BLEND_CHECKERBOARD,
SWS_ALPHA_BLEND_NB, /* not part of the ABI */
} SwsAlphaBlend;
typedef enum SwsFlags {
/**
* Scaler selection options. Only one may be active at a time.
*/
SWS_FAST_BILINEAR = 1 << 0, ///< fast bilinear filtering
SWS_BILINEAR = 1 << 1, ///< bilinear filtering
SWS_BICUBIC = 1 << 2, ///< 2-tap cubic B-spline
SWS_X = 1 << 3, ///< experimental
SWS_POINT = 1 << 4, ///< nearest neighbor
SWS_AREA = 1 << 5, ///< area averaging
SWS_BICUBLIN = 1 << 6, ///< bicubic luma, bilinear chroma
SWS_GAUSS = 1 << 7, ///< gaussian approximation
SWS_SINC = 1 << 8, ///< unwindowed sinc
SWS_LANCZOS = 1 << 9, ///< 3-tap sinc/sinc
SWS_SPLINE = 1 << 10, ///< cubic Keys spline
/**
* Return an error on underspecified conversions. Without this flag,
* unspecified fields are defaulted to sensible values.
*/
SWS_STRICT = 1 << 11,
/**
* Emit verbose log of scaling parameters.
*/
SWS_PRINT_INFO = 1 << 12,
/**
* Perform full chroma upsampling when upscaling to RGB.
*
* For example, when converting 50x50 yuv420p to 100x100 rgba, setting this flag
* will scale the chroma plane from 25x25 to 100x100 (4:4:4), and then convert
* the 100x100 yuv444p image to rgba in the final output step.
*
* Without this flag, the chroma plane is instead scaled to 50x100 (4:2:2),
* with a single chroma sample being reused for both of the horizontally
* adjacent RGBA output pixels.
*/
SWS_FULL_CHR_H_INT = 1 << 13,
/**
* Perform full chroma interpolation when downscaling RGB sources.
*
* For example, when converting a 100x100 rgba source to 50x50 yuv444p, setting
* this flag will generate a 100x100 (4:4:4) chroma plane, which is then
* downscaled to the required 50x50.
*
* Without this flag, the chroma plane is instead generated at 50x100 (dropping
* every other pixel), before then being downscaled to the required 50x50
* resolution.
*/
SWS_FULL_CHR_H_INP = 1 << 14,
/**
* Force bit-exact output. This will prevent the use of platform-specific
* optimizations that may lead to slight difference in rounding, in favor
* of always maintaining exact bit output compatibility with the reference
* C code.
*
* Note: It is recommended to set both of these flags simultaneously.
*/
SWS_ACCURATE_RND = 1 << 18,
SWS_BITEXACT = 1 << 19,
/**
* Deprecated flags.
*/
SWS_DIRECT_BGR = 1 << 15, ///< This flag has no effect
SWS_ERROR_DIFFUSION = 1 << 23, ///< Set `SwsContext.dither` instead
} SwsFlags;
typedef enum SwsIntent {
SWS_INTENT_PERCEPTUAL = 0, ///< Perceptual tone mapping
SWS_INTENT_RELATIVE_COLORIMETRIC = 1, ///< Relative colorimetric clipping
SWS_INTENT_SATURATION = 2, ///< Saturation mapping
SWS_INTENT_ABSOLUTE_COLORIMETRIC = 3, ///< Absolute colorimetric clipping
SWS_INTENT_NB, ///< not part of the ABI
} SwsIntent;
/***********************************
* Context creation and management *
***********************************/
/**
* Main external API structure. New fields can be added to the end with
* minor version bumps. Removal, reordering and changes to existing fields
* require a major version bump. sizeof(SwsContext) is not part of the ABI.
*/
typedef struct SwsContext {
const AVClass *av_class;
/**
* Private data of the user, can be used to carry app specific stuff.
*/
void *opaque;
/**
* Bitmask of SWS_*. See `SwsFlags` for details.
*/
unsigned flags;
/**
* Extra parameters for fine-tuning certain scalers.
*/
double scaler_params[2];
/**
* How many threads to use for processing, or 0 for automatic selection.
*/
int threads;
/**
* Dither mode.
*/
SwsDither dither;
/**
* Alpha blending mode. See `SwsAlphaBlend` for details.
*/
SwsAlphaBlend alpha_blend;
/**
* Use gamma correct scaling.
*/
int gamma_flag;
/**
* Deprecated frame property overrides, for the legacy API only.
*
* Ignored by sws_scale_frame() when used in dynamic mode, in which
* case all properties are instead taken from the frame directly.
*/
int src_w, src_h; ///< Width and height of the source frame
int dst_w, dst_h; ///< Width and height of the destination frame
int src_format; ///< Source pixel format
int dst_format; ///< Destination pixel format
int src_range; ///< Source is full range
int dst_range; ///< Destination is full range
int src_v_chr_pos; ///< Source vertical chroma position in luma grid / 256
int src_h_chr_pos; ///< Source horizontal chroma position
int dst_v_chr_pos; ///< Destination vertical chroma position
int dst_h_chr_pos; ///< Destination horizontal chroma position
/**
* Desired ICC intent for color space conversions.
*/
int intent;
/* Remember to add new fields to graph.c:opts_equal() */
} SwsContext;
/**
* Allocate an empty SwsContext and set its fields to default values.
*/
SwsContext *sws_alloc_context(void);
/**
* Free the context and everything associated with it, and write NULL
* to the provided pointer.
*/
void sws_free_context(SwsContext **ctx);
/***************************
* Supported frame formats *
***************************/
/**
* Test if a given pixel format is supported.
*
* @param output If 0, test if compatible with the source/input frame;
* otherwise, with the destination/output frame.
* @param format The format to check.
*
* @return A positive integer if supported, 0 otherwise.
*/
int sws_test_format(enum AVPixelFormat format, int output);
/**
* Test if a given color space is supported.
*
* @param output If 0, test if compatible with the source/input frame;
* otherwise, with the destination/output frame.
* @param colorspace The colorspace to check.
*
* @return A positive integer if supported, 0 otherwise.
*/
int sws_test_colorspace(enum AVColorSpace colorspace, int output);
/**
* Test if a given set of color primaries is supported.
*
* @param output If 0, test if compatible with the source/input frame;
* otherwise, with the destination/output frame.
* @param primaries The color primaries to check.
*
* @return A positive integer if supported, 0 otherwise.
*/
int sws_test_primaries(enum AVColorPrimaries primaries, int output);
/**
* Test if a given color transfer function is supported.
*
* @param output If 0, test if compatible with the source/input frame;
* otherwise, with the destination/output frame.
* @param trc The color transfer function to check.
*
* @return A positive integer if supported, 0 otherwise.
*/
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output);
/**
* Helper function to run all sws_test_* against a frame, as well as testing
* the basic frame properties for sanity. Ignores irrelevant properties - for
* example, AVColorSpace is not checked for RGB frames.
*/
int sws_test_frame(const AVFrame *frame, int output);
/**
* Like `sws_scale_frame`, but without actually scaling. It will instead
* merely initialize internal state that *would* be required to perform the
* operation, as well as returning the correct error code for unsupported
* frame combinations.
*
* @param ctx The scaling context.
* @param dst The destination frame to consider.
* @param src The source frame to consider.
* @return 0 on success, a negative AVERROR code on failure.
*/
int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src);
/********************
* Main scaling API *
********************/
/**
* Check if a given conversion is a noop. Returns a positive integer if
* no operation needs to be performed, 0 otherwise.
*/
int sws_is_noop(const AVFrame *dst, const AVFrame *src);
/**
* Scale source data from `src` and write the output to `dst`.
*
* This function can be used directly on an allocated context, without setting
* up any frame properties or calling `sws_init_context()`. Such usage is fully
* dynamic and does not require reallocation if the frame properties change.
*
* Alternatively, this function can be called on a context that has been
* explicitly initialized. However, this is provided only for backwards
* compatibility. In this usage mode, all frame properties must be correctly
* set at init time, and may no longer change after initialization.
*
* @param ctx The scaling context.
* @param dst The destination frame. The data buffers may either be already
* allocated by the caller or left clear, in which case they will
* be allocated by the scaler. The latter may have performance
* advantages - e.g. in certain cases some (or all) output planes
* may be references to input planes, rather than copies.
* @param src The source frame. If the data buffers are set to NULL, then
* this function behaves identically to `sws_frame_setup`.
* @return >= 0 on success, a negative AVERROR code on failure.
*/
int sws_scale_frame(SwsContext *c, AVFrame *dst, const AVFrame *src);
/*************************
* Legacy (stateful) API *
*************************/
#define SWS_SRC_V_CHR_DROP_MASK 0x30000
#define SWS_SRC_V_CHR_DROP_SHIFT 16
#define SWS_PARAM_DEFAULT 123456
#define SWS_PRINT_INFO 0x1000
//the following 3 flags are not completely implemented
//internal chrominance subsampling info
#define SWS_FULL_CHR_H_INT 0x2000
//input subsampling info
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define SWS_ACCURATE_RND 0x40000
#define SWS_BITEXACT 0x80000
#define SWS_ERROR_DIFFUSION 0x800000
#define SWS_MAX_REDUCE_CUTOFF 0.002
#define SWS_CS_ITU709 1
@ -126,8 +399,6 @@ typedef struct SwsFilter {
SwsVector *chrV;
} SwsFilter;
struct SwsContext;
/**
* Return a positive value if pix_fmt is a supported input format, 0
* otherwise.
@ -147,27 +418,25 @@ int sws_isSupportedOutput(enum AVPixelFormat pix_fmt);
*/
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt);
/**
* Allocate an empty SwsContext. This must be filled and passed to
* sws_init_context(). For filling see AVOptions, options.c and
* sws_setColorspaceDetails().
*/
struct SwsContext *sws_alloc_context(void);
/**
* Initialize the swscaler context sws_context.
*
* This function is considered deprecated, and provided only for backwards
* compatibility with sws_scale() and sws_start_frame(). The preferred way to
* use libswscale is to set all frame properties correctly and call
* sws_scale_frame() directly, without explicitly initializing the context.
*
* @return zero or positive value on success, a negative value on
* error
*/
av_warn_unused_result
int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
/**
* Free the swscaler context swsContext.
* If swsContext is NULL, then does nothing.
*/
void sws_freeContext(struct SwsContext *swsContext);
void sws_freeContext(SwsContext *swsContext);
/**
* Allocate and return an SwsContext. You need it to perform
@ -190,7 +459,7 @@ void sws_freeContext(struct SwsContext *swsContext);
* @note this function is to be removed after a saner alternative is
* written
*/
struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
int dstW, int dstH, enum AVPixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
@ -198,7 +467,8 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcForm
/**
* Scale the image slice in srcSlice and put the resulting scaled
* slice in the image in dst. A slice is a sequence of consecutive
* rows in an image.
* rows in an image. Requires a context that has been previously
* been initialized with sws_init_context().
*
* Slices have to be provided in sequential order, either in
* top-bottom or bottom-top order. If slices are provided in
@ -221,31 +491,15 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcForm
* the destination image
* @return the height of the output slice
*/
int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
int sws_scale(SwsContext *c, const uint8_t *const srcSlice[],
const int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *const dst[], const int dstStride[]);
/**
* Scale source data from src and write the output to dst.
*
* This is merely a convenience wrapper around
* - sws_frame_start()
* - sws_send_slice(0, src->height)
* - sws_receive_slice(0, dst->height)
* - sws_frame_end()
*
* @param c The scaling context
* @param dst The destination frame. See documentation for sws_frame_start() for
* more details.
* @param src The source frame.
*
* @return 0 on success, a negative AVERROR code on failure
*/
int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src);
/**
* Initialize the scaling process for a given pair of source/destination frames.
* Must be called before any calls to sws_send_slice() and sws_receive_slice().
* Requires a context that has been previously been initialized with
* sws_init_context().
*
* This function will retain references to src and dst, so they must both use
* refcounted buffers (if allocated by the caller, in case of dst).
@ -268,7 +522,7 @@ int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src);
*
* @see sws_frame_end()
*/
int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src);
int sws_frame_start(SwsContext *c, AVFrame *dst, const AVFrame *src);
/**
* Finish the scaling process for a pair of source/destination frames previously
@ -278,7 +532,7 @@ int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src);
*
* @param c The scaling context
*/
void sws_frame_end(struct SwsContext *c);
void sws_frame_end(SwsContext *c);
/**
* Indicate that a horizontal slice of input data is available in the source
@ -292,7 +546,7 @@ void sws_frame_end(struct SwsContext *c);
*
* @return a non-negative number on success, a negative AVERROR code on failure.
*/
int sws_send_slice(struct SwsContext *c, unsigned int slice_start,
int sws_send_slice(SwsContext *c, unsigned int slice_start,
unsigned int slice_height);
/**
@ -312,18 +566,19 @@ int sws_send_slice(struct SwsContext *c, unsigned int slice_start,
* output can be produced
* another negative AVERROR code on other kinds of scaling failure
*/
int sws_receive_slice(struct SwsContext *c, unsigned int slice_start,
int sws_receive_slice(SwsContext *c, unsigned int slice_start,
unsigned int slice_height);
/**
* Get the alignment required for slices
* Get the alignment required for slices. Requires a context that has been
* previously been initialized with sws_init_context().
*
* @param c The scaling context
* @return alignment required for output slices requested with sws_receive_slice().
* Slice offsets and sizes passed to sws_receive_slice() must be
* multiples of the value returned from this function.
*/
unsigned int sws_receive_slice_alignment(const struct SwsContext *c);
unsigned int sws_receive_slice_alignment(const SwsContext *c);
/**
* @param c the scaling context
@ -338,7 +593,7 @@ unsigned int sws_receive_slice_alignment(const struct SwsContext *c);
* @return A negative error code on error, non negative otherwise.
* If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
*/
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation);
@ -346,7 +601,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
* @return A negative error code on error, non negative otherwise.
* If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
*/
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
int sws_getColorspaceDetails(SwsContext *c, int **inv_table,
int *srcRange, int **table, int *dstRange,
int *brightness, int *contrast, int *saturation);
@ -391,11 +646,11 @@ void sws_freeFilter(SwsFilter *filter);
* Be warned that srcFilter and dstFilter are not checked, they
* are assumed to remain the same.
*/
struct SwsContext *sws_getCachedContext(struct SwsContext *context,
int srcW, int srcH, enum AVPixelFormat srcFormat,
int dstW, int dstH, enum AVPixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
SwsContext *sws_getCachedContext(SwsContext *context, int srcW, int srcH,
enum AVPixelFormat srcFormat, int dstW, int dstH,
enum AVPixelFormat dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter,
const double *param);
/**
* Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
@ -421,14 +676,6 @@ void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pix
*/
void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
/**
* Get the AVClass for swsContext. It can be used in combination with
* AV_OPT_SEARCH_FAKE_OBJ for examining options.
*
* @see av_opt_find().
*/
const AVClass *sws_get_class(void);
/**
* @}
*/

View File

@ -24,7 +24,7 @@
* swscale version macros
*/
#define LIBSWSCALE_VERSION_MAJOR 8
#define LIBSWSCALE_VERSION_MAJOR 9
/**
* FF_API_* defines may be placed below to indicate public API that will be