3rdparty/ffmpeg: Bump headers to version 7.0.2

This commit is contained in:
JordanTheToaster 2024-09-08 17:54:07 +01:00 committed by Ty
parent 5c83edb7b2
commit f75da73fca
60 changed files with 2549 additions and 2022 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,10 @@
#ifndef AVCODEC_AVFFT_H #ifndef AVCODEC_AVFFT_H
#define AVCODEC_AVFFT_H #define AVCODEC_AVFFT_H
#include "libavutil/attributes.h"
#include "version_major.h"
#if FF_API_AVFFT
/** /**
* @file * @file
* @ingroup lavc_fft * @ingroup lavc_fft
@ -44,26 +48,42 @@ typedef struct FFTContext FFTContext;
* Set up a complex FFT. * Set up a complex FFT.
* @param nbits log2 of the length of the input array * @param nbits log2 of the length of the input array
* @param inverse if 0 perform the forward transform, if 1 perform the inverse * @param inverse if 0 perform the forward transform, if 1 perform the inverse
* @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_FFT
*/ */
attribute_deprecated
FFTContext *av_fft_init(int nbits, int inverse); FFTContext *av_fft_init(int nbits, int inverse);
/** /**
* Do the permutation needed BEFORE calling ff_fft_calc(). * Do the permutation needed BEFORE calling ff_fft_calc().
* @deprecated without replacement
*/ */
attribute_deprecated
void av_fft_permute(FFTContext *s, FFTComplex *z); void av_fft_permute(FFTContext *s, FFTComplex *z);
/** /**
* Do a complex FFT with the parameters defined in av_fft_init(). The * Do a complex FFT with the parameters defined in av_fft_init(). The
* input data must be permuted before. No 1.0/sqrt(n) normalization is done. * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
* @deprecated use the av_tx_fn value returned by av_tx_init, which also does permutation
*/ */
attribute_deprecated
void av_fft_calc(FFTContext *s, FFTComplex *z); void av_fft_calc(FFTContext *s, FFTComplex *z);
attribute_deprecated
void av_fft_end(FFTContext *s); void av_fft_end(FFTContext *s);
/**
* @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_MDCT,
* with a flag of AV_TX_FULL_IMDCT for a replacement to av_imdct_calc.
*/
attribute_deprecated
FFTContext *av_mdct_init(int nbits, int inverse, double scale); FFTContext *av_mdct_init(int nbits, int inverse, double scale);
attribute_deprecated
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
attribute_deprecated
void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
attribute_deprecated
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
attribute_deprecated
void av_mdct_end(FFTContext *s); void av_mdct_end(FFTContext *s);
/* Real Discrete Fourier Transform */ /* Real Discrete Fourier Transform */
@ -81,9 +101,14 @@ typedef struct RDFTContext RDFTContext;
* Set up a real FFT. * Set up a real FFT.
* @param nbits log2 of the length of the input array * @param nbits log2 of the length of the input array
* @param trans the type of transform * @param trans the type of transform
*
* @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_RDFT
*/ */
attribute_deprecated
RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
attribute_deprecated
void av_rdft_calc(RDFTContext *s, FFTSample *data); void av_rdft_calc(RDFTContext *s, FFTSample *data);
attribute_deprecated
void av_rdft_end(RDFTContext *s); void av_rdft_end(RDFTContext *s);
/* Discrete Cosine Transform */ /* Discrete Cosine Transform */
@ -106,13 +131,19 @@ enum DCTTransformType {
* @param type the type of transform * @param type the type of transform
* *
* @note the first element of the input of DST-I is ignored * @note the first element of the input of DST-I is ignored
*
* @deprecated use av_tx_init from libavutil/tx.h with an appropriate type of AV_TX_FLOAT_DCT
*/ */
attribute_deprecated
DCTContext *av_dct_init(int nbits, enum DCTTransformType type); DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
attribute_deprecated
void av_dct_calc(DCTContext *s, FFTSample *data); void av_dct_calc(DCTContext *s, FFTSample *data);
attribute_deprecated
void av_dct_end (DCTContext *s); void av_dct_end (DCTContext *s);
/** /**
* @} * @}
*/ */
#endif /* FF_API_AVFFT */
#endif /* AVCODEC_AVFFT_H */ #endif /* AVCODEC_AVFFT_H */

View File

@ -80,6 +80,7 @@
*/ */
#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) #define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
#if FF_API_SUBFRAMES
/** /**
* Codec can output multiple frames per AVPacket * Codec can output multiple frames per AVPacket
* Normally demuxers return one frame at a time, demuxers which do not do * Normally demuxers return one frame at a time, demuxers which do not do
@ -92,6 +93,8 @@
* as a last resort. * as a last resort.
*/ */
#define AV_CODEC_CAP_SUBFRAMES (1 << 8) #define AV_CODEC_CAP_SUBFRAMES (1 << 8)
#endif
/** /**
* Codec is experimental and is thus avoided in favor of non experimental * Codec is experimental and is thus avoided in favor of non experimental
* encoders * encoders
@ -206,15 +209,8 @@ typedef struct AVCodec {
const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 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 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 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* @deprecated use ch_layouts instead
*/
attribute_deprecated
const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
#endif
const AVClass *priv_class; ///< AVClass for the private context const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
/** /**
* Group name of the codec implementation. * Group name of the codec implementation.

View File

@ -60,7 +60,7 @@ typedef struct AVCodecDescriptor {
const char *const *mime_types; const char *const *mime_types;
/** /**
* If non-NULL, an array of profiles recognized for this codec. * If non-NULL, an array of profiles recognized for this codec.
* Terminated with FF_PROFILE_UNKNOWN. * Terminated with AV_PROFILE_UNKNOWN.
*/ */
const struct AVProfile *profiles; const struct AVProfile *profiles;
} AVCodecDescriptor; } AVCodecDescriptor;
@ -90,6 +90,12 @@ typedef struct AVCodecDescriptor {
* equal. * equal.
*/ */
#define AV_CODEC_PROP_REORDER (1 << 3) #define AV_CODEC_PROP_REORDER (1 << 3)
/**
* Video codec supports separate coding of fields in interlaced frames.
*/
#define AV_CODEC_PROP_FIELDS (1 << 4)
/** /**
* Subtitle codec is bitmap based * Subtitle codec is bitmap based
* Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.

View File

@ -253,9 +253,6 @@ enum AVCodecID {
AV_CODEC_ID_AVRP, AV_CODEC_ID_AVRP,
AV_CODEC_ID_012V, AV_CODEC_ID_012V,
AV_CODEC_ID_AVUI, AV_CODEC_ID_AVUI,
#if FF_API_AYUV_CODECID
AV_CODEC_ID_AYUV,
#endif
AV_CODEC_ID_TARGA_Y216, AV_CODEC_ID_TARGA_Y216,
AV_CODEC_ID_V308, AV_CODEC_ID_V308,
AV_CODEC_ID_V408, AV_CODEC_ID_V408,
@ -320,6 +317,11 @@ enum AVCodecID {
AV_CODEC_ID_WBMP, AV_CODEC_ID_WBMP,
AV_CODEC_ID_MEDIA100, AV_CODEC_ID_MEDIA100,
AV_CODEC_ID_VQC, AV_CODEC_ID_VQC,
AV_CODEC_ID_PDV,
AV_CODEC_ID_EVC,
AV_CODEC_ID_RTV1,
AV_CODEC_ID_VMIX,
AV_CODEC_ID_LEAD,
/* various PCM "codecs" */ /* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
@ -538,6 +540,9 @@ enum AVCodecID {
AV_CODEC_ID_FTR, AV_CODEC_ID_FTR,
AV_CODEC_ID_WAVARC, AV_CODEC_ID_WAVARC,
AV_CODEC_ID_RKA, AV_CODEC_ID_RKA,
AV_CODEC_ID_AC4,
AV_CODEC_ID_OSQ,
AV_CODEC_ID_QOA,
/* subtitle codecs */ /* subtitle codecs */
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
@ -582,6 +587,7 @@ enum AVCodecID {
AV_CODEC_ID_DVD_NAV, AV_CODEC_ID_DVD_NAV,
AV_CODEC_ID_TIMED_ID3, AV_CODEC_ID_TIMED_ID3,
AV_CODEC_ID_BIN_DATA, AV_CODEC_ID_BIN_DATA,
AV_CODEC_ID_SMPTE_2038,
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it

View File

@ -29,21 +29,14 @@
#include "libavutil/pixfmt.h" #include "libavutil/pixfmt.h"
#include "codec_id.h" #include "codec_id.h"
#include "defs.h"
#include "packet.h"
/** /**
* @addtogroup lavc_core * @addtogroup lavc_core
* @{ * @{
*/ */
enum AVFieldOrder {
AV_FIELD_UNKNOWN,
AV_FIELD_PROGRESSIVE,
AV_FIELD_TT, ///< Top coded_first, top displayed first
AV_FIELD_BB, ///< Bottom coded first, bottom displayed first
AV_FIELD_TB, ///< Top coded first, bottom displayed first
AV_FIELD_BT, ///< Bottom coded first, top displayed first
};
/** /**
* This struct describes the properties of an encoded stream. * This struct describes the properties of an encoded stream.
* *
@ -79,6 +72,19 @@ typedef struct AVCodecParameters {
*/ */
int extradata_size; int extradata_size;
/**
* Additional data associated with the entire stream.
*
* Should be allocated with av_packet_side_data_new() or
* av_packet_side_data_add(), and will be freed by avcodec_parameters_free().
*/
AVPacketSideData *coded_side_data;
/**
* Amount of entries in @ref coded_side_data.
*/
int nb_coded_side_data;
/** /**
* - video: the pixel format, the value corresponds to enum AVPixelFormat. * - video: the pixel format, the value corresponds to enum AVPixelFormat.
* - audio: the sample format, the value corresponds to enum AVSampleFormat. * - audio: the sample format, the value corresponds to enum AVSampleFormat.
@ -137,6 +143,18 @@ typedef struct AVCodecParameters {
*/ */
AVRational sample_aspect_ratio; AVRational sample_aspect_ratio;
/**
* Video only. Number of frames per second, for streams with constant frame
* 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
* 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.
*/
AVRational framerate;
/** /**
* Video only. The order of the fields in interlaced video. * Video only. The order of the fields in interlaced video.
*/ */
@ -156,22 +174,10 @@ typedef struct AVCodecParameters {
*/ */
int video_delay; int video_delay;
#if FF_API_OLD_CHANNEL_LAYOUT
/** /**
* Audio only. The channel layout bitmask. May be 0 if the channel layout is * Audio only. The channel layout and number of channels.
* unknown or unspecified, otherwise the number of bits set must be equal to
* the channels field.
* @deprecated use ch_layout
*/ */
attribute_deprecated AVChannelLayout ch_layout;
uint64_t channel_layout;
/**
* Audio only. The number of audio channels.
* @deprecated use ch_layout.nb_channels
*/
attribute_deprecated
int channels;
#endif
/** /**
* Audio only. The number of audio samples per second. * Audio only. The number of audio samples per second.
*/ */
@ -206,11 +212,6 @@ typedef struct AVCodecParameters {
* Audio only. Number of samples to skip after a discontinuity. * Audio only. Number of samples to skip after a discontinuity.
*/ */
int seek_preroll; int seek_preroll;
/**
* Audio only. The channel layout and number of channels.
*/
AVChannelLayout ch_layout;
} AVCodecParameters; } AVCodecParameters;
/** /**

View File

@ -45,9 +45,6 @@
* @{ * @{
*/ */
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards
#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface
/** /**
* This structure is used to provides the necessary configurations and data * This structure is used to provides the necessary configurations and data
* to the Direct3D11 FFmpeg HWAccel implementation. * to the Direct3D11 FFmpeg HWAccel implementation.

View File

@ -61,6 +61,149 @@
#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
#define AV_PROFILE_UNKNOWN -99
#define AV_PROFILE_RESERVED -100
#define AV_PROFILE_AAC_MAIN 0
#define AV_PROFILE_AAC_LOW 1
#define AV_PROFILE_AAC_SSR 2
#define AV_PROFILE_AAC_LTP 3
#define AV_PROFILE_AAC_HE 4
#define AV_PROFILE_AAC_HE_V2 28
#define AV_PROFILE_AAC_LD 22
#define AV_PROFILE_AAC_ELD 38
#define AV_PROFILE_MPEG2_AAC_LOW 128
#define AV_PROFILE_MPEG2_AAC_HE 131
#define AV_PROFILE_DNXHD 0
#define AV_PROFILE_DNXHR_LB 1
#define AV_PROFILE_DNXHR_SQ 2
#define AV_PROFILE_DNXHR_HQ 3
#define AV_PROFILE_DNXHR_HQX 4
#define AV_PROFILE_DNXHR_444 5
#define AV_PROFILE_DTS 20
#define AV_PROFILE_DTS_ES 30
#define AV_PROFILE_DTS_96_24 40
#define AV_PROFILE_DTS_HD_HRA 50
#define AV_PROFILE_DTS_HD_MA 60
#define AV_PROFILE_DTS_EXPRESS 70
#define AV_PROFILE_DTS_HD_MA_X 61
#define AV_PROFILE_DTS_HD_MA_X_IMAX 62
#define AV_PROFILE_EAC3_DDP_ATMOS 30
#define AV_PROFILE_TRUEHD_ATMOS 30
#define AV_PROFILE_MPEG2_422 0
#define AV_PROFILE_MPEG2_HIGH 1
#define AV_PROFILE_MPEG2_SS 2
#define AV_PROFILE_MPEG2_SNR_SCALABLE 3
#define AV_PROFILE_MPEG2_MAIN 4
#define AV_PROFILE_MPEG2_SIMPLE 5
#define AV_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
#define AV_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
#define AV_PROFILE_H264_BASELINE 66
#define AV_PROFILE_H264_CONSTRAINED_BASELINE (66|AV_PROFILE_H264_CONSTRAINED)
#define AV_PROFILE_H264_MAIN 77
#define AV_PROFILE_H264_EXTENDED 88
#define AV_PROFILE_H264_HIGH 100
#define AV_PROFILE_H264_HIGH_10 110
#define AV_PROFILE_H264_HIGH_10_INTRA (110|AV_PROFILE_H264_INTRA)
#define AV_PROFILE_H264_MULTIVIEW_HIGH 118
#define AV_PROFILE_H264_HIGH_422 122
#define AV_PROFILE_H264_HIGH_422_INTRA (122|AV_PROFILE_H264_INTRA)
#define AV_PROFILE_H264_STEREO_HIGH 128
#define AV_PROFILE_H264_HIGH_444 144
#define AV_PROFILE_H264_HIGH_444_PREDICTIVE 244
#define AV_PROFILE_H264_HIGH_444_INTRA (244|AV_PROFILE_H264_INTRA)
#define AV_PROFILE_H264_CAVLC_444 44
#define AV_PROFILE_VC1_SIMPLE 0
#define AV_PROFILE_VC1_MAIN 1
#define AV_PROFILE_VC1_COMPLEX 2
#define AV_PROFILE_VC1_ADVANCED 3
#define AV_PROFILE_MPEG4_SIMPLE 0
#define AV_PROFILE_MPEG4_SIMPLE_SCALABLE 1
#define AV_PROFILE_MPEG4_CORE 2
#define AV_PROFILE_MPEG4_MAIN 3
#define AV_PROFILE_MPEG4_N_BIT 4
#define AV_PROFILE_MPEG4_SCALABLE_TEXTURE 5
#define AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
#define AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
#define AV_PROFILE_MPEG4_HYBRID 8
#define AV_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
#define AV_PROFILE_MPEG4_CORE_SCALABLE 10
#define AV_PROFILE_MPEG4_ADVANCED_CODING 11
#define AV_PROFILE_MPEG4_ADVANCED_CORE 12
#define AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
#define AV_PROFILE_MPEG4_SIMPLE_STUDIO 14
#define AV_PROFILE_MPEG4_ADVANCED_SIMPLE 15
#define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
#define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
#define AV_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
#define AV_PROFILE_JPEG2000_DCINEMA_2K 3
#define AV_PROFILE_JPEG2000_DCINEMA_4K 4
#define AV_PROFILE_VP9_0 0
#define AV_PROFILE_VP9_1 1
#define AV_PROFILE_VP9_2 2
#define AV_PROFILE_VP9_3 3
#define AV_PROFILE_HEVC_MAIN 1
#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_SCC 9
#define AV_PROFILE_VVC_MAIN_10 1
#define AV_PROFILE_VVC_MAIN_10_444 33
#define AV_PROFILE_AV1_MAIN 0
#define AV_PROFILE_AV1_HIGH 1
#define AV_PROFILE_AV1_PROFESSIONAL 2
#define AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
#define AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
#define AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
#define AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
#define AV_PROFILE_MJPEG_JPEG_LS 0xf7
#define AV_PROFILE_SBC_MSBC 1
#define AV_PROFILE_PRORES_PROXY 0
#define AV_PROFILE_PRORES_LT 1
#define AV_PROFILE_PRORES_STANDARD 2
#define AV_PROFILE_PRORES_HQ 3
#define AV_PROFILE_PRORES_4444 4
#define AV_PROFILE_PRORES_XQ 5
#define AV_PROFILE_ARIB_PROFILE_A 0
#define AV_PROFILE_ARIB_PROFILE_C 1
#define AV_PROFILE_KLVA_SYNC 0
#define AV_PROFILE_KLVA_ASYNC 1
#define AV_PROFILE_EVC_BASELINE 0
#define AV_PROFILE_EVC_MAIN 1
#define AV_LEVEL_UNKNOWN -99
enum AVFieldOrder {
AV_FIELD_UNKNOWN,
AV_FIELD_PROGRESSIVE,
AV_FIELD_TT, ///< Top coded_first, top displayed first
AV_FIELD_BB, ///< Bottom coded first, bottom displayed first
AV_FIELD_TB, ///< Top coded first, bottom displayed first
AV_FIELD_BT, ///< Bottom coded first, top displayed first
};
/** /**
* @ingroup lavc_decoding * @ingroup lavc_decoding
*/ */

View File

@ -31,7 +31,11 @@
* @author Jordi Ortiz * @author Jordi Ortiz
*/ */
#include "avcodec.h" #include <stddef.h>
#include <stdint.h>
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
/** /**
* The spec limits the number of wavelet decompositions to 4 for both * The spec limits the number of wavelet decompositions to 4 for both

View File

@ -45,9 +45,6 @@
* @{ * @{
*/ */
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface
/** /**
* This structure is used to provides the necessary configurations and data * This structure is used to provides the necessary configurations and data
* to the DXVA2 FFmpeg HWAccel implementation. * to the DXVA2 FFmpeg HWAccel implementation.

View File

@ -43,4 +43,25 @@ int av_jni_set_java_vm(void *vm, void *log_ctx);
*/ */
void *av_jni_get_java_vm(void *log_ctx); void *av_jni_get_java_vm(void *log_ctx);
/*
* Set the Android application context which will be used to retrieve the Android
* content resolver to handle content uris.
*
* This function is only available on Android.
*
* @param app_ctx global JNI reference to the Android application context
* @return 0 on success, < 0 otherwise
*/
int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
/*
* Get the Android application context that has been set with
* av_jni_set_android_app_ctx.
*
* This function is only available on Android.
*
* @return a pointer the the Android application context
*/
void *av_jni_get_android_app_ctx(void);
#endif /* AVCODEC_JNI_H */ #endif /* AVCODEC_JNI_H */

View File

@ -33,9 +33,9 @@
#include "libavcodec/version_major.h" #include "libavcodec/version_major.h"
/** /**
* @defgroup lavc_packet AVPacket * @defgroup lavc_packet_side_data AVPacketSideData
* *
* Types and functions for working with AVPacket. * Types and functions for working with AVPacketSideData.
* @{ * @{
*/ */
enum AVPacketSideDataType { enum AVPacketSideDataType {
@ -299,6 +299,37 @@ enum AVPacketSideDataType {
*/ */
AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
/**
* IAMF Mix Gain Parameter Data associated with the audio frame. This metadata
* is in the form of the AVIAMFParamDefinition struct and contains information
* defined in sections 3.6.1 and 3.8.1 of the Immersive Audio Model and
* Formats standard.
*/
AV_PKT_DATA_IAMF_MIX_GAIN_PARAM,
/**
* IAMF Demixing Info Parameter Data associated with the audio frame. This
* metadata is in the form of the AVIAMFParamDefinition struct and contains
* information defined in sections 3.6.1 and 3.8.2 of the Immersive Audio Model
* and Formats standard.
*/
AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM,
/**
* IAMF Recon Gain Info Parameter Data associated with the audio frame. This
* metadata is in the form of the AVIAMFParamDefinition struct and contains
* information defined in sections 3.6.1 and 3.8.3 of the Immersive Audio Model
* and Formats standard.
*/
AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM,
/**
* Ambient viewing environment metadata, as defined by H.274. This metadata
* should be associated with a video stream and contains data in the form
* of the AVAmbientViewingEnvironment struct.
*/
AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,
/** /**
* The number of side data types. * The number of side data types.
* This is not part of the public API/ABI in the sense that it may * This is not part of the public API/ABI in the sense that it may
@ -312,12 +343,129 @@ enum AVPacketSideDataType {
#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED #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
* and encoders and can be fed to decoders and muxers either in a per packet
* basis, or as global side data (applying to the entire coded stream).
*
* 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
* 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
* "AVStream's codec parameters", typically the output of encoders through
* the @ref AVCodecContext.coded_side_data "encoder context's side data", for
* initialization.
*
* Packet specific side data is handled as follows:
* - During demuxing, it may be exported through @ref AVPacket.side_data
* "AVPacket's side data", which can then be passed as input to decoders.
* - For muxing, it can be fed through @ref AVPacket.side_data "AVPacket's
* side data", typically the output of encoders.
*
* Different modules may accept or export different types of side data
* depending on media type and codec. Refer to @ref AVPacketSideDataType for a
* list of defined types and where they may be found or used.
*/
typedef struct AVPacketSideData { typedef struct AVPacketSideData {
uint8_t *data; uint8_t *data;
size_t size; size_t size;
enum AVPacketSideDataType type; enum AVPacketSideDataType type;
} AVPacketSideData; } AVPacketSideData;
/**
* Allocate a new packet side data.
*
* @param sd pointer to an array of side data to which the side data should
* be added. *sd may be NULL, in which case the array will be
* initialized.
* @param nb_sd pointer to an integer containing the number of entries in
* the array. The integer value will be increased by 1 on success.
* @param type side data type
* @param size desired side data size
* @param flags currently unused. Must be zero
*
* @return pointer to freshly allocated side data on success, or NULL otherwise.
*/
AVPacketSideData *av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd,
enum AVPacketSideDataType type,
size_t size, int flags);
/**
* Wrap existing data as packet side data.
*
* @param sd pointer to an array of side data to which the side data should
* be added. *sd may be NULL, in which case the array will be
* initialized
* @param nb_sd pointer to an integer containing the number of entries in
* the array. The integer value will be increased by 1 on success.
* @param type side data type
* @param data a data array. It must be allocated with the av_malloc() family
* of functions. The ownership of the data is transferred to the
* side data array on success
* @param size size of the data array
* @param flags currently unused. Must be zero
*
* @return pointer to freshly allocated side data on success, or NULL otherwise
* On failure, the side data array is unchanged and the data remains
* owned by the caller.
*/
AVPacketSideData *av_packet_side_data_add(AVPacketSideData **sd, int *nb_sd,
enum AVPacketSideDataType type,
void *data, size_t size, int flags);
/**
* Get side information from a side data array.
*
* @param sd the array from which the side data should be fetched
* @param nb_sd value containing the number of entries in the array.
* @param type desired side information type
*
* @return pointer to side data if present or NULL otherwise
*/
const AVPacketSideData *av_packet_side_data_get(const AVPacketSideData *sd,
int nb_sd,
enum AVPacketSideDataType type);
/**
* Remove side data of the given type from a side data array.
*
* @param sd the array from which the side data should be removed
* @param nb_sd pointer to an integer containing the number of entries in
* the array. Will be reduced by the amount of entries removed
* upon return
* @param type side information type
*/
void av_packet_side_data_remove(AVPacketSideData *sd, int *nb_sd,
enum AVPacketSideDataType type);
/**
* Convenience function to free all the side data stored in an array, and
* the array itself.
*
* @param sd pointer to array of side data to free. Will be set to NULL
* upon return.
* @param nb_sd pointer to an integer containing the number of entries in
* the array. Will be set to 0 upon return.
*/
void av_packet_side_data_free(AVPacketSideData **sd, int *nb_sd);
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
/**
* @}
*/
/**
* @defgroup lavc_packet AVPacket
*
* Types and functions for working with AVPacket.
* @{
*/
/** /**
* This structure stores compressed data. It is typically exported by demuxers * This structure stores compressed data. It is typically exported by demuxers
* and then passed as input to decoders, or received as output from encoders and * and then passed as input to decoders, or received as output from encoders and
@ -448,13 +596,6 @@ typedef struct AVPacketList {
#define AV_PKT_FLAG_DISPOSABLE 0x0010 #define AV_PKT_FLAG_DISPOSABLE 0x0010
enum AVSideDataParamChangeFlags { enum AVSideDataParamChangeFlags {
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* @deprecated those are not used by any decoder
*/
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
#endif
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
}; };
@ -603,8 +744,6 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
size_t *size); size_t *size);
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
/** /**
* Pack a dictionary for use in side_data. * Pack a dictionary for use in side_data.
* *

View File

@ -66,16 +66,14 @@ typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
/** /**
* This structure is used to share data between the libavcodec library and * This structure is used to share data between the libavcodec library and
* the client video application. * the client video application.
* The user shall allocate the structure via the av_alloc_vdpau_hwaccel * This structure will be allocated and stored in AVCodecContext.hwaccel_context
* function and make it available as * by av_vdpau_bind_context(). Members can be set by the user once
* AVCodecContext.hwaccel_context. Members can be set by the user once
* during initialization or through each AVCodecContext.get_buffer() * during initialization or through each AVCodecContext.get_buffer()
* function call. In any case, they must be valid prior to calling * function call. In any case, they must be valid prior to calling
* decoding functions. * decoding functions.
* *
* The size of this structure is not a part of the public ABI and must not * The size of this structure is not a part of the public ABI and must not
* be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an * be used outside of libavcodec.
* AVVDPAUContext.
*/ */
typedef struct AVVDPAUContext { typedef struct AVVDPAUContext {
/** /**
@ -95,15 +93,27 @@ typedef struct AVVDPAUContext {
AVVDPAU_Render2 render2; AVVDPAU_Render2 render2;
} AVVDPAUContext; } AVVDPAUContext;
#if FF_API_VDPAU_ALLOC_GET_SET
/** /**
* @brief allocation function for AVVDPAUContext * @brief allocation function for AVVDPAUContext
* *
* Allows extending the struct without breaking API/ABI * Allows extending the struct without breaking API/ABI
* @deprecated use av_vdpau_bind_context() instead
*/ */
attribute_deprecated
AVVDPAUContext *av_alloc_vdpaucontext(void); 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 *); 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); void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
#endif
/** /**
* Associate a VDPAU device with a codec context for hardware acceleration. * Associate a VDPAU device with a codec context for hardware acceleration.
@ -145,12 +155,16 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
uint32_t *width, uint32_t *height); uint32_t *width, uint32_t *height);
#if FF_API_VDPAU_ALLOC_GET_SET
/** /**
* Allocate an AVVDPAUContext. * Allocate an AVVDPAUContext.
* *
* @return Newly-allocated AVVDPAUContext or NULL on failure. * @return Newly-allocated AVVDPAUContext or NULL on failure.
* @deprecated use av_vdpau_bind_context() instead
*/ */
attribute_deprecated
AVVDPAUContext *av_vdpau_alloc_context(void); AVVDPAUContext *av_vdpau_alloc_context(void);
#endif
/** @} */ /** @} */

View File

@ -25,7 +25,7 @@
* Libavcodec version macros. * Libavcodec version macros.
*/ */
#define LIBAVCODEC_VERSION_MAJOR 60 #define LIBAVCODEC_VERSION_MAJOR 61
/** /**
* FF_API_* defines may be placed below to indicate public API that will be * FF_API_* defines may be placed below to indicate public API that will be
@ -37,16 +37,15 @@
* at once through the bump. This improves the git bisect-ability of the change. * at once through the bump. This improves the git bisect-ability of the change.
*/ */
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 61) #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 61) #define FF_API_SUBFRAMES (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 61) #define FF_API_TICKS_PER_FRAME (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 61) #define FF_API_DROPCHANGED (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61)
#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61)
#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 61)
#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61)
// reminder to remove CrystalHD decoders on next major bump #define FF_API_AVFFT (LIBAVCODEC_VERSION_MAJOR < 62)
#define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61) #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)
#endif /* AVCODEC_VERSION_MAJOR_H */ #endif /* AVCODEC_VERSION_MAJOR_H */

View File

@ -60,15 +60,6 @@ typedef struct AVVideotoolboxContext {
*/ */
VTDecompressionSessionRef session; VTDecompressionSessionRef session;
#if FF_API_VT_OUTPUT_CALLBACK
/**
* The output callback that must be passed to the session.
* Set by av_videottoolbox_default_init()
*/
attribute_deprecated
VTDecompressionOutputCallback output_callback;
#endif
/** /**
* CVPixelBuffer Format Type that Videotoolbox will use for decoded frames. * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
* set by the caller. If this is set to 0, then no specific format is * set by the caller. If this is set to 0, then no specific format is
@ -87,62 +78,6 @@ typedef struct AVVideotoolboxContext {
int cm_codec_type; int cm_codec_type;
} AVVideotoolboxContext; } AVVideotoolboxContext;
#if FF_API_VT_HWACCEL_CONTEXT
/**
* Allocate and initialize a Videotoolbox context.
*
* This function should be called from the get_format() callback when the caller
* selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create
* the decoder object (using the output callback provided by libavcodec) that
* will be used for Videotoolbox-accelerated decoding.
*
* When decoding with Videotoolbox is finished, the caller must destroy the decoder
* object and free the Videotoolbox context using av_free().
*
* @return the newly allocated context or NULL on failure
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
*/
attribute_deprecated
AVVideotoolboxContext *av_videotoolbox_alloc_context(void);
/**
* This is a convenience function that creates and sets up the Videotoolbox context using
* an internal implementation.
*
* @param avctx the corresponding codec context
*
* @return >= 0 on success, a negative AVERROR code on failure
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
*/
attribute_deprecated
int av_videotoolbox_default_init(AVCodecContext *avctx);
/**
* This is a convenience function that creates and sets up the Videotoolbox context using
* an internal implementation.
*
* @param avctx the corresponding codec context
* @param vtctx the Videotoolbox context to use
*
* @return >= 0 on success, a negative AVERROR code on failure
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
*/
attribute_deprecated
int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx);
/**
* This function must be called to free the Videotoolbox context initialized with
* av_videotoolbox_default_init().
*
* @param avctx the corresponding codec context
* @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead.
*/
attribute_deprecated
void av_videotoolbox_default_free(AVCodecContext *avctx);
#endif /* FF_API_VT_HWACCEL_CONTEXT */
/** /**
* @} * @}
*/ */

View File

@ -1,171 +0,0 @@
/*
* Copyright (C) 2003 Ivan Kalvachev
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_XVMC_H
#define AVCODEC_XVMC_H
/**
* @file
* @ingroup lavc_codec_hwaccel_xvmc
* Public libavcodec XvMC header.
*/
#pragma message("XvMC is no longer supported; this header is deprecated and will be removed")
#include <X11/extensions/XvMC.h>
#include "libavutil/attributes.h"
#include "avcodec.h"
/**
* @defgroup lavc_codec_hwaccel_xvmc XvMC
* @ingroup lavc_codec_hwaccel
*
* @{
*/
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
struct attribute_deprecated xvmc_pix_fmt {
/** The field contains the special constant value AV_XVMC_ID.
It is used as a test that the application correctly uses the API,
and that there is no corruption caused by pixel routines.
- application - set during initialization
- libavcodec - unchanged
*/
int xvmc_id;
/** Pointer to the block array allocated by XvMCCreateBlocks().
The array has to be freed by XvMCDestroyBlocks().
Each group of 64 values represents one data block of differential
pixel information (in MoCo mode) or coefficients for IDCT.
- application - set the pointer during initialization
- libavcodec - fills coefficients/pixel data into the array
*/
short* data_blocks;
/** Pointer to the macroblock description array allocated by
XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
- application - set the pointer during initialization
- libavcodec - fills description data into the array
*/
XvMCMacroBlock* mv_blocks;
/** Number of macroblock descriptions that can be stored in the mv_blocks
array.
- application - set during initialization
- libavcodec - unchanged
*/
int allocated_mv_blocks;
/** Number of blocks that can be stored at once in the data_blocks array.
- application - set during initialization
- libavcodec - unchanged
*/
int allocated_data_blocks;
/** Indicate that the hardware would interpret data_blocks as IDCT
coefficients and perform IDCT on them.
- application - set during initialization
- libavcodec - unchanged
*/
int idct;
/** In MoCo mode it indicates that intra macroblocks are assumed to be in
unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
- application - set during initialization
- libavcodec - unchanged
*/
int unsigned_intra;
/** Pointer to the surface allocated by XvMCCreateSurface().
It has to be freed by XvMCDestroySurface() on application exit.
It identifies the frame and its state on the video hardware.
- application - set during initialization
- libavcodec - unchanged
*/
XvMCSurface* p_surface;
/** Set by the decoder before calling ff_draw_horiz_band(),
needed by the XvMCRenderSurface function. */
//@{
/** Pointer to the surface used as past reference
- application - unchanged
- libavcodec - set
*/
XvMCSurface* p_past_surface;
/** Pointer to the surface used as future reference
- application - unchanged
- libavcodec - set
*/
XvMCSurface* p_future_surface;
/** top/bottom field or frame
- application - unchanged
- libavcodec - set
*/
unsigned int picture_structure;
/** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
- application - unchanged
- libavcodec - set
*/
unsigned int flags;
//}@
/** Number of macroblock descriptions in the mv_blocks array
that have already been passed to the hardware.
- application - zeroes it on get_buffer().
A successful ff_draw_horiz_band() may increment it
with filled_mb_block_num or zero both.
- libavcodec - unchanged
*/
int start_mv_blocks_num;
/** Number of new macroblock descriptions in the mv_blocks array (after
start_mv_blocks_num) that are filled by libavcodec and have to be
passed to the hardware.
- application - zeroes it on get_buffer() or after successful
ff_draw_horiz_band().
- libavcodec - increment with one of each stored MB
*/
int filled_mv_blocks_num;
/** Number of the next free data block; one data block consists of
64 short values in the data_blocks array.
All blocks before this one have already been claimed by placing their
position into the corresponding block description structure field,
that are part of the mv_blocks array.
- application - zeroes it on get_buffer().
A successful ff_draw_horiz_band() may zero it together
with start_mb_blocks_num.
- libavcodec - each decoded macroblock increases it by the number
of coded blocks it contains.
*/
int next_free_data_block_num;
};
/**
* @}
*/
#endif /* AVCODEC_XVMC_H */

View File

@ -307,10 +307,8 @@
* @} * @}
*/ */
#include <time.h>
#include <stdio.h> /* FILE */ #include <stdio.h> /* FILE */
#include "libavcodec/codec.h"
#include "libavcodec/codec_par.h" #include "libavcodec/codec_par.h"
#include "libavcodec/defs.h" #include "libavcodec/defs.h"
#include "libavcodec/packet.h" #include "libavcodec/packet.h"
@ -325,11 +323,13 @@
* to avoid unnecessary rebuilds. When included externally, keep including * to avoid unnecessary rebuilds. When included externally, keep including
* the full version information. */ * the full version information. */
#include "libavformat/version.h" #include "libavformat/version.h"
#include "libavutil/frame.h"
#include "libavcodec/codec.h"
#endif #endif
struct AVFormatContext; struct AVFormatContext;
struct AVFrame;
struct AVDeviceInfoList;
/** /**
* @defgroup metadata_api Public Metadata API * @defgroup metadata_api Public Metadata API
@ -485,7 +485,9 @@ typedef struct AVProbeData {
#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */ #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_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 */ #define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */
#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ #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 #define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly
increasing timestamps, but they must increasing timestamps, but they must
still be monotonic */ still be monotonic */
@ -521,7 +523,7 @@ typedef struct AVOutputFormat {
/** /**
* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER,
* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
* AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS,
* AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE * AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE
*/ */
int flags; int flags;
@ -581,103 +583,6 @@ typedef struct AVInputFormat {
* @see av_probe_input_format2 * @see av_probe_input_format2
*/ */
const char *mime_type; const char *mime_type;
/*****************************************************************
* No fields below this line are part of the public API. They
* may not be used outside of libavformat and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
/**
* Raw demuxers store their codec ID here.
*/
int raw_codec_id;
/**
* Size of private data so that it can be allocated in the wrapper.
*/
int priv_data_size;
/**
* Internal flags. See FF_FMT_FLAG_* in internal.h.
*/
int flags_internal;
/**
* Tell if a given file has a chance of being parsed as this format.
* The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes
* big so you do not have to check for that unless you need more.
*/
int (*read_probe)(const AVProbeData *);
/**
* Read the format header and initialize the AVFormatContext
* structure. Return 0 if OK. 'avformat_new_stream' should be
* called to create new streams.
*/
int (*read_header)(struct AVFormatContext *);
/**
* Read one packet and put it in 'pkt'. pts and flags are also
* set. 'avformat_new_stream' can be called only if the flag
* AVFMTCTX_NOHEADER is used and only in the calling thread (not in a
* background thread).
* @return 0 on success, < 0 on error.
* Upon returning an error, pkt must be unreferenced by the caller.
*/
int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
/**
* Close the stream. The AVFormatContext and AVStreams are not
* freed by this function
*/
int (*read_close)(struct AVFormatContext *);
/**
* Seek to a given timestamp relative to the frames in
* stream component stream_index.
* @param stream_index Must not be -1.
* @param flags Selects which direction should be preferred if no exact
* match is available.
* @return >= 0 on success (but not necessarily the new offset)
*/
int (*read_seek)(struct AVFormatContext *,
int stream_index, int64_t timestamp, int flags);
/**
* Get the next timestamp in stream[stream_index].time_base units.
* @return the timestamp or AV_NOPTS_VALUE if an error occurred
*/
int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
int64_t *pos, int64_t pos_limit);
/**
* Start/resume playing - only meaningful if using a network-based format
* (RTSP).
*/
int (*read_play)(struct AVFormatContext *);
/**
* Pause playing - only meaningful if using a network-based format
* (RTSP).
*/
int (*read_pause)(struct AVFormatContext *);
/**
* Seek to timestamp ts.
* Seeking will be done so that the point from which all active streams
* can be presented successfully will be closest to ts and within min/max_ts.
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
/**
* Returns device list with it properties.
* @see avdevice_list_devices() for more details.
*/
int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
} AVInputFormat; } AVInputFormat;
/** /**
* @} * @}
@ -799,9 +704,9 @@ typedef struct AVIndexEntry {
*/ */
#define AV_DISPOSITION_METADATA (1 << 18) #define AV_DISPOSITION_METADATA (1 << 18)
/** /**
* The audio stream is intended to be mixed with another stream before * The stream is intended to be mixed with another stream before presentation.
* presentation. * Used for example to signal the stream contains an image part of a HEIF grid,
* Corresponds to mix_type=0 in mpegts. * or for mix_type=0 in mpegts.
*/ */
#define AV_DISPOSITION_DEPENDENT (1 << 19) #define AV_DISPOSITION_DEPENDENT (1 << 19)
/** /**
@ -937,6 +842,7 @@ typedef struct AVStream {
*/ */
AVPacket attached_pic; AVPacket attached_pic;
#if FF_API_AVSTREAM_SIDE_DATA
/** /**
* An array of side data that applies to the whole stream (i.e. the * An array of side data that applies to the whole stream (i.e. the
* container does not allow it to change between packets). * container does not allow it to change between packets).
@ -953,13 +859,20 @@ typedef struct AVStream {
* *
* Freed by libavformat in avformat_free_context(). * Freed by libavformat in avformat_free_context().
* *
* @see av_format_inject_global_side_data() * @deprecated use AVStream's @ref AVCodecParameters.coded_side_data
* "codecpar side data".
*/ */
attribute_deprecated
AVPacketSideData *side_data; AVPacketSideData *side_data;
/** /**
* The number of elements in the AVStream.side_data array. * 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; int nb_side_data;
#endif
/** /**
* Flags indicating events happening on the stream, a combination of * Flags indicating events happening on the stream, a combination of
@ -1007,17 +920,255 @@ typedef struct AVStream {
int pts_wrap_bits; int pts_wrap_bits;
} AVStream; } AVStream;
struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
#if FF_API_GET_END_PTS
/** /**
* Returns the pts of the last muxed packet + its duration * AVStreamGroupTileGrid holds information on how to combine several
* independent images on a single canvas for presentation.
* *
* the retuned value is undefined when used with a demuxer. * The output should be a @ref AVStreamGroupTileGrid.background "background"
* colored @ref AVStreamGroupTileGrid.coded_width "coded_width" x
* @ref AVStreamGroupTileGrid.coded_height "coded_height" canvas where a
* @ref AVStreamGroupTileGrid.nb_tiles "nb_tiles" amount of tiles are placed in
* the order they appear in the @ref AVStreamGroupTileGrid.offsets "offsets"
* array, at the exact offset described for them. In particular, if two or more
* tiles overlap, the image with higher index in the
* @ref AVStreamGroupTileGrid.offsets "offsets" array takes priority.
* Note that a single image may be used multiple times, i.e. multiple entries
* in @ref AVStreamGroupTileGrid.offsets "offsets" may have the same value of
* idx.
*
* The following is an example of a simple grid with 3 rows and 4 columns:
*
* +---+---+---+---+
* | 0 | 1 | 2 | 3 |
* +---+---+---+---+
* | 4 | 5 | 6 | 7 |
* +---+---+---+---+
* | 8 | 9 |10 |11 |
* +---+---+---+---+
*
* Assuming all tiles have a dimension of 512x512, the
* @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
* the first @ref AVStreamGroup.streams "stream" in the group is "0,0", the
* @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
* the second @ref AVStreamGroup.streams "stream" in the group is "512,0", the
* @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
* the fifth @ref AVStreamGroup.streams "stream" in the group is "0,512", the
* @ref AVStreamGroupTileGrid.offsets "offset", of the topleft pixel of
* the sixth @ref AVStreamGroup.streams "stream" in the group is "512,512",
* etc.
*
* The following is an example of a canvas with overlaping tiles:
*
* +-----------+
* | %%%%% |
* |***%%3%%@@@|
* |**0%%%%%2@@|
* |***##1@@@@@|
* | ##### |
* +-----------+
*
* Assuming a canvas with size 1024x1024 and all tiles with a dimension of
* 512x512, a possible @ref AVStreamGroupTileGrid.offsets "offset" for the
* topleft pixel of the first @ref AVStreamGroup.streams "stream" in the group
* would be 0x256, the @ref AVStreamGroupTileGrid.offsets "offset" for the
* topleft pixel of the second @ref AVStreamGroup.streams "stream" in the group
* would be 256x512, the @ref AVStreamGroupTileGrid.offsets "offset" for the
* topleft pixel of the third @ref AVStreamGroup.streams "stream" in the group
* would be 512x256, and the @ref AVStreamGroupTileGrid.offsets "offset" for
* the topleft pixel of the fourth @ref AVStreamGroup.streams "stream" in the
* group would be 256x0.
*
* sizeof(AVStreamGroupTileGrid) is not a part of the ABI and may only be
* allocated by avformat_stream_group_create().
*/ */
attribute_deprecated typedef struct AVStreamGroupTileGrid {
int64_t av_stream_get_end_pts(const AVStream *st); const AVClass *av_class;
#endif
/**
* Amount of tiles in the grid.
*
* Must be > 0.
*/
unsigned int nb_tiles;
/**
* Width of the canvas.
*
* Must be > 0.
*/
int coded_width;
/**
* Width of the canvas.
*
* Must be > 0.
*/
int coded_height;
/**
* An @ref nb_tiles sized array of offsets in pixels from the topleft edge
* of the canvas, indicating where each stream should be placed.
* It must be allocated with the av_malloc() family of functions.
*
* - demuxing: set by libavformat, must not be modified by the caller.
* - muxing: set by the caller before avformat_write_header().
*
* Freed by libavformat in avformat_free_context().
*/
struct {
/**
* Index of the stream in the group this tile references.
*
* Must be < @ref AVStreamGroup.nb_streams "nb_streams".
*/
unsigned int idx;
/**
* Offset in pixels from the left edge of the canvas where the tile
* should be placed.
*/
int horizontal;
/**
* Offset in pixels from the top edge of the canvas where the tile
* should be placed.
*/
int vertical;
} *offsets;
/**
* The pixel value per channel in RGBA format used if no pixel of any tile
* is located at a particular pixel location.
*
* @see av_image_fill_color().
* @see av_parse_color().
*/
uint8_t background[4];
/**
* Offset in pixels from the left edge of the canvas where the actual image
* meant for presentation starts.
*
* This field must be >= 0 and < @ref coded_width.
*/
int horizontal_offset;
/**
* Offset in pixels from the top edge of the canvas where the actual image
* meant for presentation starts.
*
* This field must be >= 0 and < @ref coded_height.
*/
int vertical_offset;
/**
* Width of the final image for presentation.
*
* Must be > 0 and <= (@ref coded_width - @ref horizontal_offset).
* When it's not equal to (@ref coded_width - @ref horizontal_offset), the
* result of (@ref coded_width - width - @ref horizontal_offset) is the
* amount amount of pixels to be cropped from the right edge of the
* final image before presentation.
*/
int width;
/**
* Height of the final image for presentation.
*
* Must be > 0 and <= (@ref coded_height - @ref vertical_offset).
* When it's not equal to (@ref coded_height - @ref vertical_offset), the
* result of (@ref coded_height - height - @ref vertical_offset) is the
* amount amount of pixels to be cropped from the bottom edge of the
* final image before presentation.
*/
int height;
} AVStreamGroupTileGrid;
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,
};
struct AVIAMFAudioElement;
struct AVIAMFMixPresentation;
typedef struct AVStreamGroup {
/**
* A class for @ref avoptions. Set by avformat_stream_group_create().
*/
const AVClass *av_class;
void *priv_data;
/**
* Group index in AVFormatContext.
*/
unsigned int index;
/**
* Group type-specific group ID.
*
* decoding: set by libavformat
* encoding: may set by the user
*/
int64_t id;
/**
* Group type
*
* decoding: set by libavformat on group creation
* encoding: set by avformat_stream_group_create()
*/
enum AVStreamGroupParamsType type;
/**
* Group type-specific parameters
*/
union {
struct AVIAMFAudioElement *iamf_audio_element;
struct AVIAMFMixPresentation *iamf_mix_presentation;
struct AVStreamGroupTileGrid *tile_grid;
} params;
/**
* Metadata that applies to the whole group.
*
* - demuxing: set by libavformat on group creation
* - muxing: may be set by the caller before avformat_write_header()
*
* Freed by libavformat in avformat_free_context().
*/
AVDictionary *metadata;
/**
* Number of elements in AVStreamGroup.streams.
*
* Set by avformat_stream_group_add_stream() must not be modified by any other code.
*/
unsigned int nb_streams;
/**
* A list of streams in the group. New entries are created with
* avformat_stream_group_add_stream().
*
* - demuxing: entries are created by libavformat on group creation.
* If AVFMTCTX_NOHEADER is set in ctx_flags, then new entries may also
* appear in av_read_frame().
* - muxing: entries are created by the user before avformat_write_header().
*
* Freed by libavformat in avformat_free_context().
*/
AVStream **streams;
/**
* Stream group disposition - a combination of AV_DISPOSITION_* flags.
* This field currently applies to all defined AVStreamGroupParamsType.
*
* - demuxing: set by libavformat when creating the group or in
* avformat_find_stream_info().
* - muxing: may be set by the caller before avformat_write_header().
*/
int disposition;
} AVStreamGroup;
struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
#define AV_PROGRAM_RUNNING 1 #define AV_PROGRAM_RUNNING 1
@ -1173,6 +1324,39 @@ typedef struct AVFormatContext {
*/ */
AVStream **streams; AVStream **streams;
/**
* Number of elements in AVFormatContext.stream_groups.
*
* Set by avformat_stream_group_create(), must not be modified by any other code.
*/
unsigned int nb_stream_groups;
/**
* A list of all stream groups in the file. New groups are created with
* avformat_stream_group_create(), and filled with avformat_stream_group_add_stream().
*
* - demuxing: groups may be created by libavformat in avformat_open_input().
* If AVFMTCTX_NOHEADER is set in ctx_flags, then new groups may also
* appear in av_read_frame().
* - muxing: groups may be created by the user before avformat_write_header().
*
* Freed by libavformat in avformat_free_context().
*/
AVStreamGroup **stream_groups;
/**
* Number of chapters in AVChapter array.
* When muxing, chapters are normally written in the file header,
* so nb_chapters should normally be initialized before write_header
* is called. Some muxers (e.g. mov and mkv) can also write chapters
* in the trailer. To write chapters in the trailer, nb_chapters
* must be zero when write_header is called and non-zero when
* write_trailer is called.
* - muxing: set by user
* - demuxing: set by libavformat
*/
unsigned int nb_chapters;
AVChapter **chapters;
/** /**
* input or output URL. Unlike the old filename field, this field has no * input or output URL. Unlike the old filename field, this field has no
* length restriction. * length restriction.
@ -1241,7 +1425,9 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_BITEXACT 0x0400 #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_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 #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. #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 #define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as requested by the muxer
/** /**
@ -1290,36 +1476,10 @@ typedef struct AVFormatContext {
enum AVCodecID subtitle_codec_id; enum AVCodecID subtitle_codec_id;
/** /**
* Maximum amount of memory in bytes to use for the index of each stream. * Forced Data codec_id.
* If the index exceeds this size, entries will be discarded as * Demuxing: Set by user.
* needed to maintain a smaller size. This can lead to slower or less
* accurate seeking (depends on demuxer).
* Demuxers for which a full in-memory index is mandatory will ignore
* this.
* - muxing: unused
* - demuxing: set by user
*/ */
unsigned int max_index_size; enum AVCodecID data_codec_id;
/**
* Maximum amount of memory in bytes to use for buffering frames
* obtained from realtime capture devices.
*/
unsigned int max_picture_buffer;
/**
* Number of chapters in AVChapter array.
* When muxing, chapters are normally written in the file header,
* so nb_chapters should normally be initialized before write_header
* is called. Some muxers (e.g. mov and mkv) can also write chapters
* in the trailer. To write chapters in the trailer, nb_chapters
* must be zero when write_header is called and non-zero when
* write_trailer is called.
* - muxing: set by user
* - demuxing: set by libavformat
*/
unsigned int nb_chapters;
AVChapter **chapters;
/** /**
* Metadata that applies to the whole file. * Metadata that applies to the whole file.
@ -1375,6 +1535,31 @@ typedef struct AVFormatContext {
int debug; int debug;
#define FF_FDEBUG_TS 0x0001 #define FF_FDEBUG_TS 0x0001
/**
* The maximum number of streams.
* - encoding: unused
* - decoding: set by user
*/
int max_streams;
/**
* Maximum amount of memory in bytes to use for the index of each stream.
* If the index exceeds this size, entries will be discarded as
* needed to maintain a smaller size. This can lead to slower or less
* accurate seeking (depends on demuxer).
* Demuxers for which a full in-memory index is mandatory will ignore
* this.
* - muxing: unused
* - demuxing: set by user
*/
unsigned int max_index_size;
/**
* Maximum amount of memory in bytes to use for buffering frames
* obtained from realtime capture devices.
*/
unsigned int max_picture_buffer;
/** /**
* Maximum buffering duration for interleaving. * Maximum buffering duration for interleaving.
* *
@ -1393,6 +1578,35 @@ typedef struct AVFormatContext {
*/ */
int64_t max_interleave_delta; int64_t max_interleave_delta;
/**
* Maximum number of packets to read while waiting for the first timestamp.
* Decoding only.
*/
int max_ts_probe;
/**
* Max chunk time in microseconds.
* Note, not all formats support this and unpredictable things may happen if it is used when not supported.
* - encoding: Set by user
* - decoding: unused
*/
int max_chunk_duration;
/**
* Max chunk size in bytes
* Note, not all formats support this and unpredictable things may happen if it is used when not supported.
* - encoding: Set by user
* - decoding: unused
*/
int max_chunk_size;
/**
* Maximum number of packets that can be probed
* - encoding: unused
* - decoding: set by user
*/
int max_probe_packets;
/** /**
* Allow non-standard and experimental extension * Allow non-standard and experimental extension
* @see AVCodecContext.strict_std_compliance * @see AVCodecContext.strict_std_compliance
@ -1419,11 +1633,6 @@ typedef struct AVFormatContext {
*/ */
#define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001
/**
* Maximum number of packets to read while waiting for the first timestamp.
* Decoding only.
*/
int max_ts_probe;
/** /**
* Avoid negative timestamps during muxing. * Avoid negative timestamps during muxing.
@ -1438,12 +1647,6 @@ typedef struct AVFormatContext {
#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative
#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0
/**
* Transport stream id.
* This will be moved into demuxer private options. Thus no API/ABI compatibility
*/
int ts_id;
/** /**
* Audio preload in microseconds. * Audio preload in microseconds.
* Note, not all formats support this and unpredictable things may happen if it is used when not supported. * Note, not all formats support this and unpredictable things may happen if it is used when not supported.
@ -1452,22 +1655,6 @@ typedef struct AVFormatContext {
*/ */
int audio_preload; int audio_preload;
/**
* Max chunk time in microseconds.
* Note, not all formats support this and unpredictable things may happen if it is used when not supported.
* - encoding: Set by user
* - decoding: unused
*/
int max_chunk_duration;
/**
* Max chunk size in bytes
* Note, not all formats support this and unpredictable things may happen if it is used when not supported.
* - encoding: Set by user
* - decoding: unused
*/
int max_chunk_size;
/** /**
* forces the use of wallclock timestamps as pts/dts of packets * forces the use of wallclock timestamps as pts/dts of packets
* This has undefined results in the presence of B frames. * This has undefined results in the presence of B frames.
@ -1476,6 +1663,13 @@ typedef struct AVFormatContext {
*/ */
int use_wallclock_as_timestamps; int use_wallclock_as_timestamps;
/**
* Skip duration calcuation in estimate_timings_from_pts.
* - encoding: unused
* - decoding: set by user
*/
int skip_estimate_duration_from_pts;
/** /**
* avio flags, used to force AVIO_FLAG_DIRECT. * avio flags, used to force AVIO_FLAG_DIRECT.
* - encoding: unused * - encoding: unused
@ -1555,6 +1749,20 @@ typedef struct AVFormatContext {
*/ */
char *format_whitelist; char *format_whitelist;
/**
* ',' separated list of allowed protocols.
* - encoding: unused
* - decoding: set by user
*/
char *protocol_whitelist;
/**
* ',' separated list of disallowed protocols.
* - encoding: unused
* - decoding: set by user
*/
char *protocol_blacklist;
/** /**
* IO repositioned flag. * IO repositioned flag.
* This is set by avformat when the underlaying IO context read pointer * This is set by avformat when the underlaying IO context read pointer
@ -1569,7 +1777,7 @@ typedef struct AVFormatContext {
* the same codec_id. * the same codec_id.
* Demuxing: Set by user * Demuxing: Set by user
*/ */
const AVCodec *video_codec; const struct AVCodec *video_codec;
/** /**
* Forced audio codec. * Forced audio codec.
@ -1577,7 +1785,7 @@ typedef struct AVFormatContext {
* the same codec_id. * the same codec_id.
* Demuxing: Set by user * Demuxing: Set by user
*/ */
const AVCodec *audio_codec; const struct AVCodec *audio_codec;
/** /**
* Forced subtitle codec. * Forced subtitle codec.
@ -1585,7 +1793,7 @@ typedef struct AVFormatContext {
* the same codec_id. * the same codec_id.
* Demuxing: Set by user * Demuxing: Set by user
*/ */
const AVCodec *subtitle_codec; const struct AVCodec *subtitle_codec;
/** /**
* Forced data codec. * Forced data codec.
@ -1593,12 +1801,12 @@ typedef struct AVFormatContext {
* the same codec_id. * the same codec_id.
* Demuxing: Set by user * Demuxing: Set by user
*/ */
const AVCodec *data_codec; const struct AVCodec *data_codec;
/** /**
* Number of bytes to be written as padding in a metadata header. * Number of bytes to be written as padding in a metadata header.
* Demuxing: Unused. * Demuxing: Unused.
* Muxing: Set by user via av_format_set_metadata_header_padding. * Muxing: Set by user.
*/ */
int metadata_header_padding; int metadata_header_padding;
@ -1627,19 +1835,6 @@ typedef struct AVFormatContext {
*/ */
uint8_t *dump_separator; uint8_t *dump_separator;
/**
* Forced Data codec_id.
* Demuxing: Set by user.
*/
enum AVCodecID data_codec_id;
/**
* ',' separated list of allowed protocols.
* - encoding: unused
* - decoding: set by user
*/
char *protocol_whitelist;
/** /**
* A callback for opening new IO streams. * A callback for opening new IO streams.
* *
@ -1663,44 +1858,6 @@ typedef struct AVFormatContext {
int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url,
int flags, AVDictionary **options); int flags, AVDictionary **options);
#if FF_API_AVFORMAT_IO_CLOSE
/**
* A callback for closing the streams opened with AVFormatContext.io_open().
*
* @deprecated use io_close2
*/
attribute_deprecated
void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
#endif
/**
* ',' separated list of disallowed protocols.
* - encoding: unused
* - decoding: set by user
*/
char *protocol_blacklist;
/**
* The maximum number of streams.
* - encoding: unused
* - decoding: set by user
*/
int max_streams;
/**
* Skip duration calcuation in estimate_timings_from_pts.
* - encoding: unused
* - decoding: set by user
*/
int skip_estimate_duration_from_pts;
/**
* Maximum number of packets that can be probed
* - encoding: unused
* - decoding: set by user
*/
int max_probe_packets;
/** /**
* A callback for closing the streams opened with AVFormatContext.io_open(). * A callback for closing the streams opened with AVFormatContext.io_open().
* *
@ -1718,15 +1875,25 @@ typedef struct AVFormatContext {
/** /**
* This function will cause global side data to be injected in the next packet * This function will cause global side data to be injected in the next packet
* of each stream as well as after any subsequent seek. * 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); void av_format_inject_global_side_data(AVFormatContext *s);
#if FF_API_GET_DUR_ESTIMATE_METHOD
/** /**
* Returns the method used to set ctx->duration. * Returns the method used to set ctx->duration.
* *
* @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE. * @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); enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx);
#endif
/** /**
* @defgroup lavf_core Core functions * @defgroup lavf_core Core functions
@ -1825,6 +1992,42 @@ const AVClass *avformat_get_class(void);
*/ */
const AVClass *av_stream_get_class(void); const AVClass *av_stream_get_class(void);
/**
* Get the AVClass for AVStreamGroup. It can be used in combination with
* AV_OPT_SEARCH_FAKE_OBJ for examining options.
*
* @see av_opt_find().
*/
const AVClass *av_stream_group_get_class(void);
/**
* @return a string identifying the stream group type, or NULL if unknown
*/
const char *avformat_stream_group_name(enum AVStreamGroupParamsType type);
/**
* Add a new empty stream group to a media file.
*
* When demuxing, it may be called by the demuxer in read_header(). If the
* flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
* be called in read_packet().
*
* When muxing, may be called by the user before avformat_write_header().
*
* User is required to call avformat_free_context() to clean up the allocation
* by avformat_stream_group_create().
*
* New streams can be added to the group with avformat_stream_group_add_stream().
*
* @param s media file handle
*
* @return newly created group or NULL on error.
* @see avformat_new_stream, avformat_stream_group_add_stream.
*/
AVStreamGroup *avformat_stream_group_create(AVFormatContext *s,
enum AVStreamGroupParamsType type,
AVDictionary **options);
/** /**
* Add a new stream to a media file. * Add a new stream to a media file.
* *
@ -1842,8 +2045,34 @@ const AVClass *av_stream_get_class(void);
* *
* @return newly created stream or NULL on error. * @return newly created stream or NULL on error.
*/ */
AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); AVStream *avformat_new_stream(AVFormatContext *s, const struct AVCodec *c);
/**
* Add an already allocated stream to a stream group.
*
* When demuxing, it may be called by the demuxer in read_header(). If the
* flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
* be called in read_packet().
*
* When muxing, may be called by the user before avformat_write_header() after
* having allocated a new group with avformat_stream_group_create() and stream with
* avformat_new_stream().
*
* User is required to call avformat_free_context() to clean up the allocation
* by avformat_stream_group_add_stream().
*
* @param stg stream group belonging to a media file.
* @param st stream in the media file to add to the group.
*
* @retval 0 success
* @retval AVERROR(EEXIST) the stream was already in the group
* @retval "another negative error code" legitimate errors
*
* @see avformat_new_stream, avformat_stream_group_create.
*/
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st);
#if FF_API_AVSTREAM_SIDE_DATA
/** /**
* Wrap an existing array as stream side data. * Wrap an existing array as stream side data.
* *
@ -1856,7 +2085,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c);
* *
* @return zero on success, a negative AVERROR code on failure. On failure, * @return zero on success, a negative AVERROR code on failure. On failure,
* the stream is unchanged and the data remains owned by the caller. * 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, int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
uint8_t *data, size_t size); uint8_t *data, size_t size);
@ -1868,7 +2100,10 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
* @param size side information size * @param size side information size
* *
* @return pointer to fresh allocated data or NULL otherwise * @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, uint8_t *av_stream_new_side_data(AVStream *stream,
enum AVPacketSideDataType type, size_t size); enum AVPacketSideDataType type, size_t size);
/** /**
@ -1880,9 +2115,13 @@ uint8_t *av_stream_new_side_data(AVStream *stream,
* or to zero if the desired side data is not present. * or to zero if the desired side data is not present.
* *
* @return pointer to data if present or NULL otherwise * @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, uint8_t *av_stream_get_side_data(const AVStream *stream,
enum AVPacketSideDataType type, size_t *size); enum AVPacketSideDataType type, size_t *size);
#endif
AVProgram *av_new_program(AVFormatContext *s, int id); AVProgram *av_new_program(AVFormatContext *s, int id);
@ -2076,7 +2315,7 @@ int av_find_best_stream(AVFormatContext *ic,
enum AVMediaType type, enum AVMediaType type,
int wanted_stream_nb, int wanted_stream_nb,
int related_stream, int related_stream,
const AVCodec **decoder_ret, const struct AVCodec **decoder_ret,
int flags); int flags);
/** /**
@ -2352,7 +2591,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
* See av_interleaved_write_uncoded_frame() for details. * See av_interleaved_write_uncoded_frame() for details.
*/ */
int av_write_uncoded_frame(AVFormatContext *s, int stream_index, int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
AVFrame *frame); struct AVFrame *frame);
/** /**
* Write an uncoded frame to an output media file. * Write an uncoded frame to an output media file.
@ -2371,7 +2610,7 @@ int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
* @return >=0 for success, a negative code on error * @return >=0 for success, a negative code on error
*/ */
int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index,
AVFrame *frame); struct AVFrame *frame);
/** /**
* Test whether a muxer supports uncoded frame. * Test whether a muxer supports uncoded frame.
@ -2759,7 +2998,8 @@ const struct AVCodecTag *avformat_get_mov_audio_tags(void);
* @param frame the frame with the aspect ratio to be determined * @param frame the frame with the aspect ratio to be determined
* @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea * @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea
*/ */
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame); AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream,
struct AVFrame *frame);
/** /**
* Guess the frame rate, based on both the container and codec information. * Guess the frame rate, based on both the container and codec information.
@ -2769,7 +3009,8 @@ AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *strea
* @param frame the frame for which the frame rate should be determined, may be NULL * @param frame the frame for which the frame rate should be determined, may be NULL
* @return the guessed (valid) frame rate, 0/1 if no idea * @return the guessed (valid) frame rate, 0/1 if no idea
*/ */
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame); AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream,
struct AVFrame *frame);
/** /**
* Check if the stream st contained in s is matched by the stream specifier * Check if the stream st contained in s is matched by the stream specifier

View File

@ -101,13 +101,7 @@ typedef struct AVIODirEntry {
int64_t filemode; /**< Unix file mode, -1 if unknown. */ int64_t filemode; /**< Unix file mode, -1 if unknown. */
} AVIODirEntry; } AVIODirEntry;
#if FF_API_AVIODIRCONTEXT
typedef struct AVIODirContext {
struct URLContext *url_context;
} AVIODirContext;
#else
typedef struct AVIODirContext AVIODirContext; typedef struct AVIODirContext AVIODirContext;
#endif
/** /**
* Different data types that can be returned via the AVIO * Different data types that can be returned via the AVIO
@ -238,7 +232,7 @@ typedef struct AVIOContext {
void *opaque; /**< A private pointer, passed to the read/write/seek/... void *opaque; /**< A private pointer, passed to the read/write/seek/...
functions. */ functions. */
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size);
int64_t (*seek)(void *opaque, int64_t offset, int whence); int64_t (*seek)(void *opaque, int64_t offset, int whence);
int64_t pos; /**< position in the file of the current buffer */ int64_t pos; /**< position in the file of the current buffer */
int eof_reached; /**< true if was unable to read due to error or eof */ int eof_reached; /**< true if was unable to read due to error or eof */
@ -286,7 +280,7 @@ typedef struct AVIOContext {
/** /**
* A callback that is used instead of write_packet. * A callback that is used instead of write_packet.
*/ */
int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size, int (*write_data_type)(void *opaque, const uint8_t *buf, int buf_size,
enum AVIODataMarkerType type, int64_t time); enum AVIODataMarkerType type, int64_t time);
/** /**
* If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT, * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,
@ -407,7 +401,7 @@ AVIOContext *avio_alloc_context(
int write_flag, int write_flag,
void *opaque, void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence)); int64_t (*seek)(void *opaque, int64_t offset, int whence));
/** /**
@ -531,7 +525,7 @@ int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
* Usually you don't need to use this function directly but its macro wrapper, * Usually you don't need to use this function directly but its macro wrapper,
* avio_print. * avio_print.
*/ */
void avio_print_string_array(AVIOContext *s, const char *strings[]); void avio_print_string_array(AVIOContext *s, const char * const strings[]);
/** /**
* Write strings (const char *) to the context. * Write strings (const char *) to the context.

View File

@ -31,7 +31,7 @@
#include "version_major.h" #include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 3 #define LIBAVFORMAT_VERSION_MINOR 1
#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #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) // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here // Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 60 #define LIBAVFORMAT_VERSION_MAJOR 61
/** /**
* FF_API_* defines may be placed below to indicate public API that will be * FF_API_* defines may be placed below to indicate public API that will be
@ -41,11 +41,12 @@
* at once through the bump. This improves the git bisect-ability of the change. * at once through the bump. This improves the git bisect-ability of the change.
* *
*/ */
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 61) #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 61) #define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61) #define FF_API_ALLOW_FLUSH (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61) #define FF_API_AVSTREAM_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_GET_DUR_ESTIMATE_METHOD (LIBAVFORMAT_VERSION_MAJOR < 62)
#define FF_API_R_FRAME_RATE 1 #define FF_API_R_FRAME_RATE 1

View File

@ -91,7 +91,7 @@ int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
* code on failure. If successful, the number of samples * code on failure. If successful, the number of samples
* actually written will always be nb_samples. * actually written will always be nb_samples.
*/ */
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); int av_audio_fifo_write(AVAudioFifo *af, void * const *data, int nb_samples);
/** /**
* Peek data from an AVAudioFifo. * Peek data from an AVAudioFifo.
@ -107,7 +107,7 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
* be greater than nb_samples, and will only be less than * be greater than nb_samples, and will only be less than
* nb_samples if av_audio_fifo_size is less than nb_samples. * nb_samples if av_audio_fifo_size is less than nb_samples.
*/ */
int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples); int av_audio_fifo_peek(const AVAudioFifo *af, void * const *data, int nb_samples);
/** /**
* Peek data from an AVAudioFifo. * Peek data from an AVAudioFifo.
@ -124,7 +124,8 @@ int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples);
* be greater than nb_samples, and will only be less than * be greater than nb_samples, and will only be less than
* nb_samples if av_audio_fifo_size is less than nb_samples. * nb_samples if av_audio_fifo_size is less than nb_samples.
*/ */
int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offset); int av_audio_fifo_peek_at(const AVAudioFifo *af, void * const *data,
int nb_samples, int offset);
/** /**
* Read data from an AVAudioFifo. * Read data from an AVAudioFifo.
@ -140,7 +141,7 @@ int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offs
* be greater than nb_samples, and will only be less than * be greater than nb_samples, and will only be less than
* nb_samples if av_audio_fifo_size is less than nb_samples. * nb_samples if av_audio_fifo_size is less than nb_samples.
*/ */
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); int av_audio_fifo_read(AVAudioFifo *af, void * const *data, int nb_samples);
/** /**
* Drain data from an AVAudioFifo. * Drain data from an AVAudioFifo.

View File

@ -28,6 +28,9 @@
#define AVUTIL_AVASSERT_H #define AVUTIL_AVASSERT_H
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
#endif
#include "log.h" #include "log.h"
#include "macros.h" #include "macros.h"

View File

@ -24,7 +24,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "attributes.h" #include "attributes.h"
#include "version.h"
/** /**
* @addtogroup lavu_string * @addtogroup lavu_string
@ -265,7 +264,7 @@ int av_strncasecmp(const char *a, const char *b, size_t n);
/** /**
* Locale-independent strings replace. * Locale-independent strings replace.
* @note This means only ASCII-range characters are replace * @note This means only ASCII-range characters are replaced.
*/ */
char *av_strireplace(const char *str, const char *from, const char *to); char *av_strireplace(const char *str, const char *from, const char *to);

View File

@ -257,7 +257,12 @@ const char *av_get_media_type_string(enum AVMediaType media_type);
* Internal time base represented as fractional value * Internal time base represented as fractional value
*/ */
#ifdef __cplusplus
/* ISO C++ forbids compound-literals. */
#define AV_TIME_BASE_Q av_make_q(1, AV_TIME_BASE)
#else
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
#endif
/** /**
* @} * @}
@ -294,7 +299,6 @@ char av_get_picture_type_char(enum AVPictureType pict_type);
*/ */
#include "common.h" #include "common.h"
#include "error.h"
#include "rational.h" #include "rational.h"
#include "version.h" #include "version.h"
#include "macros.h" #include "macros.h"
@ -331,19 +335,6 @@ unsigned av_int_list_length_for_size(unsigned elsize,
#define av_int_list_length(list, term) \ #define av_int_list_length(list, term) \
av_int_list_length_for_size(sizeof(*(list)), list, term) av_int_list_length_for_size(sizeof(*(list)), list, term)
#if FF_API_AV_FOPEN_UTF8
/**
* Open a file using a UTF-8 filename.
* The API of this function matches POSIX fopen(), errors are returned through
* errno.
* @deprecated Avoid using it, as on Windows, the FILE* allocated by this
* function may be allocated with a different CRT than the caller
* who uses the FILE*. No replacement provided in public API.
*/
attribute_deprecated
FILE *av_fopen_utf8(const char *path, const char *mode);
#endif
/** /**
* Return the fractional representation of the internal time base. * Return the fractional representation of the internal time base.
*/ */

View File

@ -144,6 +144,9 @@ void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max);
* Init a print buffer using a pre-existing buffer. * Init a print buffer using a pre-existing buffer.
* *
* The buffer will not be reallocated. * The buffer will not be reallocated.
* In case size equals zero, the AVBPrint will be initialized to use
* the internal buffer as if using AV_BPRINT_SIZE_COUNT_ONLY with
* av_bprint_init().
* *
* @param buf buffer structure to init * @param buf buffer structure to init
* @param buffer byte buffer to use for the string data * @param buffer byte buffer to use for the string data
@ -169,9 +172,9 @@ void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
/** /**
* Append data to a print buffer. * Append data to a print buffer.
* *
* param buf bprint buffer to use * @param buf bprint buffer to use
* param data pointer to data * @param data pointer to data
* param size size of data * @param size size of data
*/ */
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size); void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size);
@ -179,9 +182,9 @@ struct tm;
/** /**
* Append a formatted date and time to a print buffer. * Append a formatted date and time to a print buffer.
* *
* param buf bprint buffer to use * @param buf bprint buffer to use
* param fmt date and time format string, see strftime() * @param fmt date and time format string, see strftime()
* param tm broken-down time structure to translate * @param tm broken-down time structure to translate
* *
* @note due to poor design of the standard strftime function, it may * @note due to poor design of the standard strftime function, it may
* produce poor results if the format string expands to a very long text and * produce poor results if the format string expands to a very long text and

View File

@ -119,7 +119,7 @@ enum AVChannelOrder {
/** /**
* The channel order does not correspond to any other predefined order and * The channel order does not correspond to any other predefined order and
* is stored as an explicit map. For example, this could be used to support * is stored as an explicit map. For example, this could be used to support
* layouts with 64 or more channels, or with empty/skipped (AV_CHAN_SILENCE) * layouts with 64 or more channels, or with empty/skipped (AV_CHAN_UNUSED)
* channels at arbitrary positions. * channels at arbitrary positions.
*/ */
AV_CHANNEL_ORDER_CUSTOM, AV_CHANNEL_ORDER_CUSTOM,
@ -146,6 +146,10 @@ enum AVChannelOrder {
* as defined in AmbiX format $ 2.1. * as defined in AmbiX format $ 2.1.
*/ */
AV_CHANNEL_ORDER_AMBISONIC, AV_CHANNEL_ORDER_AMBISONIC,
/**
* Number of channel orders, not part of ABI/API
*/
FF_CHANNEL_ORDER_NB
}; };
@ -192,16 +196,6 @@ enum AVChannelOrder {
#define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT ) #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_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT )
#if FF_API_OLD_CHANNEL_LAYOUT
/** Channel mask value used for AVCodecContext.request_channel_layout
to indicate that the user requests the channel order of the decoder output
to be the native codec channel order.
@deprecated channel order is now indicated in a special field in
AVChannelLayout
*/
#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
#endif
/** /**
* @} * @}
* @defgroup channel_mask_c Audio channel layouts * @defgroup channel_mask_c Audio channel layouts
@ -224,6 +218,7 @@ enum AVChannelOrder {
#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_3POINT1POINT2 (AV_CH_LAYOUT_3POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) #define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) #define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
@ -232,12 +227,19 @@ enum AVChannelOrder {
#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #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 (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_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_7POINT1_TOP_BACK (AV_CH_LAYOUT_5POINT1_BACK|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_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_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_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_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_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_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
#define AV_CH_LAYOUT_22POINT2 (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY_2|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_CENTER|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|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_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_7POINT1_TOP_BACK AV_CH_LAYOUT_5POINT1POINT2_BACK
enum AVMatrixEncoding { enum AVMatrixEncoding {
AV_MATRIX_ENCODING_NONE, AV_MATRIX_ENCODING_NONE,
@ -358,8 +360,16 @@ typedef struct AVChannelLayout {
void *opaque; void *opaque;
} AVChannelLayout; } AVChannelLayout;
/**
* Macro to define native channel layouts
*
* @note This doesn't use designated initializers for compatibility with C++ 17 and older.
*/
#define AV_CHANNEL_LAYOUT_MASK(nb, m) \ #define AV_CHANNEL_LAYOUT_MASK(nb, m) \
{ .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = { .mask = (m) }} { /* .order */ AV_CHANNEL_ORDER_NATIVE, \
/* .nb_channels */ (nb), \
/* .u.mask */ { m }, \
/* .opaque */ NULL }
/** /**
* @name Common pre-defined channel layouts * @name Common pre-defined channel layouts
@ -381,6 +391,7 @@ typedef struct AVChannelLayout {
#define AV_CHANNEL_LAYOUT_5POINT1_BACK AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK) #define AV_CHANNEL_LAYOUT_5POINT1_BACK AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK)
#define AV_CHANNEL_LAYOUT_6POINT0 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0) #define AV_CHANNEL_LAYOUT_6POINT0 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0)
#define AV_CHANNEL_LAYOUT_6POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT) #define AV_CHANNEL_LAYOUT_6POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT)
#define AV_CHANNEL_LAYOUT_3POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_3POINT1POINT2)
#define AV_CHANNEL_LAYOUT_HEXAGONAL AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL) #define AV_CHANNEL_LAYOUT_HEXAGONAL AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL)
#define AV_CHANNEL_LAYOUT_6POINT1 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1) #define AV_CHANNEL_LAYOUT_6POINT1 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1)
#define AV_CHANNEL_LAYOUT_6POINT1_BACK AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK) #define AV_CHANNEL_LAYOUT_6POINT1_BACK AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK)
@ -390,158 +401,29 @@ typedef struct AVChannelLayout {
#define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1) #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 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_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_TOP_BACK) #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_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
#define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE) #define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)
#define AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_5POINT1POINT4_BACK)
#define AV_CHANNEL_LAYOUT_7POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_7POINT1POINT2)
#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_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL) #define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX) #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) #define AV_CHANNEL_LAYOUT_22POINT2 AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)
#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK
#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER \ #define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER \
{ .order = AV_CHANNEL_ORDER_AMBISONIC, .nb_channels = 4, .u = { .mask = 0 }} { /* .order */ AV_CHANNEL_ORDER_AMBISONIC, \
/* .nb_channels */ 4, \
/* .u.mask */ { 0 }, \
/* .opaque */ NULL }
/** @} */ /** @} */
struct AVBPrint; struct AVBPrint;
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* @name Deprecated Functions
* @{
*/
/**
* Return a channel layout id that matches name, or 0 if no match is found.
*
* name can be one or several of the following notations,
* separated by '+' or '|':
* - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
* 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
* - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
* SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
* - a number of channels, in decimal, followed by 'c', yielding
* the default channel layout for that number of channels (@see
* av_get_default_channel_layout);
* - a channel layout mask, in hexadecimal starting with "0x" (see the
* AV_CH_* macros).
*
* Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
*
* @deprecated use av_channel_layout_from_string()
*/
attribute_deprecated
uint64_t av_get_channel_layout(const char *name);
/**
* Return a channel layout and the number of channels based on the specified name.
*
* This function is similar to (@see av_get_channel_layout), but can also parse
* unknown channel layout specifications.
*
* @param[in] name channel layout specification string
* @param[out] channel_layout parsed channel layout (0 if unknown)
* @param[out] nb_channels number of channels
*
* @return 0 on success, AVERROR(EINVAL) if the parsing fails.
* @deprecated use av_channel_layout_from_string()
*/
attribute_deprecated
int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
/**
* Return a description of a channel layout.
* If nb_channels is <= 0, it is guessed from the channel_layout.
*
* @param buf put here the string containing the channel layout
* @param buf_size size in bytes of the buffer
* @param nb_channels number of channels
* @param channel_layout channel layout bitset
* @deprecated use av_channel_layout_describe()
*/
attribute_deprecated
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
/**
* Append a description of a channel layout to a bprint buffer.
* @deprecated use av_channel_layout_describe()
*/
attribute_deprecated
void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
/**
* Return the number of channels in the channel layout.
* @deprecated use AVChannelLayout.nb_channels
*/
attribute_deprecated
int av_get_channel_layout_nb_channels(uint64_t channel_layout);
/**
* Return default channel layout for a given number of channels.
*
* @deprecated use av_channel_layout_default()
*/
attribute_deprecated
int64_t av_get_default_channel_layout(int nb_channels);
/**
* Get the index of a channel in channel_layout.
*
* @param channel_layout channel layout bitset
* @param channel a channel layout describing exactly one channel which must be
* present in channel_layout.
*
* @return index of channel in channel_layout on success, a negative AVERROR
* on error.
*
* @deprecated use av_channel_layout_index_from_channel()
*/
attribute_deprecated
int av_get_channel_layout_channel_index(uint64_t channel_layout,
uint64_t channel);
/**
* Get the channel with the given index in channel_layout.
* @deprecated use av_channel_layout_channel_from_index()
*/
attribute_deprecated
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
/**
* Get the name of a given channel.
*
* @return channel name on success, NULL on error.
*
* @deprecated use av_channel_name()
*/
attribute_deprecated
const char *av_get_channel_name(uint64_t channel);
/**
* Get the description of a given channel.
*
* @param channel a channel layout with a single channel
* @return channel description on success, NULL on error
* @deprecated use av_channel_description()
*/
attribute_deprecated
const char *av_get_channel_description(uint64_t channel);
/**
* Get the value and name of a standard channel layout.
*
* @param[in] index index in an internal list, starting at 0
* @param[out] layout channel layout mask
* @param[out] name name of the layout
* @return 0 if the layout exists,
* <0 if index is beyond the limits
* @deprecated use av_channel_layout_standard()
*/
attribute_deprecated
int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
const char **name);
/**
* @}
*/
#endif
/** /**
* Get a human readable string in an abbreviated form describing a given channel. * Get a human readable string in an abbreviated form describing a given channel.
* This is the inverse function of @ref av_channel_from_string(). * This is the inverse function of @ref av_channel_from_string().
@ -589,6 +471,23 @@ void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_i
*/ */
enum AVChannel av_channel_from_string(const char *name); enum AVChannel av_channel_from_string(const char *name);
/**
* Initialize a custom channel layout with the specified number of channels.
* The channel map will be allocated and the designation of all channels will
* be set to AV_CHAN_UNKNOWN.
*
* This is only a convenience helper function, a custom channel layout can also
* be constructed without using this.
*
* @param channel_layout the layout structure to be initialized
* @param nb_channels the number of channels
*
* @return 0 on success
* AVERROR(EINVAL) if the number of channels <= 0
* AVERROR(ENOMEM) if the channel map could not be allocated
*/
int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels);
/** /**
* Initialize a native channel layout from a bitmask indicating which channels * Initialize a native channel layout from a bitmask indicating which channels
* are present. * are present.
@ -613,10 +512,14 @@ int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask);
* - the number of unordered channels (eg. "4C" or "4 channels") * - the number of unordered channels (eg. "4C" or "4 channels")
* - the ambisonic order followed by optional non-diegetic channels (eg. * - the ambisonic order followed by optional non-diegetic channels (eg.
* "ambisonic 2+stereo") * "ambisonic 2+stereo")
* On error, the channel layout will remain uninitialized, but not necessarily
* untouched.
* *
* @param channel_layout input channel layout * @param channel_layout uninitialized channel layout for the result
* @param str string describing the channel layout * @param str string describing the channel layout
* @return 0 channel layout was detected, AVERROR_INVALIDATATA otherwise * @return 0 on success parsing the channel layout
* AVERROR(EINVAL) if an invalid channel layout string was provided
* AVERROR(ENOMEM) if there was not enough memory
*/ */
int av_channel_layout_from_string(AVChannelLayout *channel_layout, int av_channel_layout_from_string(AVChannelLayout *channel_layout,
const char *str); const char *str);
@ -776,6 +679,53 @@ int av_channel_layout_check(const AVChannelLayout *channel_layout);
*/ */
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1); int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1);
/**
* The conversion must be lossless.
*/
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS (1 << 0)
/**
* The specified retype target order is ignored and the simplest possible
* (canonical) order is used for which the input layout can be losslessy
* represented.
*/
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL (1 << 1)
/**
* Change the AVChannelOrder of a channel layout.
*
* Change of AVChannelOrder can be either lossless or lossy. In case of a
* lossless conversion all the channel designations and the associated channel
* names (if any) are kept. On a lossy conversion the channel names and channel
* designations might be lost depending on the capabilities of the desired
* AVChannelOrder. Note that some conversions are simply not possible in which
* case this function returns AVERROR(ENOSYS).
*
* The following conversions are supported:
*
* Any -> Custom : Always possible, always lossless.
* Any -> Unspecified: Always possible, lossless if channel designations
* are all unknown and channel names are not used, lossy otherwise.
* Custom -> Ambisonic : Possible if it contains ambisonic channels with
* optional non-diegetic channels in the end. Lossy if the channels have
* custom names, lossless otherwise.
* Custom -> Native : Possible if it contains native channels in native
* order. Lossy if the channels have custom names, lossless otherwise.
*
* On error this function keeps the original channel layout untouched.
*
* @param channel_layout channel layout which will be changed
* @param order the desired channel layout order
* @param flags a combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants
* @return 0 if the conversion was successful and lossless or if the channel
* layout was already in the desired order
* >0 if the conversion was successful but lossy
* AVERROR(ENOSYS) if the conversion was not possible (or would be
* lossy and AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS was specified)
* AVERROR(EINVAL), AVERROR(ENOMEM) on error
*/
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags);
/** /**
* @} * @}
*/ */

View File

@ -40,7 +40,15 @@
#include <string.h> #include <string.h>
#include "attributes.h" #include "attributes.h"
#include "error.h"
#include "macros.h" #include "macros.h"
#include "mem.h"
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
# include "internal.h"
#endif /* HAVE_AV_CONFIG_H */
//rounded division & shift //rounded division & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
@ -83,11 +91,6 @@
/* misc math functions */ /* misc math functions */
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
#endif
#ifndef av_ceil_log2 #ifndef av_ceil_log2
# define av_ceil_log2 av_ceil_log2_c # define av_ceil_log2 av_ceil_log2_c
#endif #endif
@ -567,12 +570,4 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
}\ }\
}\ }\
#include "mem.h"
#ifdef HAVE_AV_CONFIG_H
# include "internal.h"
#endif /* HAVE_AV_CONFIG_H */
#endif /* AVUTIL_COMMON_H */ #endif /* AVUTIL_COMMON_H */

View File

@ -69,6 +69,8 @@
#define AV_CPU_FLAG_NEON (1 << 5) #define AV_CPU_FLAG_NEON (1 << 5)
#define AV_CPU_FLAG_ARMV8 (1 << 6) #define AV_CPU_FLAG_ARMV8 (1 << 6)
#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_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_SETEND (1 <<16) #define AV_CPU_FLAG_SETEND (1 <<16)
#define AV_CPU_FLAG_MMI (1 << 0) #define AV_CPU_FLAG_MMI (1 << 0)
@ -87,6 +89,7 @@
#define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int'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_RVV_F64 (1 << 6) ///< Vectors of double's
#define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations #define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations
#define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations
/** /**
* Return the flags which specify extensions supported by the CPU. * Return the flags which specify extensions supported by the CPU.

View File

@ -105,7 +105,7 @@ int av_expr_count_vars(AVExpr *e, unsigned *counter, int size);
* @param e the AVExpr to track user provided functions in * @param e the AVExpr to track user provided functions in
* @param counter a zero-initialized array where the count of each function will be stored * @param counter a zero-initialized array where the count of each function will be stored
* if you passed 5 functions with 2 arguments to av_expr_parse() * if you passed 5 functions with 2 arguments to av_expr_parse()
* then for arg=2 this will use upto 5 entries. * then for arg=2 this will use up to 5 entries.
* @param size size of array * @param size size of array
* @param arg number of arguments the counted functions have * @param arg number of arguments the counted functions have
* @return 0 on success, a negative value indicates that no expression or array was passed * @return 0 on success, a negative value indicates that no expression or array was passed

View File

@ -1,5 +0,0 @@
/* Automatically generated by version.sh, do not manually edit! */
#ifndef AVUTIL_FFVERSION_H
#define AVUTIL_FFVERSION_H
#define FFMPEG_VERSION "6.0"
#endif /* AVUTIL_FFVERSION_H */

View File

@ -200,7 +200,7 @@ int av_fifo_read_to_cb(AVFifo *f, AVFifoCB write_cb,
* *
* @return a non-negative number on success, a negative error code on failure * @return a non-negative number on success, a negative error code on failure
*/ */
int av_fifo_peek(AVFifo *f, void *buf, size_t nb_elems, size_t offset); int av_fifo_peek(const AVFifo *f, void *buf, size_t nb_elems, size_t offset);
/** /**
* Feed data from a FIFO into a user-provided callback. * Feed data from a FIFO into a user-provided callback.
@ -217,7 +217,7 @@ int av_fifo_peek(AVFifo *f, void *buf, size_t nb_elems, size_t offset);
* *
* @return a non-negative number on success, a negative error code on failure * @return a non-negative number on success, a negative error code on failure
*/ */
int av_fifo_peek_to_cb(AVFifo *f, AVFifoCB write_cb, void *opaque, int av_fifo_peek_to_cb(const AVFifo *f, AVFifoCB write_cb, void *opaque,
size_t *nb_elems, size_t offset); size_t *nb_elems, size_t offset);
/** /**
@ -239,208 +239,6 @@ void av_fifo_reset2(AVFifo *f);
*/ */
void av_fifo_freep2(AVFifo **f); void av_fifo_freep2(AVFifo **f);
#if FF_API_FIFO_OLD_API
typedef struct AVFifoBuffer {
uint8_t *buffer;
uint8_t *rptr, *wptr, *end;
uint32_t rndx, wndx;
} AVFifoBuffer;
/**
* Initialize an AVFifoBuffer.
* @param size of FIFO
* @return AVFifoBuffer or NULL in case of memory allocation failure
* @deprecated use av_fifo_alloc2()
*/
attribute_deprecated
AVFifoBuffer *av_fifo_alloc(unsigned int size);
/**
* Initialize an AVFifoBuffer.
* @param nmemb number of elements
* @param size size of the single element
* @return AVFifoBuffer or NULL in case of memory allocation failure
* @deprecated use av_fifo_alloc2()
*/
attribute_deprecated
AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size);
/**
* Free an AVFifoBuffer.
* @param f AVFifoBuffer to free
* @deprecated use the AVFifo API with av_fifo_freep2()
*/
attribute_deprecated
void av_fifo_free(AVFifoBuffer *f);
/**
* Free an AVFifoBuffer and reset pointer to NULL.
* @param f AVFifoBuffer to free
* @deprecated use the AVFifo API with av_fifo_freep2()
*/
attribute_deprecated
void av_fifo_freep(AVFifoBuffer **f);
/**
* Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
* @param f AVFifoBuffer to reset
* @deprecated use av_fifo_reset2() with the new AVFifo-API
*/
attribute_deprecated
void av_fifo_reset(AVFifoBuffer *f);
/**
* Return the amount of data in bytes in the AVFifoBuffer, that is the
* amount of data you can read from it.
* @param f AVFifoBuffer to read from
* @return size
* @deprecated use av_fifo_can_read() with the new AVFifo-API
*/
attribute_deprecated
int av_fifo_size(const AVFifoBuffer *f);
/**
* Return the amount of space in bytes in the AVFifoBuffer, that is the
* amount of data you can write into it.
* @param f AVFifoBuffer to write into
* @return size
* @deprecated use av_fifo_can_write() with the new AVFifo-API
*/
attribute_deprecated
int av_fifo_space(const AVFifoBuffer *f);
/**
* Feed data at specific position from an AVFifoBuffer to a user-supplied callback.
* Similar as av_fifo_gereric_read but without discarding data.
* @param f AVFifoBuffer to read from
* @param offset offset from current read position
* @param buf_size number of bytes to read
* @param func generic read function
* @param dest data destination
*
* @return a non-negative number on success, a negative error code on failure
*
* @deprecated use the new AVFifo-API with av_fifo_peek() when func == NULL,
* av_fifo_peek_to_cb() otherwise
*/
attribute_deprecated
int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int));
/**
* Feed data from an AVFifoBuffer to a user-supplied callback.
* Similar as av_fifo_gereric_read but without discarding data.
* @param f AVFifoBuffer to read from
* @param buf_size number of bytes to read
* @param func generic read function
* @param dest data destination
*
* @return a non-negative number on success, a negative error code on failure
*
* @deprecated use the new AVFifo-API with av_fifo_peek() when func == NULL,
* av_fifo_peek_to_cb() otherwise
*/
attribute_deprecated
int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
/**
* Feed data from an AVFifoBuffer to a user-supplied callback.
* @param f AVFifoBuffer to read from
* @param buf_size number of bytes to read
* @param func generic read function
* @param dest data destination
*
* @return a non-negative number on success, a negative error code on failure
*
* @deprecated use the new AVFifo-API with av_fifo_read() when func == NULL,
* av_fifo_read_to_cb() otherwise
*/
attribute_deprecated
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
/**
* Feed data from a user-supplied callback to an AVFifoBuffer.
* @param f AVFifoBuffer to write to
* @param src data source; non-const since it may be used as a
* modifiable context by the function defined in func
* @param size number of bytes to write
* @param func generic write function; the first parameter is src,
* the second is dest_buf, the third is dest_buf_size.
* func must return the number of bytes written to dest_buf, or <= 0 to
* indicate no more data available to write.
* If func is NULL, src is interpreted as a simple byte array for source data.
* @return the number of bytes written to the FIFO or a negative error code on failure
*
* @deprecated use the new AVFifo-API with av_fifo_write() when func == NULL,
* av_fifo_write_from_cb() otherwise
*/
attribute_deprecated
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
/**
* Resize an AVFifoBuffer.
* In case of reallocation failure, the old FIFO is kept unchanged.
*
* @param f AVFifoBuffer to resize
* @param size new AVFifoBuffer size in bytes
* @return <0 for failure, >=0 otherwise
*
* @deprecated use the new AVFifo-API with av_fifo_grow2() to increase FIFO size,
* decreasing FIFO size is not supported
*/
attribute_deprecated
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
/**
* Enlarge an AVFifoBuffer.
* In case of reallocation failure, the old FIFO is kept unchanged.
* The new fifo size may be larger than the requested size.
*
* @param f AVFifoBuffer to resize
* @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size()
* @return <0 for failure, >=0 otherwise
*
* @deprecated use the new AVFifo-API with av_fifo_grow2(); note that unlike
* this function it adds to the allocated size, rather than to the used size
*/
attribute_deprecated
int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
/**
* Read and discard the specified amount of data from an AVFifoBuffer.
* @param f AVFifoBuffer to read from
* @param size amount of data to read in bytes
*
* @deprecated use the new AVFifo-API with av_fifo_drain2()
*/
attribute_deprecated
void av_fifo_drain(AVFifoBuffer *f, int size);
#if FF_API_FIFO_PEEK2
/**
* Return a pointer to the data stored in a FIFO buffer at a certain offset.
* The FIFO buffer is not modified.
*
* @param f AVFifoBuffer to peek at, f must be non-NULL
* @param offs an offset in bytes, its absolute value must be less
* than the used buffer size or the returned pointer will
* point outside to the buffer data.
* The used buffer size can be checked with av_fifo_size().
* @deprecated use the new AVFifo-API with av_fifo_peek() or av_fifo_peek_to_cb()
*/
attribute_deprecated
static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
{
uint8_t *ptr = f->rptr + offs;
if (ptr >= f->end)
ptr = f->buffer + (ptr - f->end);
else if (ptr < f->buffer)
ptr = f->end - (f->buffer - ptr);
return ptr;
}
#endif
#endif
/** /**
* @} * @}
*/ */

View File

@ -60,21 +60,4 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
*/ */
void av_file_unmap(uint8_t *bufptr, size_t size); void av_file_unmap(uint8_t *bufptr, size_t size);
#if FF_API_AV_FOPEN_UTF8
/**
* Wrapper to work around the lack of mkstemp() on mingw.
* Also, tries to create file in /tmp first, if possible.
* *prefix can be a character constant; *filename will be allocated internally.
* @return file descriptor of opened file (or negative value corresponding to an
* AVERROR code on error)
* and opened file name in **filename.
* @note On very old libcs it is necessary to set a secure umask before
* calling this, av_tempfile() can't call umask itself as it is used in
* libraries and could interfere with the calling application.
* @deprecated as fd numbers cannot be passed saftely between libs on some platforms
*/
attribute_deprecated
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
#endif
#endif /* AVUTIL_FILE_H */ #endif /* AVUTIL_FILE_H */

View File

@ -136,20 +136,42 @@ typedef struct AVFilmGrainH274Params {
*/ */
int model_id; int model_id;
/** #if FF_API_H274_FILM_GRAIN_VCS
* Specifies the bit depth used for the luma component. /**
*/ * 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; int bit_depth_luma;
/** /**
* Specifies the bit depth used for the chroma components. * Specifies the bit depth used for the chroma components.
*
* @deprecated use AVFilmGrainParams.bit_depth_chroma.
*/ */
attribute_deprecated
int bit_depth_chroma; int bit_depth_chroma;
/**
* Specifies the video signal characteristics.
*
* @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}.
*/
attribute_deprecated
enum AVColorRange color_range; enum AVColorRange color_range;
attribute_deprecated
enum AVColorPrimaries color_primaries; enum AVColorPrimaries color_primaries;
attribute_deprecated
enum AVColorTransferCharacteristic color_trc; enum AVColorTransferCharacteristic color_trc;
attribute_deprecated
enum AVColorSpace color_space; enum AVColorSpace color_space;
#endif
/** /**
* Specifies the blending mode used to blend the simulated film grain * Specifies the blending mode used to blend the simulated film grain
@ -231,11 +253,40 @@ typedef struct AVFilmGrainParams {
* Additional fields may be added both here and in any structure included. * Additional fields may be added both here and in any structure included.
* If a codec's film grain structure differs slightly over another * If a codec's film grain structure differs slightly over another
* codec's, fields within may change meaning depending on the type. * 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 { union {
AVFilmGrainAOMParams aom; AVFilmGrainAOMParams aom;
AVFilmGrainH274Params h274; AVFilmGrainH274Params h274;
} codec; } codec;
/**
* Intended display resolution. May be 0 if the codec does not specify
* any restrictions.
*/
int width, height;
/**
* Intended subsampling ratio, or 0 for luma-only streams.
*/
int subsampling_x, subsampling_y;
/**
* Intended video signal characteristics.
*/
enum AVColorRange color_range;
enum AVColorPrimaries color_primaries;
enum AVColorTransferCharacteristic color_trc;
enum AVColorSpace color_space;
/**
* Intended bit depth, or 0 for unknown/unspecified.
*/
int bit_depth_luma;
int bit_depth_chroma;
} AVFilmGrainParams; } AVFilmGrainParams;
/** /**
@ -257,4 +308,15 @@ AVFilmGrainParams *av_film_grain_params_alloc(size_t *size);
*/ */
AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame); AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame);
/**
* Select the most appropriate film grain parameters set for the frame,
* taking into account the frame's format, resolution and video signal
* characteristics.
*
* @note, for H.274, this may select a film grain parameter set with
* greater chroma resolution than the frame. Users should take care to
* correctly adjust the chroma grain frequency to the frame.
*/
const AVFilmGrainParams *av_film_grain_params_select(const AVFrame *frame);
#endif /* AVUTIL_FILM_GRAIN_PARAMS_H */ #endif /* AVUTIL_FILM_GRAIN_PARAMS_H */

View File

@ -180,6 +180,10 @@ enum AVFrameSideDataType {
/** /**
* Film grain parameters for a frame, described by AVFilmGrainParams. * Film grain parameters for a frame, described by AVFilmGrainParams.
* Must be present for every frame which should have film grain applied. * Must be present for every frame which should have film grain applied.
*
* May be present multiple times, for example when there are multiple
* alternative parameter sets for different video signal characteristics.
* The user should select the most appropriate set for the application.
*/ */
AV_FRAME_DATA_FILM_GRAIN_PARAMS, AV_FRAME_DATA_FILM_GRAIN_PARAMS,
@ -214,6 +218,16 @@ enum AVFrameSideDataType {
* Ambient viewing environment metadata, as defined by H.274. * Ambient viewing environment metadata, as defined by H.274.
*/ */
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
/**
* Provide encoder-specific hinting information about changed/unchanged
* portions of a frame. It can be used to pass information about which
* macroblocks can be skipped because they didn't change from the
* corresponding ones in the previous frame. This could be useful for
* applications which know this information in advance to speed up
* encoding.
*/
AV_FRAME_DATA_VIDEO_HINT,
}; };
enum AVActiveFormatDescription { enum AVActiveFormatDescription {
@ -416,10 +430,15 @@ typedef struct AVFrame {
*/ */
int format; int format;
#if FF_API_FRAME_KEY
/** /**
* 1 -> keyframe, 0-> not * 1 -> keyframe, 0-> not
*
* @deprecated Use AV_FRAME_FLAG_KEY instead
*/ */
attribute_deprecated
int key_frame; int key_frame;
#endif
/** /**
* Picture type of the frame. * Picture type of the frame.
@ -451,63 +470,71 @@ typedef struct AVFrame {
*/ */
AVRational time_base; AVRational time_base;
#if FF_API_FRAME_PICTURE_NUMBER
/**
* picture number in bitstream order
*/
attribute_deprecated
int coded_picture_number;
/**
* picture number in display order
*/
attribute_deprecated
int display_picture_number;
#endif
/** /**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad)) * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
*/ */
int quality; int quality;
/** /**
* for some private data of the user * Frame owner's private data.
*
* This field may be set by the code that allocates/owns the frame data.
* It is then not touched by any library functions, except:
* - it is copied to other references by av_frame_copy_props() (and hence by
* av_frame_ref());
* - it is set to NULL when the frame is cleared by av_frame_unref()
* - on the caller's explicit request. E.g. libavcodec encoders/decoders
* will copy this field to/from @ref AVPacket "AVPackets" if the caller sets
* @ref AV_CODEC_FLAG_COPY_OPAQUE.
*
* @see opaque_ref the reference-counted analogue
*/ */
void *opaque; void *opaque;
/** /**
* When decoding, this signals how much the picture must be delayed. * Number of fields in this frame which should be repeated, i.e. the total
* extra_delay = repeat_pict / (2*fps) * duration of this frame should be repeat_pict + 2 normal field durations.
*
* For interlaced frames this field may be set to 1, which signals that this
* frame should be presented as 3 fields: beginning with the first field (as
* determined by AV_FRAME_FLAG_TOP_FIELD_FIRST being set or not), followed
* by the second field, and then the first field again.
*
* For progressive frames this field may be set to a multiple of 2, which
* signals that this frame's duration should be (repeat_pict + 2) / 2
* normal frame durations.
*
* @note This field is computed from MPEG2 repeat_first_field flag and its
* associated flags, H.264 pic_struct from picture timing SEI, and
* their analogues in other codecs. Typically it should only be used when
* higher-layer timing information is not available.
*/ */
int repeat_pict; int repeat_pict;
#if FF_API_INTERLACED_FRAME
/** /**
* The content of the picture is interlaced. * The content of the picture is interlaced.
*
* @deprecated Use AV_FRAME_FLAG_INTERLACED instead
*/ */
attribute_deprecated
int interlaced_frame; int interlaced_frame;
/** /**
* If the content is interlaced, is top field displayed first. * 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; int top_field_first;
#endif
#if FF_API_PALETTE_HAS_CHANGED
/** /**
* Tell user application that palette has changed from previous frame. * Tell user application that palette has changed from previous frame.
*/ */
int palette_has_changed;
#if FF_API_REORDERED_OPAQUE
/**
* reordered opaque 64 bits (generally an integer or a double precision float
* PTS but can be anything).
* The user sets AVCodecContext.reordered_opaque to represent the input at
* that time,
* the decoder reorders values as needed and sets AVFrame.reordered_opaque
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
*
* @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
*/
attribute_deprecated attribute_deprecated
int64_t reordered_opaque; int palette_has_changed;
#endif #endif
/** /**
@ -515,15 +542,6 @@ typedef struct AVFrame {
*/ */
int sample_rate; int sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Channel layout of the audio data.
* @deprecated use ch_layout instead
*/
attribute_deprecated
uint64_t channel_layout;
#endif
/** /**
* AVBuffer references backing the data for this frame. All the pointers in * AVBuffer references backing the data for this frame. All the pointers in
* data and extended_data must point inside one of the buffers in buf or * data and extended_data must point inside one of the buffers in buf or
@ -571,10 +589,23 @@ typedef struct AVFrame {
* The frame data may be corrupted, e.g. due to decoding errors. * The frame data may be corrupted, e.g. due to decoding errors.
*/ */
#define AV_FRAME_FLAG_CORRUPT (1 << 0) #define AV_FRAME_FLAG_CORRUPT (1 << 0)
/**
* A flag to mark frames that are keyframes.
*/
#define AV_FRAME_FLAG_KEY (1 << 1)
/** /**
* A flag to mark the frames which need to be decoded, but shouldn't be output. * A flag to mark the frames which need to be decoded, but shouldn't be output.
*/ */
#define AV_FRAME_FLAG_DISCARD (1 << 2) #define AV_FRAME_FLAG_DISCARD (1 << 2)
/**
* A flag to mark frames whose content is interlaced.
*/
#define AV_FRAME_FLAG_INTERLACED (1 << 3)
/**
* A flag to mark frames where the top field is displayed first if the content
* is interlaced.
*/
#define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4)
/** /**
* @} * @}
*/ */
@ -611,24 +642,16 @@ typedef struct AVFrame {
*/ */
int64_t best_effort_timestamp; int64_t best_effort_timestamp;
#if FF_API_FRAME_PKT
/** /**
* reordered pos from the last AVPacket that has been input into the decoder * reordered pos from the last AVPacket that has been input into the decoder
* - encoding: unused * - encoding: unused
* - decoding: Read by user. * - decoding: Read by user.
*/ * @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user
int64_t pkt_pos; * data from packets to frames
#if FF_API_PKT_DURATION
/**
* duration of the corresponding packet, expressed in
* AVStream->time_base units, 0 if unknown.
* - encoding: unused
* - decoding: Read by user.
*
* @deprecated use duration instead
*/ */
attribute_deprecated attribute_deprecated
int64_t pkt_duration; int64_t pkt_pos;
#endif #endif
/** /**
@ -651,25 +674,19 @@ typedef struct AVFrame {
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4 #define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
#define FF_DECODE_ERROR_DECODE_SLICES 8 #define FF_DECODE_ERROR_DECODE_SLICES 8
#if FF_API_OLD_CHANNEL_LAYOUT #if FF_API_FRAME_PKT
/**
* number of audio channels, only used for audio.
* - encoding: unused
* - decoding: Read by user.
* @deprecated use ch_layout instead
*/
attribute_deprecated
int channels;
#endif
/** /**
* size of the corresponding packet containing the compressed * size of the corresponding packet containing the compressed
* frame. * frame.
* It is set to a negative value if unknown. * It is set to a negative value if unknown.
* - encoding: unused * - encoding: unused
* - decoding: set by libavcodec, read by user. * - 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; int pkt_size;
#endif
/** /**
* For hwaccel-format frames, this should be a reference to the * For hwaccel-format frames, this should be a reference to the
@ -678,13 +695,18 @@ typedef struct AVFrame {
AVBufferRef *hw_frames_ctx; AVBufferRef *hw_frames_ctx;
/** /**
* AVBufferRef for free use by the API user. FFmpeg will never check the * Frame owner's private data.
* 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 opaque_ref field.
* *
* This is unrelated to the opaque field, although it serves a similar * This field may be set by the code that allocates/owns the frame data.
* purpose. * It is then not touched by any library functions, except:
* - a new reference to the underlying buffer is propagated by
* av_frame_copy_props() (and hence by av_frame_ref());
* - it is unreferenced in av_frame_unref();
* - on the caller's explicit request. E.g. libavcodec encoders/decoders
* will propagate a new reference to/from @ref AVPacket "AVPackets" if the
* caller sets @ref AV_CODEC_FLAG_COPY_OPAQUE.
*
* @see opaque the plain pointer analogue
*/ */
AVBufferRef *opaque_ref; AVBufferRef *opaque_ref;
@ -767,6 +789,19 @@ void av_frame_free(AVFrame **frame);
*/ */
int av_frame_ref(AVFrame *dst, const AVFrame *src); int av_frame_ref(AVFrame *dst, const AVFrame *src);
/**
* Ensure the destination frame refers to the same data described by the source
* frame, either by creating a new reference for each AVBufferRef from src if
* they differ from those in dst, by allocating new buffers and copying data if
* src is not reference counted, or by unrefencing it if src is empty.
*
* Frame properties on dst will be replaced by those from src.
*
* @return 0 on success, a negative AVERROR on error. On error, dst is
* unreferenced.
*/
int av_frame_replace(AVFrame *dst, const AVFrame *src);
/** /**
* Create a new frame that references the same data as src. * Create a new frame that references the same data as src.
* *
@ -875,7 +910,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
* @return the buffer reference that contains the plane or NULL if the input * @return the buffer reference that contains the plane or NULL if the input
* frame is not valid. * frame is not valid.
*/ */
AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane);
/** /**
* Add a new side data to a frame. * Add a new side data to a frame.
@ -957,6 +992,88 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
*/ */
const char *av_frame_side_data_name(enum AVFrameSideDataType type); const char *av_frame_side_data_name(enum AVFrameSideDataType type);
/**
* Free all side data entries and their contents, then zeroes out the
* values which the pointers are pointing to.
*
* @param sd pointer to array of side data to free. Will be set to NULL
* upon return.
* @param nb_sd pointer to an integer containing the number of entries in
* the array. Will be set to 0 upon return.
*/
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0)
/**
* Add new side data entry to an array.
*
* @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 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.
*/
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 based on existing side data, taking
* a reference towards the contained 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 src side data to be cloned, with a new reference utilized
* 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.
*/
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
const AVFrameSideData *src, unsigned int flags);
/**
* Get a side data entry of a specific type from an array.
*
* @param sd array of side data.
* @param nb_sd integer containing the number of entries in the array.
* @param type type of side data to be queried
*
* @return a pointer to the side data of a given type on success, NULL if there
* is no side data with such type in this set.
*/
const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd,
const int nb_sd,
enum AVFrameSideDataType type);
/**
* Wrapper around av_frame_side_data_get_c() to workaround the limitation
* that for any type T the conversion from T * const * to const T * const *
* is not performed automatically in C.
* @see av_frame_side_data_get_c()
*/
static inline
const AVFrameSideData *av_frame_side_data_get(AVFrameSideData * const *sd,
const int nb_sd,
enum AVFrameSideDataType type)
{
return av_frame_side_data_get_c((const AVFrameSideData * const *)sd,
nb_sd, type);
}
/** /**
* @} * @}
*/ */

View File

@ -340,4 +340,37 @@ AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size);
*/ */
AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame); AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame);
/**
* Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRPlus).
* The T.35 buffer must begin with the application mode, skipping the
* country code, terminal provider codes, and application identifier.
* @param s A pointer containing the decoded AVDynamicHDRPlus structure.
* @param data The byte array containing the raw ITU-T T.35 data.
* @param size Size of the data array in bytes.
*
* @return >= 0 on success. Otherwise, returns the appropriate AVERROR.
*/
int av_dynamic_hdr_plus_from_t35(AVDynamicHDRPlus *s, const uint8_t *data,
size_t size);
#define AV_HDR_PLUS_MAX_PAYLOAD_SIZE 907
/**
* Serialize dynamic HDR10+ metadata to a user data registered ITU-T T.35 buffer,
* excluding the first 48 bytes of the header, and beginning with the application mode.
* @param s A pointer containing the decoded AVDynamicHDRPlus structure.
* @param[in,out] data A pointer to pointer to a byte buffer to be filled with the
* serialized metadata.
* If *data is NULL, a buffer be will be allocated and a pointer to
* it stored in its place. The caller assumes ownership of the buffer.
* May be NULL, in which case the function will only store the
* required buffer size in *size.
* @param[in,out] size A pointer to a size to be set to the returned buffer's size.
* If *data is not NULL, *size must contain the size of the input
* buffer. May be NULL only if *data is NULL.
*
* @return >= 0 on success. Otherwise, returns the appropriate AVERROR.
*/
int av_dynamic_hdr_plus_to_t35(const AVDynamicHDRPlus *s, uint8_t **data, size_t *size);
#endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */ #endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */

View File

@ -24,6 +24,52 @@
#include "frame.h" #include "frame.h"
#include "rational.h" #include "rational.h"
/**
* HDR Vivid three spline params.
*/
typedef struct AVHDRVivid3SplineParams {
/**
* The mode of three Spline. the value shall be in the range
* of 0 to 3, inclusive.
*/
int 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.
*
*/
AVRational 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.
*/
AVRational 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.
*/
AVRational 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.
*/
AVRational 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.
*/
AVRational enable_strength;
} AVHDRVivid3SplineParams;
/** /**
* Color tone mapping parameters at a processing window in a dynamic metadata for * Color tone mapping parameters at a processing window in a dynamic metadata for
* CUVA 005.1:2021. * CUVA 005.1:2021.
@ -122,46 +168,61 @@ typedef struct AVHDRVividColorToneMappingParams {
*/ */
int three_Spline_num; int three_Spline_num;
#if FF_API_HDR_VIVID_THREE_SPLINE
/** /**
* The mode of three Spline. the value shall be in the range * The mode of three Spline. the value shall be in the range
* of 0 to 3, inclusive. * of 0 to 3, inclusive.
* @deprecated Use three_spline instead
*/ */
attribute_deprecated
int three_Spline_TH_mode; int three_Spline_TH_mode;
/** /**
* three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
* and in multiples of 1.0/255. * and in multiples of 1.0/255.
* * @deprecated Use three_spline instead
*/ */
attribute_deprecated
AVRational three_Spline_TH_enable_MB; AVRational three_Spline_TH_enable_MB;
/** /**
* 3Spline_TH_enable of three Spline. * 3Spline_TH_enable of three Spline.
* The value shall be in the range of 0.0 to 1.0, inclusive. * The value shall be in the range of 0.0 to 1.0, inclusive.
* and in multiples of 1.0/4095. * and in multiples of 1.0/4095.
* @deprecated Use three_spline instead
*/ */
attribute_deprecated
AVRational three_Spline_TH_enable; AVRational three_Spline_TH_enable;
/** /**
* 3Spline_TH_Delta1 of three Spline. * 3Spline_TH_Delta1 of three Spline.
* The value shall be in the range of 0.0 to 0.25, inclusive, * The value shall be in the range of 0.0 to 0.25, inclusive,
* and in multiples of 0.25/1023. * and in multiples of 0.25/1023.
* @deprecated Use three_spline instead
*/ */
attribute_deprecated
AVRational three_Spline_TH_Delta1; AVRational three_Spline_TH_Delta1;
/** /**
* 3Spline_TH_Delta2 of three Spline. * 3Spline_TH_Delta2 of three Spline.
* The value shall be in the range of 0.0 to 0.25, inclusive, * The value shall be in the range of 0.0 to 0.25, inclusive,
* and in multiples of 0.25/1023. * and in multiples of 0.25/1023.
* @deprecated Use three_spline instead
*/ */
attribute_deprecated
AVRational three_Spline_TH_Delta2; AVRational three_Spline_TH_Delta2;
/** /**
* 3Spline_enable_Strength of three Spline. * 3Spline_enable_Strength of three Spline.
* The value shall be in the range of 0.0 to 1.0, inclusive, * The value shall be in the range of 0.0 to 1.0, inclusive,
* and in multiples of 1.0/255. * and in multiples of 1.0/255.
* @deprecated Use three_spline instead
*/ */
attribute_deprecated
AVRational three_Spline_enable_Strength; AVRational three_Spline_enable_Strength;
#endif
AVHDRVivid3SplineParams three_spline[2];
} AVHDRVividColorToneMappingParams; } AVHDRVividColorToneMappingParams;

View File

@ -37,10 +37,9 @@ enum AVHWDeviceType {
AV_HWDEVICE_TYPE_OPENCL, AV_HWDEVICE_TYPE_OPENCL,
AV_HWDEVICE_TYPE_MEDIACODEC, AV_HWDEVICE_TYPE_MEDIACODEC,
AV_HWDEVICE_TYPE_VULKAN, AV_HWDEVICE_TYPE_VULKAN,
AV_HWDEVICE_TYPE_D3D12VA,
}; };
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
/** /**
* This struct aggregates all the (hardware/vendor-specific) "high-level" state, * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
* i.e. state that is not tied to a concrete processing configuration. * i.e. state that is not tied to a concrete processing configuration.
@ -64,12 +63,6 @@ typedef struct AVHWDeviceContext {
*/ */
const AVClass *av_class; const AVClass *av_class;
/**
* Private data used internally by libavutil. Must not be accessed in any
* way by the caller.
*/
AVHWDeviceInternal *internal;
/** /**
* This field identifies the underlying API used for hardware access. * This field identifies the underlying API used for hardware access.
* *
@ -109,8 +102,6 @@ typedef struct AVHWDeviceContext {
void *user_opaque; void *user_opaque;
} AVHWDeviceContext; } AVHWDeviceContext;
typedef struct AVHWFramesInternal AVHWFramesInternal;
/** /**
* This struct describes a set or pool of "hardware" frames (i.e. those with * This struct describes a set or pool of "hardware" frames (i.e. those with
* data not located in normal system memory). All the frames in the pool are * data not located in normal system memory). All the frames in the pool are
@ -127,12 +118,6 @@ typedef struct AVHWFramesContext {
*/ */
const AVClass *av_class; const AVClass *av_class;
/**
* Private data used internally by libavutil. Must not be accessed in any
* way by the caller.
*/
AVHWFramesInternal *internal;
/** /**
* A reference to the parent AVHWDeviceContext. This reference is owned and * A reference to the parent AVHWDeviceContext. This reference is owned and
* managed by the enclosing AVHWFramesContext, but the caller may derive * managed by the enclosing AVHWFramesContext, but the caller may derive
@ -152,9 +137,12 @@ typedef struct AVHWFramesContext {
* The format-specific data, allocated and freed automatically along with * The format-specific data, allocated and freed automatically along with
* this context. * this context.
* *
* Should be cast by the user to the format-specific context defined in the * The user shall ignore this field if the corresponding format-specific
* corresponding header (hwframe_*.h) and filled as described in the * header (hwcontext_*.h) does not define a context to be used as
* documentation before calling av_hwframe_ctx_init(). * AVHWFramesContext.hwctx.
*
* Otherwise, it should be cast by the user to said context and filled
* as described in the documentation before calling av_hwframe_ctx_init().
* *
* After any frames using this context are created, the contents of this * After any frames using this context are created, the contents of this
* struct should not be modified by the caller. * struct should not be modified by the caller.

View File

@ -62,6 +62,11 @@ typedef struct AVCUDADeviceContext {
*/ */
#define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0) #define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0)
/**
* Use current device context instead of creating a new one.
*/
#define AV_CUDA_USE_CURRENT_CONTEXT (1 << 1)
/** /**
* @} * @}
*/ */

View File

@ -39,10 +39,13 @@
* depending on application usage, so it is preferable to let CoreVideo manage * depending on application usage, so it is preferable to let CoreVideo manage
* the pool using the default implementation. * the pool using the default implementation.
* *
* Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always * Currently AVHWDeviceContext.hwctx are always NULL.
* NULL.
*/ */
typedef struct AVVTFramesContext {
enum AVColorRange color_range;
} AVVTFramesContext;
/** /**
* Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
* Returns AV_PIX_FMT_NONE if no known equivalent was found. * Returns AV_PIX_FMT_NONE if no known equivalent was found.

View File

@ -27,6 +27,8 @@
#include "pixfmt.h" #include "pixfmt.h"
#include "frame.h" #include "frame.h"
typedef struct AVVkFrame AVVkFrame;
/** /**
* @file * @file
* API-specific header for AV_HWDEVICE_TYPE_VULKAN. * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
@ -53,7 +55,7 @@ typedef struct AVVulkanDeviceContext {
PFN_vkGetInstanceProcAddr get_proc_addr; PFN_vkGetInstanceProcAddr get_proc_addr;
/** /**
* Vulkan instance. Must be at least version 1.2. * Vulkan instance. Must be at least version 1.3.
*/ */
VkInstance inst; VkInstance inst;
@ -135,6 +137,19 @@ typedef struct AVVulkanDeviceContext {
*/ */
int queue_family_decode_index; int queue_family_decode_index;
int nb_decode_queues; int nb_decode_queues;
/**
* Locks a queue, preventing other threads from submitting any command
* buffers to this queue.
* If set to NULL, will be set to lavu-internal functions that utilize a
* mutex.
*/
void (*lock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index);
/**
* 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);
} AVVulkanDeviceContext; } AVVulkanDeviceContext;
/** /**
@ -145,10 +160,14 @@ typedef enum AVVkFrameFlags {
* device and tiling during av_hwframe_ctx_init(). */ * device and tiling during av_hwframe_ctx_init(). */
AV_VK_FRAME_FLAG_NONE = (1ULL << 0), AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
/* Image planes will be allocated in a single VkDeviceMemory, rather #if FF_API_VULKAN_CONTIGUOUS_MEMORY
* than as per-plane VkDeviceMemory allocations. Required for exporting /* DEPRECATED: does nothing. Replaced by multiplane images. */
* to VAAPI on Intel devices. */
AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1), 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),
} AVVkFrameFlags; } AVVkFrameFlags;
/** /**
@ -156,26 +175,32 @@ typedef enum AVVkFrameFlags {
*/ */
typedef struct AVVulkanFramesContext { typedef struct AVVulkanFramesContext {
/** /**
* Controls the tiling of allocated frames. If left as optimal tiling, * Controls the tiling of allocated frames.
* then during av_hwframe_ctx_init() will decide based on whether the device * If left as VK_IMAGE_TILING_OPTIMAL (0), will use optimal tiling.
* supports DRM modifiers, or if the linear_images flag is set, otherwise * Can be set to VK_IMAGE_TILING_LINEAR to force linear images,
* will allocate optimally-tiled images. * or VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT to force DMABUF-backed
* images.
* @note Imported frames from other APIs ignore this.
*/ */
VkImageTiling tiling; VkImageTiling tiling;
/** /**
* Defines extra usage of output frames. If left as 0, the following bits * Defines extra usage of output frames. If non-zero, all flags MUST be
* are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE. * supported by the VkFormat. Otherwise, will use supported flags amongst:
* - VK_IMAGE_USAGE_SAMPLED_BIT
* - VK_IMAGE_USAGE_STORAGE_BIT
* - VK_IMAGE_USAGE_TRANSFER_SRC_BIT
* - VK_IMAGE_USAGE_TRANSFER_DST_BIT
*/ */
VkImageUsageFlagBits usage; VkImageUsageFlagBits usage;
/** /**
* Extension data for image creation. * Extension data for image creation.
* If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain, * If DRM tiling is used, a VkImageDrmFormatModifierListCreateInfoEXT structure
* and the device supports DRM modifiers, then images will be allocated * can be added to specify the exact modifier to use.
* with the specific requested DRM modifiers. *
* Additional structures may be added at av_hwframe_ctx_init() time, * Additional structures may be added at av_hwframe_ctx_init() time,
* which will be freed automatically on uninit(), so users need only free * which will be freed automatically on uninit(), so users must only free
* any structures they've allocated themselves. * any structures they've allocated themselves.
*/ */
void *create_pnext; void *create_pnext;
@ -195,36 +220,65 @@ typedef struct AVVulkanFramesContext {
* av_hwframe_ctx_init(). * av_hwframe_ctx_init().
*/ */
AVVkFrameFlags flags; AVVkFrameFlags flags;
/**
* Flags to set during image creation. If unset, defaults to
* VK_IMAGE_CREATE_ALIAS_BIT.
*/
VkImageCreateFlags img_flags;
/**
* Vulkan format for each image. MUST be compatible with the pixel format.
* If unset, will be automatically set.
* There are at most two compatible formats for a frame - a multiplane
* format, and a single-plane multi-image format.
*/
VkFormat format[AV_NUM_DATA_POINTERS];
/**
* Number of layers each image will have.
*/
int nb_layers;
/**
* Locks a frame, preventing other threads from changing frame properties.
* Users SHOULD only ever lock just before command submission in order
* to get accurate frame properties, and unlock immediately after command
* submission without waiting for it to finish.
*
* If unset, will be set to lavu-internal functions that utilize a mutex.
*/
void (*lock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf);
/**
* Similar to lock_frame(), unlocks a frame. Must only be called after locking.
*/
void (*unlock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf);
} AVVulkanFramesContext; } AVVulkanFramesContext;
/* /*
* Frame structure, the VkFormat of the image will always match * Frame structure.
* the pool's sw_format.
* All frames, imported or allocated, will be created with the
* VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if needed.
*
* If all queue family indices in the device context are the same,
* images will be created with the EXCLUSIVE sharing mode. Otherwise, all images
* will be created using the CONCURRENT sharing mode.
* *
* @note the size of this structure is not part of the ABI, to allocate * @note the size of this structure is not part of the ABI, to allocate
* you must use @av_vk_frame_alloc(). * you must use @av_vk_frame_alloc().
*/ */
typedef struct AVVkFrame { struct AVVkFrame {
/** /**
* Vulkan images to which the memory is bound to. * Vulkan images to which the memory is bound to.
* May be one for multiplane formats, or multiple.
*/ */
VkImage img[AV_NUM_DATA_POINTERS]; VkImage img[AV_NUM_DATA_POINTERS];
/** /**
* The same tiling must be used for all images in the frame. * Tiling for the frame.
*/ */
VkImageTiling tiling; VkImageTiling tiling;
/** /**
* Memory backing the images. Could be less than the amount of planes, * Memory backing the images. Either one, or as many as there are planes
* in which case the offset value will indicate the binding offset of * in the sw_format.
* each plane in the memory. * In case of having multiple VkImages, but one memory, the offset field
* will indicate the bound offset for each image.
*/ */
VkDeviceMemory mem[AV_NUM_DATA_POINTERS]; VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
size_t size[AV_NUM_DATA_POINTERS]; size_t size[AV_NUM_DATA_POINTERS];
@ -235,13 +289,13 @@ typedef struct AVVkFrame {
VkMemoryPropertyFlagBits flags; VkMemoryPropertyFlagBits flags;
/** /**
* Updated after every barrier * Updated after every barrier. One per VkImage.
*/ */
VkAccessFlagBits access[AV_NUM_DATA_POINTERS]; VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
VkImageLayout layout[AV_NUM_DATA_POINTERS]; VkImageLayout layout[AV_NUM_DATA_POINTERS];
/** /**
* Synchronization timeline semaphores, one for each sw_format plane. * Synchronization timeline semaphores, one for each VkImage.
* Must not be freed manually. Must be waited on at every submission using * Must not be freed manually. Must be waited on at every submission using
* the value in sem_value, and must be signalled at every submission, * the value in sem_value, and must be signalled at every submission,
* using an incremented value. * using an incremented value.
@ -250,6 +304,7 @@ typedef struct AVVkFrame {
/** /**
* Up to date semaphore value at which each image becomes accessible. * Up to date semaphore value at which each image becomes accessible.
* One per VkImage.
* Clients must wait on this value when submitting a command queue, * Clients must wait on this value when submitting a command queue,
* and increment it when signalling. * and increment it when signalling.
*/ */
@ -261,10 +316,18 @@ typedef struct AVVkFrame {
struct AVVkFrameInternal *internal; struct AVVkFrameInternal *internal;
/** /**
* Describes the binding offset of each plane to the VkDeviceMemory. * Describes the binding offset of each image to the VkDeviceMemory.
* One per VkImage.
*/ */
ptrdiff_t offset[AV_NUM_DATA_POINTERS]; ptrdiff_t offset[AV_NUM_DATA_POINTERS];
} AVVkFrame;
/**
* Queue family of the images. Must be VK_QUEUE_FAMILY_IGNORED if
* the image was allocated with the CONCURRENT concurrency option.
* One per VkImage.
*/
uint32_t queue_family[AV_NUM_DATA_POINTERS];
};
/** /**
* Allocates a single AVVkFrame and initializes everything as 0. * Allocates a single AVVkFrame and initializes everything as 0.
@ -273,7 +336,8 @@ typedef struct AVVkFrame {
AVVkFrame *av_vk_frame_alloc(void); AVVkFrame *av_vk_frame_alloc(void);
/** /**
* Returns the format of each image up to the number of planes for a given sw_format. * Returns the optimal per-plane Vulkan format for a given sw_format,
* one for each plane.
* Returns NULL on unsupported formats. * Returns NULL on unsupported formats.
*/ */
const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p); const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p);

View File

@ -170,10 +170,26 @@ void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
* @param width width of the image in pixels * @param width width of the image in pixels
* @param height height of the image in pixels * @param height height of the image in pixels
*/ */
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], void av_image_copy(uint8_t * const dst_data[4], const int dst_linesizes[4],
const uint8_t *src_data[4], const int src_linesizes[4], const uint8_t * const src_data[4], const int src_linesizes[4],
enum AVPixelFormat pix_fmt, int width, int height); enum AVPixelFormat pix_fmt, int width, int height);
/**
* Wrapper around av_image_copy() to workaround the limitation
* that the conversion from uint8_t * const * to const uint8_t * const *
* is not performed automatically in C.
* @see av_image_copy()
*/
static inline
void av_image_copy2(uint8_t * const dst_data[4], const int dst_linesizes[4],
uint8_t * const src_data[4], const int src_linesizes[4],
enum AVPixelFormat pix_fmt, int width, int height)
{
av_image_copy(dst_data, dst_linesizes,
(const uint8_t * const *)src_data, src_linesizes,
pix_fmt, width, height);
}
/** /**
* Copy image data located in uncacheable (e.g. GPU mapped) memory. Where * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
* available, this function will use special functionality for reading from such * available, this function will use special functionality for reading from such
@ -188,8 +204,8 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
* @note On x86, the linesizes currently need to be aligned to the cacheline * @note On x86, the linesizes currently need to be aligned to the cacheline
* size (i.e. 64) to get improved performance. * size (i.e. 64) to get improved performance.
*/ */
void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4], void av_image_copy_uc_from(uint8_t * const dst_data[4], const ptrdiff_t dst_linesizes[4],
const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4], const uint8_t * const src_data[4], const ptrdiff_t src_linesizes[4],
enum AVPixelFormat pix_fmt, int width, int height); enum AVPixelFormat pix_fmt, int width, int height);
/** /**
@ -319,10 +335,40 @@ int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar);
* @param height the height of the image in pixels * @param height the height of the image in pixels
* @return 0 if the image data was cleared, a negative AVERROR code otherwise * @return 0 if the image data was cleared, a negative AVERROR code otherwise
*/ */
int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4], int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4],
enum AVPixelFormat pix_fmt, enum AVColorRange range, enum AVPixelFormat pix_fmt, enum AVColorRange range,
int width, int height); int width, int height);
/**
* Overwrite the image data with a color. This is suitable for filling a
* sub-rectangle of an image, meaning the padding between the right most pixel
* and the left most pixel on the next line will not be overwritten. For some
* formats, the image size might be rounded up due to inherent alignment.
*
* If the pixel format has alpha, it is also replaced. Color component values
* are interpreted as native integers (or intfloats) regardless of actual pixel
* format endianness.
*
* This can return an error if the pixel format is not supported. Normally, all
* non-hwaccel pixel formats should be supported.
*
* Passing NULL for dst_data is allowed. Then the function returns whether the
* operation would have succeeded. (It can return an error if the pix_fmt is
* not supported.)
*
* @param dst_data data pointers to destination image
* @param dst_linesize linesizes for the destination image
* @param pix_fmt the pixel format of the image
* @param color the color components to be used for the fill
* @param width the width of the image in pixels
* @param height the height of the image in pixels
* @param flags currently unused
* @return 0 if the image data was filled, a negative AVERROR code otherwise
*/
int av_image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4],
enum AVPixelFormat pix_fmt, const uint32_t color[4],
int width, int height, int flags);
/** /**
* @} * @}
*/ */

View File

@ -72,8 +72,6 @@ typedef union {
# include "mips/intreadwrite.h" # include "mips/intreadwrite.h"
#elif ARCH_PPC #elif ARCH_PPC
# include "ppc/intreadwrite.h" # include "ppc/intreadwrite.h"
#elif ARCH_TOMI
# include "tomi/intreadwrite.h"
#elif ARCH_X86 #elif ARCH_X86
# include "x86/intreadwrite.h" # include "x86/intreadwrite.h"
#endif #endif
@ -215,7 +213,7 @@ typedef union {
* by per-arch headers. * by per-arch headers.
*/ */
#if defined(__GNUC__) #if defined(__GNUC__) || defined(__clang__)
union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
@ -585,9 +583,7 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
#endif #endif
/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be /* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
* naturally aligned. They may be implemented using MMX, * naturally aligned.
* so emms_c() must be called before using any float code
* afterwards.
*/ */
#define AV_COPY(n, d, s) \ #define AV_COPY(n, d, s) \

View File

@ -36,30 +36,81 @@
#ifndef M_E #ifndef M_E
#define M_E 2.7182818284590452354 /* e */ #define M_E 2.7182818284590452354 /* e */
#endif #endif
#ifndef M_Ef
#define M_Ef 2.7182818284590452354f /* e */
#endif
#ifndef M_LN2 #ifndef M_LN2
#define M_LN2 0.69314718055994530942 /* log_e 2 */ #define M_LN2 0.69314718055994530942 /* log_e 2 */
#endif #endif
#ifndef M_LN2f
#define M_LN2f 0.69314718055994530942f /* log_e 2 */
#endif
#ifndef M_LN10 #ifndef M_LN10
#define M_LN10 2.30258509299404568402 /* log_e 10 */ #define M_LN10 2.30258509299404568402 /* log_e 10 */
#endif #endif
#ifndef M_LN10f
#define M_LN10f 2.30258509299404568402f /* log_e 10 */
#endif
#ifndef M_LOG2_10 #ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
#endif #endif
#ifndef M_LOG2_10f
#define M_LOG2_10f 3.32192809488736234787f /* log_2 10 */
#endif
#ifndef M_PHI #ifndef M_PHI
#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ #define M_PHI 1.61803398874989484820 /* phi / golden ratio */
#endif #endif
#ifndef M_PHIf
#define M_PHIf 1.61803398874989484820f /* phi / golden ratio */
#endif
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */ #define M_PI 3.14159265358979323846 /* pi */
#endif #endif
#ifndef M_PIf
#define M_PIf 3.14159265358979323846f /* pi */
#endif
#ifndef M_PI_2 #ifndef M_PI_2
#define M_PI_2 1.57079632679489661923 /* pi/2 */ #define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif #endif
#ifndef M_PI_2f
#define M_PI_2f 1.57079632679489661923f /* pi/2 */
#endif
#ifndef M_PI_4
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#endif
#ifndef M_PI_4f
#define M_PI_4f 0.78539816339744830962f /* pi/4 */
#endif
#ifndef M_1_PI
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#endif
#ifndef M_1_PIf
#define M_1_PIf 0.31830988618379067154f /* 1/pi */
#endif
#ifndef M_2_PI
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#endif
#ifndef M_2_PIf
#define M_2_PIf 0.63661977236758134308f /* 2/pi */
#endif
#ifndef M_2_SQRTPI
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#endif
#ifndef M_2_SQRTPIf
#define M_2_SQRTPIf 1.12837916709551257390f /* 2/sqrt(pi) */
#endif
#ifndef M_SQRT1_2 #ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#endif #endif
#ifndef M_SQRT1_2f
#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */
#endif
#ifndef M_SQRT2 #ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#endif #endif
#ifndef M_SQRT2f
#define M_SQRT2f 1.41421356237309504880f /* sqrt(2) */
#endif
#ifndef NAN #ifndef NAN
#define NAN av_int2float(0x7fc00000) #define NAN av_int2float(0x7fc00000)
#endif #endif
@ -237,6 +288,10 @@ int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int
*/ */
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
/**
* 0th order modified bessel function of the first kind.
*/
double av_bessel_i0(double x);
/** /**
* @} * @}

View File

@ -27,12 +27,10 @@
#ifndef AVUTIL_MEM_H #ifndef AVUTIL_MEM_H
#define AVUTIL_MEM_H #define AVUTIL_MEM_H
#include <limits.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "attributes.h" #include "attributes.h"
#include "avutil.h"
#include "version.h"
/** /**
* @addtogroup lavu_mem * @addtogroup lavu_mem

View File

@ -43,6 +43,16 @@
* ("objects"). An option can have a help text, a type and a range of possible * ("objects"). An option can have a help text, a type and a range of possible
* values. Options may then be enumerated, read and written to. * values. Options may then be enumerated, read and written to.
* *
* There are two modes of access to members of AVOption and its child structs.
* One is called 'native access', and refers to access from the code that
* declares the AVOption in question. The other is 'foreign access', and refers
* to access from other code.
*
* Certain struct members in this header are documented as 'native access only'
* or similar - it means that only the code that declared the AVOption in
* question is allowed to access the field. This allows us to extend the
* semantics of those fields without breaking API compatibility.
*
* @section avoptions_implement Implementing AVOptions * @section avoptions_implement Implementing AVOptions
* This section describes how to add AVOptions capabilities to a struct. * This section describes how to add AVOptions capabilities to a struct.
* *
@ -221,7 +231,7 @@
*/ */
enum AVOptionType{ enum AVOptionType{
AV_OPT_TYPE_FLAGS, AV_OPT_TYPE_FLAGS = 1,
AV_OPT_TYPE_INT, AV_OPT_TYPE_INT,
AV_OPT_TYPE_INT64, AV_OPT_TYPE_INT64,
AV_OPT_TYPE_DOUBLE, AV_OPT_TYPE_DOUBLE,
@ -238,13 +248,98 @@ enum AVOptionType{
AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational
AV_OPT_TYPE_DURATION, AV_OPT_TYPE_DURATION,
AV_OPT_TYPE_COLOR, AV_OPT_TYPE_COLOR,
#if FF_API_OLD_CHANNEL_LAYOUT
AV_OPT_TYPE_CHANNEL_LAYOUT,
#endif
AV_OPT_TYPE_BOOL, AV_OPT_TYPE_BOOL,
AV_OPT_TYPE_CHLAYOUT, AV_OPT_TYPE_CHLAYOUT,
/**
* May be combined with another regular option type to declare an array
* option.
*
* For array options, @ref AVOption.offset should refer to a pointer
* corresponding to the option type. The pointer should be immediately
* followed by an unsigned int that will store the number of elements in the
* array.
*/
AV_OPT_TYPE_FLAG_ARRAY = (1 << 16),
}; };
/**
* A generic parameter which can be set by the user for muxing or encoding.
*/
#define AV_OPT_FLAG_ENCODING_PARAM (1 << 0)
/**
* A generic parameter which can be set by the user for demuxing or decoding.
*/
#define AV_OPT_FLAG_DECODING_PARAM (1 << 1)
#define AV_OPT_FLAG_AUDIO_PARAM (1 << 3)
#define AV_OPT_FLAG_VIDEO_PARAM (1 << 4)
#define AV_OPT_FLAG_SUBTITLE_PARAM (1 << 5)
/**
* The option is intended for exporting values to the caller.
*/
#define AV_OPT_FLAG_EXPORT (1 << 6)
/**
* The option may not be set through the AVOptions API, only read.
* This flag only makes sense when AV_OPT_FLAG_EXPORT is also set.
*/
#define AV_OPT_FLAG_READONLY (1 << 7)
/**
* A generic parameter which can be set by the user for bit stream filtering.
*/
#define AV_OPT_FLAG_BSF_PARAM (1 << 8)
/**
* A generic parameter which can be set by the user at runtime.
*/
#define AV_OPT_FLAG_RUNTIME_PARAM (1 << 15)
/**
* A generic parameter which can be set by the user for filtering.
*/
#define AV_OPT_FLAG_FILTERING_PARAM (1 << 16)
/**
* Set if option is deprecated, users should refer to AVOption.help text for
* more information.
*/
#define AV_OPT_FLAG_DEPRECATED (1 << 17)
/**
* Set if option constants can also reside in child objects.
*/
#define AV_OPT_FLAG_CHILD_CONSTS (1 << 18)
/**
* May be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
*/
typedef struct AVOptionArrayDef {
/**
* Native access only.
*
* Default value of the option, as would be serialized by av_opt_get() (i.e.
* using the value of sep as the separator).
*/
const char *def;
/**
* Minimum number of elements in the array. When this field is non-zero, def
* must be non-NULL and contain at least this number of elements.
*/
unsigned size_min;
/**
* Maximum number of elements in the array, 0 when unlimited.
*/
unsigned size_max;
/**
* Separator between array elements in string representations of this
* option, used by av_opt_set() and av_opt_get(). It must be a printable
* ASCII character, excluding alphanumeric and the backslash. A comma is
* used when sep=0.
*
* The separator and the backslash must be backslash-escaped in order to
* appear in string representations of the option value.
*/
char sep;
} AVOptionArrayDef;
/** /**
* AVOption * AVOption
*/ */
@ -258,6 +353,8 @@ typedef struct AVOption {
const char *help; const char *help;
/** /**
* Native access only.
*
* The offset relative to the context structure where the option * The offset relative to the context structure where the option
* value is stored. It should be 0 for named constants. * value is stored. It should be 0 for named constants.
*/ */
@ -265,6 +362,7 @@ typedef struct AVOption {
enum AVOptionType type; enum AVOptionType type;
/** /**
* Native access only, except when documented otherwise.
* the default value for scalar options * the default value for scalar options
*/ */
union { union {
@ -273,31 +371,22 @@ typedef struct AVOption {
const char *str; const char *str;
/* TODO those are unused now */ /* TODO those are unused now */
AVRational q; AVRational q;
/**
* Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL.
*
* Foreign access to some members allowed, as noted in AVOptionArrayDef
* documentation.
*/
const AVOptionArrayDef *arr;
} default_val; } default_val;
double min; ///< minimum valid value for the option double min; ///< minimum valid value for the option
double max; ///< maximum valid value for the option double max; ///< maximum valid value for the option
/**
* A combination of AV_OPT_FLAG_*.
*/
int flags; int flags;
#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding
#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding
#define AV_OPT_FLAG_AUDIO_PARAM 8
#define AV_OPT_FLAG_VIDEO_PARAM 16
#define AV_OPT_FLAG_SUBTITLE_PARAM 32
/**
* The option is intended for exporting values to the caller.
*/
#define AV_OPT_FLAG_EXPORT 64
/**
* The option may not be set through the AVOptions API, only read.
* This flag only makes sense when AV_OPT_FLAG_EXPORT is also set.
*/
#define AV_OPT_FLAG_READONLY 128
#define AV_OPT_FLAG_BSF_PARAM (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering
#define AV_OPT_FLAG_RUNTIME_PARAM (1<<15) ///< a generic parameter which can be set by the user at runtime
#define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
#define AV_OPT_FLAG_DEPRECATED (1<<17) ///< set if option is deprecated, users should refer to AVOption.help text for more information
#define AV_OPT_FLAG_CHILD_CONSTS (1<<18) ///< set if option constants can also reside in child objects
//FIXME think about enc-audio, ... style flags
/** /**
* The logical unit to which the option belongs. Non-constant * The logical unit to which the option belongs. Non-constant
@ -376,15 +465,9 @@ typedef struct AVOptionRanges {
} AVOptionRanges; } AVOptionRanges;
/** /**
* Show the obj options. * @defgroup opt_mng AVOption (un)initialization and inspection.
* * @{
* @param req_flags requested flags for the options to show. Show only the
* options for which it is opt->flags & req_flags.
* @param rej_flags rejected flags for the options to show. Show only the
* options for which it is !(opt->flags & req_flags).
* @param av_log_obj log context to use for showing the options
*/ */
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
/** /**
* Set the values of all AVOption fields to their default values. * Set the values of all AVOption fields to their default values.
@ -404,161 +487,37 @@ void av_opt_set_defaults(void *s);
*/ */
void av_opt_set_defaults2(void *s, int mask, int flags); void av_opt_set_defaults2(void *s, int mask, int flags);
/**
* Parse the key/value pairs list in opts. For each key/value pair
* found, stores the value in the field in ctx that is named like the
* key. ctx must be an AVClass context, storing is done using
* AVOptions.
*
* @param opts options string to parse, may be NULL
* @param key_val_sep a 0-terminated list of characters used to
* separate key from value
* @param pairs_sep a 0-terminated list of characters used to separate
* two pairs from each other
* @return the number of successfully set key/value pairs, or a negative
* value corresponding to an AVERROR code in case of error:
* AVERROR(EINVAL) if opts cannot be parsed,
* the error code issued by av_opt_set() if a key/value pair
* cannot be set
*/
int av_set_options_string(void *ctx, const char *opts,
const char *key_val_sep, const char *pairs_sep);
/**
* Parse the key-value pairs list in opts. For each key=value pair found,
* set the value of the corresponding option in ctx.
*
* @param ctx the AVClass object to set options on
* @param opts the options string, key-value pairs separated by a
* delimiter
* @param shorthand a NULL-terminated array of options names for shorthand
* notation: if the first field in opts has no key part,
* the key is taken from the first element of shorthand;
* then again for the second, etc., until either opts is
* finished, shorthand is finished or a named option is
* found; after that, all options must be named
* @param key_val_sep a 0-terminated list of characters used to separate
* key from value, for example '='
* @param pairs_sep a 0-terminated list of characters used to separate
* two pairs from each other, for example ':' or ','
* @return the number of successfully set key=value pairs, or a negative
* value corresponding to an AVERROR code in case of error:
* AVERROR(EINVAL) if opts cannot be parsed,
* the error code issued by av_set_string3() if a key/value pair
* cannot be set
*
* Options names must use only the following characters: a-z A-Z 0-9 - . / _
* Separators must use characters distinct from option names and from each
* other.
*/
int av_opt_set_from_string(void *ctx, const char *opts,
const char *const *shorthand,
const char *key_val_sep, const char *pairs_sep);
/** /**
* Free all allocated objects in obj. * Free all allocated objects in obj.
*/ */
void av_opt_free(void *obj); void av_opt_free(void *obj);
/** /**
* Check whether a particular flag is set in a flags field. * Iterate over all AVOptions belonging to obj.
* *
* @param field_name the name of the flag field option * @param obj an AVOptions-enabled struct or a double pointer to an
* @param flag_name the name of the flag to check * AVClass describing it.
* @return non-zero if the flag is set, zero if the flag isn't set, * @param prev result of the previous call to av_opt_next() on this object
* isn't of the right type, or the flags field doesn't exist. * or NULL
* @return next AVOption or NULL
*/ */
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); const AVOption *av_opt_next(const void *obj, const AVOption *prev);
/** /**
* Set all the options from a given dictionary on an object. * Iterate over AVOptions-enabled children of obj.
* *
* @param obj a struct whose first element is a pointer to AVClass * @param prev result of a previous call to this function or NULL
* @param options options to process. This dictionary will be freed and replaced * @return next AVOptions-enabled child or NULL
* by a new one containing all options not found in obj.
* Of course this new dictionary needs to be freed by caller
* with av_dict_free().
*
* @return 0 on success, a negative AVERROR if some option was found in obj,
* but could not be set.
*
* @see av_dict_copy()
*/ */
int av_opt_set_dict(void *obj, struct AVDictionary **options); void *av_opt_child_next(void *obj, void *prev);
/** /**
* Set all the options from a given dictionary on an object. * Iterate over potential AVOptions-enabled children of parent.
* *
* @param obj a struct whose first element is a pointer to AVClass * @param iter a pointer where iteration state is stored.
* @param options options to process. This dictionary will be freed and replaced * @return AVClass corresponding to next potential child or NULL
* by a new one containing all options not found in obj.
* Of course this new dictionary needs to be freed by caller
* with av_dict_free().
* @param search_flags A combination of AV_OPT_SEARCH_*.
*
* @return 0 on success, a negative AVERROR if some option was found in obj,
* but could not be set.
*
* @see av_dict_copy()
*/
int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags);
/**
* Extract a key-value pair from the beginning of a string.
*
* @param ropts pointer to the options string, will be updated to
* point to the rest of the string (one of the pairs_sep
* or the final NUL)
* @param key_val_sep a 0-terminated list of characters used to separate
* key from value, for example '='
* @param pairs_sep a 0-terminated list of characters used to separate
* two pairs from each other, for example ':' or ','
* @param flags flags; see the AV_OPT_FLAG_* values below
* @param rkey parsed key; must be freed using av_free()
* @param rval parsed value; must be freed using av_free()
*
* @return >=0 for success, or a negative value corresponding to an
* AVERROR code in case of error; in particular:
* AVERROR(EINVAL) if no key is present
*
*/
int av_opt_get_key_value(const char **ropts,
const char *key_val_sep, const char *pairs_sep,
unsigned flags,
char **rkey, char **rval);
enum {
/**
* Accept to parse a value without a key; the key will then be returned
* as NULL.
*/
AV_OPT_FLAG_IMPLICIT_KEY = 1,
};
/**
* @defgroup opt_eval_funcs Evaluating option strings
* @{
* This group of functions can be used to evaluate option strings
* and get numbers out of them. They do the same thing as av_opt_set(),
* except the result is written into the caller-supplied pointer.
*
* @param obj a struct whose first element is a pointer to AVClass.
* @param o an option for which the string is to be evaluated.
* @param val string to be evaluated.
* @param *_out value of the string will be written here.
*
* @return 0 on success, a negative number on failure.
*/
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_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);
int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
/**
* @}
*/ */
const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter);
#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the #define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the
given object first. */ given object first. */
@ -633,31 +592,161 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
int opt_flags, int search_flags, void **target_obj); int opt_flags, int search_flags, void **target_obj);
/** /**
* Iterate over all AVOptions belonging to obj. * Show the obj options.
* *
* @param obj an AVOptions-enabled struct or a double pointer to an * @param req_flags requested flags for the options to show. Show only the
* AVClass describing it. * options for which it is opt->flags & req_flags.
* @param prev result of the previous call to av_opt_next() on this object * @param rej_flags rejected flags for the options to show. Show only the
* or NULL * options for which it is !(opt->flags & req_flags).
* @return next AVOption or NULL * @param av_log_obj log context to use for showing the options
*/ */
const AVOption *av_opt_next(const void *obj, const AVOption *prev); int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
/** /**
* Iterate over AVOptions-enabled children of obj. * Extract a key-value pair from the beginning of a string.
*
* @param ropts pointer to the options string, will be updated to
* point to the rest of the string (one of the pairs_sep
* or the final NUL)
* @param key_val_sep a 0-terminated list of characters used to separate
* key from value, for example '='
* @param pairs_sep a 0-terminated list of characters used to separate
* two pairs from each other, for example ':' or ','
* @param flags flags; see the AV_OPT_FLAG_* values below
* @param rkey parsed key; must be freed using av_free()
* @param rval parsed value; must be freed using av_free()
*
* @return >=0 for success, or a negative value corresponding to an
* AVERROR code in case of error; in particular:
* AVERROR(EINVAL) if no key is present
* *
* @param prev result of a previous call to this function or NULL
* @return next AVOptions-enabled child or NULL
*/ */
void *av_opt_child_next(void *obj, void *prev); int av_opt_get_key_value(const char **ropts,
const char *key_val_sep, const char *pairs_sep,
unsigned flags,
char **rkey, char **rval);
enum {
/**
* Accept to parse a value without a key; the key will then be returned
* as NULL.
*/
AV_OPT_FLAG_IMPLICIT_KEY = 1,
};
/** /**
* Iterate over potential AVOptions-enabled children of parent. * @}
*
* @param iter a pointer where iteration state is stored.
* @return AVClass corresponding to next potential child or NULL
*/ */
const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter);
/**
* @defgroup opt_write Setting and modifying option values
* @{
*/
/**
* Parse the key/value pairs list in opts. For each key/value pair
* found, stores the value in the field in ctx that is named like the
* key. ctx must be an AVClass context, storing is done using
* AVOptions.
*
* @param opts options string to parse, may be NULL
* @param key_val_sep a 0-terminated list of characters used to
* separate key from value
* @param pairs_sep a 0-terminated list of characters used to separate
* two pairs from each other
* @return the number of successfully set key/value pairs, or a negative
* value corresponding to an AVERROR code in case of error:
* AVERROR(EINVAL) if opts cannot be parsed,
* the error code issued by av_opt_set() if a key/value pair
* cannot be set
*/
int av_set_options_string(void *ctx, const char *opts,
const char *key_val_sep, const char *pairs_sep);
/**
* Parse the key-value pairs list in opts. For each key=value pair found,
* set the value of the corresponding option in ctx.
*
* @param ctx the AVClass object to set options on
* @param opts the options string, key-value pairs separated by a
* delimiter
* @param shorthand a NULL-terminated array of options names for shorthand
* notation: if the first field in opts has no key part,
* the key is taken from the first element of shorthand;
* then again for the second, etc., until either opts is
* finished, shorthand is finished or a named option is
* found; after that, all options must be named
* @param key_val_sep a 0-terminated list of characters used to separate
* key from value, for example '='
* @param pairs_sep a 0-terminated list of characters used to separate
* two pairs from each other, for example ':' or ','
* @return the number of successfully set key=value pairs, or a negative
* value corresponding to an AVERROR code in case of error:
* AVERROR(EINVAL) if opts cannot be parsed,
* the error code issued by av_set_string3() if a key/value pair
* cannot be set
*
* Options names must use only the following characters: a-z A-Z 0-9 - . / _
* Separators must use characters distinct from option names and from each
* other.
*/
int av_opt_set_from_string(void *ctx, const char *opts,
const char *const *shorthand,
const char *key_val_sep, const char *pairs_sep);
/**
* Set all the options from a given dictionary on an object.
*
* @param obj a struct whose first element is a pointer to AVClass
* @param options options to process. This dictionary will be freed and replaced
* by a new one containing all options not found in obj.
* Of course this new dictionary needs to be freed by caller
* with av_dict_free().
*
* @return 0 on success, a negative AVERROR if some option was found in obj,
* but could not be set.
*
* @see av_dict_copy()
*/
int av_opt_set_dict(void *obj, struct AVDictionary **options);
/**
* Set all the options from a given dictionary on an object.
*
* @param obj a struct whose first element is a pointer to AVClass
* @param options options to process. This dictionary will be freed and replaced
* by a new one containing all options not found in obj.
* Of course this new dictionary needs to be freed by caller
* with av_dict_free().
* @param search_flags A combination of AV_OPT_SEARCH_*.
*
* @return 0 on success, a negative AVERROR if some option was found in obj,
* but could not be set.
*
* @see av_dict_copy()
*/
int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags);
/**
* Copy options from src object into dest object.
*
* The underlying AVClass of both src and dest must coincide. The guarantee
* below does not apply if this is not fulfilled.
*
* Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object.
* Original memory allocated for such options is freed unless both src and dest options points to the same memory.
*
* Even on error it is guaranteed that allocated options from src and dest
* no longer alias each other afterwards; in particular calling av_opt_free()
* on both src and dest is safe afterwards if dest has been memdup'ed from src.
*
* @param dest Object to copy from
* @param src Object to copy into
* @return 0 on success, negative on error
*/
int av_opt_copy(void *dest, const void *src);
/** /**
* @defgroup opt_set_funcs Option setting functions * @defgroup opt_set_funcs Option setting functions
@ -697,10 +786,6 @@ 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_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_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); int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
#if FF_API_OLD_CHANNEL_LAYOUT
attribute_deprecated
int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags);
#endif
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layout, int search_flags); 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 * @note Any old dictionary present is discarded and replaced with a copy of the new one. The
@ -726,6 +811,12 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in
/** /**
* @} * @}
* @}
*/
/**
* @defgroup opt_read Reading option values
* @{
*/ */
/** /**
@ -756,10 +847,6 @@ 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_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_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); int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
#if FF_API_OLD_CHANNEL_LAYOUT
attribute_deprecated
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout);
#endif
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *layout); 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 * @param[out] out_val The returned dictionary is a copy of the actual value and must
@ -769,6 +856,31 @@ int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDiction
/** /**
* @} * @}
*/ */
/**
* @defgroup opt_eval_funcs Evaluating option strings
* @{
* This group of functions can be used to evaluate option strings
* and get numbers out of them. They do the same thing as av_opt_set(),
* except the result is written into the caller-supplied pointer.
*
* @param obj a struct whose first element is a pointer to AVClass.
* @param o an option for which the string is to be evaluated.
* @param val string to be evaluated.
* @param *_out value of the string will be written here.
*
* @return 0 on success, a negative number on failure.
*/
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_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);
int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
/**
* @}
*/
/** /**
* Gets a pointer to the requested field in a struct. * Gets a pointer to the requested field in a struct.
* This function allows accessing a struct even when its fields are moved or * This function allows accessing a struct even when its fields are moved or
@ -779,61 +891,6 @@ int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDiction
*/ */
void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
/**
* Free an AVOptionRanges struct and set it to NULL.
*/
void av_opt_freep_ranges(AVOptionRanges **ranges);
/**
* Get a list of allowed ranges for the given option.
*
* The returned list may depend on other fields in obj like for example profile.
*
* @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
* AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
* AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
*
* The result must be freed with av_opt_freep_ranges.
*
* @return number of compontents returned on success, a negative errro code otherwise
*/
int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
/**
* Copy options from src object into dest object.
*
* The underlying AVClass of both src and dest must coincide. The guarantee
* below does not apply if this is not fulfilled.
*
* Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object.
* Original memory allocated for such options is freed unless both src and dest options points to the same memory.
*
* Even on error it is guaranteed that allocated options from src and dest
* no longer alias each other afterwards; in particular calling av_opt_free()
* on both src and dest is safe afterwards if dest has been memdup'ed from src.
*
* @param dest Object to copy from
* @param src Object to copy into
* @return 0 on success, negative on error
*/
int av_opt_copy(void *dest, const void *src);
/**
* Get a default list of allowed ranges for the given option.
*
* This list is constructed without using the AVClass.query_ranges() callback
* and can be used as fallback from within the callback.
*
* @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
* AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
* AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
*
* The result must be freed with av_opt_free_ranges.
*
* @return number of compontents returned on success, a negative errro code otherwise
*/
int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
/** /**
* Check if given option is set to its default value. * Check if given option is set to its default value.
* *
@ -860,6 +917,15 @@ int av_opt_is_set_to_default(void *obj, const AVOption *o);
*/ */
int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags); int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags);
/**
* Check whether a particular flag is set in a flags field.
*
* @param field_name the name of the flag field option
* @param flag_name the name of the flag to check
* @return non-zero if the flag is set, zero if the flag isn't set,
* isn't of the right type, or the flags field doesn't exist.
*/
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_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_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only.
@ -884,6 +950,47 @@ int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_fla
*/ */
int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
const char key_val_sep, const char pairs_sep); const char key_val_sep, const char pairs_sep);
/**
* @}
*/
/**
* Free an AVOptionRanges struct and set it to NULL.
*/
void av_opt_freep_ranges(AVOptionRanges **ranges);
/**
* Get a list of allowed ranges for the given option.
*
* The returned list may depend on other fields in obj like for example profile.
*
* @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
* AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
* AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
*
* The result must be freed with av_opt_freep_ranges.
*
* @return number of compontents returned on success, a negative errro code otherwise
*/
int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
/**
* Get a default list of allowed ranges for the given option.
*
* This list is constructed without using the AVClass.query_ranges() callback
* and can be used as fallback from within the callback.
*
* @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
* AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
* AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
*
* The result must be freed with av_opt_free_ranges.
*
* @return number of compontents returned on success, a negative errro code otherwise
*/
int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
/** /**
* @} * @}
*/ */

View File

@ -157,6 +157,11 @@ typedef struct AVPixFmtDescriptor {
*/ */
#define AV_PIX_FMT_FLAG_FLOAT (1 << 9) #define AV_PIX_FMT_FLAG_FLOAT (1 << 9)
/**
* The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale).
*/
#define AV_PIX_FMT_FLAG_XYZ (1 << 10)
/** /**
* Return the number of bits per pixel used by the pixel format * Return the number of bits per pixel used by the pixel format
* described by pixdesc. Note that this is not the same as the number * described by pixdesc. Note that this is not the same as the number

View File

@ -32,6 +32,13 @@
#define AVPALETTE_SIZE 1024 #define AVPALETTE_SIZE 1024
#define AVPALETTE_COUNT 256 #define AVPALETTE_COUNT 256
/**
* Maximum number of planes in any pixel format.
* This should be used when a maximum is needed, but code should not
* be written to require a maximum for no good reason.
*/
#define AV_VIDEO_MAX_PLANES 4
/** /**
* Pixel format. * Pixel format.
* *
@ -83,7 +90,7 @@ enum AVPixelFormat {
AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
@ -288,10 +295,6 @@ enum AVPixelFormat {
AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
#if FF_API_XVMC
AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
#endif
AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
@ -420,6 +423,22 @@ enum AVPixelFormat {
AV_PIX_FMT_RGBAF32BE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian AV_PIX_FMT_RGBAF32BE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian
AV_PIX_FMT_RGBAF32LE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian AV_PIX_FMT_RGBAF32LE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian
AV_PIX_FMT_P212BE, ///< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian
AV_PIX_FMT_P212LE, ///< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian
AV_PIX_FMT_P412BE, ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
AV_PIX_FMT_P412LE, ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian
AV_PIX_FMT_GBRAP14BE, ///< planar GBR 4:4:4:4 56bpp, big-endian
AV_PIX_FMT_GBRAP14LE, ///< planar GBR 4:4:4:4 56bpp, little-endian
/**
* Hardware surfaces for Direct3D 12.
*
* data[0] points to an AVD3D12VAFrame
*/
AV_PIX_FMT_D3D12,
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 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
}; };
@ -478,6 +497,7 @@ enum AVPixelFormat {
#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) #define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE) #define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE) #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_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE) #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
@ -518,6 +538,8 @@ enum AVPixelFormat {
#define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE) #define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE)
#define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE) #define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE)
#define AV_PIX_FMT_P212 AV_PIX_FMT_NE(P212BE, P212LE)
#define AV_PIX_FMT_P412 AV_PIX_FMT_NE(P412BE, P412LE)
#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) #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_P416 AV_PIX_FMT_NE(P416BE, P416LE)

View File

@ -21,6 +21,7 @@
#ifndef AVUTIL_RANDOM_SEED_H #ifndef AVUTIL_RANDOM_SEED_H
#define AVUTIL_RANDOM_SEED_H #define AVUTIL_RANDOM_SEED_H
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
/** /**
* @addtogroup lavu_crypto * @addtogroup lavu_crypto
@ -36,6 +37,19 @@
*/ */
uint32_t av_get_random_seed(void); uint32_t av_get_random_seed(void);
/**
* Generate cryptographically secure random data, i.e. suitable for use as
* encryption keys and similar.
*
* @param buf buffer into which the random data will be written
* @param len size of buf in bytes
*
* @retval 0 success, len bytes of random data was written
* into buf
* @retval "a negative AVERROR code" random data could not be generated
*/
int av_random_bytes(uint8_t *buf, size_t len);
/** /**
* @} * @}
*/ */

View File

@ -168,6 +168,10 @@ static av_always_inline AVRational av_inv_q(AVRational q)
* In case of infinity, the returned value is expressed as `{1, 0}` or * In case of infinity, the returned value is expressed as `{1, 0}` or
* `{-1, 0}` depending on the sign. * `{-1, 0}` depending on the sign.
* *
* In general rational numbers with |num| <= 1<<26 && |den| <= 1<<26
* can be recovered exactly from their double representation.
* (no exceptions were found within 1B random ones)
*
* @param d `double` to convert * @param d `double` to convert
* @param max Maximum allowed numerator and denominator * @param max Maximum allowed numerator and denominator
* @return `d` in AVRational form * @return `d` in AVRational form

View File

@ -246,7 +246,7 @@ int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int
* @param nb_channels number of audio channels * @param nb_channels number of audio channels
* @param sample_fmt audio sample format * @param sample_fmt audio sample format
*/ */
int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, int av_samples_copy(uint8_t * const *dst, uint8_t * const *src, int dst_offset,
int src_offset, int nb_samples, int nb_channels, int src_offset, int nb_samples, int nb_channels,
enum AVSampleFormat sample_fmt); enum AVSampleFormat sample_fmt);
@ -259,7 +259,7 @@ int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
* @param nb_channels number of audio channels * @param nb_channels number of audio channels
* @param sample_fmt audio sample format * @param sample_fmt audio sample format
*/ */
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int av_samples_set_silence(uint8_t * const *audio_data, int offset, int nb_samples,
int nb_channels, enum AVSampleFormat sample_fmt); int nb_channels, enum AVSampleFormat sample_fmt);
/** /**

View File

@ -98,8 +98,8 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss
/** /**
* Load timecode string in buf. * Load timecode string in buf.
* *
* @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
* @param tc timecode data correctly initialized * @param tc timecode data correctly initialized
* @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
* @param framenum frame number * @param framenum frame number
* @return the buf parameter * @return the buf parameter
* *
@ -149,13 +149,13 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit);
/** /**
* Init a timecode struct with the passed parameters. * Init a timecode struct with the passed parameters.
* *
* @param log_ctx a pointer to an arbitrary struct of which the first field
* is a pointer to an AVClass struct (used for av_log)
* @param tc pointer to an allocated AVTimecode * @param tc pointer to an allocated AVTimecode
* @param rate frame rate in rational form * @param rate frame rate in rational form
* @param flags miscellaneous flags such as drop frame, +24 hours, ... * @param flags miscellaneous flags such as drop frame, +24 hours, ...
* (see AVTimecodeFlag) * (see AVTimecodeFlag)
* @param frame_start the first frame number * @param frame_start the first frame number
* @param log_ctx a pointer to an arbitrary struct of which the first field
* is a pointer to an AVClass struct (used for av_log)
* @return 0 on success, AVERROR otherwise * @return 0 on success, AVERROR otherwise
*/ */
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx); int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx);
@ -163,8 +163,6 @@ int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start
/** /**
* Init a timecode struct from the passed timecode components. * Init a timecode struct from the passed timecode components.
* *
* @param log_ctx a pointer to an arbitrary struct of which the first field
* is a pointer to an AVClass struct (used for av_log)
* @param tc pointer to an allocated AVTimecode * @param tc pointer to an allocated AVTimecode
* @param rate frame rate in rational form * @param rate frame rate in rational form
* @param flags miscellaneous flags such as drop frame, +24 hours, ... * @param flags miscellaneous flags such as drop frame, +24 hours, ...
@ -173,6 +171,8 @@ int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start
* @param mm minutes * @param mm minutes
* @param ss seconds * @param ss seconds
* @param ff frames * @param ff frames
* @param log_ctx a pointer to an arbitrary struct of which the first field
* is a pointer to an AVClass struct (used for av_log)
* @return 0 on success, AVERROR otherwise * @return 0 on success, AVERROR otherwise
*/ */
int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx); int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx);
@ -180,11 +180,11 @@ int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags,
/** /**
* Parse timecode representation (hh:mm:ss[:;.]ff). * Parse timecode representation (hh:mm:ss[:;.]ff).
* *
* @param log_ctx a pointer to an arbitrary struct of which the first field is a
* pointer to an AVClass struct (used for av_log).
* @param tc pointer to an allocated AVTimecode * @param tc pointer to an allocated AVTimecode
* @param rate frame rate in rational form * @param rate frame rate in rational form
* @param str timecode string which will determine the frame start * @param str timecode string which will determine the frame start
* @param log_ctx a pointer to an arbitrary struct of which the first field is a
* pointer to an AVClass struct (used for av_log).
* @return 0 on success, AVERROR otherwise * @return 0 on success, AVERROR otherwise
*/ */
int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx); int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx);

View File

@ -24,7 +24,7 @@
#ifndef AVUTIL_TIMESTAMP_H #ifndef AVUTIL_TIMESTAMP_H
#define AVUTIL_TIMESTAMP_H #define AVUTIL_TIMESTAMP_H
#include "common.h" #include "avutil.h"
#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
@ -62,11 +62,18 @@ static inline char *av_ts_make_string(char *buf, int64_t ts)
* @param tb the timebase of the timestamp * @param tb the timebase of the timestamp
* @return the buffer in input * @return the buffer in input
*/ */
static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb);
/**
* Fill the provided buffer with a string containing a timestamp
* representation.
*
* @see av_ts_make_time_string2
*/
static inline char *av_ts_make_time_string(char *buf, int64_t ts,
const AVRational *tb)
{ {
if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); return av_ts_make_time_string2(buf, ts, *tb);
else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts);
return buf;
} }
/** /**

View File

@ -105,6 +105,30 @@ enum AVTXType {
AV_TX_DOUBLE_DCT = 10, AV_TX_DOUBLE_DCT = 10,
AV_TX_INT32_DCT = 11, AV_TX_INT32_DCT = 11,
/**
* Discrete Cosine Transform I
*
* The forward transform is a DCT-I.
* The inverse transform is a DCT-I multiplied by 2/(N + 1).
*
* The input array is always overwritten.
*/
AV_TX_FLOAT_DCT_I = 12,
AV_TX_DOUBLE_DCT_I = 13,
AV_TX_INT32_DCT_I = 14,
/**
* Discrete Sine Transform I
*
* The forward transform is a DST-I.
* The inverse transform is a DST-I multiplied by 2/(N + 1).
*
* The input array is always overwritten.
*/
AV_TX_FLOAT_DST_I = 15,
AV_TX_DOUBLE_DST_I = 16,
AV_TX_INT32_DST_I = 17,
/* Not part of the API, do not use */ /* Not part of the API, do not use */
AV_TX_NB, AV_TX_NB,
}; };
@ -149,6 +173,16 @@ enum AVTXFlags {
* Ignored for all transforms but inverse MDCTs. * Ignored for all transforms but inverse MDCTs.
*/ */
AV_TX_FULL_IMDCT = 1ULL << 2, AV_TX_FULL_IMDCT = 1ULL << 2,
/**
* Perform a real to half-complex RDFT.
* Only the real, or imaginary coefficients will
* be output, depending on the flag used. Only available for forward RDFTs.
* Output array must have enough space to hold N complex values
* (regular size for a real to complex transform).
*/
AV_TX_REAL_TO_REAL = 1ULL << 3,
AV_TX_REAL_TO_IMAGINARY = 1ULL << 4,
}; };
/** /**

View File

@ -78,8 +78,8 @@
* @{ * @{
*/ */
#define LIBAVUTIL_VERSION_MAJOR 58 #define LIBAVUTIL_VERSION_MAJOR 59
#define LIBAVUTIL_VERSION_MINOR 2 #define LIBAVUTIL_VERSION_MINOR 8
#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@ -105,14 +105,13 @@
* @{ * @{
*/ */
#define FF_API_FIFO_PEEK2 (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59) #define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
/** /**
* @} * @}

View File

@ -136,8 +136,8 @@ typedef struct AVVideoBlockParams {
int32_t delta_qp; int32_t delta_qp;
} AVVideoBlockParams; } AVVideoBlockParams;
/* /**
* Get the block at the specified {@code idx}. Must be between 0 and nb_blocks. * Get the block at the specified {@code idx}. Must be between 0 and nb_blocks - 1.
*/ */
static av_always_inline AVVideoBlockParams* static av_always_inline AVVideoBlockParams*
av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx) av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)

View File

@ -234,35 +234,6 @@ int swr_init(struct SwrContext *s);
*/ */
int swr_is_initialized(struct SwrContext *s); int swr_is_initialized(struct SwrContext *s);
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Allocate SwrContext if needed and set/reset common parameters.
*
* This function does not require s to be allocated with swr_alloc(). On the
* other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters
* on the allocated context.
*
* @param s existing Swr context if available, or NULL if not
* @param out_ch_layout output channel layout (AV_CH_LAYOUT_*)
* @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*).
* @param out_sample_rate output sample rate (frequency in Hz)
* @param in_ch_layout input channel layout (AV_CH_LAYOUT_*)
* @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*).
* @param in_sample_rate input sample rate (frequency in Hz)
* @param log_offset logging level offset
* @param log_ctx parent logging context, can be NULL
*
* @see swr_init(), swr_free()
* @return NULL on error, allocated context otherwise
* @deprecated use @ref swr_alloc_set_opts2()
*/
attribute_deprecated
struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
int log_offset, void *log_ctx);
#endif
/** /**
* Allocate SwrContext if needed and set/reset common parameters. * Allocate SwrContext if needed and set/reset common parameters.
* *
@ -340,8 +311,8 @@ void swr_close(struct SwrContext *s);
* *
* @return number of samples output per channel, negative value on error * @return number of samples output per channel, negative value on error
*/ */
int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, int swr_convert(struct SwrContext *s, uint8_t * const *out, int out_count,
const uint8_t **in , int in_count); const uint8_t * const *in , int in_count);
/** /**
* Convert the next timestamp from input to output * Convert the next timestamp from input to output
@ -399,40 +370,6 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
*/ */
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map); int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Generate a channel mixing matrix.
*
* This function is the one used internally by libswresample for building the
* default mixing matrix. It is made public just as a utility function for
* building custom matrices.
*
* @param in_layout input channel layout
* @param out_layout output channel layout
* @param center_mix_level mix level for the center channel
* @param surround_mix_level mix level for the surround channel(s)
* @param lfe_mix_level mix level for the low-frequency effects channel
* @param rematrix_maxval if 1.0, coefficients will be normalized to prevent
* overflow. if INT_MAX, coefficients will not be
* normalized.
* @param[out] matrix mixing coefficients; matrix[i + stride * o] is
* the weight of input channel i in output channel o.
* @param stride distance between adjacent input channels in the
* matrix array
* @param matrix_encoding matrixed stereo downmix mode (e.g. dplii)
* @param log_ctx parent logging context, can be NULL
* @return 0 on success, negative AVERROR code on failure
* @deprecated use @ref swr_build_matrix2()
*/
attribute_deprecated
int swr_build_matrix(uint64_t in_layout, uint64_t out_layout,
double center_mix_level, double surround_mix_level,
double lfe_mix_level, double rematrix_maxval,
double rematrix_volume, double *matrix,
int stride, enum AVMatrixEncoding matrix_encoding,
void *log_ctx);
#endif
/** /**
* Generate a channel mixing matrix. * Generate a channel mixing matrix.
* *

View File

@ -30,7 +30,7 @@
#include "version_major.h" #include "version_major.h"
#define LIBSWRESAMPLE_VERSION_MINOR 10 #define LIBSWRESAMPLE_VERSION_MINOR 1
#define LIBSWRESAMPLE_VERSION_MICRO 100 #define LIBSWRESAMPLE_VERSION_MICRO 100
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \

View File

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

View File

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