diff --git a/mac/include/libavcodec/avcodec.h b/mac/include/libavcodec/avcodec.h index 8a71c04..7ee8bc2 100644 --- a/mac/include/libavcodec/avcodec.h +++ b/mac/include/libavcodec/avcodec.h @@ -27,25 +27,21 @@ * Libavcodec external API header */ -#include #include "libavutil/samplefmt.h" #include "libavutil/attributes.h" #include "libavutil/avutil.h" #include "libavutil/buffer.h" -#include "libavutil/cpu.h" -#include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/frame.h" -#include "libavutil/hwcontext.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "bsf.h" #include "codec.h" #include "codec_desc.h" #include "codec_par.h" #include "codec_id.h" +#include "defs.h" #include "packet.h" #include "version.h" @@ -155,29 +151,6 @@ * at least will not fail with AVERROR(EAGAIN). In general, no codec will * permit unlimited buffering of input or output. * - * This API replaces the following legacy functions: - * - avcodec_decode_video2() and avcodec_decode_audio4(): - * Use avcodec_send_packet() to feed input to the decoder, then use - * avcodec_receive_frame() to receive decoded frames after each packet. - * Unlike with the old video decoding API, multiple frames might result from - * a packet. For audio, splitting the input packet into frames by partially - * decoding packets becomes transparent to the API user. You never need to - * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then - * no data was read from the packet). - * Additionally, sending a flush/draining packet is required only once. - * - avcodec_encode_video2()/avcodec_encode_audio2(): - * Use avcodec_send_frame() to feed input to the encoder, then use - * avcodec_receive_packet() to receive encoded packets. - * Providing user-allocated buffers for avcodec_receive_packet() is not - * possible. - * - The new API does not handle subtitles yet. - * - * Mixing new and old function calls on the same AVCodecContext is not allowed, - * and will result in undefined behavior. - * - * Some codecs might require using the new API; using the old API will return - * an error when calling it. All codecs support the new API. - * * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This * would be an invalid state, which could put the codec user into an endless * loop. The API has no concept of time either: it cannot happen that trying to @@ -204,16 +177,6 @@ * @{ */ -/** - * @ingroup lavc_decoding - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * This is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end.
- * Note: If the first 23 bits of the additional bytes are not 0, then damaged - * MPEG bitstreams could cause overread and segfault. - */ -#define AV_INPUT_BUFFER_PADDING_SIZE 64 - /** * @ingroup lavc_encoding * minimum encoding buffer size @@ -221,34 +184,6 @@ */ #define AV_INPUT_BUFFER_MIN_SIZE 16384 -/** - * @ingroup lavc_decoding - */ -enum AVDiscard{ - /* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). */ - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONINTRA= 24, ///< discard all non intra frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -enum AVAudioServiceType { - AV_AUDIO_SERVICE_TYPE_MAIN = 0, - AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, - AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, - AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, - AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, - AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, - AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, - AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, - AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, - AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI -}; - /** * @ingroup lavc_encoding */ @@ -310,11 +245,15 @@ typedef struct RcOverride{ * error[?] variables will be set during encoding. */ #define AV_CODEC_FLAG_PSNR (1 << 15) +#if FF_API_FLAG_TRUNCATED /** * Input bitstream might be truncated at a random location * instead of only at frame boundaries. + * + * @deprecated use codec parsers for packetizing input */ #define AV_CODEC_FLAG_TRUNCATED (1 << 16) +#endif /** * Use interlaced DCT. */ @@ -416,98 +355,6 @@ typedef struct RcOverride{ */ #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) -/** - * Pan Scan area. - * This specifies the area which should be displayed. - * Note there may be multiple such areas for one frame. - */ -typedef struct AVPanScan { - /** - * id - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int16_t position[3][2]; -} AVPanScan; - -/** - * This structure describes the bitrate properties of an encoded bitstream. It - * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD - * parameters for H.264/HEVC. - */ -typedef struct AVCPBProperties { - /** - * Maximum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int max_bitrate; -#else - int64_t max_bitrate; -#endif - /** - * Minimum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int min_bitrate; -#else - int64_t min_bitrate; -#endif - /** - * Average bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int avg_bitrate; -#else - int64_t avg_bitrate; -#endif - - /** - * The size of the buffer to which the ratecontrol is applied, in bits. - * Zero if unknown or unspecified. - */ - int buffer_size; - - /** - * The delay between the time the packet this structure is associated with - * is received and the time when it should be decoded, in periods of a 27MHz - * clock. - * - * UINT64_MAX when unknown or unspecified. - */ - uint64_t vbv_delay; -} AVCPBProperties; - -/** - * This structure supplies correlation between a packet timestamp and a wall clock - * production time. The definition follows the Producer Reference Time ('prft') - * as defined in ISO/IEC 14496-12 - */ -typedef struct AVProducerReferenceTime { - /** - * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). - */ - int64_t wallclock; - int flags; -} AVProducerReferenceTime; - /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -697,7 +544,7 @@ typedef struct AVCodecContext { * picture width / height. * * @note Those fields may not match the values of the last - * AVFrame output by avcodec_decode_video2 due frame + * AVFrame output by avcodec_receive_frame() due frame * reordering. * * - encoding: MUST be set by user. @@ -773,17 +620,29 @@ typedef struct AVCodecContext { int y, int type, int height); /** - * callback to negotiate the pixelFormat - * @param fmt is the list of formats which are supported by the codec, - * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. - * The first is always the native one. - * @note The callback may be called again immediately if initialization for - * the selected (hardware-accelerated) pixel format failed. - * @warning Behavior is undefined if the callback returns a value not - * in the fmt list of formats. - * @return the chosen format - * - encoding: unused - * - decoding: Set by user, if not set the native format will be chosen. + * Callback to negotiate the pixel format. Decoding only, may be set by the + * caller before avcodec_open2(). + * + * Called by some decoders to select the pixel format that will be used for + * the output frames. This is mainly used to set up hardware acceleration, + * then the provided format list contains the corresponding hwaccel pixel + * formats alongside the "software" one. The software pixel format may also + * be retrieved from \ref sw_pix_fmt. + * + * This callback will be called when the coded frame properties (such as + * resolution, pixel format, etc.) change and more than one output format is + * supported for those new properties. If a hardware pixel format is chosen + * and initialization for it fails, the callback may be called again + * immediately. + * + * This callback may be called from different threads if the decoder is + * multi-threaded, but not from more than one thread simultaneously. + * + * @param fmt list of formats which may be used in the current + * configuration, terminated by AV_PIX_FMT_NONE. + * @warning Behavior is undefined if the callback returns a value other + * than one of the formats in fmt or AV_PIX_FMT_NONE. + * @return the chosen format or AV_PIX_FMT_NONE */ enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); @@ -804,12 +663,6 @@ typedef struct AVCodecContext { */ float b_quant_factor; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_frame_strategy; -#endif - /** * qscale offset between IP and B-frames * - encoding: Set by user. @@ -825,12 +678,6 @@ typedef struct AVCodecContext { */ int has_b_frames; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int mpeg_quant; -#endif - /** * qscale factor between P- and I-frames * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). @@ -889,15 +736,6 @@ typedef struct AVCodecContext { */ int slice_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 -#endif - /** * slice offsets in the frame in bytes * - encoding: Set/allocated by libavcodec. @@ -970,12 +808,6 @@ typedef struct AVCodecContext { */ int last_predictor_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int pre_me; -#endif - /** * motion estimation prepass comparison function * - encoding: Set by user. @@ -1044,16 +876,6 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int scenechange_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int noise_reduction; -#endif - /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. @@ -1089,26 +911,12 @@ typedef struct AVCodecContext { */ int mb_lmax; -#if FF_API_PRIVATE_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int me_penalty_compensation; -#endif - /** * - encoding: Set by user. * - decoding: unused */ int bidir_refine; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int brd_scale; -#endif - /** * minimum GOP size * - encoding: Set by user. @@ -1123,12 +931,6 @@ typedef struct AVCodecContext { */ int refs; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int chromaoffset; -#endif - /** * Note: Value depends upon the compare function used for fullpel ME. * - encoding: Set by user. @@ -1136,12 +938,6 @@ typedef struct AVCodecContext { */ int mv0_threshold; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_sensitivity; -#endif - /** * Chromaticity coordinates of the source primaries. * - encoding: Set by user @@ -1350,24 +1146,6 @@ typedef struct AVCodecContext { */ int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); -#if FF_API_OLD_ENCDEC - /** - * If non-zero, the decoded audio and video frames returned from - * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted - * and are valid indefinitely. The caller must free them with - * av_frame_unref() when they are not needed anymore. - * Otherwise, the decoded frames must not be freed by the caller and are - * only valid until the next decode call. - * - * This is always automatically enabled if avcodec_receive_frame() is used. - * - * - encoding: unused - * - decoding: set by the caller before avcodec_open2(). - */ - attribute_deprecated - int refcounted_frames; -#endif - /* - encoding parameters */ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) float qblur; ///< amount of qscale smoothing over time (0.0-1.0) @@ -1443,42 +1221,6 @@ typedef struct AVCodecContext { */ int rc_initial_buffer_occupancy; -#if FF_API_CODER_TYPE -#define FF_CODER_TYPE_VLC 0 -#define FF_CODER_TYPE_AC 1 -#define FF_CODER_TYPE_RAW 2 -#define FF_CODER_TYPE_RLE 3 - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int coder_type; -#endif /* FF_API_CODER_TYPE */ - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int context_model; -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_factor; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_exp; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_cmp; -#endif /* FF_API_PRIVATE_OPT */ - /** * trellis RD quantization * - encoding: Set by user. @@ -1486,69 +1228,6 @@ typedef struct AVCodecContext { */ int trellis; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int min_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int max_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int64_t timecode_frame_start; -#endif - -#if FF_API_RTP_CALLBACK - /** - * @deprecated unused - */ - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send. */ - /* It depends on the encoder if the data starts */ - /* with a Start Code (it should). H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload. */ - attribute_deprecated - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do its best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263. */ - /* This doesn't take account of any particular */ - /* headers inside the transmitted RTP payload. */ -#endif - -#if FF_API_STAT_BITS - /* statistics, used for 2-pass encoding */ - attribute_deprecated - int mv_bits; - attribute_deprecated - int header_bits; - attribute_deprecated - int i_tex_bits; - attribute_deprecated - int p_tex_bits; - attribute_deprecated - int i_count; - attribute_deprecated - int p_count; - attribute_deprecated - int skip_count; - attribute_deprecated - int misc_bits; - - /** @deprecated this field is unused */ - attribute_deprecated - int frame_bits; -#endif - /** * pass1 encoding statistics output buffer * - encoding: Set by libavcodec. @@ -1684,8 +1363,7 @@ typedef struct AVCodecContext { * For some hardware accelerators, a global context needs to be * provided by the user. In that case, this holds display-dependent * data FFmpeg cannot instantiate itself. Please refer to the - * FFmpeg HW accelerator documentation to know how to fill this - * is. e.g. for VA API, this is a struct vaapi_context. + * FFmpeg HW accelerator documentation to know how to fill this. * - encoding: unused * - decoding: Set by user */ @@ -1753,17 +1431,6 @@ typedef struct AVCodecContext { */ int lowres; -#if FF_API_CODED_FRAME - /** - * the picture in the bitstream - * - encoding: Set by libavcodec. - * - decoding: unused - * - * @deprecated use the quality factor packet side data instead - */ - attribute_deprecated AVFrame *coded_frame; -#endif - /** * thread count * is used to decide how many independent tasks should be passed to execute() @@ -2016,34 +1683,6 @@ typedef struct AVCodecContext { uint8_t *subtitle_header; int subtitle_header_size; -#if FF_API_VBV_DELAY - /** - * VBV delay coded in the last frame (in periods of a 27 MHz clock). - * Used for compliant TS muxing. - * - encoding: Set by libavcodec. - * - decoding: unused. - * @deprecated this value is now exported as a part of - * AV_PKT_DATA_CPB_PROPERTIES packet side data - */ - attribute_deprecated - uint64_t vbv_delay; -#endif - -#if FF_API_SIDEDATA_ONLY_PKT - /** - * Encoding only and set by default. Allow encoders to output packets - * that do not contain any encoded data, only side data. - * - * Some encoders need to output such packets, e.g. to update some stream - * parameters at the end of encoding. - * - * @deprecated this field disables the default behaviour and - * it is kept only for compatibility. - */ - attribute_deprecated - int side_data_only_packets; -#endif - /** * Audio only. The number of "priming" samples (padding) inserted by the * encoder at the beginning of the audio. I.e. this number of leading @@ -2183,6 +1822,7 @@ typedef struct AVCodecContext { unsigned properties; #define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004 /** * Additional data associated with the entire coded stream. @@ -2217,15 +1857,13 @@ typedef struct AVCodecContext { */ AVBufferRef *hw_frames_ctx; +#if FF_API_SUB_TEXT_FORMAT /** - * Control the form of AVSubtitle.rects[N]->ass - * - decoding: set by user - * - encoding: unused + * @deprecated unused */ + attribute_deprecated int sub_text_format; #define FF_SUB_TEXT_FMT_ASS 0 -#if FF_API_ASS_TIMING -#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 #endif /** @@ -2355,6 +1993,10 @@ typedef struct AVCodecContext { * This callback must use the above value to calculate the required buffer size, * which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes. * + * In some specific cases, the encoder may not use the entire buffer allocated by this + * callback. This will be reflected in the size value in the packet once returned by + * avcodec_receive_packet(). + * * This callback must fill the following fields in the packet: * - data: alignment requirements for AVPacket apply, if any. Some architectures and * encoders may benefit from having aligned data. @@ -2384,47 +2026,6 @@ typedef struct AVCodecContext { int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags); } AVCodecContext; -#if FF_API_CODEC_GET_SET -/** - * Accessors for some AVCodecContext fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); - -attribute_deprecated -const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); - -attribute_deprecated -unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); - -attribute_deprecated -int av_codec_get_lowres(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_lowres(AVCodecContext *avctx, int val); - -attribute_deprecated -int av_codec_get_seek_preroll(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); - -attribute_deprecated -uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); -#endif - -struct AVSubtitle; - -#if FF_API_CODEC_GET_SET -attribute_deprecated -int av_codec_get_max_lowres(const AVCodec *codec); -#endif - struct MpegEncContext; /** @@ -2637,33 +2238,6 @@ typedef struct AVHWAccel { * @} */ -#if FF_API_AVPICTURE -/** - * @defgroup lavc_picture AVPicture - * - * Functions for working with AVPicture - * @{ - */ - -/** - * Picture data structure. - * - * Up to four components can be stored into it, the last component is - * alpha. - * @deprecated use AVFrame or imgutils functions instead - */ -typedef struct AVPicture { - attribute_deprecated - uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes - attribute_deprecated - int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line -} AVPicture; - -/** - * @} - */ -#endif - enum AVSubtitleType { SUBTITLE_NONE, @@ -2691,13 +2265,6 @@ typedef struct AVSubtitleRect { int h; ///< height of pict, undefined when pict is not set int nb_colors; ///< number of colors in pict, undefined when pict is not set -#if FF_API_AVPICTURE - /** - * @deprecated unused - */ - attribute_deprecated - AVPicture pict; -#endif /** * data+linesize for the bitmap of this subtitle. * Can be set for text/ass as well once they are rendered. @@ -2728,16 +2295,6 @@ typedef struct AVSubtitle { int64_t pts; ///< Same as packet pts, in AV_TIME_BASE } AVSubtitle; -#if FF_API_NEXT -/** - * If c is NULL, returns the first registered codec, - * if c is non-NULL, returns the next registered codec after c, - * or NULL if c is the last one. - */ -attribute_deprecated -AVCodec *av_codec_next(const AVCodec *c); -#endif - /** * Return the LIBAVCODEC_VERSION_INT constant. */ @@ -2753,20 +2310,6 @@ const char *avcodec_configuration(void); */ const char *avcodec_license(void); -#if FF_API_NEXT -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register(AVCodec *codec); - -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register_all(void); -#endif - /** * Allocate an AVCodecContext and set its fields to default values. The * resulting struct should be freed with avcodec_free_context(). @@ -2788,15 +2331,6 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); */ void avcodec_free_context(AVCodecContext **avctx); -#if FF_API_GET_CONTEXT_DEFAULTS -/** - * @deprecated This function should not be used, as closing and opening a codec - * context multiple time is not supported. A new codec context should be - * allocated for each new use. - */ -int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); -#endif - /** * Get the AVClass for AVCodecContext. It can be used in combination with * AV_OPT_SEARCH_FAKE_OBJ for examining options. @@ -2821,28 +2355,6 @@ const AVClass *avcodec_get_frame_class(void); */ const AVClass *avcodec_get_subtitle_rect_class(void); -#if FF_API_COPY_CONTEXT -/** - * Copy the settings of the source AVCodecContext into the destination - * AVCodecContext. The resulting destination codec context will be - * unopened, i.e. you are required to call avcodec_open2() before you - * can use this AVCodecContext to decode/encode video/audio data. - * - * @param dest target codec context, should be initialized with - * avcodec_alloc_context3(NULL), but otherwise uninitialized - * @param src source codec context - * @return AVERROR() on error (e.g. memory allocation error), 0 on success - * - * @deprecated The semantics of this function are ill-defined and it should not - * be used. If you need to transfer the stream parameters from one codec context - * to another, use an intermediate AVCodecParameters instance and the - * avcodec_parameters_from_context() / avcodec_parameters_to_context() - * functions. - */ -attribute_deprecated -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#endif - /** * Fill the parameters struct based on the values from the supplied codec * context. Any allocated fields in par are freed and replaced with duplicates @@ -2989,115 +2501,6 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); */ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); -#if FF_API_OLD_ENCDEC -/** - * Decode the audio frame of size avpkt->size from avpkt->data into frame. - * - * Some decoders may support multiple frames in a single AVPacket. Such - * decoders would then just decode the first frame and the return value would be - * less than the packet size. In this case, avcodec_decode_audio4 has to be - * called again with an AVPacket containing the remaining data in order to - * decode the second frame, etc... Even if no frames are returned, the packet - * needs to be fed to the decoder with remaining data until it is completely - * consumed or an error occurs. - * - * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input - * and output. This means that for some packets they will not immediately - * produce decoded output and need to be flushed at the end of decoding to get - * all the decoded data. Flushing is done by calling this function with packets - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops - * returning samples. It is safe to flush even those decoders that are not - * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. - * - * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE - * larger than the actual read bytes because some optimized bitstream - * readers read 32 or 64 bits at once and could read over the end. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] frame The AVFrame in which to store decoded audio samples. - * The decoder will allocate a buffer for the decoded frame by - * calling the AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is - * non-zero. Note that this field being set to zero - * does not mean that an error has occurred. For - * decoders with AV_CODEC_CAP_DELAY set, no given decode - * call is guaranteed to produce a frame. - * @param[in] avpkt The input AVPacket containing the input buffer. - * At least avpkt->data and avpkt->size should be set. Some - * decoders might also require additional fields to be set. - * @return A negative error code is returned if an error occurred during - * decoding, otherwise the number of bytes consumed from the input - * AVPacket is returned. - * -* @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, - int *got_frame_ptr, const AVPacket *avpkt); - -/** - * Decode the video frame of size avpkt->size from avpkt->data into picture. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * - * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * Use av_frame_alloc() to get an AVFrame. The codec will - * allocate memory for the actual bitmap by calling the - * AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields like - * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least - * fields possible. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - * - * @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const AVPacket *avpkt); -#endif - /** * Decode a subtitle message. * Return a negative value on error, otherwise return the number of bytes used. @@ -3141,10 +2544,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * - * @warning Do not mix this API with the legacy API (like avcodec_decode_video2()) - * on the same AVCodecContext. It will return unexpected results now - * or in future libavcodec versions. - * * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() * before packets may be fed to the decoder. * @@ -3234,8 +2633,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); * the call will not fail with EAGAIN). * AVERROR_EOF: the encoder has been flushed, and no new frames can * be sent to it - * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a - * decoder, or requires flush + * AVERROR(EINVAL): codec not opened, it is a decoder, or requires flush * AVERROR(ENOMEM): failed to add packet to internal queue, or similar * other errors: legitimate encoding errors */ @@ -3376,7 +2774,7 @@ enum AVPictureStructure { typedef struct AVCodecParserContext { void *priv_data; - struct AVCodecParser *parser; + const struct AVCodecParser *parser; int64_t frame_offset; /* offset of the current frame */ int64_t cur_offset; /* current offset (incremented by each av_parser_parse()) */ @@ -3425,14 +2823,6 @@ typedef struct AVCodecParserContext { */ int key_frame; -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated unused - */ - attribute_deprecated - int64_t convergence_duration; -#endif - // Timestamp generation support: /** * Synchronization point for start of timestamp generation. @@ -3542,7 +2932,7 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ + int codec_ids[7]; /* several codec IDs are permitted */ int priv_data_size; int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that @@ -3553,10 +2943,6 @@ typedef struct AVCodecParser { const uint8_t *buf, int buf_size); void (*parser_close)(AVCodecParserContext *s); int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); -#if FF_API_NEXT - attribute_deprecated - struct AVCodecParser *next; -#endif } AVCodecParser; /** @@ -3570,13 +2956,6 @@ typedef struct AVCodecParser { */ const AVCodecParser *av_parser_iterate(void **opaque); -#if FF_API_NEXT -attribute_deprecated -AVCodecParser *av_parser_next(const AVCodecParser *c); - -attribute_deprecated -void av_register_codec_parser(AVCodecParser *parser); -#endif AVCodecParserContext *av_parser_init(int codec_id); /** @@ -3617,18 +2996,6 @@ int av_parser_parse2(AVCodecParserContext *s, int64_t pts, int64_t dts, int64_t pos); -#if FF_API_PARSER_CHANGE -/** - * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed - * @deprecated Use dump_extradata, remove_extra or extract_extradata - * bitstream filters instead. - */ -attribute_deprecated -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -#endif void av_parser_close(AVCodecParserContext *s); /** @@ -3641,95 +3008,6 @@ void av_parser_close(AVCodecParserContext *s); * @{ */ -#if FF_API_OLD_ENCDEC -/** - * Encode a frame of audio. - * - * Takes input samples from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay, split, and combine input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. If avpkt->data and - * avpkt->size are set, avpkt->destruct must also be set. All - * other AVPacket fields will be reset by the encoder using - * av_init_packet(). If avpkt->data is NULL, the encoder will - * allocate it. The encoder will set avpkt->size to the size - * of the output packet. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw audio data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame - * can have any number of samples. - * If it is not set, frame->nb_samples must be equal to - * avctx->frame_size for all frames except the last. - * The final frame may be smaller than avctx->frame_size. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); - -/** - * Encode a frame of video. - * - * Takes input raw video data from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay and reorder input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. All other AVPacket fields - * will be reset by the encoder using av_init_packet(). If - * avpkt->data is NULL, the encoder will allocate it. - * The encoder will set avpkt->size to the size of the - * output packet. The returned data (if any) belongs to the - * caller, he is responsible for freeing it. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw video data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); -#endif - int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub); @@ -3738,71 +3016,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ -#if FF_API_AVPICTURE -/** - * @addtogroup lavc_picture - * @{ - */ - -/** - * @deprecated unused - */ -attribute_deprecated -int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -void avpicture_free(AVPicture *picture); - -/** - * @deprecated use av_image_fill_arrays() instead. - */ -attribute_deprecated -int avpicture_fill(AVPicture *picture, const uint8_t *ptr, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated use av_image_copy_to_buffer() instead. - */ -attribute_deprecated -int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, - int width, int height, - unsigned char *dest, int dest_size); - -/** - * @deprecated use av_image_get_buffer_size() instead. - */ -attribute_deprecated -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated av_image_copy() instead. - */ -attribute_deprecated -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int top_band, int left_band); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -/** - * @} - */ -#endif - /** * @defgroup lavc_misc Utility functions * @ingroup libavc @@ -3819,15 +3032,6 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -#if FF_API_GETCHROMA -/** - * @deprecated Use av_pix_fmt_get_chroma_sub_sample - */ - -attribute_deprecated -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); -#endif - /** * Return a value representing the fourCC code associated to the * pixel format pix_fmt, or 0 if no associated fourCC code can be @@ -3856,71 +3060,14 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#if FF_API_AVCODEC_PIX_FMT -/** - * @deprecated see av_get_pix_fmt_loss() - */ -attribute_deprecated -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, - int has_alpha); -/** - * @deprecated see av_find_best_pix_fmt_of_2() - */ -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#endif - enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); /** * @} */ -#if FF_API_TAG_STRING -/** - * Put a string representing the codec tag codec_tag in buf. - * - * @param buf buffer to place codec tag in - * @param buf_size size in bytes of buf - * @param codec_tag codec tag to assign - * @return the length of the string that would have been generated if - * enough space had been available, excluding the trailing null - * - * @deprecated see av_fourcc_make_string() and av_fourcc2str(). - */ -attribute_deprecated -size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); -#endif - void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); -/** - * Return a name for the specified profile, if available. - * - * @param codec the codec that is searched for the given profile - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - */ -const char *av_get_profile_name(const AVCodec *codec, int profile); - -/** - * Return a name for the specified profile, if available. - * - * @param codec_id the ID of the codec to which the requested profile belongs - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - * - * @note unlike av_get_profile_name(), which searches a list of profiles - * supported by a specific decoder or encoder implementation, this - * function searches the list of profiles from the AVCodecDescriptor - */ -const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); - int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -3956,11 +3103,8 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, * Reset the internal codec state / flush internal buffers. Should be called * e.g. when seeking or when switching to a different stream. * - * @note for decoders, when refcounted frames are not used - * (i.e. avctx->refcounted_frames is 0), this invalidates the frames previously - * returned from the decoder. When refcounted frames are used, the decoder just - * releases any references it might keep internally, but the caller's reference - * remains valid. + * @note for decoders, this function just releases any references the decoder + * might keep internally, but the caller's references remain valid. * * @note for encoders, this function will only do something if the encoder * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder @@ -3971,32 +3115,6 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, */ void avcodec_flush_buffers(AVCodecContext *avctx); -/** - * Return codec bits per sample. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum AVCodecID codec_id); - -/** - * Return the PCM codec associated with a sample format. - * @param be endianness, 0 for little, 1 for big, - * -1 (or anything else) for native - * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE - */ -enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); - -/** - * Return codec bits per sample. - * Only return non-zero if the bits per sample is exactly correct, not an - * approximation. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_exact_bits_per_sample(enum AVCodecID codec_id); - /** * Return audio frame duration. * @@ -4007,69 +3125,6 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id); */ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); -/** - * This function is the same as av_get_audio_frame_duration(), except it works - * with AVCodecParameters instead of an AVCodecContext. - */ -int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); - -#if FF_API_OLD_BSF -typedef struct AVBitStreamFilterContext { - void *priv_data; - const struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; - /** - * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). - * Not for access by library users. - */ - char *args; -} AVBitStreamFilterContext; - -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -void av_register_bitstream_filter(AVBitStreamFilter *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init() - * from the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the - * new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); -#endif - -#if FF_API_NEXT -attribute_deprecated -const AVBitStreamFilter *av_bsf_next(void **opaque); -#endif - /* memory */ /** @@ -4087,96 +3142,12 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); */ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); -/** - * Encode extradata length to a buffer. Used by xiph codecs. - * - * @param s buffer to write to; must be at least (v/255+1) bytes long - * @param v size of extradata in bytes - * @return number of bytes written to the buffer. - */ -unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -#if FF_API_USER_VISIBLE_AVHWACCEL -/** - * Register the hardware accelerator hwaccel. - * - * @deprecated This function doesn't do anything. - */ -attribute_deprecated -void av_register_hwaccel(AVHWAccel *hwaccel); - -/** - * If hwaccel is NULL, returns the first registered hardware accelerator, - * if hwaccel is non-NULL, returns the next registered hardware accelerator - * after hwaccel, or NULL if hwaccel is the last one. - * - * @deprecated AVHWaccel structures contain no user-serviceable parts, so - * this function should not be used. - */ -attribute_deprecated -AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); -#endif - -#if FF_API_LOCKMGR -/** - * Lock operation used by lockmgr - * - * @deprecated Deprecated together with av_lockmgr_register(). - */ -enum AVLockOp { - AV_LOCK_CREATE, ///< Create a mutex - AV_LOCK_OBTAIN, ///< Lock the mutex - AV_LOCK_RELEASE, ///< Unlock the mutex - AV_LOCK_DESTROY, ///< Free mutex resources -}; - -/** - * Register a user provided lock manager supporting the operations - * specified by AVLockOp. The "mutex" argument to the function points - * to a (void *) where the lockmgr should store/get a pointer to a user - * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the - * value left by the last call for all other ops. If the lock manager is - * unable to perform the op then it should leave the mutex in the same - * state as when it was called and return a non-zero value. However, - * when called with AV_LOCK_DESTROY the mutex will always be assumed to - * have been successfully destroyed. If av_lockmgr_register succeeds - * it will return a non-negative value, if it fails it will return a - * negative value and destroy all mutex and unregister all callbacks. - * av_lockmgr_register is not thread-safe, it must be called from a - * single thread before any calls which make use of locking are used. - * - * @param cb User defined callback. av_lockmgr_register invokes calls - * to this callback and the previously registered callback. - * The callback will be used to create more than one mutex - * each of which must be backed by its own underlying locking - * mechanism (i.e. do not use a single static object to - * implement your lock manager). If cb is set to NULL the - * lockmgr will be unregistered. - * - * @deprecated This function does nothing, and always returns 0. Be sure to - * build with thread support to get basic thread safety. - */ -attribute_deprecated -int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); -#endif - /** * @return a positive value if s is open (i.e. avcodec_open2() was called on it * with no corresponding avcodec_close()), 0 otherwise. */ int avcodec_is_open(AVCodecContext *s); -/** - * Allocate a CPB properties structure and initialize its fields to default - * values. - * - * @param size if non-NULL, the size of the allocated struct will be written - * here. This is useful for embedding it in side data. - * - * @return the newly allocated struct or NULL on failure - */ -AVCPBProperties *av_cpb_properties_alloc(size_t *size); - /** * @} */ diff --git a/mac/include/libavcodec/bsf.h b/mac/include/libavcodec/bsf.h index 3b5faa8..8c5355d 100644 --- a/mac/include/libavcodec/bsf.h +++ b/mac/include/libavcodec/bsf.h @@ -34,8 +34,6 @@ * @{ */ -typedef struct AVBSFInternal AVBSFInternal; - /** * The bitstream filter state. * @@ -57,12 +55,6 @@ typedef struct AVBSFContext { */ const struct AVBitStreamFilter *filter; - /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - /** * Opaque filter-specific private data. If filter->priv_class is non-NULL, * this is an AVOptions-enabled struct. diff --git a/mac/include/libavcodec/codec.h b/mac/include/libavcodec/codec.h index 50a22f6..a8147ec 100644 --- a/mac/include/libavcodec/codec.h +++ b/mac/include/libavcodec/codec.h @@ -50,7 +50,12 @@ * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. */ #define AV_CODEC_CAP_DR1 (1 << 1) +#if FF_API_FLAG_TRUNCATED +/** + * @deprecated Use parsers to always send proper frames. + */ #define AV_CODEC_CAP_TRUNCATED (1 << 3) +#endif /** * Encoder or decoder requires flushing with NULL input at the end in order to * give the complete and correct output. @@ -214,12 +219,12 @@ typedef struct AVCodec { * see AV_CODEC_CAP_* */ int capabilities; + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder 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} @@ -242,10 +247,13 @@ typedef struct AVCodec { * New public fields should be added right above. ***************************************************************** */ + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; + int priv_data_size; -#if FF_API_NEXT - struct AVCodec *next; -#endif /** * @name Frame-level threading support functions * @{ @@ -258,6 +266,11 @@ typedef struct AVCodec { * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. */ int (*update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src); + + /** + * Copy variables back to the user-facing context + */ + int (*update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src); /** @} */ /** @@ -321,11 +334,6 @@ typedef struct AVCodec { * Will be called when seeking */ void (*flush)(struct AVCodecContext *); - /** - * Internal codec capabilities. - * See FF_CODEC_CAP_* in internal.h - */ - int caps_internal; /** * Decoding only, a comma-separated list of bitstream filters to apply to @@ -365,7 +373,7 @@ const AVCodec *av_codec_iterate(void **opaque); * @param id AVCodecID of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder(enum AVCodecID id); +const AVCodec *avcodec_find_decoder(enum AVCodecID id); /** * Find a registered decoder with the specified name. @@ -373,7 +381,7 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); * @param name name of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder_by_name(const char *name); +const AVCodec *avcodec_find_decoder_by_name(const char *name); /** * Find a registered encoder with a matching codec ID. @@ -381,7 +389,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); * @param id AVCodecID of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder(enum AVCodecID id); +const AVCodec *avcodec_find_encoder(enum AVCodecID id); /** * Find a registered encoder with the specified name. @@ -389,7 +397,7 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id); * @param name name of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder_by_name(const char *name); +const AVCodec *avcodec_find_encoder_by_name(const char *name); /** * @return a non-zero number if codec is an encoder, zero otherwise */ @@ -400,6 +408,15 @@ int av_codec_is_encoder(const AVCodec *codec); */ int av_codec_is_decoder(const AVCodec *codec); +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + enum { /** * The codec supports this format via the hw_device_ctx interface. diff --git a/mac/include/libavcodec/codec_id.h b/mac/include/libavcodec/codec_id.h index ab7bc68..ab265ec 100644 --- a/mac/include/libavcodec/codec_id.h +++ b/mac/include/libavcodec/codec_id.h @@ -22,6 +22,7 @@ #define AVCODEC_CODEC_ID_H #include "libavutil/avutil.h" +#include "libavutil/samplefmt.h" /** * @addtogroup lavc_core @@ -246,8 +247,7 @@ enum AVCodecID { AV_CODEC_ID_MSP2, AV_CODEC_ID_VVC, #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC - - AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_Y41P, AV_CODEC_ID_AVRP, AV_CODEC_ID_012V, AV_CODEC_ID_AVUI, @@ -307,6 +307,7 @@ enum AVCodecID { AV_CODEC_ID_CRI, AV_CODEC_ID_SIMBIOSIS_IMX, AV_CODEC_ID_SGA_VIDEO, + AV_CODEC_ID_GEM, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -341,8 +342,7 @@ enum AVCodecID { AV_CODEC_ID_PCM_S24LE_PLANAR, AV_CODEC_ID_PCM_S32LE_PLANAR, AV_CODEC_ID_PCM_S16BE_PLANAR, - - AV_CODEC_ID_PCM_S64LE = 0x10800, + AV_CODEC_ID_PCM_S64LE, AV_CODEC_ID_PCM_S64BE, AV_CODEC_ID_PCM_F16LE, AV_CODEC_ID_PCM_F24LE, @@ -381,8 +381,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, AV_CODEC_ID_ADPCM_VIMA, - - AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_AFC, AV_CODEC_ID_ADPCM_IMA_OKI, AV_CODEC_ID_ADPCM_DTK, AV_CODEC_ID_ADPCM_IMA_RAD, @@ -401,6 +400,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_IMA_MTF, AV_CODEC_ID_ADPCM_IMA_CUNNING, AV_CODEC_ID_ADPCM_IMA_MOFLEX, + AV_CODEC_ID_ADPCM_IMA_ACORN, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -415,8 +415,7 @@ enum AVCodecID { AV_CODEC_ID_INTERPLAY_DPCM, AV_CODEC_ID_XAN_DPCM, AV_CODEC_ID_SOL_DPCM, - - AV_CODEC_ID_SDX2_DPCM = 0x14800, + AV_CODEC_ID_SDX2_DPCM, AV_CODEC_ID_GREMLIN_DPCM, AV_CODEC_ID_DERF_DPCM, @@ -489,8 +488,7 @@ enum AVCodecID { AV_CODEC_ID_ON2AVC, AV_CODEC_ID_DSS_SP, AV_CODEC_ID_CODEC2, - - AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_FFWAVESYNTH, AV_CODEC_ID_SONIC, AV_CODEC_ID_SONIC_LS, AV_CODEC_ID_EVRC, @@ -517,6 +515,7 @@ enum AVCodecID { AV_CODEC_ID_SIREN, AV_CODEC_ID_HCA, AV_CODEC_ID_FASTAUDIO, + AV_CODEC_ID_MSNSIREN, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -529,8 +528,7 @@ enum AVCodecID { AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT, AV_CODEC_ID_SRT, - - AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_MICRODVD, AV_CODEC_ID_EIA_608, AV_CODEC_ID_JACOSUB, AV_CODEC_ID_SAMI, @@ -554,7 +552,7 @@ enum AVCodecID { AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. AV_CODEC_ID_EPG, - AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_BINTEXT, AV_CODEC_ID_XBIN, AV_CODEC_ID_IDF, AV_CODEC_ID_OTF, @@ -585,6 +583,45 @@ enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); */ const char *avcodec_get_name(enum AVCodecID id); +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + /** * @} */ diff --git a/mac/include/libavcodec/codec_par.h b/mac/include/libavcodec/codec_par.h index 948758e..10cf79d 100644 --- a/mac/include/libavcodec/codec_par.h +++ b/mac/include/libavcodec/codec_par.h @@ -221,6 +221,11 @@ void avcodec_parameters_free(AVCodecParameters **par); */ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); +/** + * This function is the same as av_get_audio_frame_duration(), except it works + * with AVCodecParameters instead of an AVCodecContext. + */ +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); /** * @} diff --git a/mac/include/libavcodec/defs.h b/mac/include/libavcodec/defs.h new file mode 100644 index 0000000..420a042 --- /dev/null +++ b/mac/include/libavcodec/defs.h @@ -0,0 +1,170 @@ +/* + * + * 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_DEFS_H +#define AVCODEC_DEFS_H + +/** + * @file + * @ingroup libavc + * Misc types and constants that do not belong anywhere else. + */ + +#include +#include + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define AV_INPUT_BUFFER_PADDING_SIZE 64 + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int64_t buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** + * This structure supplies correlation between a packet timestamp and a wall clock + * production time. The definition follows the Producer Reference Time ('prft') + * as defined in ISO/IEC 14496-12 + */ +typedef struct AVProducerReferenceTime { + /** + * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). + */ + int64_t wallclock; + int flags; +} AVProducerReferenceTime; + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#endif // AVCODEC_DEFS_H diff --git a/mac/include/libavcodec/dv_profile.h b/mac/include/libavcodec/dv_profile.h index 9380a66..4365f1b 100644 --- a/mac/include/libavcodec/dv_profile.h +++ b/mac/include/libavcodec/dv_profile.h @@ -23,7 +23,6 @@ #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "avcodec.h" /* minimum number of bytes to read from a DV stream in order to * determine the profile */ diff --git a/mac/include/libavcodec/packet.h b/mac/include/libavcodec/packet.h index ca18ae6..4a349fe 100644 --- a/mac/include/libavcodec/packet.h +++ b/mac/include/libavcodec/packet.h @@ -290,6 +290,14 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_S12M_TIMECODE, + /** + * HDR10+ dynamic metadata associated with a video frame. The metadata is in + * the form of the AVDynamicHDRPlus struct and contains + * information for color volume transform - application 4 of + * SMPTE 2094-40:2016 standard. + */ + AV_PKT_DATA_DYNAMIC_HDR10_PLUS, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may @@ -305,11 +313,7 @@ enum AVPacketSideDataType { typedef struct AVPacketSideData { uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif enum AVPacketSideDataType type; } AVPacketSideData; @@ -388,15 +392,29 @@ typedef struct AVPacket { int64_t pos; ///< byte position in stream, -1 if unknown -#if FF_API_CONVERGENCE_DURATION /** - * @deprecated Same as the duration field, but as int64_t. This was required - * for Matroska subtitles, whose duration values could overflow when the - * duration field was still an int. + * for some private data of the user */ - attribute_deprecated - int64_t convergence_duration; -#endif + void *opaque; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the packet is unreferenced. av_packet_copy_props() calls create a new + * reference with av_buffer_ref() for the target packet's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * Time base of the packet's timestamps. + * In the future, this field may be set on packets output by encoders or + * demuxers, but its value will be by default ignored on input to decoders + * or muxers. + */ + AVRational time_base; } AVPacket; #if FF_API_INIT_PACKET @@ -529,45 +547,6 @@ int av_grow_packet(AVPacket *pkt, int grow_by); */ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); -#if FF_API_AVPACKET_OLD_API -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated. - * - * @deprecated Use av_packet_ref or av_packet_make_refcounted - */ -attribute_deprecated -int av_dup_packet(AVPacket *pkt); -/** - * Copy packet, including contents - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_ref - */ -attribute_deprecated -int av_copy_packet(AVPacket *dst, const AVPacket *src); - -/** - * Copy packet side data - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_copy_props - */ -attribute_deprecated -int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); - -/** - * Free a packet. - * - * @deprecated Use av_packet_unref - * - * @param pkt packet to free - */ -attribute_deprecated -void av_free_packet(AVPacket *pkt); -#endif /** * Allocate new information of a packet. * @@ -577,11 +556,7 @@ void av_free_packet(AVPacket *pkt); * @return pointer to fresh allocated data or NULL otherwise */ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Wrap an existing array as a packet side data. @@ -608,11 +583,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return 0 on success, < 0 on failure */ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Get side information from packet. @@ -624,19 +595,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return pointer to data if present or NULL otherwise */ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int *size); -#else size_t *size); -#endif - -#if FF_API_MERGE_SD_API -attribute_deprecated -int av_packet_merge_side_data(AVPacket *pkt); - -attribute_deprecated -int av_packet_split_side_data(AVPacket *pkt); -#endif const char *av_packet_side_data_name(enum AVPacketSideDataType type); @@ -647,11 +606,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type); * @param size pointer to store the size of the returned data * @return pointer to data if successful, NULL otherwise */ -#if FF_API_BUFFER_SIZE_T -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); -#else uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); -#endif /** * Unpack a dictionary from side_data. * @@ -660,12 +615,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); * @param dict the metadata storage dictionary * @return 0 on success, < 0 on failure */ -#if FF_API_BUFFER_SIZE_T -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); -#else int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict); -#endif /** * Convenience function to free all the side data stored. diff --git a/mac/include/libavcodec/vaapi.h b/mac/include/libavcodec/vaapi.h deleted file mode 100644 index 2cf7da5..0000000 --- a/mac/include/libavcodec/vaapi.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Video Acceleration API (shared data between FFmpeg and the video player) - * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 - * - * Copyright (C) 2008-2009 Splitted-Desktop Systems - * - * 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_VAAPI_H -#define AVCODEC_VAAPI_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vaapi - * Public libavcodec VA API header. - */ - -#include -#include "libavutil/attributes.h" -#include "version.h" - -#if FF_API_STRUCT_VAAPI_CONTEXT - -/** - * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding - * @ingroup lavc_codec_hwaccel - * @{ - */ - -/** - * This structure is used to share data between the FFmpeg library and - * the client video application. - * This shall be zero-allocated and available as - * AVCodecContext.hwaccel_context. All user members can be set once - * during initialization or through each AVCodecContext.get_buffer() - * function call. In any case, they must be valid prior to calling - * decoding functions. - * - * Deprecated: use AVCodecContext.hw_frames_ctx instead. - */ -struct attribute_deprecated vaapi_context { - /** - * Window system dependent data - * - * - encoding: unused - * - decoding: Set by user - */ - void *display; - - /** - * Configuration ID - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t config_id; - - /** - * Context ID (video decode pipeline) - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t context_id; -}; - -/* @} */ - -#endif /* FF_API_STRUCT_VAAPI_CONTEXT */ - -#endif /* AVCODEC_VAAPI_H */ diff --git a/mac/include/libavcodec/vdpau.h b/mac/include/libavcodec/vdpau.h index 4d99943..3010094 100644 --- a/mac/include/libavcodec/vdpau.h +++ b/mac/include/libavcodec/vdpau.h @@ -55,7 +55,6 @@ #include "libavutil/attributes.h" #include "avcodec.h" -#include "version.h" struct AVCodecContext; struct AVFrame; @@ -153,24 +152,6 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, */ AVVDPAUContext *av_vdpau_alloc_context(void); -#if FF_API_VDPAU_PROFILE -/** - * Get a decoder profile that should be used for initializing a VDPAU decoder. - * Should be called from the AVCodecContext.get_format() callback. - * - * @deprecated Use av_vdpau_bind_context() instead. - * - * @param avctx the codec context being used for decoding the stream - * @param profile a pointer into which the result will be written on success. - * The contents of profile are undefined if this function returns - * an error. - * - * @return 0 on success (non-negative), a negative AVERROR on failure. - */ -attribute_deprecated -int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); -#endif - /* @}*/ #endif /* AVCODEC_VDPAU_H */ diff --git a/mac/include/libavcodec/version.h b/mac/include/libavcodec/version.h index cfdde46..4d77431 100644 --- a/mac/include/libavcodec/version.h +++ b/mac/include/libavcodec/version.h @@ -27,8 +27,8 @@ #include "libavutil/version.h" -#define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 134 +#define LIBAVCODEC_VERSION_MAJOR 59 +#define LIBAVCODEC_VERSION_MINOR 18 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -51,122 +51,17 @@ * at once through the bump. This improves the git bisect-ability of the change. */ -#ifndef FF_API_AVCTX_TIMEBASE -#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODED_FRAME -#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_SIDEDATA_ONLY_PKT -#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VDPAU_PROFILE -#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CONVERGENCE_DURATION -#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPICTURE -#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPACKET_OLD_API -#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_RTP_CALLBACK -#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VBV_DELAY -#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODER_TYPE -#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STAT_BITS -#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PRIVATE_OPT -#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_ASS_TIMING -#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_BSF -#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_COPY_CONTEXT -#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GET_CONTEXT_DEFAULTS -#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NVENC_OLD_NAME -#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STRUCT_VAAPI_CONTEXT -#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MERGE_SD_API -#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_TAG_STRING -#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GETCHROMA -#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODEC_GET_SET -#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_USER_VISIBLE_AVHWACCEL -#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_LOCKMGR -#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NEXT -#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNSANITIZED_BITRATES -#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_SLICE_MODE -#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_CABAC -#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNUSED_CODEC_CAPS -#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPRIV_PUT_BITS -#define FF_API_AVPRIV_PUT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_ENCDEC -#define FF_API_OLD_ENCDEC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVCODEC_PIX_FMT -#define FF_API_AVCODEC_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MPV_RC_STRATEGY -#define FF_API_MPV_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PARSER_CHANGE -#define FF_API_PARSER_CHANGE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_THREAD_SAFE_CALLBACKS +#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_GET_FRAME_CLASS #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_AUTO_THREADS #define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_INIT_PACKET #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) -#endif +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_MPEGVIDEO_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_H */ diff --git a/mac/include/libavutil/adler32.h b/mac/include/libavutil/adler32.h index e7a8f83..232d07f 100644 --- a/mac/include/libavutil/adler32.h +++ b/mac/include/libavutil/adler32.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_adler32 Adler-32 @@ -40,11 +39,7 @@ * @{ */ -#if FF_API_CRYPTO_SIZE_T -typedef unsigned long AVAdler; -#else typedef uint32_t AVAdler; -#endif /** * Calculate the Adler32 checksum of a buffer. @@ -59,11 +54,7 @@ typedef uint32_t AVAdler; * @return updated checksum */ AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, -#if FF_API_CRYPTO_SIZE_T - unsigned int len) av_pure; -#else size_t len) av_pure; -#endif /** * @} diff --git a/mac/include/libavutil/aes.h b/mac/include/libavutil/aes.h index 09efbda..d243286 100644 --- a/mac/include/libavutil/aes.h +++ b/mac/include/libavutil/aes.h @@ -24,7 +24,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_aes AES diff --git a/mac/include/libavutil/aes_ctr.h b/mac/include/libavutil/aes_ctr.h index e4aae12..4e9fda7 100644 --- a/mac/include/libavutil/aes_ctr.h +++ b/mac/include/libavutil/aes_ctr.h @@ -25,7 +25,6 @@ #include #include "attributes.h" -#include "version.h" #define AES_CTR_KEY_SIZE (16) #define AES_CTR_IV_SIZE (8) diff --git a/mac/include/libavutil/buffer.h b/mac/include/libavutil/buffer.h index 241a80e..e1ef5b7 100644 --- a/mac/include/libavutil/buffer.h +++ b/mac/include/libavutil/buffer.h @@ -28,8 +28,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_buffer AVBuffer * @ingroup lavu_data @@ -93,11 +91,7 @@ typedef struct AVBufferRef { /** * Size of data in bytes. */ -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif } AVBufferRef; /** @@ -105,21 +99,13 @@ typedef struct AVBufferRef { * * @return an AVBufferRef of given size or NULL when out of memory */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_alloc(int size); -#else AVBufferRef *av_buffer_alloc(size_t size); -#endif /** * Same as av_buffer_alloc(), except the returned buffer will be initialized * to zero. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_allocz(int size); -#else AVBufferRef *av_buffer_allocz(size_t size); -#endif /** * Always treat the buffer as read-only, even when it has only one @@ -142,11 +128,7 @@ AVBufferRef *av_buffer_allocz(size_t size); * * @return an AVBufferRef referring to data on success, NULL on failure. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_create(uint8_t *data, int size, -#else AVBufferRef *av_buffer_create(uint8_t *data, size_t size, -#endif void (*free)(void *opaque, uint8_t *data), void *opaque, int flags); @@ -163,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on * failure. */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); /** * Free a given reference and automatically free the buffer if there are no more @@ -214,11 +196,7 @@ int av_buffer_make_writable(AVBufferRef **buf); * reference to it (i.e. the one passed to this function). In all other cases * a new buffer is allocated and the data is copied. */ -#if FF_API_BUFFER_SIZE_T -int av_buffer_realloc(AVBufferRef **buf, int size); -#else int av_buffer_realloc(AVBufferRef **buf, size_t size); -#endif /** * Ensure dst refers to the same data as src. @@ -234,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); * @return 0 on success * AVERROR(ENOMEM) on memory allocation failure. */ -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); /** * @} @@ -285,11 +263,7 @@ typedef struct AVBufferPool AVBufferPool; * (av_buffer_alloc()). * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); -#else AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size)); -#endif /** * Allocate and initialize a buffer pool with a more complex allocator. @@ -306,13 +280,8 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size * data. May be NULL. * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), -#else AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, AVBufferRef* (*alloc)(void *opaque, size_t size), -#endif void (*pool_free)(void *opaque)); /** @@ -344,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); * therefore you have to use this function to access the original opaque * parameter of an allocated buffer. */ -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); /** * @} diff --git a/mac/include/libavutil/common.h b/mac/include/libavutil/common.h index aee353d..3eb9bc5 100644 --- a/mac/include/libavutil/common.h +++ b/mac/include/libavutil/common.h @@ -42,13 +42,6 @@ #include "attributes.h" #include "macros.h" #include "version.h" -#include "libavutil/avconfig.h" - -#if AV_HAVE_BIGENDIAN -# define AV_NE(be, le) (be) -#else -# define AV_NE(be, le) (le) -#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -89,25 +82,6 @@ #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) -/** - * Comparator. - * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 - * if x == y. This is useful for instance in a qsort comparator callback. - * Furthermore, compilers are able to optimize this to branchless code, and - * there is no risk of overflow with signed types. - * As with many macros, this evaluates its argument multiple times, it thus - * must not have a side-effect. - */ -#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) - /* misc math functions */ #ifdef HAVE_AV_CONFIG_H @@ -405,6 +379,8 @@ static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) { /** * Clip a float value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -415,13 +391,13 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** * Clip a double value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -432,9 +408,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** Compute ceil(log2(x)). @@ -475,9 +449,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v) return av_popcount(v) & 1; } -#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) -#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) - /** * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. * diff --git a/mac/include/libavutil/cpu.h b/mac/include/libavutil/cpu.h index 83099dd..ce9bf14 100644 --- a/mac/include/libavutil/cpu.h +++ b/mac/include/libavutil/cpu.h @@ -23,8 +23,6 @@ #include -#include "attributes.h" - #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ /* lower 16 bits - CPU features */ @@ -56,6 +54,7 @@ #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers. #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 @@ -74,6 +73,10 @@ #define AV_CPU_FLAG_MMI (1 << 0) #define AV_CPU_FLAG_MSA (1 << 1) +//Loongarch SIMD extension. +#define AV_CPU_FLAG_LSX (1 << 0) +#define AV_CPU_FLAG_LASX (1 << 1) + /** * Return the flags which specify extensions supported by the CPU. * The returned value is affected by av_force_cpu_flags() if that was used @@ -88,25 +91,6 @@ int av_get_cpu_flags(void); */ void av_force_cpu_flags(int flags); -/** - * Set a mask on flags returned by av_get_cpu_flags(). - * This function is mainly useful for testing. - * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible - */ -attribute_deprecated void av_set_cpu_flags_mask(int mask); - -/** - * Parse CPU flags from a string. - * - * The returned flags contain the specified flags as well as related unspecified flags. - * - * This function exists only for compatibility with libav. - * Please use av_parse_cpu_caps() when possible. - * @return a combination of AV_CPU_* flags, negative on error. - */ -attribute_deprecated -int av_parse_cpu_flags(const char *s); - /** * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. * @@ -119,6 +103,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s); */ int av_cpu_count(void); +/** + * Overrides cpu count detection and forces the specified count. + * Count < 1 disables forcing of specific count. + */ +void av_cpu_force_count(int count); + /** * Get the maximum data alignment that may be required by FFmpeg. * diff --git a/mac/include/libavutil/crc.h b/mac/include/libavutil/crc.h index 47e22b4..24a2e3c 100644 --- a/mac/include/libavutil/crc.h +++ b/mac/include/libavutil/crc.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_crc32 CRC diff --git a/mac/include/libavutil/detection_bbox.h b/mac/include/libavutil/detection_bbox.h new file mode 100644 index 0000000..c20c204 --- /dev/null +++ b/mac/include/libavutil/detection_bbox.h @@ -0,0 +1,107 @@ +/* + * 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 AVUTIL_DETECTION_BBOX_H +#define AVUTIL_DETECTION_BBOX_H + +#include "rational.h" +#include "avassert.h" +#include "frame.h" + +typedef struct AVDetectionBBox { + /** + * Distance in pixels from the left/top edge of the frame, + * together with width and height, defining the bounding box. + */ + int x; + int y; + int w; + int h; + +#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64 + + /** + * Detect result with confidence + */ + char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational detect_confidence; + + /** + * At most 4 classifications based on the detected bounding box. + * For example, we can get max 4 different attributes with 4 different + * DNN models on one bounding box. + * classify_count is zero if no classification. + */ +#define AV_NUM_DETECTION_BBOX_CLASSIFY 4 + uint32_t classify_count; + char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY]; +} AVDetectionBBox; + +typedef struct AVDetectionBBoxHeader { + /** + * Information about how the bounding box is generated. + * for example, the DNN model name. + */ + char source[256]; + + /** + * Number of bounding boxes in the array. + */ + uint32_t nb_bboxes; + + /** + * Offset in bytes from the beginning of this structure at which + * the array of bounding boxes starts. + */ + size_t bboxes_offset; + + /** + * Size of each bounding box in bytes. + */ + size_t bbox_size; +} AVDetectionBBoxHeader; + +/* + * Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes. + */ +static av_always_inline AVDetectionBBox * +av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx) +{ + av_assert0(idx < header->nb_bboxes); + return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset + + idx * header->bbox_size); +} + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, and initializes the variables. + * Can be freed with a normal av_free() call. + * + * @param out_size if non-NULL, the size in bytes of the resulting data array is + * written here. + */ +AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size); + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type + * AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables. + */ +AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes); +#endif diff --git a/mac/include/libavutil/dict.h b/mac/include/libavutil/dict.h index 118f1f0..0d1afc6 100644 --- a/mac/include/libavutil/dict.h +++ b/mac/include/libavutil/dict.h @@ -32,8 +32,6 @@ #include -#include "version.h" - /** * @addtogroup lavu_dict AVDictionary * @ingroup lavu_data diff --git a/mac/include/libavutil/display.h b/mac/include/libavutil/display.h index 515adad..d87bf68 100644 --- a/mac/include/libavutil/display.h +++ b/mac/include/libavutil/display.h @@ -88,7 +88,7 @@ double av_display_rotation_get(const int32_t matrix[9]); /** - * Initialize a transformation matrix describing a pure counterclockwise + * Initialize a transformation matrix describing a pure clockwise * rotation by the specified angle (in degrees). * * @param matrix an allocated transformation matrix (will be fully overwritten diff --git a/mac/include/libavutil/dovi_meta.h b/mac/include/libavutil/dovi_meta.h index 299911d..3d11e02 100644 --- a/mac/include/libavutil/dovi_meta.h +++ b/mac/include/libavutil/dovi_meta.h @@ -29,6 +29,7 @@ #include #include +#include "rational.h" /* * DOVI configuration @@ -67,4 +68,169 @@ typedef struct AVDOVIDecoderConfigurationRecord { */ AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size); +/** + * Dolby Vision RPU data header. + * + * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI. + */ +typedef struct AVDOVIRpuDataHeader { + uint8_t rpu_type; + uint16_t rpu_format; + uint8_t vdr_rpu_profile; + uint8_t vdr_rpu_level; + uint8_t chroma_resampling_explicit_filter_flag; + uint8_t coef_data_type; /* informative, lavc always converts to fixed */ + uint8_t coef_log2_denom; + uint8_t vdr_rpu_normalized_idc; + uint8_t bl_video_full_range_flag; + uint8_t bl_bit_depth; /* [8, 16] */ + uint8_t el_bit_depth; /* [8, 16] */ + uint8_t vdr_bit_depth; /* [8, 16] */ + uint8_t spatial_resampling_filter_flag; + uint8_t el_spatial_resampling_filter_flag; + uint8_t disable_residual_flag; +} AVDOVIRpuDataHeader; + +enum AVDOVIMappingMethod { + AV_DOVI_MAPPING_POLYNOMIAL = 0, + AV_DOVI_MAPPING_MMR = 1, +}; + +/** + * Coefficients of a piece-wise function. The pieces of the function span the + * value ranges between two adjacent pivot values. + */ +#define AV_DOVI_MAX_PIECES 8 +typedef struct AVDOVIReshapingCurve { + uint8_t num_pivots; /* [2, 9] */ + uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */ + enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]; + /* AV_DOVI_MAPPING_POLYNOMIAL */ + uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */ + int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */ + /* AV_DOVI_MAPPING_MMR */ + uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */ + int64_t mmr_constant[AV_DOVI_MAX_PIECES]; + int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7]; +} AVDOVIReshapingCurve; + +enum AVDOVINLQMethod { + AV_DOVI_NLQ_NONE = -1, + AV_DOVI_NLQ_LINEAR_DZ = 0, +}; + +/** + * Coefficients of the non-linear inverse quantization. For the interpretation + * of these, see ETSI GS CCM 001. + */ +typedef struct AVDOVINLQParams { + uint16_t nlq_offset; + uint64_t vdr_in_max; + /* AV_DOVI_NLQ_LINEAR_DZ */ + uint64_t linear_deadzone_slope; + uint64_t linear_deadzone_threshold; +} AVDOVINLQParams; + +/** + * Dolby Vision RPU data mapping parameters. + * + * @note sizeof(AVDOVIDataMapping) is not part of the public ABI. + */ +typedef struct AVDOVIDataMapping { + uint8_t vdr_rpu_id; + uint8_t mapping_color_space; + uint8_t mapping_chroma_format_idc; + AVDOVIReshapingCurve curves[3]; /* per component */ + + /* Non-linear inverse quantization */ + enum AVDOVINLQMethod nlq_method_idc; + uint32_t num_x_partitions; + uint32_t num_y_partitions; + AVDOVINLQParams nlq[3]; /* per component */ +} AVDOVIDataMapping; + +/** + * Dolby Vision RPU colorspace metadata parameters. + * + * @note sizeof(AVDOVIColorMetadata) is not part of the public ABI. + */ +typedef struct AVDOVIColorMetadata { + uint8_t dm_metadata_id; + uint8_t scene_refresh_flag; + + /** + * Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be + * used instead of the matrices indicated by the frame's colorspace tags. + * The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB + * matrix based on a Hunt-Pointer-Estevez transform, but without any + * crosstalk. (See the definition of the ICtCp colorspace for more + * information.) + */ + AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */ + AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */ + AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */ + + /** + * Extra signal metadata (see Dolby patents for more info). + */ + uint16_t signal_eotf; + uint16_t signal_eotf_param0; + uint16_t signal_eotf_param1; + uint32_t signal_eotf_param2; + uint8_t signal_bit_depth; + uint8_t signal_color_space; + uint8_t signal_chroma_format; + uint8_t signal_full_range_flag; /* [0, 3] */ + uint16_t source_min_pq; + uint16_t source_max_pq; + uint16_t source_diagonal; +} AVDOVIColorMetadata; + +/** + * Combined struct representing a combination of header, mapping and color + * metadata, for attaching to frames as side data. + * + * @note The struct must be allocated with av_dovi_metadata_alloc() and + * its size is not a part of the public ABI. + */ + +typedef struct AVDOVIMetadata { + /** + * Offset in bytes from the beginning of this structure at which the + * respective structs start. + */ + size_t header_offset; /* AVDOVIRpuDataHeader */ + size_t mapping_offset; /* AVDOVIDataMapping */ + size_t color_offset; /* AVDOVIColorMetadata */ +} AVDOVIMetadata; + +static av_always_inline AVDOVIRpuDataHeader * +av_dovi_get_header(const AVDOVIMetadata *data) +{ + return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset); +} + +static av_always_inline AVDOVIDataMapping * +av_dovi_get_mapping(const AVDOVIMetadata *data) +{ + return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset); +} + +static av_always_inline AVDOVIColorMetadata * +av_dovi_get_color(const AVDOVIMetadata *data) +{ + return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset); +} + +/** + * Allocate an AVDOVIMetadata structure and initialize its + * fields to default values. + * + * @param size If this parameter is non-NULL, the size in bytes of the + * allocated struct will be written here on success + * + * @return the newly allocated struct or NULL on failure + */ +AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size); + #endif /* AVUTIL_DOVI_META_H */ diff --git a/mac/include/libavutil/error.h b/mac/include/libavutil/error.h index 71df4da..0d3269a 100644 --- a/mac/include/libavutil/error.h +++ b/mac/include/libavutil/error.h @@ -27,6 +27,8 @@ #include #include +#include "macros.h" + /** * @addtogroup lavu_error * diff --git a/mac/include/libavutil/ffversion.h b/mac/include/libavutil/ffversion.h index c2b610f..cb3926a 100644 --- a/mac/include/libavutil/ffversion.h +++ b/mac/include/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "n4.4.1" +#define FFMPEG_VERSION "n5.0" #endif /* AVUTIL_FFVERSION_H */ diff --git a/mac/include/libavutil/film_grain_params.h b/mac/include/libavutil/film_grain_params.h index 7629e3a..f3bd0a4 100644 --- a/mac/include/libavutil/film_grain_params.h +++ b/mac/include/libavutil/film_grain_params.h @@ -28,6 +28,11 @@ enum AVFilmGrainParamsType { * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom) */ AV_FILM_GRAIN_PARAMS_AV1, + + /** + * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274) + */ + AV_FILM_GRAIN_PARAMS_H274, }; /** @@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams { int limit_output_range; } AVFilmGrainAOMParams; +/** + * This structure describes how to handle film grain synthesis for codecs using + * the ITU-T H.274 Versatile suplemental enhancement information message. + * + * @note The struct must be allocated as part of AVFilmGrainParams using + * av_film_grain_params_alloc(). Its size is not a part of the public ABI. + */ +typedef struct AVFilmGrainH274Params { + /** + * Specifies the film grain simulation mode. + * 0 = Frequency filtering, 1 = Auto-regression + */ + int model_id; + + /** + * Specifies the bit depth used for the luma component. + */ + int bit_depth_luma; + + /** + * Specifies the bit depth used for the chroma components. + */ + int bit_depth_chroma; + + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + + /** + * Specifies the blending mode used to blend the simulated film grain + * with the decoded images. + * + * 0 = Additive, 1 = Multiplicative + */ + int blending_mode_id; + + /** + * Specifies a scale factor used in the film grain characterization equations. + */ + int log2_scale_factor; + + /** + * Indicates if the modelling of film grain for a given component is present. + */ + int component_model_present[3 /* y, cb, cr */]; + + /** + * Specifies the number of intensity intervals for which a specific set of + * model values has been estimated, with a range of [1, 256]. + */ + uint16_t num_intensity_intervals[3 /* y, cb, cr */]; + + /** + * Specifies the number of model values present for each intensity interval + * in which the film grain has been modelled, with a range of [1, 6]. + */ + uint8_t num_model_values[3 /* y, cb, cr */]; + + /** + * Specifies the lower ounds of each intensity interval for whichthe set of + * model values applies for the component. + */ + uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the upper bound of each intensity interval for which the set of + * model values applies for the component. + */ + uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the model values for the component for each intensity interval. + * - When model_id == 0, the following applies: + * For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1] + * For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1] + * - Otherwise, the following applies: + * For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1] + * For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1] + */ + int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */]; +} AVFilmGrainH274Params; + /** * This structure describes how to handle film grain synthesis in video * for specific codecs. Must be present on every frame where film grain is @@ -133,6 +221,9 @@ typedef struct AVFilmGrainParams { /** * Seed to use for the synthesis process, if the codec allows for it. + * + * @note For H.264, this refers to `pic_offset` as defined in + * SMPTE RDD 5-2006. */ uint64_t seed; @@ -143,6 +234,7 @@ typedef struct AVFilmGrainParams { */ union { AVFilmGrainAOMParams aom; + AVFilmGrainH274Params h274; } codec; } AVFilmGrainParams; diff --git a/mac/include/libavutil/frame.h b/mac/include/libavutil/frame.h index 7d1f8e2..18e239f 100644 --- a/mac/include/libavutil/frame.h +++ b/mac/include/libavutil/frame.h @@ -142,23 +142,6 @@ enum AVFrameSideDataType { */ AV_FRAME_DATA_ICC_PROFILE, -#if FF_API_FRAME_QP - /** - * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA. - * The contents of this side data are undocumented and internal; use - * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a - * meaningful way instead. - */ - AV_FRAME_DATA_QP_TABLE_PROPERTIES, - - /** - * Raw QP table data. Its format is described by - * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and - * av_frame_get_qp_table() to access this instead. - */ - AV_FRAME_DATA_QP_TABLE_DATA, -#endif - /** * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t * where the first uint32_t describes how many (1-3) of the other timecodes are used. @@ -198,6 +181,26 @@ enum AVFrameSideDataType { * Must be present for every frame which should have film grain applied. */ AV_FRAME_DATA_FILM_GRAIN_PARAMS, + + /** + * Bounding boxes for object detection and classification, + * as described by AVDetectionBBoxHeader. + */ + AV_FRAME_DATA_DETECTION_BBOXES, + + /** + * Dolby Vision RPU raw data, suitable for passing to x265 + * or other libraries. Array of uint8_t, with NAL emulation + * bytes intact. + */ + AV_FRAME_DATA_DOVI_RPU_BUFFER, + + /** + * Parsed Dolby Vision metadata, suitable for passing to a software + * implementation. The payload is the AVDOVIMetadata struct defined in + * libavutil/dovi_meta.h. + */ + AV_FRAME_DATA_DOVI_METADATA, }; enum AVActiveFormatDescription { @@ -220,11 +223,7 @@ enum AVActiveFormatDescription { typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif AVDictionary *metadata; AVBufferRef *buf; } AVFrameSideData; @@ -319,21 +318,32 @@ typedef struct AVFrame { #define AV_NUM_DATA_POINTERS 8 /** * pointer to the picture/channel planes. - * This might be different from the first allocated byte + * This might be different from the first allocated byte. For video, + * it could even point to the end of the image data. + * + * All pointers in data and extended_data must point into one of the + * AVBufferRef in buf or extended_buf. * * Some decoders access areas outside 0,0 - width,height, please * see avcodec_align_dimensions2(). Some filters and swscale can read * up to 16 bytes beyond the planes, if these filters are to be used, * then 16 extra bytes must be allocated. * - * NOTE: Except for hwaccel formats, pointers not needed by the format - * MUST be set to NULL. + * NOTE: Pointers not needed by the format MUST be set to NULL. + * + * @attention In case of video, the data[] pointers can point to the + * end of image data in order to reverse line order, when used in + * combination with negative values in the linesize[] array. */ uint8_t *data[AV_NUM_DATA_POINTERS]; /** - * For video, size in bytes of each picture line. - * For audio, size in bytes of each plane. + * For video, a positive or negative value, which is typically indicating + * the size in bytes of each picture line, but it can also be: + * - the negative byte size of lines for vertical flipping + * (with data[n] pointing to the end of the data + * - a positive or negative multiple of the byte size as for accessing + * even and odd fields of a frame (possibly flipped) * * For audio, only linesize[0] may be set. For planar audio, each channel * plane must be the same size. @@ -345,6 +355,9 @@ typedef struct AVFrame { * * @note The linesize may be larger than the size of usable data -- there * may be extra padding present for performance reasons. + * + * @attention In case of video, line size values can be negative to achieve + * a vertically inverted iteration over image lines. */ int linesize[AV_NUM_DATA_POINTERS]; @@ -410,15 +423,6 @@ typedef struct AVFrame { */ int64_t pts; -#if FF_API_PKT_PTS - /** - * PTS copied from the AVPacket that was decoded to produce this frame. - * @deprecated use the pts field instead - */ - attribute_deprecated - int64_t pkt_pts; -#endif - /** * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) * This is also the Presentation time of this AVFrame calculated from @@ -426,6 +430,14 @@ typedef struct AVFrame { */ int64_t pkt_dts; + /** + * Time base for the timestamps in this frame. + * In the future, this field may be set on frames output by decoders or + * filters, but its value will be by default ignored on input to encoders + * or filters. + */ + AVRational time_base; + /** * picture number in bitstream order */ @@ -445,14 +457,6 @@ typedef struct AVFrame { */ void *opaque; -#if FF_API_ERROR_FRAME - /** - * @deprecated unused - */ - attribute_deprecated - uint64_t error[AV_NUM_DATA_POINTERS]; -#endif - /** * When decoding, this signals how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps) @@ -495,10 +499,10 @@ typedef struct AVFrame { uint64_t channel_layout; /** - * AVBuffer references backing the data for this frame. If all elements of - * this array are NULL, then this frame is not reference counted. This array - * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must - * also be non-NULL for all j < i. + * 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 + * extended_buf. This array must be filled contiguously -- if buf[i] is + * non-NULL then buf[j] must also be non-NULL for all j < i. * * There may be at most one AVBuffer per data plane, so for video this array * always contains all the references. For planar audio with more than @@ -632,24 +636,6 @@ typedef struct AVFrame { */ int pkt_size; -#if FF_API_FRAME_QP - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - attribute_deprecated - AVBufferRef *qp_table_buf; -#endif /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. @@ -697,69 +683,16 @@ typedef struct AVFrame { AVBufferRef *private_ref; } AVFrame; -#if FF_API_FRAME_GET_SET -/** - * Accessors for some AVFrame fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); -attribute_deprecated -void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_duration (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_pos (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_channel_layout (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channel_layout (AVFrame *frame, int64_t val); -attribute_deprecated -int av_frame_get_channels (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channels (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_sample_rate (const AVFrame *frame); -attribute_deprecated -void av_frame_set_sample_rate (AVFrame *frame, int val); -attribute_deprecated -AVDictionary *av_frame_get_metadata (const AVFrame *frame); -attribute_deprecated -void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); -attribute_deprecated -int av_frame_get_decode_error_flags (const AVFrame *frame); -attribute_deprecated -void av_frame_set_decode_error_flags (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_pkt_size(const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_size(AVFrame *frame, int val); -#if FF_API_FRAME_QP -attribute_deprecated -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); -attribute_deprecated -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); -#endif -attribute_deprecated -enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); -attribute_deprecated -void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); -attribute_deprecated -enum AVColorRange av_frame_get_color_range(const AVFrame *frame); -attribute_deprecated -void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); -#endif +#if FF_API_COLORSPACE_NAME /** * Get the name of a colorspace. * @return a static string identifying the colorspace; can be NULL. + * @deprecated use av_color_space_name() */ +attribute_deprecated const char *av_get_colorspace_name(enum AVColorSpace val); - +#endif /** * Allocate an AVFrame and set its fields to default values. The resulting * struct must be freed using av_frame_free(). @@ -917,11 +850,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); */ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Add a new side data to a frame from an existing AVBufferRef diff --git a/mac/include/libavutil/hash.h b/mac/include/libavutil/hash.h index af4719e..94151de 100644 --- a/mac/include/libavutil/hash.h +++ b/mac/include/libavutil/hash.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_hash Hash Functions * @ingroup lavu_crypto @@ -182,11 +180,7 @@ void av_hash_init(struct AVHashContext *ctx); * @param[in] src Data to be added to the hash context * @param[in] len Size of the additional data */ -#if FF_API_CRYPTO_SIZE_T -void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); -#else void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len); -#endif /** * Finalize a hash context and compute the actual hash value. diff --git a/mac/include/libavutil/hmac.h b/mac/include/libavutil/hmac.h index 412e950..ca4da6a 100644 --- a/mac/include/libavutil/hmac.h +++ b/mac/include/libavutil/hmac.h @@ -23,7 +23,6 @@ #include -#include "version.h" /** * @defgroup lavu_hmac HMAC * @ingroup lavu_crypto diff --git a/mac/include/libavutil/hwcontext_d3d11va.h b/mac/include/libavutil/hwcontext_d3d11va.h index 9f91e9b..77d2d72 100644 --- a/mac/include/libavutil/hwcontext_d3d11va.h +++ b/mac/include/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if a user-allocated texture is provided. */ UINT MiscFlags; + + /** + * In case if texture structure member above is not NULL contains the same texture + * pointer for all elements and different indexes into the array texture. + * In case if texture structure member above is NULL, all elements contains + * pointers to separate non-array textures and 0 indexes. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + AVD3D11FrameDescriptor *texture_infos; } AVD3D11VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/mac/include/libavutil/hwcontext_videotoolbox.h b/mac/include/libavutil/hwcontext_videotoolbox.h index 5074d79..b6bdcf2 100644 --- a/mac/include/libavutil/hwcontext_videotoolbox.h +++ b/mac/include/libavutil/hwcontext_videotoolbox.h @@ -29,11 +29,14 @@ * @file * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. * - * This API currently does not support frame allocation, as the raw VideoToolbox - * API does allocation, and FFmpeg itself never has the need to allocate frames. + * This API supports frame allocation using a native CVPixelBufferPool + * instead of an AVBufferPool. * * If the API user sets a custom pool, AVHWFramesContext.pool must return * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. + * Note that the underlying CVPixelBuffer could be retained by OS frameworks + * depending on application usage, so it is preferable to let CoreVideo manage + * the pool using the default implementation. * * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always * NULL. @@ -57,4 +60,36 @@ uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); */ uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); +/** + * Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc); + +/** + * Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space); + +/** + * Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri); + +/** + * Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer + * function string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc); + +/** + * Update a CVPixelBufferRef's metadata to based on an AVFrame. + * Returns 0 if no known equivalent was found. + */ +int av_vt_pixbuf_set_attachments(void *log_ctx, + CVPixelBufferRef pixbuf, const struct AVFrame *src); + #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ diff --git a/mac/include/libavutil/hwcontext_vulkan.h b/mac/include/libavutil/hwcontext_vulkan.h index 5cbeb8e..df86c85 100644 --- a/mac/include/libavutil/hwcontext_vulkan.h +++ b/mac/include/libavutil/hwcontext_vulkan.h @@ -19,6 +19,9 @@ #ifndef AVUTIL_HWCONTEXT_VULKAN_H #define AVUTIL_HWCONTEXT_VULKAN_H +#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR) +#define VK_USE_PLATFORM_WIN32_KHR +#endif #include #include "pixfmt.h" @@ -41,43 +44,37 @@ typedef struct AVVulkanDeviceContext { * Custom memory allocator, else NULL */ const VkAllocationCallbacks *alloc; + + /** + * Pointer to the instance-provided vkGetInstanceProcAddr loading function. + * If NULL, will pick either libvulkan or libvolk, depending on libavutil's + * compilation settings, and set this field. + */ + PFN_vkGetInstanceProcAddr get_proc_addr; + /** - * Vulkan instance. Must be at least version 1.1. + * Vulkan instance. Must be at least version 1.2. */ VkInstance inst; + /** * Physical device */ VkPhysicalDevice phys_dev; + /** * Active device */ VkDevice act_dev; + /** - * Queue family index for graphics - * @note av_hwdevice_create() will set all 3 queue indices if unset - * If there is no dedicated queue for compute or transfer operations, - * they will be set to the graphics queue index which can handle both. - * nb_graphics_queues indicates how many queues were enabled for the - * graphics queue (must be at least 1) - */ - int queue_family_index; - int nb_graphics_queues; - /** - * Queue family index to use for transfer operations, and the amount of queues - * enabled. In case there is no dedicated transfer queue, nb_tx_queues - * must be 0 and queue_family_tx_index must be the same as either the graphics - * queue or the compute queue, if available. - */ - int queue_family_tx_index; - int nb_tx_queues; - /** - * Queue family index for compute ops, and the amount of queues enabled. - * In case there are no dedicated compute queues, nb_comp_queues must be - * 0 and its queue family index must be set to the graphics queue. + * This structure should be set to the set of features that present and enabled + * during device creation. When a device is created by FFmpeg, it will default to + * enabling all that are present of the shaderImageGatherExtended, + * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. */ - int queue_family_comp_index; - int nb_comp_queues; + VkPhysicalDeviceFeatures2 device_features; + /** * Enabled instance extensions. * If supplying your own device context, set this to an array of strings, with @@ -87,6 +84,7 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_inst_extensions; int nb_enabled_inst_extensions; + /** * Enabled device extensions. By default, VK_KHR_external_memory_fd, * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier, @@ -97,32 +95,91 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_dev_extensions; int nb_enabled_dev_extensions; + /** - * This structure should be set to the set of features that present and enabled - * during device creation. When a device is created by FFmpeg, it will default to - * enabling all that are present of the shaderImageGatherExtended, - * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. + * Queue family index for graphics operations, and the number of queues + * enabled for it. If unavaiable, will be set to -1. Not required. + * av_hwdevice_create() will attempt to find a dedicated queue for each + * queue family, or pick the one with the least unrelated flags set. + * Queue indices here may overlap if a queue has to share capabilities. */ - VkPhysicalDeviceFeatures2 device_features; + int queue_family_index; + int nb_graphics_queues; + + /** + * Queue family index for transfer operations and the number of queues + * enabled. Required. + */ + int queue_family_tx_index; + int nb_tx_queues; + + /** + * Queue family index for compute operations and the number of queues + * enabled. Required. + */ + int queue_family_comp_index; + int nb_comp_queues; + + /** + * Queue family index for video encode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_encode_index will be -1. + * Not required. + */ + int queue_family_encode_index; + int nb_encode_queues; + + /** + * Queue family index for video decode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_decode_index will be -1. + * Not required. + */ + int queue_family_decode_index; + int nb_decode_queues; } AVVulkanDeviceContext; +/** + * Defines the behaviour of frame allocation. + */ +typedef enum AVVkFrameFlags { + /* Unless this flag is set, autodetected flags will be OR'd based on the + * device and tiling during av_hwframe_ctx_init(). */ + AV_VK_FRAME_FLAG_NONE = (1ULL << 0), + + /* Image planes will be allocated in a single VkDeviceMemory, rather + * than as per-plane VkDeviceMemory allocations. Required for exporting + * to VAAPI on Intel devices. */ + AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1), +} AVVkFrameFlags; + /** * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options */ typedef struct AVVulkanFramesContext { /** - * Controls the tiling of allocated frames. + * Controls the tiling of allocated frames. If left as optimal tiling, + * then during av_hwframe_ctx_init() will decide based on whether the device + * supports DRM modifiers, or if the linear_images flag is set, otherwise + * will allocate optimally-tiled images. */ VkImageTiling tiling; + /** * Defines extra usage of output frames. If left as 0, the following bits * are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE. */ VkImageUsageFlagBits usage; + /** * Extension data for image creation. + * If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain, + * and the device supports DRM modifiers, then images will be allocated + * with the specific requested DRM modifiers. + * Additional structures may be added at av_hwframe_ctx_init() time, + * which will be freed automatically on uninit(), so users need only free + * any structures they've allocated themselves. */ void *create_pnext; + /** * Extension data for memory allocation. Must have as many entries as * the number of planes of the sw_format. @@ -131,6 +188,13 @@ typedef struct AVVulkanFramesContext { * extensions are present in enabled_dev_extensions. */ void *alloc_pnext[AV_NUM_DATA_POINTERS]; + + /** + * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set, + * autodetected flags will be OR'd based on the device and tiling during + * av_hwframe_ctx_init(). + */ + AVVkFrameFlags flags; } AVVulkanFramesContext; /* @@ -139,7 +203,7 @@ typedef struct AVVulkanFramesContext { * 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 three queue family indices in the device context are the same, + * 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. * @@ -158,8 +222,9 @@ typedef struct AVVkFrame { VkImageTiling tiling; /** - * Memory backing the images. Could be less than the amount of images - * if importing from a DRM or VAAPI frame. + * Memory backing the images. Could be less than the amount of planes, + * in which case the offset value will indicate the binding offset of + * each plane in the memory. */ VkDeviceMemory mem[AV_NUM_DATA_POINTERS]; size_t size[AV_NUM_DATA_POINTERS]; @@ -176,17 +241,29 @@ typedef struct AVVkFrame { VkImageLayout layout[AV_NUM_DATA_POINTERS]; /** - * Synchronization semaphores. Must not be freed manually. Must be waited on - * and signalled at every queue submission. - * Could be less than the amount of images: either one per VkDeviceMemory - * or one for the entire frame. All others will be set to VK_NULL_HANDLE. + * Synchronization timeline semaphores, one for each sw_format plane. + * 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, + * using an incremented value. */ VkSemaphore sem[AV_NUM_DATA_POINTERS]; + /** + * Up to date semaphore value at which each image becomes accessible. + * Clients must wait on this value when submitting a command queue, + * and increment it when signalling. + */ + uint64_t sem_value[AV_NUM_DATA_POINTERS]; + /** * Internal data. */ struct AVVkFrameInternal *internal; + + /** + * Describes the binding offset of each plane to the VkDeviceMemory. + */ + ptrdiff_t offset[AV_NUM_DATA_POINTERS]; } AVVkFrame; /** diff --git a/mac/include/libavutil/imgutils.h b/mac/include/libavutil/imgutils.h index 5eccbf0..cb2d747 100644 --- a/mac/include/libavutil/imgutils.h +++ b/mac/include/libavutil/imgutils.h @@ -124,6 +124,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height); +/** + * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where + * available, this function will use special functionality for reading from such + * memory, which may result in greatly improved performance compared to plain + * av_image_copy_plane(). + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy_plane(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize, + ptrdiff_t bytewidth, int height); + /** * Copy image in src_data to dst_data. * diff --git a/mac/include/libavutil/log.h b/mac/include/libavutil/log.h index 8edd6bb..99625af 100644 --- a/mac/include/libavutil/log.h +++ b/mac/include/libavutil/log.h @@ -24,7 +24,6 @@ #include #include "avutil.h" #include "attributes.h" -#include "version.h" typedef enum { AV_CLASS_CATEGORY_NA = 0, @@ -107,24 +106,6 @@ typedef struct AVClass { */ int parent_log_context_offset; - /** - * Return next AVOptions-enabled child or NULL - */ - void* (*child_next)(void *obj, void *prev); - -#if FF_API_CHILD_CLASS_NEXT - /** - * Return an AVClass corresponding to the next potential - * AVOptions-enabled child. - * - * The difference between child_next and this is that - * child_next iterates over _already existing_ objects, while - * child_class_next iterates over _all possible_ children. - */ - attribute_deprecated - const struct AVClass* (*child_class_next)(const struct AVClass *prev); -#endif - /** * Category used for visualization (like color) * This is only set if the category is equal for all objects using this class. @@ -144,6 +125,11 @@ typedef struct AVClass { */ int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + /** * Iterate over the AVClasses corresponding to potential AVOptions-enabled * children. diff --git a/mac/include/libavutil/macros.h b/mac/include/libavutil/macros.h index 2007ee5..2a7567c 100644 --- a/mac/include/libavutil/macros.h +++ b/mac/include/libavutil/macros.h @@ -25,6 +25,36 @@ #ifndef AVUTIL_MACROS_H #define AVUTIL_MACROS_H +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + /** * @addtogroup preproc_misc Preprocessor String Macros * diff --git a/mac/include/libavutil/md5.h b/mac/include/libavutil/md5.h index ca72ccb..fc2eabd 100644 --- a/mac/include/libavutil/md5.h +++ b/mac/include/libavutil/md5.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_md5 MD5 @@ -64,11 +63,7 @@ void av_md5_init(struct AVMD5 *ctx); * @param src input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); -#else void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. @@ -85,11 +80,7 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); * @param src The data to hash * @param len The length of the data, in bytes */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); -#else void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); -#endif /** * @} diff --git a/mac/include/libavutil/mem.h b/mac/include/libavutil/mem.h index e21a1fe..b9fe807 100644 --- a/mac/include/libavutil/mem.h +++ b/mac/include/libavutil/mem.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "error.h" #include "avutil.h" #include "version.h" @@ -238,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); * @see av_mallocz() * @see av_malloc_array() */ -av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#if FF_API_AV_MALLOCZ_ARRAY /** - * Non-inlined equivalent of av_mallocz_array(). - * - * Created for symmetry with the calloc() C function. + * @deprecated use av_calloc() */ -void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; +attribute_deprecated +void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#endif /** * Allocate, reallocate, or free a block of memory. @@ -672,16 +672,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, * @param[out] r Pointer to the result of the operation * @return 0 on success, AVERROR(EINVAL) on overflow */ -static inline int av_size_mult(size_t a, size_t b, size_t *r) -{ - size_t t = a * b; - /* Hack inspired from glibc: don't try the division if nelem and elsize - * are both less than sqrt(SIZE_MAX). */ - if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) - return AVERROR(EINVAL); - *r = t; - return 0; -} +int av_size_mult(size_t a, size_t b, size_t *r); /** * Set the maximum size that may be allocated in one block. diff --git a/mac/include/libavutil/murmur3.h b/mac/include/libavutil/murmur3.h index b3b3a07..d90bc2f 100644 --- a/mac/include/libavutil/murmur3.h +++ b/mac/include/libavutil/murmur3.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_murmur3 Murmur3 * @ingroup lavu_hash @@ -100,11 +98,7 @@ void av_murmur3_init(struct AVMurMur3 *c); * @param[in] src Input data to update hash with * @param[in] len Number of bytes to read from `src` */ -#if FF_API_CRYPTO_SIZE_T -void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); -#else void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/mac/include/libavutil/opt.h b/mac/include/libavutil/opt.h index 8dc020a..2820435 100644 --- a/mac/include/libavutil/opt.h +++ b/mac/include/libavutil/opt.h @@ -33,7 +33,6 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" -#include "version.h" /** * @defgroup avoptions AVOptions @@ -648,19 +647,6 @@ const AVOption *av_opt_next(const void *obj, const AVOption *prev); */ void *av_opt_child_next(void *obj, void *prev); -#if FF_API_CHILD_CLASS_NEXT -/** - * Iterate over potential AVOptions-enabled children of parent. - * - * @param prev result of a previous call to this function or NULL - * @return AVClass corresponding to next potential child or NULL - * - * @deprecated use av_opt_child_class_iterate - */ -attribute_deprecated -const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); -#endif - /** * Iterate over potential AVOptions-enabled children of parent. * @@ -804,9 +790,16 @@ 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 diff --git a/mac/include/libavutil/pixdesc.h b/mac/include/libavutil/pixdesc.h index 9b9d386..f8a195f 100644 --- a/mac/include/libavutil/pixdesc.h +++ b/mac/include/libavutil/pixdesc.h @@ -26,7 +26,6 @@ #include "attributes.h" #include "pixfmt.h" -#include "version.h" typedef struct AVComponentDescriptor { /** @@ -56,17 +55,6 @@ typedef struct AVComponentDescriptor { * Number of bits in the component. */ int depth; - -#if FF_API_PLUS1_MINUS1 - /** deprecated, use step instead */ - attribute_deprecated int step_minus1; - - /** deprecated, use depth instead */ - attribute_deprecated int depth_minus1; - - /** deprecated, use offset instead */ - attribute_deprecated int offset_plus1; -#endif } AVComponentDescriptor; /** @@ -147,26 +135,6 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_RGB (1 << 5) -#if FF_API_PSEUDOPAL -/** - * The pixel format is "pseudo-paletted". This means that it contains a - * fixed palette in the 2nd plane but the palette is fixed/constant for each - * PIX_FMT. This allows interpreting the data as if it was PAL8, which can - * in some cases be simpler. Or the data can be interpreted purely based on - * the pixel format without using the palette. - * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 - * - * @deprecated This flag is deprecated, and will be removed. When it is removed, - * the extra palette allocation in AVFrame.data[1] is removed as well. Only - * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a - * palette. Starting with FFmpeg versions which have this flag deprecated, the - * extra "pseudo" palette is already ignored, and API users are not required to - * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required - * before the deprecation, though). - */ -#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) -#endif - /** * The pixel format has an alpha channel. This is set on all formats that * support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always diff --git a/mac/include/libavutil/pixfmt.h b/mac/include/libavutil/pixfmt.h index 46ef211..02e355e 100644 --- a/mac/include/libavutil/pixfmt.h +++ b/mac/include/libavutil/pixfmt.h @@ -112,21 +112,11 @@ enum AVPixelFormat { AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined -#if FF_API_VAAPI - /** @name Deprecated pixel formats */ - /**@{*/ - AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers - AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers - AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID - /**@}*/ - AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, -#else /** * Hardware acceleration through VA-API, data[3] contains a * VASurfaceID. */ AV_PIX_FMT_VAAPI, -#endif AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian @@ -360,6 +350,21 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian + + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, liddle-endian + + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian + AV_PIX_FMT_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 }; @@ -450,35 +455,41 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) + +#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_P216 AV_PIX_FMT_NE(P216BE, P216LE) +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) /** * Chromaticity coordinates of the source primaries. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. */ enum AVColorPrimaries { AVCOL_PRI_RESERVED0 = 0, - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B AVCOL_PRI_UNSPECIFIED = 2, AVCOL_PRI_RESERVED = 3, AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65 AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428, AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3 AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 - AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E / JEDEC P22 phosphors + AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213, AVCOL_PRI_NB ///< Not part of ABI }; /** * Color Transfer Characteristic. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2. */ enum AVColorTransferCharacteristic { AVCOL_TRC_RESERVED0 = 0, @@ -507,18 +518,18 @@ enum AVColorTransferCharacteristic { /** * YUV colorspace type. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3. */ enum AVColorSpace { - AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above - AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries + AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO, AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system @@ -540,9 +551,9 @@ enum AVColorSpace { * recommended, as it also defines the full range representation. * * Common definitions: - * - For RGB and luminance planes such as Y in YCbCr and I in ICtCp, + * - For RGB and luma planes such as Y in YCbCr and I in ICtCp, * 'E' is the original value in range of 0.0 to 1.0. - * - For chrominance planes such as Cb,Cr and Ct,Cp, 'E' is the original + * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original * value in range of -0.5 to 0.5. * - 'n' is the output bit depth. * - For additional definitions such as rounding and clipping to valid n @@ -554,13 +565,13 @@ enum AVColorRange { /** * Narrow or limited range content. * - * - For luminance planes: + * - For luma planes: * * (219 * E + 16) * 2^(n-8) * * F.ex. the range of 16-235 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (224 * E + 128) * 2^(n-8) * @@ -571,13 +582,13 @@ enum AVColorRange { /** * Full range content. * - * - For RGB and luminance planes: + * - For RGB and luma planes: * * (2^n - 1) * E * * F.ex. the range of 0-255 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (2^n - 1) * E + 2^(n - 1) * diff --git a/mac/include/libavutil/ripemd.h b/mac/include/libavutil/ripemd.h index 921aa66..9df9f90 100644 --- a/mac/include/libavutil/ripemd.h +++ b/mac/include/libavutil/ripemd.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_ripemd RIPEMD @@ -67,11 +66,7 @@ int av_ripemd_init(struct AVRIPEMD* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); -#else void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/mac/include/libavutil/samplefmt.h b/mac/include/libavutil/samplefmt.h index 8cd43ae..f270199 100644 --- a/mac/include/libavutil/samplefmt.h +++ b/mac/include/libavutil/samplefmt.h @@ -195,9 +195,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return >=0 on success or a negative error code on failure - * @todo return minimum size in bytes required for the buffer in case - * of success at the next bump + * @return minimum size in bytes required for the buffer on success, + * or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, diff --git a/mac/include/libavutil/sha.h b/mac/include/libavutil/sha.h index c0180e5..2e1220a 100644 --- a/mac/include/libavutil/sha.h +++ b/mac/include/libavutil/sha.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha SHA @@ -74,11 +73,7 @@ int av_sha_init(struct AVSHA* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len); -#else void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/mac/include/libavutil/sha512.h b/mac/include/libavutil/sha512.h index bef714b..a4a3f23 100644 --- a/mac/include/libavutil/sha512.h +++ b/mac/include/libavutil/sha512.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha512 SHA-512 @@ -76,11 +75,7 @@ int av_sha512_init(struct AVSHA512* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); -#else void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/mac/include/libavutil/tree.h b/mac/include/libavutil/tree.h index d5e0aeb..bbb8fbb 100644 --- a/mac/include/libavutil/tree.h +++ b/mac/include/libavutil/tree.h @@ -28,7 +28,6 @@ #define AVUTIL_TREE_H #include "attributes.h" -#include "version.h" /** * @addtogroup lavu_tree AVTree diff --git a/mac/include/libavutil/tx.h b/mac/include/libavutil/tx.h index bfc0c7f..5517381 100644 --- a/mac/include/libavutil/tx.h +++ b/mac/include/libavutil/tx.h @@ -49,11 +49,14 @@ enum AVTXType { * float. Length is the frame size, not the window size (which is 2x frame) * For forward transforms, the stride specifies the spacing between each * sample in the output array in bytes. The input must be a flat array. + * * For inverse transforms, the stride specifies the spacing between each * sample in the input array in bytes. The output will be a flat array. * Stride must be a non-zero multiple of sizeof(float). + * * NOTE: the inverse transform is half-length, meaning the output will not - * contain redundant data. This is what most codecs work with. + * contain redundant data. This is what most codecs work with. To do a full + * inverse transform, set the AV_TX_FULL_IMDCT flag on init. */ AV_TX_FLOAT_MDCT = 1, @@ -93,7 +96,7 @@ enum AVTXType { * @param stride the input or output stride in bytes * * The out and in arrays must be aligned to the maximum required by the CPU - * architecture. + * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init(). * The stride must follow the constraints the transform type has specified. */ typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride); @@ -108,6 +111,20 @@ enum AVTXFlags { * transform types. */ AV_TX_INPLACE = 1ULL << 0, + + /** + * Relaxes alignment requirement for the in and out arrays of av_tx_fn(). + * May be slower with certain transform types. + */ + AV_TX_UNALIGNED = 1ULL << 1, + + /** + * Performs a full inverse MDCT rather than leaving out samples that can be + * derived through symmetry. Requires an output array of 'len' floats, + * rather than the usual 'len/2' floats. + * Ignored for all transforms but inverse MDCTs. + */ + AV_TX_FULL_IMDCT = 1ULL << 2, }; /** diff --git a/mac/include/libavutil/version.h b/mac/include/libavutil/version.h index f888dbb..58c6179 100644 --- a/mac/include/libavutil/version.h +++ b/mac/include/libavutil/version.h @@ -78,8 +78,8 @@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 70 +#define LIBAVUTIL_VERSION_MAJOR 57 +#define LIBAVUTIL_VERSION_MINOR 17 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -105,42 +105,10 @@ * @{ */ -#ifndef FF_API_VAAPI -#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_QP -#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PLUS1_MINUS1 -#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_ERROR_FRAME -#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PKT_PTS -#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CRYPTO_SIZE_T -#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_GET_SET -#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PSEUDOPAL -#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CHILD_CLASS_NEXT -#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_BUFFER_SIZE_T -#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_D2STR #define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_DECLARE_ALIGNED #define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58) -#endif +#define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58) +#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58) /** * @} diff --git a/mac/lib/libavcodec.58.dylib b/mac/lib/libavcodec.59.dylib similarity index 68% rename from mac/lib/libavcodec.58.dylib rename to mac/lib/libavcodec.59.dylib index 4749879..4e3c3ea 100755 Binary files a/mac/lib/libavcodec.58.dylib and b/mac/lib/libavcodec.59.dylib differ diff --git a/mac/lib/libavutil.56.dylib b/mac/lib/libavutil.56.dylib deleted file mode 100755 index 7de1221..0000000 Binary files a/mac/lib/libavutil.56.dylib and /dev/null differ diff --git a/mac/lib/libavutil.57.dylib b/mac/lib/libavutil.57.dylib new file mode 100755 index 0000000..f7c1579 Binary files /dev/null and b/mac/lib/libavutil.57.dylib differ diff --git a/windows/include/arm64/libavcodec/avcodec.h b/windows/include/arm64/libavcodec/avcodec.h index 8a71c04..7ee8bc2 100644 --- a/windows/include/arm64/libavcodec/avcodec.h +++ b/windows/include/arm64/libavcodec/avcodec.h @@ -27,25 +27,21 @@ * Libavcodec external API header */ -#include #include "libavutil/samplefmt.h" #include "libavutil/attributes.h" #include "libavutil/avutil.h" #include "libavutil/buffer.h" -#include "libavutil/cpu.h" -#include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/frame.h" -#include "libavutil/hwcontext.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "bsf.h" #include "codec.h" #include "codec_desc.h" #include "codec_par.h" #include "codec_id.h" +#include "defs.h" #include "packet.h" #include "version.h" @@ -155,29 +151,6 @@ * at least will not fail with AVERROR(EAGAIN). In general, no codec will * permit unlimited buffering of input or output. * - * This API replaces the following legacy functions: - * - avcodec_decode_video2() and avcodec_decode_audio4(): - * Use avcodec_send_packet() to feed input to the decoder, then use - * avcodec_receive_frame() to receive decoded frames after each packet. - * Unlike with the old video decoding API, multiple frames might result from - * a packet. For audio, splitting the input packet into frames by partially - * decoding packets becomes transparent to the API user. You never need to - * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then - * no data was read from the packet). - * Additionally, sending a flush/draining packet is required only once. - * - avcodec_encode_video2()/avcodec_encode_audio2(): - * Use avcodec_send_frame() to feed input to the encoder, then use - * avcodec_receive_packet() to receive encoded packets. - * Providing user-allocated buffers for avcodec_receive_packet() is not - * possible. - * - The new API does not handle subtitles yet. - * - * Mixing new and old function calls on the same AVCodecContext is not allowed, - * and will result in undefined behavior. - * - * Some codecs might require using the new API; using the old API will return - * an error when calling it. All codecs support the new API. - * * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This * would be an invalid state, which could put the codec user into an endless * loop. The API has no concept of time either: it cannot happen that trying to @@ -204,16 +177,6 @@ * @{ */ -/** - * @ingroup lavc_decoding - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * This is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end.
- * Note: If the first 23 bits of the additional bytes are not 0, then damaged - * MPEG bitstreams could cause overread and segfault. - */ -#define AV_INPUT_BUFFER_PADDING_SIZE 64 - /** * @ingroup lavc_encoding * minimum encoding buffer size @@ -221,34 +184,6 @@ */ #define AV_INPUT_BUFFER_MIN_SIZE 16384 -/** - * @ingroup lavc_decoding - */ -enum AVDiscard{ - /* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). */ - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONINTRA= 24, ///< discard all non intra frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -enum AVAudioServiceType { - AV_AUDIO_SERVICE_TYPE_MAIN = 0, - AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, - AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, - AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, - AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, - AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, - AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, - AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, - AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, - AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI -}; - /** * @ingroup lavc_encoding */ @@ -310,11 +245,15 @@ typedef struct RcOverride{ * error[?] variables will be set during encoding. */ #define AV_CODEC_FLAG_PSNR (1 << 15) +#if FF_API_FLAG_TRUNCATED /** * Input bitstream might be truncated at a random location * instead of only at frame boundaries. + * + * @deprecated use codec parsers for packetizing input */ #define AV_CODEC_FLAG_TRUNCATED (1 << 16) +#endif /** * Use interlaced DCT. */ @@ -416,98 +355,6 @@ typedef struct RcOverride{ */ #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) -/** - * Pan Scan area. - * This specifies the area which should be displayed. - * Note there may be multiple such areas for one frame. - */ -typedef struct AVPanScan { - /** - * id - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int16_t position[3][2]; -} AVPanScan; - -/** - * This structure describes the bitrate properties of an encoded bitstream. It - * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD - * parameters for H.264/HEVC. - */ -typedef struct AVCPBProperties { - /** - * Maximum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int max_bitrate; -#else - int64_t max_bitrate; -#endif - /** - * Minimum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int min_bitrate; -#else - int64_t min_bitrate; -#endif - /** - * Average bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int avg_bitrate; -#else - int64_t avg_bitrate; -#endif - - /** - * The size of the buffer to which the ratecontrol is applied, in bits. - * Zero if unknown or unspecified. - */ - int buffer_size; - - /** - * The delay between the time the packet this structure is associated with - * is received and the time when it should be decoded, in periods of a 27MHz - * clock. - * - * UINT64_MAX when unknown or unspecified. - */ - uint64_t vbv_delay; -} AVCPBProperties; - -/** - * This structure supplies correlation between a packet timestamp and a wall clock - * production time. The definition follows the Producer Reference Time ('prft') - * as defined in ISO/IEC 14496-12 - */ -typedef struct AVProducerReferenceTime { - /** - * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). - */ - int64_t wallclock; - int flags; -} AVProducerReferenceTime; - /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -697,7 +544,7 @@ typedef struct AVCodecContext { * picture width / height. * * @note Those fields may not match the values of the last - * AVFrame output by avcodec_decode_video2 due frame + * AVFrame output by avcodec_receive_frame() due frame * reordering. * * - encoding: MUST be set by user. @@ -773,17 +620,29 @@ typedef struct AVCodecContext { int y, int type, int height); /** - * callback to negotiate the pixelFormat - * @param fmt is the list of formats which are supported by the codec, - * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. - * The first is always the native one. - * @note The callback may be called again immediately if initialization for - * the selected (hardware-accelerated) pixel format failed. - * @warning Behavior is undefined if the callback returns a value not - * in the fmt list of formats. - * @return the chosen format - * - encoding: unused - * - decoding: Set by user, if not set the native format will be chosen. + * Callback to negotiate the pixel format. Decoding only, may be set by the + * caller before avcodec_open2(). + * + * Called by some decoders to select the pixel format that will be used for + * the output frames. This is mainly used to set up hardware acceleration, + * then the provided format list contains the corresponding hwaccel pixel + * formats alongside the "software" one. The software pixel format may also + * be retrieved from \ref sw_pix_fmt. + * + * This callback will be called when the coded frame properties (such as + * resolution, pixel format, etc.) change and more than one output format is + * supported for those new properties. If a hardware pixel format is chosen + * and initialization for it fails, the callback may be called again + * immediately. + * + * This callback may be called from different threads if the decoder is + * multi-threaded, but not from more than one thread simultaneously. + * + * @param fmt list of formats which may be used in the current + * configuration, terminated by AV_PIX_FMT_NONE. + * @warning Behavior is undefined if the callback returns a value other + * than one of the formats in fmt or AV_PIX_FMT_NONE. + * @return the chosen format or AV_PIX_FMT_NONE */ enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); @@ -804,12 +663,6 @@ typedef struct AVCodecContext { */ float b_quant_factor; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_frame_strategy; -#endif - /** * qscale offset between IP and B-frames * - encoding: Set by user. @@ -825,12 +678,6 @@ typedef struct AVCodecContext { */ int has_b_frames; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int mpeg_quant; -#endif - /** * qscale factor between P- and I-frames * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). @@ -889,15 +736,6 @@ typedef struct AVCodecContext { */ int slice_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 -#endif - /** * slice offsets in the frame in bytes * - encoding: Set/allocated by libavcodec. @@ -970,12 +808,6 @@ typedef struct AVCodecContext { */ int last_predictor_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int pre_me; -#endif - /** * motion estimation prepass comparison function * - encoding: Set by user. @@ -1044,16 +876,6 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int scenechange_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int noise_reduction; -#endif - /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. @@ -1089,26 +911,12 @@ typedef struct AVCodecContext { */ int mb_lmax; -#if FF_API_PRIVATE_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int me_penalty_compensation; -#endif - /** * - encoding: Set by user. * - decoding: unused */ int bidir_refine; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int brd_scale; -#endif - /** * minimum GOP size * - encoding: Set by user. @@ -1123,12 +931,6 @@ typedef struct AVCodecContext { */ int refs; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int chromaoffset; -#endif - /** * Note: Value depends upon the compare function used for fullpel ME. * - encoding: Set by user. @@ -1136,12 +938,6 @@ typedef struct AVCodecContext { */ int mv0_threshold; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_sensitivity; -#endif - /** * Chromaticity coordinates of the source primaries. * - encoding: Set by user @@ -1350,24 +1146,6 @@ typedef struct AVCodecContext { */ int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); -#if FF_API_OLD_ENCDEC - /** - * If non-zero, the decoded audio and video frames returned from - * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted - * and are valid indefinitely. The caller must free them with - * av_frame_unref() when they are not needed anymore. - * Otherwise, the decoded frames must not be freed by the caller and are - * only valid until the next decode call. - * - * This is always automatically enabled if avcodec_receive_frame() is used. - * - * - encoding: unused - * - decoding: set by the caller before avcodec_open2(). - */ - attribute_deprecated - int refcounted_frames; -#endif - /* - encoding parameters */ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) float qblur; ///< amount of qscale smoothing over time (0.0-1.0) @@ -1443,42 +1221,6 @@ typedef struct AVCodecContext { */ int rc_initial_buffer_occupancy; -#if FF_API_CODER_TYPE -#define FF_CODER_TYPE_VLC 0 -#define FF_CODER_TYPE_AC 1 -#define FF_CODER_TYPE_RAW 2 -#define FF_CODER_TYPE_RLE 3 - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int coder_type; -#endif /* FF_API_CODER_TYPE */ - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int context_model; -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_factor; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_exp; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_cmp; -#endif /* FF_API_PRIVATE_OPT */ - /** * trellis RD quantization * - encoding: Set by user. @@ -1486,69 +1228,6 @@ typedef struct AVCodecContext { */ int trellis; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int min_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int max_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int64_t timecode_frame_start; -#endif - -#if FF_API_RTP_CALLBACK - /** - * @deprecated unused - */ - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send. */ - /* It depends on the encoder if the data starts */ - /* with a Start Code (it should). H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload. */ - attribute_deprecated - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do its best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263. */ - /* This doesn't take account of any particular */ - /* headers inside the transmitted RTP payload. */ -#endif - -#if FF_API_STAT_BITS - /* statistics, used for 2-pass encoding */ - attribute_deprecated - int mv_bits; - attribute_deprecated - int header_bits; - attribute_deprecated - int i_tex_bits; - attribute_deprecated - int p_tex_bits; - attribute_deprecated - int i_count; - attribute_deprecated - int p_count; - attribute_deprecated - int skip_count; - attribute_deprecated - int misc_bits; - - /** @deprecated this field is unused */ - attribute_deprecated - int frame_bits; -#endif - /** * pass1 encoding statistics output buffer * - encoding: Set by libavcodec. @@ -1684,8 +1363,7 @@ typedef struct AVCodecContext { * For some hardware accelerators, a global context needs to be * provided by the user. In that case, this holds display-dependent * data FFmpeg cannot instantiate itself. Please refer to the - * FFmpeg HW accelerator documentation to know how to fill this - * is. e.g. for VA API, this is a struct vaapi_context. + * FFmpeg HW accelerator documentation to know how to fill this. * - encoding: unused * - decoding: Set by user */ @@ -1753,17 +1431,6 @@ typedef struct AVCodecContext { */ int lowres; -#if FF_API_CODED_FRAME - /** - * the picture in the bitstream - * - encoding: Set by libavcodec. - * - decoding: unused - * - * @deprecated use the quality factor packet side data instead - */ - attribute_deprecated AVFrame *coded_frame; -#endif - /** * thread count * is used to decide how many independent tasks should be passed to execute() @@ -2016,34 +1683,6 @@ typedef struct AVCodecContext { uint8_t *subtitle_header; int subtitle_header_size; -#if FF_API_VBV_DELAY - /** - * VBV delay coded in the last frame (in periods of a 27 MHz clock). - * Used for compliant TS muxing. - * - encoding: Set by libavcodec. - * - decoding: unused. - * @deprecated this value is now exported as a part of - * AV_PKT_DATA_CPB_PROPERTIES packet side data - */ - attribute_deprecated - uint64_t vbv_delay; -#endif - -#if FF_API_SIDEDATA_ONLY_PKT - /** - * Encoding only and set by default. Allow encoders to output packets - * that do not contain any encoded data, only side data. - * - * Some encoders need to output such packets, e.g. to update some stream - * parameters at the end of encoding. - * - * @deprecated this field disables the default behaviour and - * it is kept only for compatibility. - */ - attribute_deprecated - int side_data_only_packets; -#endif - /** * Audio only. The number of "priming" samples (padding) inserted by the * encoder at the beginning of the audio. I.e. this number of leading @@ -2183,6 +1822,7 @@ typedef struct AVCodecContext { unsigned properties; #define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004 /** * Additional data associated with the entire coded stream. @@ -2217,15 +1857,13 @@ typedef struct AVCodecContext { */ AVBufferRef *hw_frames_ctx; +#if FF_API_SUB_TEXT_FORMAT /** - * Control the form of AVSubtitle.rects[N]->ass - * - decoding: set by user - * - encoding: unused + * @deprecated unused */ + attribute_deprecated int sub_text_format; #define FF_SUB_TEXT_FMT_ASS 0 -#if FF_API_ASS_TIMING -#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 #endif /** @@ -2355,6 +1993,10 @@ typedef struct AVCodecContext { * This callback must use the above value to calculate the required buffer size, * which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes. * + * In some specific cases, the encoder may not use the entire buffer allocated by this + * callback. This will be reflected in the size value in the packet once returned by + * avcodec_receive_packet(). + * * This callback must fill the following fields in the packet: * - data: alignment requirements for AVPacket apply, if any. Some architectures and * encoders may benefit from having aligned data. @@ -2384,47 +2026,6 @@ typedef struct AVCodecContext { int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags); } AVCodecContext; -#if FF_API_CODEC_GET_SET -/** - * Accessors for some AVCodecContext fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); - -attribute_deprecated -const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); - -attribute_deprecated -unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); - -attribute_deprecated -int av_codec_get_lowres(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_lowres(AVCodecContext *avctx, int val); - -attribute_deprecated -int av_codec_get_seek_preroll(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); - -attribute_deprecated -uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); -#endif - -struct AVSubtitle; - -#if FF_API_CODEC_GET_SET -attribute_deprecated -int av_codec_get_max_lowres(const AVCodec *codec); -#endif - struct MpegEncContext; /** @@ -2637,33 +2238,6 @@ typedef struct AVHWAccel { * @} */ -#if FF_API_AVPICTURE -/** - * @defgroup lavc_picture AVPicture - * - * Functions for working with AVPicture - * @{ - */ - -/** - * Picture data structure. - * - * Up to four components can be stored into it, the last component is - * alpha. - * @deprecated use AVFrame or imgutils functions instead - */ -typedef struct AVPicture { - attribute_deprecated - uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes - attribute_deprecated - int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line -} AVPicture; - -/** - * @} - */ -#endif - enum AVSubtitleType { SUBTITLE_NONE, @@ -2691,13 +2265,6 @@ typedef struct AVSubtitleRect { int h; ///< height of pict, undefined when pict is not set int nb_colors; ///< number of colors in pict, undefined when pict is not set -#if FF_API_AVPICTURE - /** - * @deprecated unused - */ - attribute_deprecated - AVPicture pict; -#endif /** * data+linesize for the bitmap of this subtitle. * Can be set for text/ass as well once they are rendered. @@ -2728,16 +2295,6 @@ typedef struct AVSubtitle { int64_t pts; ///< Same as packet pts, in AV_TIME_BASE } AVSubtitle; -#if FF_API_NEXT -/** - * If c is NULL, returns the first registered codec, - * if c is non-NULL, returns the next registered codec after c, - * or NULL if c is the last one. - */ -attribute_deprecated -AVCodec *av_codec_next(const AVCodec *c); -#endif - /** * Return the LIBAVCODEC_VERSION_INT constant. */ @@ -2753,20 +2310,6 @@ const char *avcodec_configuration(void); */ const char *avcodec_license(void); -#if FF_API_NEXT -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register(AVCodec *codec); - -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register_all(void); -#endif - /** * Allocate an AVCodecContext and set its fields to default values. The * resulting struct should be freed with avcodec_free_context(). @@ -2788,15 +2331,6 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); */ void avcodec_free_context(AVCodecContext **avctx); -#if FF_API_GET_CONTEXT_DEFAULTS -/** - * @deprecated This function should not be used, as closing and opening a codec - * context multiple time is not supported. A new codec context should be - * allocated for each new use. - */ -int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); -#endif - /** * Get the AVClass for AVCodecContext. It can be used in combination with * AV_OPT_SEARCH_FAKE_OBJ for examining options. @@ -2821,28 +2355,6 @@ const AVClass *avcodec_get_frame_class(void); */ const AVClass *avcodec_get_subtitle_rect_class(void); -#if FF_API_COPY_CONTEXT -/** - * Copy the settings of the source AVCodecContext into the destination - * AVCodecContext. The resulting destination codec context will be - * unopened, i.e. you are required to call avcodec_open2() before you - * can use this AVCodecContext to decode/encode video/audio data. - * - * @param dest target codec context, should be initialized with - * avcodec_alloc_context3(NULL), but otherwise uninitialized - * @param src source codec context - * @return AVERROR() on error (e.g. memory allocation error), 0 on success - * - * @deprecated The semantics of this function are ill-defined and it should not - * be used. If you need to transfer the stream parameters from one codec context - * to another, use an intermediate AVCodecParameters instance and the - * avcodec_parameters_from_context() / avcodec_parameters_to_context() - * functions. - */ -attribute_deprecated -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#endif - /** * Fill the parameters struct based on the values from the supplied codec * context. Any allocated fields in par are freed and replaced with duplicates @@ -2989,115 +2501,6 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); */ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); -#if FF_API_OLD_ENCDEC -/** - * Decode the audio frame of size avpkt->size from avpkt->data into frame. - * - * Some decoders may support multiple frames in a single AVPacket. Such - * decoders would then just decode the first frame and the return value would be - * less than the packet size. In this case, avcodec_decode_audio4 has to be - * called again with an AVPacket containing the remaining data in order to - * decode the second frame, etc... Even if no frames are returned, the packet - * needs to be fed to the decoder with remaining data until it is completely - * consumed or an error occurs. - * - * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input - * and output. This means that for some packets they will not immediately - * produce decoded output and need to be flushed at the end of decoding to get - * all the decoded data. Flushing is done by calling this function with packets - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops - * returning samples. It is safe to flush even those decoders that are not - * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. - * - * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE - * larger than the actual read bytes because some optimized bitstream - * readers read 32 or 64 bits at once and could read over the end. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] frame The AVFrame in which to store decoded audio samples. - * The decoder will allocate a buffer for the decoded frame by - * calling the AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is - * non-zero. Note that this field being set to zero - * does not mean that an error has occurred. For - * decoders with AV_CODEC_CAP_DELAY set, no given decode - * call is guaranteed to produce a frame. - * @param[in] avpkt The input AVPacket containing the input buffer. - * At least avpkt->data and avpkt->size should be set. Some - * decoders might also require additional fields to be set. - * @return A negative error code is returned if an error occurred during - * decoding, otherwise the number of bytes consumed from the input - * AVPacket is returned. - * -* @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, - int *got_frame_ptr, const AVPacket *avpkt); - -/** - * Decode the video frame of size avpkt->size from avpkt->data into picture. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * - * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * Use av_frame_alloc() to get an AVFrame. The codec will - * allocate memory for the actual bitmap by calling the - * AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields like - * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least - * fields possible. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - * - * @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const AVPacket *avpkt); -#endif - /** * Decode a subtitle message. * Return a negative value on error, otherwise return the number of bytes used. @@ -3141,10 +2544,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * - * @warning Do not mix this API with the legacy API (like avcodec_decode_video2()) - * on the same AVCodecContext. It will return unexpected results now - * or in future libavcodec versions. - * * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() * before packets may be fed to the decoder. * @@ -3234,8 +2633,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); * the call will not fail with EAGAIN). * AVERROR_EOF: the encoder has been flushed, and no new frames can * be sent to it - * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a - * decoder, or requires flush + * AVERROR(EINVAL): codec not opened, it is a decoder, or requires flush * AVERROR(ENOMEM): failed to add packet to internal queue, or similar * other errors: legitimate encoding errors */ @@ -3376,7 +2774,7 @@ enum AVPictureStructure { typedef struct AVCodecParserContext { void *priv_data; - struct AVCodecParser *parser; + const struct AVCodecParser *parser; int64_t frame_offset; /* offset of the current frame */ int64_t cur_offset; /* current offset (incremented by each av_parser_parse()) */ @@ -3425,14 +2823,6 @@ typedef struct AVCodecParserContext { */ int key_frame; -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated unused - */ - attribute_deprecated - int64_t convergence_duration; -#endif - // Timestamp generation support: /** * Synchronization point for start of timestamp generation. @@ -3542,7 +2932,7 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ + int codec_ids[7]; /* several codec IDs are permitted */ int priv_data_size; int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that @@ -3553,10 +2943,6 @@ typedef struct AVCodecParser { const uint8_t *buf, int buf_size); void (*parser_close)(AVCodecParserContext *s); int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); -#if FF_API_NEXT - attribute_deprecated - struct AVCodecParser *next; -#endif } AVCodecParser; /** @@ -3570,13 +2956,6 @@ typedef struct AVCodecParser { */ const AVCodecParser *av_parser_iterate(void **opaque); -#if FF_API_NEXT -attribute_deprecated -AVCodecParser *av_parser_next(const AVCodecParser *c); - -attribute_deprecated -void av_register_codec_parser(AVCodecParser *parser); -#endif AVCodecParserContext *av_parser_init(int codec_id); /** @@ -3617,18 +2996,6 @@ int av_parser_parse2(AVCodecParserContext *s, int64_t pts, int64_t dts, int64_t pos); -#if FF_API_PARSER_CHANGE -/** - * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed - * @deprecated Use dump_extradata, remove_extra or extract_extradata - * bitstream filters instead. - */ -attribute_deprecated -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -#endif void av_parser_close(AVCodecParserContext *s); /** @@ -3641,95 +3008,6 @@ void av_parser_close(AVCodecParserContext *s); * @{ */ -#if FF_API_OLD_ENCDEC -/** - * Encode a frame of audio. - * - * Takes input samples from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay, split, and combine input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. If avpkt->data and - * avpkt->size are set, avpkt->destruct must also be set. All - * other AVPacket fields will be reset by the encoder using - * av_init_packet(). If avpkt->data is NULL, the encoder will - * allocate it. The encoder will set avpkt->size to the size - * of the output packet. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw audio data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame - * can have any number of samples. - * If it is not set, frame->nb_samples must be equal to - * avctx->frame_size for all frames except the last. - * The final frame may be smaller than avctx->frame_size. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); - -/** - * Encode a frame of video. - * - * Takes input raw video data from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay and reorder input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. All other AVPacket fields - * will be reset by the encoder using av_init_packet(). If - * avpkt->data is NULL, the encoder will allocate it. - * The encoder will set avpkt->size to the size of the - * output packet. The returned data (if any) belongs to the - * caller, he is responsible for freeing it. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw video data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); -#endif - int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub); @@ -3738,71 +3016,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ -#if FF_API_AVPICTURE -/** - * @addtogroup lavc_picture - * @{ - */ - -/** - * @deprecated unused - */ -attribute_deprecated -int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -void avpicture_free(AVPicture *picture); - -/** - * @deprecated use av_image_fill_arrays() instead. - */ -attribute_deprecated -int avpicture_fill(AVPicture *picture, const uint8_t *ptr, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated use av_image_copy_to_buffer() instead. - */ -attribute_deprecated -int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, - int width, int height, - unsigned char *dest, int dest_size); - -/** - * @deprecated use av_image_get_buffer_size() instead. - */ -attribute_deprecated -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated av_image_copy() instead. - */ -attribute_deprecated -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int top_band, int left_band); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -/** - * @} - */ -#endif - /** * @defgroup lavc_misc Utility functions * @ingroup libavc @@ -3819,15 +3032,6 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -#if FF_API_GETCHROMA -/** - * @deprecated Use av_pix_fmt_get_chroma_sub_sample - */ - -attribute_deprecated -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); -#endif - /** * Return a value representing the fourCC code associated to the * pixel format pix_fmt, or 0 if no associated fourCC code can be @@ -3856,71 +3060,14 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#if FF_API_AVCODEC_PIX_FMT -/** - * @deprecated see av_get_pix_fmt_loss() - */ -attribute_deprecated -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, - int has_alpha); -/** - * @deprecated see av_find_best_pix_fmt_of_2() - */ -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#endif - enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); /** * @} */ -#if FF_API_TAG_STRING -/** - * Put a string representing the codec tag codec_tag in buf. - * - * @param buf buffer to place codec tag in - * @param buf_size size in bytes of buf - * @param codec_tag codec tag to assign - * @return the length of the string that would have been generated if - * enough space had been available, excluding the trailing null - * - * @deprecated see av_fourcc_make_string() and av_fourcc2str(). - */ -attribute_deprecated -size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); -#endif - void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); -/** - * Return a name for the specified profile, if available. - * - * @param codec the codec that is searched for the given profile - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - */ -const char *av_get_profile_name(const AVCodec *codec, int profile); - -/** - * Return a name for the specified profile, if available. - * - * @param codec_id the ID of the codec to which the requested profile belongs - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - * - * @note unlike av_get_profile_name(), which searches a list of profiles - * supported by a specific decoder or encoder implementation, this - * function searches the list of profiles from the AVCodecDescriptor - */ -const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); - int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -3956,11 +3103,8 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, * Reset the internal codec state / flush internal buffers. Should be called * e.g. when seeking or when switching to a different stream. * - * @note for decoders, when refcounted frames are not used - * (i.e. avctx->refcounted_frames is 0), this invalidates the frames previously - * returned from the decoder. When refcounted frames are used, the decoder just - * releases any references it might keep internally, but the caller's reference - * remains valid. + * @note for decoders, this function just releases any references the decoder + * might keep internally, but the caller's references remain valid. * * @note for encoders, this function will only do something if the encoder * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder @@ -3971,32 +3115,6 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, */ void avcodec_flush_buffers(AVCodecContext *avctx); -/** - * Return codec bits per sample. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum AVCodecID codec_id); - -/** - * Return the PCM codec associated with a sample format. - * @param be endianness, 0 for little, 1 for big, - * -1 (or anything else) for native - * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE - */ -enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); - -/** - * Return codec bits per sample. - * Only return non-zero if the bits per sample is exactly correct, not an - * approximation. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_exact_bits_per_sample(enum AVCodecID codec_id); - /** * Return audio frame duration. * @@ -4007,69 +3125,6 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id); */ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); -/** - * This function is the same as av_get_audio_frame_duration(), except it works - * with AVCodecParameters instead of an AVCodecContext. - */ -int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); - -#if FF_API_OLD_BSF -typedef struct AVBitStreamFilterContext { - void *priv_data; - const struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; - /** - * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). - * Not for access by library users. - */ - char *args; -} AVBitStreamFilterContext; - -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -void av_register_bitstream_filter(AVBitStreamFilter *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init() - * from the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the - * new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); -#endif - -#if FF_API_NEXT -attribute_deprecated -const AVBitStreamFilter *av_bsf_next(void **opaque); -#endif - /* memory */ /** @@ -4087,96 +3142,12 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); */ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); -/** - * Encode extradata length to a buffer. Used by xiph codecs. - * - * @param s buffer to write to; must be at least (v/255+1) bytes long - * @param v size of extradata in bytes - * @return number of bytes written to the buffer. - */ -unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -#if FF_API_USER_VISIBLE_AVHWACCEL -/** - * Register the hardware accelerator hwaccel. - * - * @deprecated This function doesn't do anything. - */ -attribute_deprecated -void av_register_hwaccel(AVHWAccel *hwaccel); - -/** - * If hwaccel is NULL, returns the first registered hardware accelerator, - * if hwaccel is non-NULL, returns the next registered hardware accelerator - * after hwaccel, or NULL if hwaccel is the last one. - * - * @deprecated AVHWaccel structures contain no user-serviceable parts, so - * this function should not be used. - */ -attribute_deprecated -AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); -#endif - -#if FF_API_LOCKMGR -/** - * Lock operation used by lockmgr - * - * @deprecated Deprecated together with av_lockmgr_register(). - */ -enum AVLockOp { - AV_LOCK_CREATE, ///< Create a mutex - AV_LOCK_OBTAIN, ///< Lock the mutex - AV_LOCK_RELEASE, ///< Unlock the mutex - AV_LOCK_DESTROY, ///< Free mutex resources -}; - -/** - * Register a user provided lock manager supporting the operations - * specified by AVLockOp. The "mutex" argument to the function points - * to a (void *) where the lockmgr should store/get a pointer to a user - * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the - * value left by the last call for all other ops. If the lock manager is - * unable to perform the op then it should leave the mutex in the same - * state as when it was called and return a non-zero value. However, - * when called with AV_LOCK_DESTROY the mutex will always be assumed to - * have been successfully destroyed. If av_lockmgr_register succeeds - * it will return a non-negative value, if it fails it will return a - * negative value and destroy all mutex and unregister all callbacks. - * av_lockmgr_register is not thread-safe, it must be called from a - * single thread before any calls which make use of locking are used. - * - * @param cb User defined callback. av_lockmgr_register invokes calls - * to this callback and the previously registered callback. - * The callback will be used to create more than one mutex - * each of which must be backed by its own underlying locking - * mechanism (i.e. do not use a single static object to - * implement your lock manager). If cb is set to NULL the - * lockmgr will be unregistered. - * - * @deprecated This function does nothing, and always returns 0. Be sure to - * build with thread support to get basic thread safety. - */ -attribute_deprecated -int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); -#endif - /** * @return a positive value if s is open (i.e. avcodec_open2() was called on it * with no corresponding avcodec_close()), 0 otherwise. */ int avcodec_is_open(AVCodecContext *s); -/** - * Allocate a CPB properties structure and initialize its fields to default - * values. - * - * @param size if non-NULL, the size of the allocated struct will be written - * here. This is useful for embedding it in side data. - * - * @return the newly allocated struct or NULL on failure - */ -AVCPBProperties *av_cpb_properties_alloc(size_t *size); - /** * @} */ diff --git a/windows/include/arm64/libavcodec/bsf.h b/windows/include/arm64/libavcodec/bsf.h index 3b5faa8..8c5355d 100644 --- a/windows/include/arm64/libavcodec/bsf.h +++ b/windows/include/arm64/libavcodec/bsf.h @@ -34,8 +34,6 @@ * @{ */ -typedef struct AVBSFInternal AVBSFInternal; - /** * The bitstream filter state. * @@ -57,12 +55,6 @@ typedef struct AVBSFContext { */ const struct AVBitStreamFilter *filter; - /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - /** * Opaque filter-specific private data. If filter->priv_class is non-NULL, * this is an AVOptions-enabled struct. diff --git a/windows/include/arm64/libavcodec/codec.h b/windows/include/arm64/libavcodec/codec.h index 50a22f6..a8147ec 100644 --- a/windows/include/arm64/libavcodec/codec.h +++ b/windows/include/arm64/libavcodec/codec.h @@ -50,7 +50,12 @@ * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. */ #define AV_CODEC_CAP_DR1 (1 << 1) +#if FF_API_FLAG_TRUNCATED +/** + * @deprecated Use parsers to always send proper frames. + */ #define AV_CODEC_CAP_TRUNCATED (1 << 3) +#endif /** * Encoder or decoder requires flushing with NULL input at the end in order to * give the complete and correct output. @@ -214,12 +219,12 @@ typedef struct AVCodec { * see AV_CODEC_CAP_* */ int capabilities; + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder 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} @@ -242,10 +247,13 @@ typedef struct AVCodec { * New public fields should be added right above. ***************************************************************** */ + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; + int priv_data_size; -#if FF_API_NEXT - struct AVCodec *next; -#endif /** * @name Frame-level threading support functions * @{ @@ -258,6 +266,11 @@ typedef struct AVCodec { * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. */ int (*update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src); + + /** + * Copy variables back to the user-facing context + */ + int (*update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src); /** @} */ /** @@ -321,11 +334,6 @@ typedef struct AVCodec { * Will be called when seeking */ void (*flush)(struct AVCodecContext *); - /** - * Internal codec capabilities. - * See FF_CODEC_CAP_* in internal.h - */ - int caps_internal; /** * Decoding only, a comma-separated list of bitstream filters to apply to @@ -365,7 +373,7 @@ const AVCodec *av_codec_iterate(void **opaque); * @param id AVCodecID of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder(enum AVCodecID id); +const AVCodec *avcodec_find_decoder(enum AVCodecID id); /** * Find a registered decoder with the specified name. @@ -373,7 +381,7 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); * @param name name of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder_by_name(const char *name); +const AVCodec *avcodec_find_decoder_by_name(const char *name); /** * Find a registered encoder with a matching codec ID. @@ -381,7 +389,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); * @param id AVCodecID of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder(enum AVCodecID id); +const AVCodec *avcodec_find_encoder(enum AVCodecID id); /** * Find a registered encoder with the specified name. @@ -389,7 +397,7 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id); * @param name name of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder_by_name(const char *name); +const AVCodec *avcodec_find_encoder_by_name(const char *name); /** * @return a non-zero number if codec is an encoder, zero otherwise */ @@ -400,6 +408,15 @@ int av_codec_is_encoder(const AVCodec *codec); */ int av_codec_is_decoder(const AVCodec *codec); +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + enum { /** * The codec supports this format via the hw_device_ctx interface. diff --git a/windows/include/arm64/libavcodec/codec_id.h b/windows/include/arm64/libavcodec/codec_id.h index ab7bc68..ab265ec 100644 --- a/windows/include/arm64/libavcodec/codec_id.h +++ b/windows/include/arm64/libavcodec/codec_id.h @@ -22,6 +22,7 @@ #define AVCODEC_CODEC_ID_H #include "libavutil/avutil.h" +#include "libavutil/samplefmt.h" /** * @addtogroup lavc_core @@ -246,8 +247,7 @@ enum AVCodecID { AV_CODEC_ID_MSP2, AV_CODEC_ID_VVC, #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC - - AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_Y41P, AV_CODEC_ID_AVRP, AV_CODEC_ID_012V, AV_CODEC_ID_AVUI, @@ -307,6 +307,7 @@ enum AVCodecID { AV_CODEC_ID_CRI, AV_CODEC_ID_SIMBIOSIS_IMX, AV_CODEC_ID_SGA_VIDEO, + AV_CODEC_ID_GEM, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -341,8 +342,7 @@ enum AVCodecID { AV_CODEC_ID_PCM_S24LE_PLANAR, AV_CODEC_ID_PCM_S32LE_PLANAR, AV_CODEC_ID_PCM_S16BE_PLANAR, - - AV_CODEC_ID_PCM_S64LE = 0x10800, + AV_CODEC_ID_PCM_S64LE, AV_CODEC_ID_PCM_S64BE, AV_CODEC_ID_PCM_F16LE, AV_CODEC_ID_PCM_F24LE, @@ -381,8 +381,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, AV_CODEC_ID_ADPCM_VIMA, - - AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_AFC, AV_CODEC_ID_ADPCM_IMA_OKI, AV_CODEC_ID_ADPCM_DTK, AV_CODEC_ID_ADPCM_IMA_RAD, @@ -401,6 +400,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_IMA_MTF, AV_CODEC_ID_ADPCM_IMA_CUNNING, AV_CODEC_ID_ADPCM_IMA_MOFLEX, + AV_CODEC_ID_ADPCM_IMA_ACORN, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -415,8 +415,7 @@ enum AVCodecID { AV_CODEC_ID_INTERPLAY_DPCM, AV_CODEC_ID_XAN_DPCM, AV_CODEC_ID_SOL_DPCM, - - AV_CODEC_ID_SDX2_DPCM = 0x14800, + AV_CODEC_ID_SDX2_DPCM, AV_CODEC_ID_GREMLIN_DPCM, AV_CODEC_ID_DERF_DPCM, @@ -489,8 +488,7 @@ enum AVCodecID { AV_CODEC_ID_ON2AVC, AV_CODEC_ID_DSS_SP, AV_CODEC_ID_CODEC2, - - AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_FFWAVESYNTH, AV_CODEC_ID_SONIC, AV_CODEC_ID_SONIC_LS, AV_CODEC_ID_EVRC, @@ -517,6 +515,7 @@ enum AVCodecID { AV_CODEC_ID_SIREN, AV_CODEC_ID_HCA, AV_CODEC_ID_FASTAUDIO, + AV_CODEC_ID_MSNSIREN, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -529,8 +528,7 @@ enum AVCodecID { AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT, AV_CODEC_ID_SRT, - - AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_MICRODVD, AV_CODEC_ID_EIA_608, AV_CODEC_ID_JACOSUB, AV_CODEC_ID_SAMI, @@ -554,7 +552,7 @@ enum AVCodecID { AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. AV_CODEC_ID_EPG, - AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_BINTEXT, AV_CODEC_ID_XBIN, AV_CODEC_ID_IDF, AV_CODEC_ID_OTF, @@ -585,6 +583,45 @@ enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); */ const char *avcodec_get_name(enum AVCodecID id); +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + /** * @} */ diff --git a/windows/include/arm64/libavcodec/codec_par.h b/windows/include/arm64/libavcodec/codec_par.h index 948758e..10cf79d 100644 --- a/windows/include/arm64/libavcodec/codec_par.h +++ b/windows/include/arm64/libavcodec/codec_par.h @@ -221,6 +221,11 @@ void avcodec_parameters_free(AVCodecParameters **par); */ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); +/** + * This function is the same as av_get_audio_frame_duration(), except it works + * with AVCodecParameters instead of an AVCodecContext. + */ +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); /** * @} diff --git a/windows/include/arm64/libavcodec/defs.h b/windows/include/arm64/libavcodec/defs.h new file mode 100644 index 0000000..420a042 --- /dev/null +++ b/windows/include/arm64/libavcodec/defs.h @@ -0,0 +1,170 @@ +/* + * + * 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_DEFS_H +#define AVCODEC_DEFS_H + +/** + * @file + * @ingroup libavc + * Misc types and constants that do not belong anywhere else. + */ + +#include +#include + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define AV_INPUT_BUFFER_PADDING_SIZE 64 + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int64_t buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** + * This structure supplies correlation between a packet timestamp and a wall clock + * production time. The definition follows the Producer Reference Time ('prft') + * as defined in ISO/IEC 14496-12 + */ +typedef struct AVProducerReferenceTime { + /** + * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). + */ + int64_t wallclock; + int flags; +} AVProducerReferenceTime; + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#endif // AVCODEC_DEFS_H diff --git a/windows/include/arm64/libavcodec/dv_profile.h b/windows/include/arm64/libavcodec/dv_profile.h index 9380a66..4365f1b 100644 --- a/windows/include/arm64/libavcodec/dv_profile.h +++ b/windows/include/arm64/libavcodec/dv_profile.h @@ -23,7 +23,6 @@ #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "avcodec.h" /* minimum number of bytes to read from a DV stream in order to * determine the profile */ diff --git a/windows/include/arm64/libavcodec/packet.h b/windows/include/arm64/libavcodec/packet.h index ca18ae6..4a349fe 100644 --- a/windows/include/arm64/libavcodec/packet.h +++ b/windows/include/arm64/libavcodec/packet.h @@ -290,6 +290,14 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_S12M_TIMECODE, + /** + * HDR10+ dynamic metadata associated with a video frame. The metadata is in + * the form of the AVDynamicHDRPlus struct and contains + * information for color volume transform - application 4 of + * SMPTE 2094-40:2016 standard. + */ + AV_PKT_DATA_DYNAMIC_HDR10_PLUS, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may @@ -305,11 +313,7 @@ enum AVPacketSideDataType { typedef struct AVPacketSideData { uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif enum AVPacketSideDataType type; } AVPacketSideData; @@ -388,15 +392,29 @@ typedef struct AVPacket { int64_t pos; ///< byte position in stream, -1 if unknown -#if FF_API_CONVERGENCE_DURATION /** - * @deprecated Same as the duration field, but as int64_t. This was required - * for Matroska subtitles, whose duration values could overflow when the - * duration field was still an int. + * for some private data of the user */ - attribute_deprecated - int64_t convergence_duration; -#endif + void *opaque; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the packet is unreferenced. av_packet_copy_props() calls create a new + * reference with av_buffer_ref() for the target packet's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * Time base of the packet's timestamps. + * In the future, this field may be set on packets output by encoders or + * demuxers, but its value will be by default ignored on input to decoders + * or muxers. + */ + AVRational time_base; } AVPacket; #if FF_API_INIT_PACKET @@ -529,45 +547,6 @@ int av_grow_packet(AVPacket *pkt, int grow_by); */ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); -#if FF_API_AVPACKET_OLD_API -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated. - * - * @deprecated Use av_packet_ref or av_packet_make_refcounted - */ -attribute_deprecated -int av_dup_packet(AVPacket *pkt); -/** - * Copy packet, including contents - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_ref - */ -attribute_deprecated -int av_copy_packet(AVPacket *dst, const AVPacket *src); - -/** - * Copy packet side data - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_copy_props - */ -attribute_deprecated -int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); - -/** - * Free a packet. - * - * @deprecated Use av_packet_unref - * - * @param pkt packet to free - */ -attribute_deprecated -void av_free_packet(AVPacket *pkt); -#endif /** * Allocate new information of a packet. * @@ -577,11 +556,7 @@ void av_free_packet(AVPacket *pkt); * @return pointer to fresh allocated data or NULL otherwise */ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Wrap an existing array as a packet side data. @@ -608,11 +583,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return 0 on success, < 0 on failure */ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Get side information from packet. @@ -624,19 +595,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return pointer to data if present or NULL otherwise */ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int *size); -#else size_t *size); -#endif - -#if FF_API_MERGE_SD_API -attribute_deprecated -int av_packet_merge_side_data(AVPacket *pkt); - -attribute_deprecated -int av_packet_split_side_data(AVPacket *pkt); -#endif const char *av_packet_side_data_name(enum AVPacketSideDataType type); @@ -647,11 +606,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type); * @param size pointer to store the size of the returned data * @return pointer to data if successful, NULL otherwise */ -#if FF_API_BUFFER_SIZE_T -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); -#else uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); -#endif /** * Unpack a dictionary from side_data. * @@ -660,12 +615,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); * @param dict the metadata storage dictionary * @return 0 on success, < 0 on failure */ -#if FF_API_BUFFER_SIZE_T -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); -#else int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict); -#endif /** * Convenience function to free all the side data stored. diff --git a/windows/include/arm64/libavcodec/vaapi.h b/windows/include/arm64/libavcodec/vaapi.h deleted file mode 100644 index 2cf7da5..0000000 --- a/windows/include/arm64/libavcodec/vaapi.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Video Acceleration API (shared data between FFmpeg and the video player) - * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 - * - * Copyright (C) 2008-2009 Splitted-Desktop Systems - * - * 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_VAAPI_H -#define AVCODEC_VAAPI_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vaapi - * Public libavcodec VA API header. - */ - -#include -#include "libavutil/attributes.h" -#include "version.h" - -#if FF_API_STRUCT_VAAPI_CONTEXT - -/** - * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding - * @ingroup lavc_codec_hwaccel - * @{ - */ - -/** - * This structure is used to share data between the FFmpeg library and - * the client video application. - * This shall be zero-allocated and available as - * AVCodecContext.hwaccel_context. All user members can be set once - * during initialization or through each AVCodecContext.get_buffer() - * function call. In any case, they must be valid prior to calling - * decoding functions. - * - * Deprecated: use AVCodecContext.hw_frames_ctx instead. - */ -struct attribute_deprecated vaapi_context { - /** - * Window system dependent data - * - * - encoding: unused - * - decoding: Set by user - */ - void *display; - - /** - * Configuration ID - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t config_id; - - /** - * Context ID (video decode pipeline) - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t context_id; -}; - -/* @} */ - -#endif /* FF_API_STRUCT_VAAPI_CONTEXT */ - -#endif /* AVCODEC_VAAPI_H */ diff --git a/windows/include/arm64/libavcodec/vdpau.h b/windows/include/arm64/libavcodec/vdpau.h index 4d99943..3010094 100644 --- a/windows/include/arm64/libavcodec/vdpau.h +++ b/windows/include/arm64/libavcodec/vdpau.h @@ -55,7 +55,6 @@ #include "libavutil/attributes.h" #include "avcodec.h" -#include "version.h" struct AVCodecContext; struct AVFrame; @@ -153,24 +152,6 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, */ AVVDPAUContext *av_vdpau_alloc_context(void); -#if FF_API_VDPAU_PROFILE -/** - * Get a decoder profile that should be used for initializing a VDPAU decoder. - * Should be called from the AVCodecContext.get_format() callback. - * - * @deprecated Use av_vdpau_bind_context() instead. - * - * @param avctx the codec context being used for decoding the stream - * @param profile a pointer into which the result will be written on success. - * The contents of profile are undefined if this function returns - * an error. - * - * @return 0 on success (non-negative), a negative AVERROR on failure. - */ -attribute_deprecated -int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); -#endif - /* @}*/ #endif /* AVCODEC_VDPAU_H */ diff --git a/windows/include/arm64/libavcodec/version.h b/windows/include/arm64/libavcodec/version.h index cfdde46..4d77431 100644 --- a/windows/include/arm64/libavcodec/version.h +++ b/windows/include/arm64/libavcodec/version.h @@ -27,8 +27,8 @@ #include "libavutil/version.h" -#define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 134 +#define LIBAVCODEC_VERSION_MAJOR 59 +#define LIBAVCODEC_VERSION_MINOR 18 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -51,122 +51,17 @@ * at once through the bump. This improves the git bisect-ability of the change. */ -#ifndef FF_API_AVCTX_TIMEBASE -#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODED_FRAME -#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_SIDEDATA_ONLY_PKT -#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VDPAU_PROFILE -#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CONVERGENCE_DURATION -#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPICTURE -#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPACKET_OLD_API -#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_RTP_CALLBACK -#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VBV_DELAY -#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODER_TYPE -#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STAT_BITS -#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PRIVATE_OPT -#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_ASS_TIMING -#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_BSF -#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_COPY_CONTEXT -#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GET_CONTEXT_DEFAULTS -#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NVENC_OLD_NAME -#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STRUCT_VAAPI_CONTEXT -#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MERGE_SD_API -#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_TAG_STRING -#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GETCHROMA -#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODEC_GET_SET -#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_USER_VISIBLE_AVHWACCEL -#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_LOCKMGR -#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NEXT -#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNSANITIZED_BITRATES -#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_SLICE_MODE -#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_CABAC -#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNUSED_CODEC_CAPS -#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPRIV_PUT_BITS -#define FF_API_AVPRIV_PUT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_ENCDEC -#define FF_API_OLD_ENCDEC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVCODEC_PIX_FMT -#define FF_API_AVCODEC_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MPV_RC_STRATEGY -#define FF_API_MPV_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PARSER_CHANGE -#define FF_API_PARSER_CHANGE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_THREAD_SAFE_CALLBACKS +#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_GET_FRAME_CLASS #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_AUTO_THREADS #define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_INIT_PACKET #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) -#endif +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_MPEGVIDEO_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_H */ diff --git a/windows/include/arm64/libavutil/adler32.h b/windows/include/arm64/libavutil/adler32.h index e7a8f83..232d07f 100644 --- a/windows/include/arm64/libavutil/adler32.h +++ b/windows/include/arm64/libavutil/adler32.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_adler32 Adler-32 @@ -40,11 +39,7 @@ * @{ */ -#if FF_API_CRYPTO_SIZE_T -typedef unsigned long AVAdler; -#else typedef uint32_t AVAdler; -#endif /** * Calculate the Adler32 checksum of a buffer. @@ -59,11 +54,7 @@ typedef uint32_t AVAdler; * @return updated checksum */ AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, -#if FF_API_CRYPTO_SIZE_T - unsigned int len) av_pure; -#else size_t len) av_pure; -#endif /** * @} diff --git a/windows/include/arm64/libavutil/aes.h b/windows/include/arm64/libavutil/aes.h index 09efbda..d243286 100644 --- a/windows/include/arm64/libavutil/aes.h +++ b/windows/include/arm64/libavutil/aes.h @@ -24,7 +24,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_aes AES diff --git a/windows/include/arm64/libavutil/aes_ctr.h b/windows/include/arm64/libavutil/aes_ctr.h index e4aae12..4e9fda7 100644 --- a/windows/include/arm64/libavutil/aes_ctr.h +++ b/windows/include/arm64/libavutil/aes_ctr.h @@ -25,7 +25,6 @@ #include #include "attributes.h" -#include "version.h" #define AES_CTR_KEY_SIZE (16) #define AES_CTR_IV_SIZE (8) diff --git a/windows/include/arm64/libavutil/buffer.h b/windows/include/arm64/libavutil/buffer.h index 241a80e..e1ef5b7 100644 --- a/windows/include/arm64/libavutil/buffer.h +++ b/windows/include/arm64/libavutil/buffer.h @@ -28,8 +28,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_buffer AVBuffer * @ingroup lavu_data @@ -93,11 +91,7 @@ typedef struct AVBufferRef { /** * Size of data in bytes. */ -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif } AVBufferRef; /** @@ -105,21 +99,13 @@ typedef struct AVBufferRef { * * @return an AVBufferRef of given size or NULL when out of memory */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_alloc(int size); -#else AVBufferRef *av_buffer_alloc(size_t size); -#endif /** * Same as av_buffer_alloc(), except the returned buffer will be initialized * to zero. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_allocz(int size); -#else AVBufferRef *av_buffer_allocz(size_t size); -#endif /** * Always treat the buffer as read-only, even when it has only one @@ -142,11 +128,7 @@ AVBufferRef *av_buffer_allocz(size_t size); * * @return an AVBufferRef referring to data on success, NULL on failure. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_create(uint8_t *data, int size, -#else AVBufferRef *av_buffer_create(uint8_t *data, size_t size, -#endif void (*free)(void *opaque, uint8_t *data), void *opaque, int flags); @@ -163,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on * failure. */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); /** * Free a given reference and automatically free the buffer if there are no more @@ -214,11 +196,7 @@ int av_buffer_make_writable(AVBufferRef **buf); * reference to it (i.e. the one passed to this function). In all other cases * a new buffer is allocated and the data is copied. */ -#if FF_API_BUFFER_SIZE_T -int av_buffer_realloc(AVBufferRef **buf, int size); -#else int av_buffer_realloc(AVBufferRef **buf, size_t size); -#endif /** * Ensure dst refers to the same data as src. @@ -234,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); * @return 0 on success * AVERROR(ENOMEM) on memory allocation failure. */ -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); /** * @} @@ -285,11 +263,7 @@ typedef struct AVBufferPool AVBufferPool; * (av_buffer_alloc()). * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); -#else AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size)); -#endif /** * Allocate and initialize a buffer pool with a more complex allocator. @@ -306,13 +280,8 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size * data. May be NULL. * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), -#else AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, AVBufferRef* (*alloc)(void *opaque, size_t size), -#endif void (*pool_free)(void *opaque)); /** @@ -344,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); * therefore you have to use this function to access the original opaque * parameter of an allocated buffer. */ -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); /** * @} diff --git a/windows/include/arm64/libavutil/common.h b/windows/include/arm64/libavutil/common.h index aee353d..3eb9bc5 100644 --- a/windows/include/arm64/libavutil/common.h +++ b/windows/include/arm64/libavutil/common.h @@ -42,13 +42,6 @@ #include "attributes.h" #include "macros.h" #include "version.h" -#include "libavutil/avconfig.h" - -#if AV_HAVE_BIGENDIAN -# define AV_NE(be, le) (be) -#else -# define AV_NE(be, le) (le) -#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -89,25 +82,6 @@ #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) -/** - * Comparator. - * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 - * if x == y. This is useful for instance in a qsort comparator callback. - * Furthermore, compilers are able to optimize this to branchless code, and - * there is no risk of overflow with signed types. - * As with many macros, this evaluates its argument multiple times, it thus - * must not have a side-effect. - */ -#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) - /* misc math functions */ #ifdef HAVE_AV_CONFIG_H @@ -405,6 +379,8 @@ static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) { /** * Clip a float value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -415,13 +391,13 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** * Clip a double value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -432,9 +408,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** Compute ceil(log2(x)). @@ -475,9 +449,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v) return av_popcount(v) & 1; } -#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) -#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) - /** * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. * diff --git a/windows/include/arm64/libavutil/cpu.h b/windows/include/arm64/libavutil/cpu.h index 83099dd..ce9bf14 100644 --- a/windows/include/arm64/libavutil/cpu.h +++ b/windows/include/arm64/libavutil/cpu.h @@ -23,8 +23,6 @@ #include -#include "attributes.h" - #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ /* lower 16 bits - CPU features */ @@ -56,6 +54,7 @@ #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers. #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 @@ -74,6 +73,10 @@ #define AV_CPU_FLAG_MMI (1 << 0) #define AV_CPU_FLAG_MSA (1 << 1) +//Loongarch SIMD extension. +#define AV_CPU_FLAG_LSX (1 << 0) +#define AV_CPU_FLAG_LASX (1 << 1) + /** * Return the flags which specify extensions supported by the CPU. * The returned value is affected by av_force_cpu_flags() if that was used @@ -88,25 +91,6 @@ int av_get_cpu_flags(void); */ void av_force_cpu_flags(int flags); -/** - * Set a mask on flags returned by av_get_cpu_flags(). - * This function is mainly useful for testing. - * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible - */ -attribute_deprecated void av_set_cpu_flags_mask(int mask); - -/** - * Parse CPU flags from a string. - * - * The returned flags contain the specified flags as well as related unspecified flags. - * - * This function exists only for compatibility with libav. - * Please use av_parse_cpu_caps() when possible. - * @return a combination of AV_CPU_* flags, negative on error. - */ -attribute_deprecated -int av_parse_cpu_flags(const char *s); - /** * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. * @@ -119,6 +103,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s); */ int av_cpu_count(void); +/** + * Overrides cpu count detection and forces the specified count. + * Count < 1 disables forcing of specific count. + */ +void av_cpu_force_count(int count); + /** * Get the maximum data alignment that may be required by FFmpeg. * diff --git a/windows/include/arm64/libavutil/crc.h b/windows/include/arm64/libavutil/crc.h index 47e22b4..24a2e3c 100644 --- a/windows/include/arm64/libavutil/crc.h +++ b/windows/include/arm64/libavutil/crc.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_crc32 CRC diff --git a/windows/include/arm64/libavutil/detection_bbox.h b/windows/include/arm64/libavutil/detection_bbox.h new file mode 100644 index 0000000..c20c204 --- /dev/null +++ b/windows/include/arm64/libavutil/detection_bbox.h @@ -0,0 +1,107 @@ +/* + * 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 AVUTIL_DETECTION_BBOX_H +#define AVUTIL_DETECTION_BBOX_H + +#include "rational.h" +#include "avassert.h" +#include "frame.h" + +typedef struct AVDetectionBBox { + /** + * Distance in pixels from the left/top edge of the frame, + * together with width and height, defining the bounding box. + */ + int x; + int y; + int w; + int h; + +#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64 + + /** + * Detect result with confidence + */ + char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational detect_confidence; + + /** + * At most 4 classifications based on the detected bounding box. + * For example, we can get max 4 different attributes with 4 different + * DNN models on one bounding box. + * classify_count is zero if no classification. + */ +#define AV_NUM_DETECTION_BBOX_CLASSIFY 4 + uint32_t classify_count; + char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY]; +} AVDetectionBBox; + +typedef struct AVDetectionBBoxHeader { + /** + * Information about how the bounding box is generated. + * for example, the DNN model name. + */ + char source[256]; + + /** + * Number of bounding boxes in the array. + */ + uint32_t nb_bboxes; + + /** + * Offset in bytes from the beginning of this structure at which + * the array of bounding boxes starts. + */ + size_t bboxes_offset; + + /** + * Size of each bounding box in bytes. + */ + size_t bbox_size; +} AVDetectionBBoxHeader; + +/* + * Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes. + */ +static av_always_inline AVDetectionBBox * +av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx) +{ + av_assert0(idx < header->nb_bboxes); + return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset + + idx * header->bbox_size); +} + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, and initializes the variables. + * Can be freed with a normal av_free() call. + * + * @param out_size if non-NULL, the size in bytes of the resulting data array is + * written here. + */ +AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size); + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type + * AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables. + */ +AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes); +#endif diff --git a/windows/include/arm64/libavutil/dict.h b/windows/include/arm64/libavutil/dict.h index 118f1f0..0d1afc6 100644 --- a/windows/include/arm64/libavutil/dict.h +++ b/windows/include/arm64/libavutil/dict.h @@ -32,8 +32,6 @@ #include -#include "version.h" - /** * @addtogroup lavu_dict AVDictionary * @ingroup lavu_data diff --git a/windows/include/arm64/libavutil/display.h b/windows/include/arm64/libavutil/display.h index 515adad..d87bf68 100644 --- a/windows/include/arm64/libavutil/display.h +++ b/windows/include/arm64/libavutil/display.h @@ -88,7 +88,7 @@ double av_display_rotation_get(const int32_t matrix[9]); /** - * Initialize a transformation matrix describing a pure counterclockwise + * Initialize a transformation matrix describing a pure clockwise * rotation by the specified angle (in degrees). * * @param matrix an allocated transformation matrix (will be fully overwritten diff --git a/windows/include/arm64/libavutil/dovi_meta.h b/windows/include/arm64/libavutil/dovi_meta.h index 299911d..3d11e02 100644 --- a/windows/include/arm64/libavutil/dovi_meta.h +++ b/windows/include/arm64/libavutil/dovi_meta.h @@ -29,6 +29,7 @@ #include #include +#include "rational.h" /* * DOVI configuration @@ -67,4 +68,169 @@ typedef struct AVDOVIDecoderConfigurationRecord { */ AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size); +/** + * Dolby Vision RPU data header. + * + * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI. + */ +typedef struct AVDOVIRpuDataHeader { + uint8_t rpu_type; + uint16_t rpu_format; + uint8_t vdr_rpu_profile; + uint8_t vdr_rpu_level; + uint8_t chroma_resampling_explicit_filter_flag; + uint8_t coef_data_type; /* informative, lavc always converts to fixed */ + uint8_t coef_log2_denom; + uint8_t vdr_rpu_normalized_idc; + uint8_t bl_video_full_range_flag; + uint8_t bl_bit_depth; /* [8, 16] */ + uint8_t el_bit_depth; /* [8, 16] */ + uint8_t vdr_bit_depth; /* [8, 16] */ + uint8_t spatial_resampling_filter_flag; + uint8_t el_spatial_resampling_filter_flag; + uint8_t disable_residual_flag; +} AVDOVIRpuDataHeader; + +enum AVDOVIMappingMethod { + AV_DOVI_MAPPING_POLYNOMIAL = 0, + AV_DOVI_MAPPING_MMR = 1, +}; + +/** + * Coefficients of a piece-wise function. The pieces of the function span the + * value ranges between two adjacent pivot values. + */ +#define AV_DOVI_MAX_PIECES 8 +typedef struct AVDOVIReshapingCurve { + uint8_t num_pivots; /* [2, 9] */ + uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */ + enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]; + /* AV_DOVI_MAPPING_POLYNOMIAL */ + uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */ + int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */ + /* AV_DOVI_MAPPING_MMR */ + uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */ + int64_t mmr_constant[AV_DOVI_MAX_PIECES]; + int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7]; +} AVDOVIReshapingCurve; + +enum AVDOVINLQMethod { + AV_DOVI_NLQ_NONE = -1, + AV_DOVI_NLQ_LINEAR_DZ = 0, +}; + +/** + * Coefficients of the non-linear inverse quantization. For the interpretation + * of these, see ETSI GS CCM 001. + */ +typedef struct AVDOVINLQParams { + uint16_t nlq_offset; + uint64_t vdr_in_max; + /* AV_DOVI_NLQ_LINEAR_DZ */ + uint64_t linear_deadzone_slope; + uint64_t linear_deadzone_threshold; +} AVDOVINLQParams; + +/** + * Dolby Vision RPU data mapping parameters. + * + * @note sizeof(AVDOVIDataMapping) is not part of the public ABI. + */ +typedef struct AVDOVIDataMapping { + uint8_t vdr_rpu_id; + uint8_t mapping_color_space; + uint8_t mapping_chroma_format_idc; + AVDOVIReshapingCurve curves[3]; /* per component */ + + /* Non-linear inverse quantization */ + enum AVDOVINLQMethod nlq_method_idc; + uint32_t num_x_partitions; + uint32_t num_y_partitions; + AVDOVINLQParams nlq[3]; /* per component */ +} AVDOVIDataMapping; + +/** + * Dolby Vision RPU colorspace metadata parameters. + * + * @note sizeof(AVDOVIColorMetadata) is not part of the public ABI. + */ +typedef struct AVDOVIColorMetadata { + uint8_t dm_metadata_id; + uint8_t scene_refresh_flag; + + /** + * Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be + * used instead of the matrices indicated by the frame's colorspace tags. + * The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB + * matrix based on a Hunt-Pointer-Estevez transform, but without any + * crosstalk. (See the definition of the ICtCp colorspace for more + * information.) + */ + AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */ + AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */ + AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */ + + /** + * Extra signal metadata (see Dolby patents for more info). + */ + uint16_t signal_eotf; + uint16_t signal_eotf_param0; + uint16_t signal_eotf_param1; + uint32_t signal_eotf_param2; + uint8_t signal_bit_depth; + uint8_t signal_color_space; + uint8_t signal_chroma_format; + uint8_t signal_full_range_flag; /* [0, 3] */ + uint16_t source_min_pq; + uint16_t source_max_pq; + uint16_t source_diagonal; +} AVDOVIColorMetadata; + +/** + * Combined struct representing a combination of header, mapping and color + * metadata, for attaching to frames as side data. + * + * @note The struct must be allocated with av_dovi_metadata_alloc() and + * its size is not a part of the public ABI. + */ + +typedef struct AVDOVIMetadata { + /** + * Offset in bytes from the beginning of this structure at which the + * respective structs start. + */ + size_t header_offset; /* AVDOVIRpuDataHeader */ + size_t mapping_offset; /* AVDOVIDataMapping */ + size_t color_offset; /* AVDOVIColorMetadata */ +} AVDOVIMetadata; + +static av_always_inline AVDOVIRpuDataHeader * +av_dovi_get_header(const AVDOVIMetadata *data) +{ + return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset); +} + +static av_always_inline AVDOVIDataMapping * +av_dovi_get_mapping(const AVDOVIMetadata *data) +{ + return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset); +} + +static av_always_inline AVDOVIColorMetadata * +av_dovi_get_color(const AVDOVIMetadata *data) +{ + return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset); +} + +/** + * Allocate an AVDOVIMetadata structure and initialize its + * fields to default values. + * + * @param size If this parameter is non-NULL, the size in bytes of the + * allocated struct will be written here on success + * + * @return the newly allocated struct or NULL on failure + */ +AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size); + #endif /* AVUTIL_DOVI_META_H */ diff --git a/windows/include/arm64/libavutil/error.h b/windows/include/arm64/libavutil/error.h index 71df4da..0d3269a 100644 --- a/windows/include/arm64/libavutil/error.h +++ b/windows/include/arm64/libavutil/error.h @@ -27,6 +27,8 @@ #include #include +#include "macros.h" + /** * @addtogroup lavu_error * diff --git a/windows/include/arm64/libavutil/ffversion.h b/windows/include/arm64/libavutil/ffversion.h index c2b610f..cb3926a 100644 --- a/windows/include/arm64/libavutil/ffversion.h +++ b/windows/include/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "n4.4.1" +#define FFMPEG_VERSION "n5.0" #endif /* AVUTIL_FFVERSION_H */ diff --git a/windows/include/arm64/libavutil/film_grain_params.h b/windows/include/arm64/libavutil/film_grain_params.h index 7629e3a..f3bd0a4 100644 --- a/windows/include/arm64/libavutil/film_grain_params.h +++ b/windows/include/arm64/libavutil/film_grain_params.h @@ -28,6 +28,11 @@ enum AVFilmGrainParamsType { * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom) */ AV_FILM_GRAIN_PARAMS_AV1, + + /** + * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274) + */ + AV_FILM_GRAIN_PARAMS_H274, }; /** @@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams { int limit_output_range; } AVFilmGrainAOMParams; +/** + * This structure describes how to handle film grain synthesis for codecs using + * the ITU-T H.274 Versatile suplemental enhancement information message. + * + * @note The struct must be allocated as part of AVFilmGrainParams using + * av_film_grain_params_alloc(). Its size is not a part of the public ABI. + */ +typedef struct AVFilmGrainH274Params { + /** + * Specifies the film grain simulation mode. + * 0 = Frequency filtering, 1 = Auto-regression + */ + int model_id; + + /** + * Specifies the bit depth used for the luma component. + */ + int bit_depth_luma; + + /** + * Specifies the bit depth used for the chroma components. + */ + int bit_depth_chroma; + + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + + /** + * Specifies the blending mode used to blend the simulated film grain + * with the decoded images. + * + * 0 = Additive, 1 = Multiplicative + */ + int blending_mode_id; + + /** + * Specifies a scale factor used in the film grain characterization equations. + */ + int log2_scale_factor; + + /** + * Indicates if the modelling of film grain for a given component is present. + */ + int component_model_present[3 /* y, cb, cr */]; + + /** + * Specifies the number of intensity intervals for which a specific set of + * model values has been estimated, with a range of [1, 256]. + */ + uint16_t num_intensity_intervals[3 /* y, cb, cr */]; + + /** + * Specifies the number of model values present for each intensity interval + * in which the film grain has been modelled, with a range of [1, 6]. + */ + uint8_t num_model_values[3 /* y, cb, cr */]; + + /** + * Specifies the lower ounds of each intensity interval for whichthe set of + * model values applies for the component. + */ + uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the upper bound of each intensity interval for which the set of + * model values applies for the component. + */ + uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the model values for the component for each intensity interval. + * - When model_id == 0, the following applies: + * For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1] + * For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1] + * - Otherwise, the following applies: + * For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1] + * For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1] + */ + int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */]; +} AVFilmGrainH274Params; + /** * This structure describes how to handle film grain synthesis in video * for specific codecs. Must be present on every frame where film grain is @@ -133,6 +221,9 @@ typedef struct AVFilmGrainParams { /** * Seed to use for the synthesis process, if the codec allows for it. + * + * @note For H.264, this refers to `pic_offset` as defined in + * SMPTE RDD 5-2006. */ uint64_t seed; @@ -143,6 +234,7 @@ typedef struct AVFilmGrainParams { */ union { AVFilmGrainAOMParams aom; + AVFilmGrainH274Params h274; } codec; } AVFilmGrainParams; diff --git a/windows/include/arm64/libavutil/frame.h b/windows/include/arm64/libavutil/frame.h index 7d1f8e2..18e239f 100644 --- a/windows/include/arm64/libavutil/frame.h +++ b/windows/include/arm64/libavutil/frame.h @@ -142,23 +142,6 @@ enum AVFrameSideDataType { */ AV_FRAME_DATA_ICC_PROFILE, -#if FF_API_FRAME_QP - /** - * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA. - * The contents of this side data are undocumented and internal; use - * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a - * meaningful way instead. - */ - AV_FRAME_DATA_QP_TABLE_PROPERTIES, - - /** - * Raw QP table data. Its format is described by - * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and - * av_frame_get_qp_table() to access this instead. - */ - AV_FRAME_DATA_QP_TABLE_DATA, -#endif - /** * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t * where the first uint32_t describes how many (1-3) of the other timecodes are used. @@ -198,6 +181,26 @@ enum AVFrameSideDataType { * Must be present for every frame which should have film grain applied. */ AV_FRAME_DATA_FILM_GRAIN_PARAMS, + + /** + * Bounding boxes for object detection and classification, + * as described by AVDetectionBBoxHeader. + */ + AV_FRAME_DATA_DETECTION_BBOXES, + + /** + * Dolby Vision RPU raw data, suitable for passing to x265 + * or other libraries. Array of uint8_t, with NAL emulation + * bytes intact. + */ + AV_FRAME_DATA_DOVI_RPU_BUFFER, + + /** + * Parsed Dolby Vision metadata, suitable for passing to a software + * implementation. The payload is the AVDOVIMetadata struct defined in + * libavutil/dovi_meta.h. + */ + AV_FRAME_DATA_DOVI_METADATA, }; enum AVActiveFormatDescription { @@ -220,11 +223,7 @@ enum AVActiveFormatDescription { typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif AVDictionary *metadata; AVBufferRef *buf; } AVFrameSideData; @@ -319,21 +318,32 @@ typedef struct AVFrame { #define AV_NUM_DATA_POINTERS 8 /** * pointer to the picture/channel planes. - * This might be different from the first allocated byte + * This might be different from the first allocated byte. For video, + * it could even point to the end of the image data. + * + * All pointers in data and extended_data must point into one of the + * AVBufferRef in buf or extended_buf. * * Some decoders access areas outside 0,0 - width,height, please * see avcodec_align_dimensions2(). Some filters and swscale can read * up to 16 bytes beyond the planes, if these filters are to be used, * then 16 extra bytes must be allocated. * - * NOTE: Except for hwaccel formats, pointers not needed by the format - * MUST be set to NULL. + * NOTE: Pointers not needed by the format MUST be set to NULL. + * + * @attention In case of video, the data[] pointers can point to the + * end of image data in order to reverse line order, when used in + * combination with negative values in the linesize[] array. */ uint8_t *data[AV_NUM_DATA_POINTERS]; /** - * For video, size in bytes of each picture line. - * For audio, size in bytes of each plane. + * For video, a positive or negative value, which is typically indicating + * the size in bytes of each picture line, but it can also be: + * - the negative byte size of lines for vertical flipping + * (with data[n] pointing to the end of the data + * - a positive or negative multiple of the byte size as for accessing + * even and odd fields of a frame (possibly flipped) * * For audio, only linesize[0] may be set. For planar audio, each channel * plane must be the same size. @@ -345,6 +355,9 @@ typedef struct AVFrame { * * @note The linesize may be larger than the size of usable data -- there * may be extra padding present for performance reasons. + * + * @attention In case of video, line size values can be negative to achieve + * a vertically inverted iteration over image lines. */ int linesize[AV_NUM_DATA_POINTERS]; @@ -410,15 +423,6 @@ typedef struct AVFrame { */ int64_t pts; -#if FF_API_PKT_PTS - /** - * PTS copied from the AVPacket that was decoded to produce this frame. - * @deprecated use the pts field instead - */ - attribute_deprecated - int64_t pkt_pts; -#endif - /** * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) * This is also the Presentation time of this AVFrame calculated from @@ -426,6 +430,14 @@ typedef struct AVFrame { */ int64_t pkt_dts; + /** + * Time base for the timestamps in this frame. + * In the future, this field may be set on frames output by decoders or + * filters, but its value will be by default ignored on input to encoders + * or filters. + */ + AVRational time_base; + /** * picture number in bitstream order */ @@ -445,14 +457,6 @@ typedef struct AVFrame { */ void *opaque; -#if FF_API_ERROR_FRAME - /** - * @deprecated unused - */ - attribute_deprecated - uint64_t error[AV_NUM_DATA_POINTERS]; -#endif - /** * When decoding, this signals how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps) @@ -495,10 +499,10 @@ typedef struct AVFrame { uint64_t channel_layout; /** - * AVBuffer references backing the data for this frame. If all elements of - * this array are NULL, then this frame is not reference counted. This array - * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must - * also be non-NULL for all j < i. + * 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 + * extended_buf. This array must be filled contiguously -- if buf[i] is + * non-NULL then buf[j] must also be non-NULL for all j < i. * * There may be at most one AVBuffer per data plane, so for video this array * always contains all the references. For planar audio with more than @@ -632,24 +636,6 @@ typedef struct AVFrame { */ int pkt_size; -#if FF_API_FRAME_QP - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - attribute_deprecated - AVBufferRef *qp_table_buf; -#endif /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. @@ -697,69 +683,16 @@ typedef struct AVFrame { AVBufferRef *private_ref; } AVFrame; -#if FF_API_FRAME_GET_SET -/** - * Accessors for some AVFrame fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); -attribute_deprecated -void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_duration (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_pos (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_channel_layout (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channel_layout (AVFrame *frame, int64_t val); -attribute_deprecated -int av_frame_get_channels (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channels (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_sample_rate (const AVFrame *frame); -attribute_deprecated -void av_frame_set_sample_rate (AVFrame *frame, int val); -attribute_deprecated -AVDictionary *av_frame_get_metadata (const AVFrame *frame); -attribute_deprecated -void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); -attribute_deprecated -int av_frame_get_decode_error_flags (const AVFrame *frame); -attribute_deprecated -void av_frame_set_decode_error_flags (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_pkt_size(const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_size(AVFrame *frame, int val); -#if FF_API_FRAME_QP -attribute_deprecated -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); -attribute_deprecated -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); -#endif -attribute_deprecated -enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); -attribute_deprecated -void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); -attribute_deprecated -enum AVColorRange av_frame_get_color_range(const AVFrame *frame); -attribute_deprecated -void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); -#endif +#if FF_API_COLORSPACE_NAME /** * Get the name of a colorspace. * @return a static string identifying the colorspace; can be NULL. + * @deprecated use av_color_space_name() */ +attribute_deprecated const char *av_get_colorspace_name(enum AVColorSpace val); - +#endif /** * Allocate an AVFrame and set its fields to default values. The resulting * struct must be freed using av_frame_free(). @@ -917,11 +850,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); */ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Add a new side data to a frame from an existing AVBufferRef diff --git a/windows/include/arm64/libavutil/hash.h b/windows/include/arm64/libavutil/hash.h index af4719e..94151de 100644 --- a/windows/include/arm64/libavutil/hash.h +++ b/windows/include/arm64/libavutil/hash.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_hash Hash Functions * @ingroup lavu_crypto @@ -182,11 +180,7 @@ void av_hash_init(struct AVHashContext *ctx); * @param[in] src Data to be added to the hash context * @param[in] len Size of the additional data */ -#if FF_API_CRYPTO_SIZE_T -void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); -#else void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len); -#endif /** * Finalize a hash context and compute the actual hash value. diff --git a/windows/include/arm64/libavutil/hmac.h b/windows/include/arm64/libavutil/hmac.h index 412e950..ca4da6a 100644 --- a/windows/include/arm64/libavutil/hmac.h +++ b/windows/include/arm64/libavutil/hmac.h @@ -23,7 +23,6 @@ #include -#include "version.h" /** * @defgroup lavu_hmac HMAC * @ingroup lavu_crypto diff --git a/windows/include/arm64/libavutil/hwcontext_d3d11va.h b/windows/include/arm64/libavutil/hwcontext_d3d11va.h index 9f91e9b..77d2d72 100644 --- a/windows/include/arm64/libavutil/hwcontext_d3d11va.h +++ b/windows/include/arm64/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if a user-allocated texture is provided. */ UINT MiscFlags; + + /** + * In case if texture structure member above is not NULL contains the same texture + * pointer for all elements and different indexes into the array texture. + * In case if texture structure member above is NULL, all elements contains + * pointers to separate non-array textures and 0 indexes. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + AVD3D11FrameDescriptor *texture_infos; } AVD3D11VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/windows/include/arm64/libavutil/hwcontext_videotoolbox.h b/windows/include/arm64/libavutil/hwcontext_videotoolbox.h index 5074d79..b6bdcf2 100644 --- a/windows/include/arm64/libavutil/hwcontext_videotoolbox.h +++ b/windows/include/arm64/libavutil/hwcontext_videotoolbox.h @@ -29,11 +29,14 @@ * @file * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. * - * This API currently does not support frame allocation, as the raw VideoToolbox - * API does allocation, and FFmpeg itself never has the need to allocate frames. + * This API supports frame allocation using a native CVPixelBufferPool + * instead of an AVBufferPool. * * If the API user sets a custom pool, AVHWFramesContext.pool must return * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. + * Note that the underlying CVPixelBuffer could be retained by OS frameworks + * depending on application usage, so it is preferable to let CoreVideo manage + * the pool using the default implementation. * * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always * NULL. @@ -57,4 +60,36 @@ uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); */ uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); +/** + * Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc); + +/** + * Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space); + +/** + * Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri); + +/** + * Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer + * function string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc); + +/** + * Update a CVPixelBufferRef's metadata to based on an AVFrame. + * Returns 0 if no known equivalent was found. + */ +int av_vt_pixbuf_set_attachments(void *log_ctx, + CVPixelBufferRef pixbuf, const struct AVFrame *src); + #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ diff --git a/windows/include/arm64/libavutil/hwcontext_vulkan.h b/windows/include/arm64/libavutil/hwcontext_vulkan.h index 5cbeb8e..df86c85 100644 --- a/windows/include/arm64/libavutil/hwcontext_vulkan.h +++ b/windows/include/arm64/libavutil/hwcontext_vulkan.h @@ -19,6 +19,9 @@ #ifndef AVUTIL_HWCONTEXT_VULKAN_H #define AVUTIL_HWCONTEXT_VULKAN_H +#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR) +#define VK_USE_PLATFORM_WIN32_KHR +#endif #include #include "pixfmt.h" @@ -41,43 +44,37 @@ typedef struct AVVulkanDeviceContext { * Custom memory allocator, else NULL */ const VkAllocationCallbacks *alloc; + + /** + * Pointer to the instance-provided vkGetInstanceProcAddr loading function. + * If NULL, will pick either libvulkan or libvolk, depending on libavutil's + * compilation settings, and set this field. + */ + PFN_vkGetInstanceProcAddr get_proc_addr; + /** - * Vulkan instance. Must be at least version 1.1. + * Vulkan instance. Must be at least version 1.2. */ VkInstance inst; + /** * Physical device */ VkPhysicalDevice phys_dev; + /** * Active device */ VkDevice act_dev; + /** - * Queue family index for graphics - * @note av_hwdevice_create() will set all 3 queue indices if unset - * If there is no dedicated queue for compute or transfer operations, - * they will be set to the graphics queue index which can handle both. - * nb_graphics_queues indicates how many queues were enabled for the - * graphics queue (must be at least 1) - */ - int queue_family_index; - int nb_graphics_queues; - /** - * Queue family index to use for transfer operations, and the amount of queues - * enabled. In case there is no dedicated transfer queue, nb_tx_queues - * must be 0 and queue_family_tx_index must be the same as either the graphics - * queue or the compute queue, if available. - */ - int queue_family_tx_index; - int nb_tx_queues; - /** - * Queue family index for compute ops, and the amount of queues enabled. - * In case there are no dedicated compute queues, nb_comp_queues must be - * 0 and its queue family index must be set to the graphics queue. + * This structure should be set to the set of features that present and enabled + * during device creation. When a device is created by FFmpeg, it will default to + * enabling all that are present of the shaderImageGatherExtended, + * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. */ - int queue_family_comp_index; - int nb_comp_queues; + VkPhysicalDeviceFeatures2 device_features; + /** * Enabled instance extensions. * If supplying your own device context, set this to an array of strings, with @@ -87,6 +84,7 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_inst_extensions; int nb_enabled_inst_extensions; + /** * Enabled device extensions. By default, VK_KHR_external_memory_fd, * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier, @@ -97,32 +95,91 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_dev_extensions; int nb_enabled_dev_extensions; + /** - * This structure should be set to the set of features that present and enabled - * during device creation. When a device is created by FFmpeg, it will default to - * enabling all that are present of the shaderImageGatherExtended, - * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. + * Queue family index for graphics operations, and the number of queues + * enabled for it. If unavaiable, will be set to -1. Not required. + * av_hwdevice_create() will attempt to find a dedicated queue for each + * queue family, or pick the one with the least unrelated flags set. + * Queue indices here may overlap if a queue has to share capabilities. */ - VkPhysicalDeviceFeatures2 device_features; + int queue_family_index; + int nb_graphics_queues; + + /** + * Queue family index for transfer operations and the number of queues + * enabled. Required. + */ + int queue_family_tx_index; + int nb_tx_queues; + + /** + * Queue family index for compute operations and the number of queues + * enabled. Required. + */ + int queue_family_comp_index; + int nb_comp_queues; + + /** + * Queue family index for video encode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_encode_index will be -1. + * Not required. + */ + int queue_family_encode_index; + int nb_encode_queues; + + /** + * Queue family index for video decode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_decode_index will be -1. + * Not required. + */ + int queue_family_decode_index; + int nb_decode_queues; } AVVulkanDeviceContext; +/** + * Defines the behaviour of frame allocation. + */ +typedef enum AVVkFrameFlags { + /* Unless this flag is set, autodetected flags will be OR'd based on the + * device and tiling during av_hwframe_ctx_init(). */ + AV_VK_FRAME_FLAG_NONE = (1ULL << 0), + + /* Image planes will be allocated in a single VkDeviceMemory, rather + * than as per-plane VkDeviceMemory allocations. Required for exporting + * to VAAPI on Intel devices. */ + AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1), +} AVVkFrameFlags; + /** * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options */ typedef struct AVVulkanFramesContext { /** - * Controls the tiling of allocated frames. + * Controls the tiling of allocated frames. If left as optimal tiling, + * then during av_hwframe_ctx_init() will decide based on whether the device + * supports DRM modifiers, or if the linear_images flag is set, otherwise + * will allocate optimally-tiled images. */ VkImageTiling tiling; + /** * Defines extra usage of output frames. If left as 0, the following bits * are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE. */ VkImageUsageFlagBits usage; + /** * Extension data for image creation. + * If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain, + * and the device supports DRM modifiers, then images will be allocated + * with the specific requested DRM modifiers. + * Additional structures may be added at av_hwframe_ctx_init() time, + * which will be freed automatically on uninit(), so users need only free + * any structures they've allocated themselves. */ void *create_pnext; + /** * Extension data for memory allocation. Must have as many entries as * the number of planes of the sw_format. @@ -131,6 +188,13 @@ typedef struct AVVulkanFramesContext { * extensions are present in enabled_dev_extensions. */ void *alloc_pnext[AV_NUM_DATA_POINTERS]; + + /** + * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set, + * autodetected flags will be OR'd based on the device and tiling during + * av_hwframe_ctx_init(). + */ + AVVkFrameFlags flags; } AVVulkanFramesContext; /* @@ -139,7 +203,7 @@ typedef struct AVVulkanFramesContext { * 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 three queue family indices in the device context are the same, + * 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. * @@ -158,8 +222,9 @@ typedef struct AVVkFrame { VkImageTiling tiling; /** - * Memory backing the images. Could be less than the amount of images - * if importing from a DRM or VAAPI frame. + * Memory backing the images. Could be less than the amount of planes, + * in which case the offset value will indicate the binding offset of + * each plane in the memory. */ VkDeviceMemory mem[AV_NUM_DATA_POINTERS]; size_t size[AV_NUM_DATA_POINTERS]; @@ -176,17 +241,29 @@ typedef struct AVVkFrame { VkImageLayout layout[AV_NUM_DATA_POINTERS]; /** - * Synchronization semaphores. Must not be freed manually. Must be waited on - * and signalled at every queue submission. - * Could be less than the amount of images: either one per VkDeviceMemory - * or one for the entire frame. All others will be set to VK_NULL_HANDLE. + * Synchronization timeline semaphores, one for each sw_format plane. + * 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, + * using an incremented value. */ VkSemaphore sem[AV_NUM_DATA_POINTERS]; + /** + * Up to date semaphore value at which each image becomes accessible. + * Clients must wait on this value when submitting a command queue, + * and increment it when signalling. + */ + uint64_t sem_value[AV_NUM_DATA_POINTERS]; + /** * Internal data. */ struct AVVkFrameInternal *internal; + + /** + * Describes the binding offset of each plane to the VkDeviceMemory. + */ + ptrdiff_t offset[AV_NUM_DATA_POINTERS]; } AVVkFrame; /** diff --git a/windows/include/arm64/libavutil/imgutils.h b/windows/include/arm64/libavutil/imgutils.h index 5eccbf0..cb2d747 100644 --- a/windows/include/arm64/libavutil/imgutils.h +++ b/windows/include/arm64/libavutil/imgutils.h @@ -124,6 +124,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height); +/** + * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where + * available, this function will use special functionality for reading from such + * memory, which may result in greatly improved performance compared to plain + * av_image_copy_plane(). + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy_plane(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize, + ptrdiff_t bytewidth, int height); + /** * Copy image in src_data to dst_data. * diff --git a/windows/include/arm64/libavutil/log.h b/windows/include/arm64/libavutil/log.h index 8edd6bb..99625af 100644 --- a/windows/include/arm64/libavutil/log.h +++ b/windows/include/arm64/libavutil/log.h @@ -24,7 +24,6 @@ #include #include "avutil.h" #include "attributes.h" -#include "version.h" typedef enum { AV_CLASS_CATEGORY_NA = 0, @@ -107,24 +106,6 @@ typedef struct AVClass { */ int parent_log_context_offset; - /** - * Return next AVOptions-enabled child or NULL - */ - void* (*child_next)(void *obj, void *prev); - -#if FF_API_CHILD_CLASS_NEXT - /** - * Return an AVClass corresponding to the next potential - * AVOptions-enabled child. - * - * The difference between child_next and this is that - * child_next iterates over _already existing_ objects, while - * child_class_next iterates over _all possible_ children. - */ - attribute_deprecated - const struct AVClass* (*child_class_next)(const struct AVClass *prev); -#endif - /** * Category used for visualization (like color) * This is only set if the category is equal for all objects using this class. @@ -144,6 +125,11 @@ typedef struct AVClass { */ int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + /** * Iterate over the AVClasses corresponding to potential AVOptions-enabled * children. diff --git a/windows/include/arm64/libavutil/macros.h b/windows/include/arm64/libavutil/macros.h index 2007ee5..2a7567c 100644 --- a/windows/include/arm64/libavutil/macros.h +++ b/windows/include/arm64/libavutil/macros.h @@ -25,6 +25,36 @@ #ifndef AVUTIL_MACROS_H #define AVUTIL_MACROS_H +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + /** * @addtogroup preproc_misc Preprocessor String Macros * diff --git a/windows/include/arm64/libavutil/md5.h b/windows/include/arm64/libavutil/md5.h index ca72ccb..fc2eabd 100644 --- a/windows/include/arm64/libavutil/md5.h +++ b/windows/include/arm64/libavutil/md5.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_md5 MD5 @@ -64,11 +63,7 @@ void av_md5_init(struct AVMD5 *ctx); * @param src input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); -#else void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. @@ -85,11 +80,7 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); * @param src The data to hash * @param len The length of the data, in bytes */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); -#else void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); -#endif /** * @} diff --git a/windows/include/arm64/libavutil/mem.h b/windows/include/arm64/libavutil/mem.h index e21a1fe..b9fe807 100644 --- a/windows/include/arm64/libavutil/mem.h +++ b/windows/include/arm64/libavutil/mem.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "error.h" #include "avutil.h" #include "version.h" @@ -238,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); * @see av_mallocz() * @see av_malloc_array() */ -av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#if FF_API_AV_MALLOCZ_ARRAY /** - * Non-inlined equivalent of av_mallocz_array(). - * - * Created for symmetry with the calloc() C function. + * @deprecated use av_calloc() */ -void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; +attribute_deprecated +void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#endif /** * Allocate, reallocate, or free a block of memory. @@ -672,16 +672,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, * @param[out] r Pointer to the result of the operation * @return 0 on success, AVERROR(EINVAL) on overflow */ -static inline int av_size_mult(size_t a, size_t b, size_t *r) -{ - size_t t = a * b; - /* Hack inspired from glibc: don't try the division if nelem and elsize - * are both less than sqrt(SIZE_MAX). */ - if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) - return AVERROR(EINVAL); - *r = t; - return 0; -} +int av_size_mult(size_t a, size_t b, size_t *r); /** * Set the maximum size that may be allocated in one block. diff --git a/windows/include/arm64/libavutil/murmur3.h b/windows/include/arm64/libavutil/murmur3.h index b3b3a07..d90bc2f 100644 --- a/windows/include/arm64/libavutil/murmur3.h +++ b/windows/include/arm64/libavutil/murmur3.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_murmur3 Murmur3 * @ingroup lavu_hash @@ -100,11 +98,7 @@ void av_murmur3_init(struct AVMurMur3 *c); * @param[in] src Input data to update hash with * @param[in] len Number of bytes to read from `src` */ -#if FF_API_CRYPTO_SIZE_T -void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); -#else void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/arm64/libavutil/opt.h b/windows/include/arm64/libavutil/opt.h index 8dc020a..2820435 100644 --- a/windows/include/arm64/libavutil/opt.h +++ b/windows/include/arm64/libavutil/opt.h @@ -33,7 +33,6 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" -#include "version.h" /** * @defgroup avoptions AVOptions @@ -648,19 +647,6 @@ const AVOption *av_opt_next(const void *obj, const AVOption *prev); */ void *av_opt_child_next(void *obj, void *prev); -#if FF_API_CHILD_CLASS_NEXT -/** - * Iterate over potential AVOptions-enabled children of parent. - * - * @param prev result of a previous call to this function or NULL - * @return AVClass corresponding to next potential child or NULL - * - * @deprecated use av_opt_child_class_iterate - */ -attribute_deprecated -const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); -#endif - /** * Iterate over potential AVOptions-enabled children of parent. * @@ -804,9 +790,16 @@ 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 diff --git a/windows/include/arm64/libavutil/pixdesc.h b/windows/include/arm64/libavutil/pixdesc.h index 9b9d386..f8a195f 100644 --- a/windows/include/arm64/libavutil/pixdesc.h +++ b/windows/include/arm64/libavutil/pixdesc.h @@ -26,7 +26,6 @@ #include "attributes.h" #include "pixfmt.h" -#include "version.h" typedef struct AVComponentDescriptor { /** @@ -56,17 +55,6 @@ typedef struct AVComponentDescriptor { * Number of bits in the component. */ int depth; - -#if FF_API_PLUS1_MINUS1 - /** deprecated, use step instead */ - attribute_deprecated int step_minus1; - - /** deprecated, use depth instead */ - attribute_deprecated int depth_minus1; - - /** deprecated, use offset instead */ - attribute_deprecated int offset_plus1; -#endif } AVComponentDescriptor; /** @@ -147,26 +135,6 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_RGB (1 << 5) -#if FF_API_PSEUDOPAL -/** - * The pixel format is "pseudo-paletted". This means that it contains a - * fixed palette in the 2nd plane but the palette is fixed/constant for each - * PIX_FMT. This allows interpreting the data as if it was PAL8, which can - * in some cases be simpler. Or the data can be interpreted purely based on - * the pixel format without using the palette. - * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 - * - * @deprecated This flag is deprecated, and will be removed. When it is removed, - * the extra palette allocation in AVFrame.data[1] is removed as well. Only - * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a - * palette. Starting with FFmpeg versions which have this flag deprecated, the - * extra "pseudo" palette is already ignored, and API users are not required to - * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required - * before the deprecation, though). - */ -#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) -#endif - /** * The pixel format has an alpha channel. This is set on all formats that * support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always diff --git a/windows/include/arm64/libavutil/pixfmt.h b/windows/include/arm64/libavutil/pixfmt.h index 46ef211..02e355e 100644 --- a/windows/include/arm64/libavutil/pixfmt.h +++ b/windows/include/arm64/libavutil/pixfmt.h @@ -112,21 +112,11 @@ enum AVPixelFormat { AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined -#if FF_API_VAAPI - /** @name Deprecated pixel formats */ - /**@{*/ - AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers - AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers - AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID - /**@}*/ - AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, -#else /** * Hardware acceleration through VA-API, data[3] contains a * VASurfaceID. */ AV_PIX_FMT_VAAPI, -#endif AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian @@ -360,6 +350,21 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian + + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, liddle-endian + + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian + AV_PIX_FMT_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 }; @@ -450,35 +455,41 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) + +#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_P216 AV_PIX_FMT_NE(P216BE, P216LE) +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) /** * Chromaticity coordinates of the source primaries. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. */ enum AVColorPrimaries { AVCOL_PRI_RESERVED0 = 0, - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B AVCOL_PRI_UNSPECIFIED = 2, AVCOL_PRI_RESERVED = 3, AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65 AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428, AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3 AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 - AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E / JEDEC P22 phosphors + AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213, AVCOL_PRI_NB ///< Not part of ABI }; /** * Color Transfer Characteristic. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2. */ enum AVColorTransferCharacteristic { AVCOL_TRC_RESERVED0 = 0, @@ -507,18 +518,18 @@ enum AVColorTransferCharacteristic { /** * YUV colorspace type. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3. */ enum AVColorSpace { - AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above - AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries + AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO, AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system @@ -540,9 +551,9 @@ enum AVColorSpace { * recommended, as it also defines the full range representation. * * Common definitions: - * - For RGB and luminance planes such as Y in YCbCr and I in ICtCp, + * - For RGB and luma planes such as Y in YCbCr and I in ICtCp, * 'E' is the original value in range of 0.0 to 1.0. - * - For chrominance planes such as Cb,Cr and Ct,Cp, 'E' is the original + * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original * value in range of -0.5 to 0.5. * - 'n' is the output bit depth. * - For additional definitions such as rounding and clipping to valid n @@ -554,13 +565,13 @@ enum AVColorRange { /** * Narrow or limited range content. * - * - For luminance planes: + * - For luma planes: * * (219 * E + 16) * 2^(n-8) * * F.ex. the range of 16-235 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (224 * E + 128) * 2^(n-8) * @@ -571,13 +582,13 @@ enum AVColorRange { /** * Full range content. * - * - For RGB and luminance planes: + * - For RGB and luma planes: * * (2^n - 1) * E * * F.ex. the range of 0-255 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (2^n - 1) * E + 2^(n - 1) * diff --git a/windows/include/arm64/libavutil/ripemd.h b/windows/include/arm64/libavutil/ripemd.h index 921aa66..9df9f90 100644 --- a/windows/include/arm64/libavutil/ripemd.h +++ b/windows/include/arm64/libavutil/ripemd.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_ripemd RIPEMD @@ -67,11 +66,7 @@ int av_ripemd_init(struct AVRIPEMD* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); -#else void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/arm64/libavutil/samplefmt.h b/windows/include/arm64/libavutil/samplefmt.h index 8cd43ae..f270199 100644 --- a/windows/include/arm64/libavutil/samplefmt.h +++ b/windows/include/arm64/libavutil/samplefmt.h @@ -195,9 +195,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return >=0 on success or a negative error code on failure - * @todo return minimum size in bytes required for the buffer in case - * of success at the next bump + * @return minimum size in bytes required for the buffer on success, + * or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, diff --git a/windows/include/arm64/libavutil/sha.h b/windows/include/arm64/libavutil/sha.h index c0180e5..2e1220a 100644 --- a/windows/include/arm64/libavutil/sha.h +++ b/windows/include/arm64/libavutil/sha.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha SHA @@ -74,11 +73,7 @@ int av_sha_init(struct AVSHA* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len); -#else void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/arm64/libavutil/sha512.h b/windows/include/arm64/libavutil/sha512.h index bef714b..a4a3f23 100644 --- a/windows/include/arm64/libavutil/sha512.h +++ b/windows/include/arm64/libavutil/sha512.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha512 SHA-512 @@ -76,11 +75,7 @@ int av_sha512_init(struct AVSHA512* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); -#else void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/arm64/libavutil/tree.h b/windows/include/arm64/libavutil/tree.h index d5e0aeb..bbb8fbb 100644 --- a/windows/include/arm64/libavutil/tree.h +++ b/windows/include/arm64/libavutil/tree.h @@ -28,7 +28,6 @@ #define AVUTIL_TREE_H #include "attributes.h" -#include "version.h" /** * @addtogroup lavu_tree AVTree diff --git a/windows/include/arm64/libavutil/tx.h b/windows/include/arm64/libavutil/tx.h index bfc0c7f..5517381 100644 --- a/windows/include/arm64/libavutil/tx.h +++ b/windows/include/arm64/libavutil/tx.h @@ -49,11 +49,14 @@ enum AVTXType { * float. Length is the frame size, not the window size (which is 2x frame) * For forward transforms, the stride specifies the spacing between each * sample in the output array in bytes. The input must be a flat array. + * * For inverse transforms, the stride specifies the spacing between each * sample in the input array in bytes. The output will be a flat array. * Stride must be a non-zero multiple of sizeof(float). + * * NOTE: the inverse transform is half-length, meaning the output will not - * contain redundant data. This is what most codecs work with. + * contain redundant data. This is what most codecs work with. To do a full + * inverse transform, set the AV_TX_FULL_IMDCT flag on init. */ AV_TX_FLOAT_MDCT = 1, @@ -93,7 +96,7 @@ enum AVTXType { * @param stride the input or output stride in bytes * * The out and in arrays must be aligned to the maximum required by the CPU - * architecture. + * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init(). * The stride must follow the constraints the transform type has specified. */ typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride); @@ -108,6 +111,20 @@ enum AVTXFlags { * transform types. */ AV_TX_INPLACE = 1ULL << 0, + + /** + * Relaxes alignment requirement for the in and out arrays of av_tx_fn(). + * May be slower with certain transform types. + */ + AV_TX_UNALIGNED = 1ULL << 1, + + /** + * Performs a full inverse MDCT rather than leaving out samples that can be + * derived through symmetry. Requires an output array of 'len' floats, + * rather than the usual 'len/2' floats. + * Ignored for all transforms but inverse MDCTs. + */ + AV_TX_FULL_IMDCT = 1ULL << 2, }; /** diff --git a/windows/include/arm64/libavutil/version.h b/windows/include/arm64/libavutil/version.h index f888dbb..58c6179 100644 --- a/windows/include/arm64/libavutil/version.h +++ b/windows/include/arm64/libavutil/version.h @@ -78,8 +78,8 @@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 70 +#define LIBAVUTIL_VERSION_MAJOR 57 +#define LIBAVUTIL_VERSION_MINOR 17 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -105,42 +105,10 @@ * @{ */ -#ifndef FF_API_VAAPI -#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_QP -#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PLUS1_MINUS1 -#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_ERROR_FRAME -#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PKT_PTS -#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CRYPTO_SIZE_T -#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_GET_SET -#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PSEUDOPAL -#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CHILD_CLASS_NEXT -#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_BUFFER_SIZE_T -#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_D2STR #define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_DECLARE_ALIGNED #define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58) -#endif +#define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58) +#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58) /** * @} diff --git a/windows/include/x64/libavcodec/avcodec.h b/windows/include/x64/libavcodec/avcodec.h index 8a71c04..7ee8bc2 100644 --- a/windows/include/x64/libavcodec/avcodec.h +++ b/windows/include/x64/libavcodec/avcodec.h @@ -27,25 +27,21 @@ * Libavcodec external API header */ -#include #include "libavutil/samplefmt.h" #include "libavutil/attributes.h" #include "libavutil/avutil.h" #include "libavutil/buffer.h" -#include "libavutil/cpu.h" -#include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/frame.h" -#include "libavutil/hwcontext.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "bsf.h" #include "codec.h" #include "codec_desc.h" #include "codec_par.h" #include "codec_id.h" +#include "defs.h" #include "packet.h" #include "version.h" @@ -155,29 +151,6 @@ * at least will not fail with AVERROR(EAGAIN). In general, no codec will * permit unlimited buffering of input or output. * - * This API replaces the following legacy functions: - * - avcodec_decode_video2() and avcodec_decode_audio4(): - * Use avcodec_send_packet() to feed input to the decoder, then use - * avcodec_receive_frame() to receive decoded frames after each packet. - * Unlike with the old video decoding API, multiple frames might result from - * a packet. For audio, splitting the input packet into frames by partially - * decoding packets becomes transparent to the API user. You never need to - * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then - * no data was read from the packet). - * Additionally, sending a flush/draining packet is required only once. - * - avcodec_encode_video2()/avcodec_encode_audio2(): - * Use avcodec_send_frame() to feed input to the encoder, then use - * avcodec_receive_packet() to receive encoded packets. - * Providing user-allocated buffers for avcodec_receive_packet() is not - * possible. - * - The new API does not handle subtitles yet. - * - * Mixing new and old function calls on the same AVCodecContext is not allowed, - * and will result in undefined behavior. - * - * Some codecs might require using the new API; using the old API will return - * an error when calling it. All codecs support the new API. - * * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This * would be an invalid state, which could put the codec user into an endless * loop. The API has no concept of time either: it cannot happen that trying to @@ -204,16 +177,6 @@ * @{ */ -/** - * @ingroup lavc_decoding - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * This is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end.
- * Note: If the first 23 bits of the additional bytes are not 0, then damaged - * MPEG bitstreams could cause overread and segfault. - */ -#define AV_INPUT_BUFFER_PADDING_SIZE 64 - /** * @ingroup lavc_encoding * minimum encoding buffer size @@ -221,34 +184,6 @@ */ #define AV_INPUT_BUFFER_MIN_SIZE 16384 -/** - * @ingroup lavc_decoding - */ -enum AVDiscard{ - /* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). */ - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONINTRA= 24, ///< discard all non intra frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -enum AVAudioServiceType { - AV_AUDIO_SERVICE_TYPE_MAIN = 0, - AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, - AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, - AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, - AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, - AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, - AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, - AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, - AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, - AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI -}; - /** * @ingroup lavc_encoding */ @@ -310,11 +245,15 @@ typedef struct RcOverride{ * error[?] variables will be set during encoding. */ #define AV_CODEC_FLAG_PSNR (1 << 15) +#if FF_API_FLAG_TRUNCATED /** * Input bitstream might be truncated at a random location * instead of only at frame boundaries. + * + * @deprecated use codec parsers for packetizing input */ #define AV_CODEC_FLAG_TRUNCATED (1 << 16) +#endif /** * Use interlaced DCT. */ @@ -416,98 +355,6 @@ typedef struct RcOverride{ */ #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) -/** - * Pan Scan area. - * This specifies the area which should be displayed. - * Note there may be multiple such areas for one frame. - */ -typedef struct AVPanScan { - /** - * id - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int16_t position[3][2]; -} AVPanScan; - -/** - * This structure describes the bitrate properties of an encoded bitstream. It - * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD - * parameters for H.264/HEVC. - */ -typedef struct AVCPBProperties { - /** - * Maximum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int max_bitrate; -#else - int64_t max_bitrate; -#endif - /** - * Minimum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int min_bitrate; -#else - int64_t min_bitrate; -#endif - /** - * Average bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int avg_bitrate; -#else - int64_t avg_bitrate; -#endif - - /** - * The size of the buffer to which the ratecontrol is applied, in bits. - * Zero if unknown or unspecified. - */ - int buffer_size; - - /** - * The delay between the time the packet this structure is associated with - * is received and the time when it should be decoded, in periods of a 27MHz - * clock. - * - * UINT64_MAX when unknown or unspecified. - */ - uint64_t vbv_delay; -} AVCPBProperties; - -/** - * This structure supplies correlation between a packet timestamp and a wall clock - * production time. The definition follows the Producer Reference Time ('prft') - * as defined in ISO/IEC 14496-12 - */ -typedef struct AVProducerReferenceTime { - /** - * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). - */ - int64_t wallclock; - int flags; -} AVProducerReferenceTime; - /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -697,7 +544,7 @@ typedef struct AVCodecContext { * picture width / height. * * @note Those fields may not match the values of the last - * AVFrame output by avcodec_decode_video2 due frame + * AVFrame output by avcodec_receive_frame() due frame * reordering. * * - encoding: MUST be set by user. @@ -773,17 +620,29 @@ typedef struct AVCodecContext { int y, int type, int height); /** - * callback to negotiate the pixelFormat - * @param fmt is the list of formats which are supported by the codec, - * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. - * The first is always the native one. - * @note The callback may be called again immediately if initialization for - * the selected (hardware-accelerated) pixel format failed. - * @warning Behavior is undefined if the callback returns a value not - * in the fmt list of formats. - * @return the chosen format - * - encoding: unused - * - decoding: Set by user, if not set the native format will be chosen. + * Callback to negotiate the pixel format. Decoding only, may be set by the + * caller before avcodec_open2(). + * + * Called by some decoders to select the pixel format that will be used for + * the output frames. This is mainly used to set up hardware acceleration, + * then the provided format list contains the corresponding hwaccel pixel + * formats alongside the "software" one. The software pixel format may also + * be retrieved from \ref sw_pix_fmt. + * + * This callback will be called when the coded frame properties (such as + * resolution, pixel format, etc.) change and more than one output format is + * supported for those new properties. If a hardware pixel format is chosen + * and initialization for it fails, the callback may be called again + * immediately. + * + * This callback may be called from different threads if the decoder is + * multi-threaded, but not from more than one thread simultaneously. + * + * @param fmt list of formats which may be used in the current + * configuration, terminated by AV_PIX_FMT_NONE. + * @warning Behavior is undefined if the callback returns a value other + * than one of the formats in fmt or AV_PIX_FMT_NONE. + * @return the chosen format or AV_PIX_FMT_NONE */ enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); @@ -804,12 +663,6 @@ typedef struct AVCodecContext { */ float b_quant_factor; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_frame_strategy; -#endif - /** * qscale offset between IP and B-frames * - encoding: Set by user. @@ -825,12 +678,6 @@ typedef struct AVCodecContext { */ int has_b_frames; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int mpeg_quant; -#endif - /** * qscale factor between P- and I-frames * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). @@ -889,15 +736,6 @@ typedef struct AVCodecContext { */ int slice_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 -#endif - /** * slice offsets in the frame in bytes * - encoding: Set/allocated by libavcodec. @@ -970,12 +808,6 @@ typedef struct AVCodecContext { */ int last_predictor_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int pre_me; -#endif - /** * motion estimation prepass comparison function * - encoding: Set by user. @@ -1044,16 +876,6 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int scenechange_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int noise_reduction; -#endif - /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. @@ -1089,26 +911,12 @@ typedef struct AVCodecContext { */ int mb_lmax; -#if FF_API_PRIVATE_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int me_penalty_compensation; -#endif - /** * - encoding: Set by user. * - decoding: unused */ int bidir_refine; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int brd_scale; -#endif - /** * minimum GOP size * - encoding: Set by user. @@ -1123,12 +931,6 @@ typedef struct AVCodecContext { */ int refs; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int chromaoffset; -#endif - /** * Note: Value depends upon the compare function used for fullpel ME. * - encoding: Set by user. @@ -1136,12 +938,6 @@ typedef struct AVCodecContext { */ int mv0_threshold; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_sensitivity; -#endif - /** * Chromaticity coordinates of the source primaries. * - encoding: Set by user @@ -1350,24 +1146,6 @@ typedef struct AVCodecContext { */ int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); -#if FF_API_OLD_ENCDEC - /** - * If non-zero, the decoded audio and video frames returned from - * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted - * and are valid indefinitely. The caller must free them with - * av_frame_unref() when they are not needed anymore. - * Otherwise, the decoded frames must not be freed by the caller and are - * only valid until the next decode call. - * - * This is always automatically enabled if avcodec_receive_frame() is used. - * - * - encoding: unused - * - decoding: set by the caller before avcodec_open2(). - */ - attribute_deprecated - int refcounted_frames; -#endif - /* - encoding parameters */ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) float qblur; ///< amount of qscale smoothing over time (0.0-1.0) @@ -1443,42 +1221,6 @@ typedef struct AVCodecContext { */ int rc_initial_buffer_occupancy; -#if FF_API_CODER_TYPE -#define FF_CODER_TYPE_VLC 0 -#define FF_CODER_TYPE_AC 1 -#define FF_CODER_TYPE_RAW 2 -#define FF_CODER_TYPE_RLE 3 - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int coder_type; -#endif /* FF_API_CODER_TYPE */ - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int context_model; -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_factor; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_exp; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_cmp; -#endif /* FF_API_PRIVATE_OPT */ - /** * trellis RD quantization * - encoding: Set by user. @@ -1486,69 +1228,6 @@ typedef struct AVCodecContext { */ int trellis; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int min_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int max_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int64_t timecode_frame_start; -#endif - -#if FF_API_RTP_CALLBACK - /** - * @deprecated unused - */ - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send. */ - /* It depends on the encoder if the data starts */ - /* with a Start Code (it should). H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload. */ - attribute_deprecated - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do its best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263. */ - /* This doesn't take account of any particular */ - /* headers inside the transmitted RTP payload. */ -#endif - -#if FF_API_STAT_BITS - /* statistics, used for 2-pass encoding */ - attribute_deprecated - int mv_bits; - attribute_deprecated - int header_bits; - attribute_deprecated - int i_tex_bits; - attribute_deprecated - int p_tex_bits; - attribute_deprecated - int i_count; - attribute_deprecated - int p_count; - attribute_deprecated - int skip_count; - attribute_deprecated - int misc_bits; - - /** @deprecated this field is unused */ - attribute_deprecated - int frame_bits; -#endif - /** * pass1 encoding statistics output buffer * - encoding: Set by libavcodec. @@ -1684,8 +1363,7 @@ typedef struct AVCodecContext { * For some hardware accelerators, a global context needs to be * provided by the user. In that case, this holds display-dependent * data FFmpeg cannot instantiate itself. Please refer to the - * FFmpeg HW accelerator documentation to know how to fill this - * is. e.g. for VA API, this is a struct vaapi_context. + * FFmpeg HW accelerator documentation to know how to fill this. * - encoding: unused * - decoding: Set by user */ @@ -1753,17 +1431,6 @@ typedef struct AVCodecContext { */ int lowres; -#if FF_API_CODED_FRAME - /** - * the picture in the bitstream - * - encoding: Set by libavcodec. - * - decoding: unused - * - * @deprecated use the quality factor packet side data instead - */ - attribute_deprecated AVFrame *coded_frame; -#endif - /** * thread count * is used to decide how many independent tasks should be passed to execute() @@ -2016,34 +1683,6 @@ typedef struct AVCodecContext { uint8_t *subtitle_header; int subtitle_header_size; -#if FF_API_VBV_DELAY - /** - * VBV delay coded in the last frame (in periods of a 27 MHz clock). - * Used for compliant TS muxing. - * - encoding: Set by libavcodec. - * - decoding: unused. - * @deprecated this value is now exported as a part of - * AV_PKT_DATA_CPB_PROPERTIES packet side data - */ - attribute_deprecated - uint64_t vbv_delay; -#endif - -#if FF_API_SIDEDATA_ONLY_PKT - /** - * Encoding only and set by default. Allow encoders to output packets - * that do not contain any encoded data, only side data. - * - * Some encoders need to output such packets, e.g. to update some stream - * parameters at the end of encoding. - * - * @deprecated this field disables the default behaviour and - * it is kept only for compatibility. - */ - attribute_deprecated - int side_data_only_packets; -#endif - /** * Audio only. The number of "priming" samples (padding) inserted by the * encoder at the beginning of the audio. I.e. this number of leading @@ -2183,6 +1822,7 @@ typedef struct AVCodecContext { unsigned properties; #define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004 /** * Additional data associated with the entire coded stream. @@ -2217,15 +1857,13 @@ typedef struct AVCodecContext { */ AVBufferRef *hw_frames_ctx; +#if FF_API_SUB_TEXT_FORMAT /** - * Control the form of AVSubtitle.rects[N]->ass - * - decoding: set by user - * - encoding: unused + * @deprecated unused */ + attribute_deprecated int sub_text_format; #define FF_SUB_TEXT_FMT_ASS 0 -#if FF_API_ASS_TIMING -#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 #endif /** @@ -2355,6 +1993,10 @@ typedef struct AVCodecContext { * This callback must use the above value to calculate the required buffer size, * which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes. * + * In some specific cases, the encoder may not use the entire buffer allocated by this + * callback. This will be reflected in the size value in the packet once returned by + * avcodec_receive_packet(). + * * This callback must fill the following fields in the packet: * - data: alignment requirements for AVPacket apply, if any. Some architectures and * encoders may benefit from having aligned data. @@ -2384,47 +2026,6 @@ typedef struct AVCodecContext { int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags); } AVCodecContext; -#if FF_API_CODEC_GET_SET -/** - * Accessors for some AVCodecContext fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); - -attribute_deprecated -const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); - -attribute_deprecated -unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); - -attribute_deprecated -int av_codec_get_lowres(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_lowres(AVCodecContext *avctx, int val); - -attribute_deprecated -int av_codec_get_seek_preroll(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); - -attribute_deprecated -uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); -#endif - -struct AVSubtitle; - -#if FF_API_CODEC_GET_SET -attribute_deprecated -int av_codec_get_max_lowres(const AVCodec *codec); -#endif - struct MpegEncContext; /** @@ -2637,33 +2238,6 @@ typedef struct AVHWAccel { * @} */ -#if FF_API_AVPICTURE -/** - * @defgroup lavc_picture AVPicture - * - * Functions for working with AVPicture - * @{ - */ - -/** - * Picture data structure. - * - * Up to four components can be stored into it, the last component is - * alpha. - * @deprecated use AVFrame or imgutils functions instead - */ -typedef struct AVPicture { - attribute_deprecated - uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes - attribute_deprecated - int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line -} AVPicture; - -/** - * @} - */ -#endif - enum AVSubtitleType { SUBTITLE_NONE, @@ -2691,13 +2265,6 @@ typedef struct AVSubtitleRect { int h; ///< height of pict, undefined when pict is not set int nb_colors; ///< number of colors in pict, undefined when pict is not set -#if FF_API_AVPICTURE - /** - * @deprecated unused - */ - attribute_deprecated - AVPicture pict; -#endif /** * data+linesize for the bitmap of this subtitle. * Can be set for text/ass as well once they are rendered. @@ -2728,16 +2295,6 @@ typedef struct AVSubtitle { int64_t pts; ///< Same as packet pts, in AV_TIME_BASE } AVSubtitle; -#if FF_API_NEXT -/** - * If c is NULL, returns the first registered codec, - * if c is non-NULL, returns the next registered codec after c, - * or NULL if c is the last one. - */ -attribute_deprecated -AVCodec *av_codec_next(const AVCodec *c); -#endif - /** * Return the LIBAVCODEC_VERSION_INT constant. */ @@ -2753,20 +2310,6 @@ const char *avcodec_configuration(void); */ const char *avcodec_license(void); -#if FF_API_NEXT -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register(AVCodec *codec); - -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register_all(void); -#endif - /** * Allocate an AVCodecContext and set its fields to default values. The * resulting struct should be freed with avcodec_free_context(). @@ -2788,15 +2331,6 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); */ void avcodec_free_context(AVCodecContext **avctx); -#if FF_API_GET_CONTEXT_DEFAULTS -/** - * @deprecated This function should not be used, as closing and opening a codec - * context multiple time is not supported. A new codec context should be - * allocated for each new use. - */ -int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); -#endif - /** * Get the AVClass for AVCodecContext. It can be used in combination with * AV_OPT_SEARCH_FAKE_OBJ for examining options. @@ -2821,28 +2355,6 @@ const AVClass *avcodec_get_frame_class(void); */ const AVClass *avcodec_get_subtitle_rect_class(void); -#if FF_API_COPY_CONTEXT -/** - * Copy the settings of the source AVCodecContext into the destination - * AVCodecContext. The resulting destination codec context will be - * unopened, i.e. you are required to call avcodec_open2() before you - * can use this AVCodecContext to decode/encode video/audio data. - * - * @param dest target codec context, should be initialized with - * avcodec_alloc_context3(NULL), but otherwise uninitialized - * @param src source codec context - * @return AVERROR() on error (e.g. memory allocation error), 0 on success - * - * @deprecated The semantics of this function are ill-defined and it should not - * be used. If you need to transfer the stream parameters from one codec context - * to another, use an intermediate AVCodecParameters instance and the - * avcodec_parameters_from_context() / avcodec_parameters_to_context() - * functions. - */ -attribute_deprecated -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#endif - /** * Fill the parameters struct based on the values from the supplied codec * context. Any allocated fields in par are freed and replaced with duplicates @@ -2989,115 +2501,6 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); */ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); -#if FF_API_OLD_ENCDEC -/** - * Decode the audio frame of size avpkt->size from avpkt->data into frame. - * - * Some decoders may support multiple frames in a single AVPacket. Such - * decoders would then just decode the first frame and the return value would be - * less than the packet size. In this case, avcodec_decode_audio4 has to be - * called again with an AVPacket containing the remaining data in order to - * decode the second frame, etc... Even if no frames are returned, the packet - * needs to be fed to the decoder with remaining data until it is completely - * consumed or an error occurs. - * - * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input - * and output. This means that for some packets they will not immediately - * produce decoded output and need to be flushed at the end of decoding to get - * all the decoded data. Flushing is done by calling this function with packets - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops - * returning samples. It is safe to flush even those decoders that are not - * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. - * - * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE - * larger than the actual read bytes because some optimized bitstream - * readers read 32 or 64 bits at once and could read over the end. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] frame The AVFrame in which to store decoded audio samples. - * The decoder will allocate a buffer for the decoded frame by - * calling the AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is - * non-zero. Note that this field being set to zero - * does not mean that an error has occurred. For - * decoders with AV_CODEC_CAP_DELAY set, no given decode - * call is guaranteed to produce a frame. - * @param[in] avpkt The input AVPacket containing the input buffer. - * At least avpkt->data and avpkt->size should be set. Some - * decoders might also require additional fields to be set. - * @return A negative error code is returned if an error occurred during - * decoding, otherwise the number of bytes consumed from the input - * AVPacket is returned. - * -* @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, - int *got_frame_ptr, const AVPacket *avpkt); - -/** - * Decode the video frame of size avpkt->size from avpkt->data into picture. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * - * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * Use av_frame_alloc() to get an AVFrame. The codec will - * allocate memory for the actual bitmap by calling the - * AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields like - * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least - * fields possible. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - * - * @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const AVPacket *avpkt); -#endif - /** * Decode a subtitle message. * Return a negative value on error, otherwise return the number of bytes used. @@ -3141,10 +2544,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * - * @warning Do not mix this API with the legacy API (like avcodec_decode_video2()) - * on the same AVCodecContext. It will return unexpected results now - * or in future libavcodec versions. - * * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() * before packets may be fed to the decoder. * @@ -3234,8 +2633,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); * the call will not fail with EAGAIN). * AVERROR_EOF: the encoder has been flushed, and no new frames can * be sent to it - * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a - * decoder, or requires flush + * AVERROR(EINVAL): codec not opened, it is a decoder, or requires flush * AVERROR(ENOMEM): failed to add packet to internal queue, or similar * other errors: legitimate encoding errors */ @@ -3376,7 +2774,7 @@ enum AVPictureStructure { typedef struct AVCodecParserContext { void *priv_data; - struct AVCodecParser *parser; + const struct AVCodecParser *parser; int64_t frame_offset; /* offset of the current frame */ int64_t cur_offset; /* current offset (incremented by each av_parser_parse()) */ @@ -3425,14 +2823,6 @@ typedef struct AVCodecParserContext { */ int key_frame; -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated unused - */ - attribute_deprecated - int64_t convergence_duration; -#endif - // Timestamp generation support: /** * Synchronization point for start of timestamp generation. @@ -3542,7 +2932,7 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ + int codec_ids[7]; /* several codec IDs are permitted */ int priv_data_size; int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that @@ -3553,10 +2943,6 @@ typedef struct AVCodecParser { const uint8_t *buf, int buf_size); void (*parser_close)(AVCodecParserContext *s); int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); -#if FF_API_NEXT - attribute_deprecated - struct AVCodecParser *next; -#endif } AVCodecParser; /** @@ -3570,13 +2956,6 @@ typedef struct AVCodecParser { */ const AVCodecParser *av_parser_iterate(void **opaque); -#if FF_API_NEXT -attribute_deprecated -AVCodecParser *av_parser_next(const AVCodecParser *c); - -attribute_deprecated -void av_register_codec_parser(AVCodecParser *parser); -#endif AVCodecParserContext *av_parser_init(int codec_id); /** @@ -3617,18 +2996,6 @@ int av_parser_parse2(AVCodecParserContext *s, int64_t pts, int64_t dts, int64_t pos); -#if FF_API_PARSER_CHANGE -/** - * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed - * @deprecated Use dump_extradata, remove_extra or extract_extradata - * bitstream filters instead. - */ -attribute_deprecated -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -#endif void av_parser_close(AVCodecParserContext *s); /** @@ -3641,95 +3008,6 @@ void av_parser_close(AVCodecParserContext *s); * @{ */ -#if FF_API_OLD_ENCDEC -/** - * Encode a frame of audio. - * - * Takes input samples from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay, split, and combine input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. If avpkt->data and - * avpkt->size are set, avpkt->destruct must also be set. All - * other AVPacket fields will be reset by the encoder using - * av_init_packet(). If avpkt->data is NULL, the encoder will - * allocate it. The encoder will set avpkt->size to the size - * of the output packet. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw audio data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame - * can have any number of samples. - * If it is not set, frame->nb_samples must be equal to - * avctx->frame_size for all frames except the last. - * The final frame may be smaller than avctx->frame_size. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); - -/** - * Encode a frame of video. - * - * Takes input raw video data from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay and reorder input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. All other AVPacket fields - * will be reset by the encoder using av_init_packet(). If - * avpkt->data is NULL, the encoder will allocate it. - * The encoder will set avpkt->size to the size of the - * output packet. The returned data (if any) belongs to the - * caller, he is responsible for freeing it. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw video data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); -#endif - int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub); @@ -3738,71 +3016,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ -#if FF_API_AVPICTURE -/** - * @addtogroup lavc_picture - * @{ - */ - -/** - * @deprecated unused - */ -attribute_deprecated -int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -void avpicture_free(AVPicture *picture); - -/** - * @deprecated use av_image_fill_arrays() instead. - */ -attribute_deprecated -int avpicture_fill(AVPicture *picture, const uint8_t *ptr, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated use av_image_copy_to_buffer() instead. - */ -attribute_deprecated -int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, - int width, int height, - unsigned char *dest, int dest_size); - -/** - * @deprecated use av_image_get_buffer_size() instead. - */ -attribute_deprecated -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated av_image_copy() instead. - */ -attribute_deprecated -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int top_band, int left_band); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -/** - * @} - */ -#endif - /** * @defgroup lavc_misc Utility functions * @ingroup libavc @@ -3819,15 +3032,6 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -#if FF_API_GETCHROMA -/** - * @deprecated Use av_pix_fmt_get_chroma_sub_sample - */ - -attribute_deprecated -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); -#endif - /** * Return a value representing the fourCC code associated to the * pixel format pix_fmt, or 0 if no associated fourCC code can be @@ -3856,71 +3060,14 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#if FF_API_AVCODEC_PIX_FMT -/** - * @deprecated see av_get_pix_fmt_loss() - */ -attribute_deprecated -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, - int has_alpha); -/** - * @deprecated see av_find_best_pix_fmt_of_2() - */ -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#endif - enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); /** * @} */ -#if FF_API_TAG_STRING -/** - * Put a string representing the codec tag codec_tag in buf. - * - * @param buf buffer to place codec tag in - * @param buf_size size in bytes of buf - * @param codec_tag codec tag to assign - * @return the length of the string that would have been generated if - * enough space had been available, excluding the trailing null - * - * @deprecated see av_fourcc_make_string() and av_fourcc2str(). - */ -attribute_deprecated -size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); -#endif - void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); -/** - * Return a name for the specified profile, if available. - * - * @param codec the codec that is searched for the given profile - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - */ -const char *av_get_profile_name(const AVCodec *codec, int profile); - -/** - * Return a name for the specified profile, if available. - * - * @param codec_id the ID of the codec to which the requested profile belongs - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - * - * @note unlike av_get_profile_name(), which searches a list of profiles - * supported by a specific decoder or encoder implementation, this - * function searches the list of profiles from the AVCodecDescriptor - */ -const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); - int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -3956,11 +3103,8 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, * Reset the internal codec state / flush internal buffers. Should be called * e.g. when seeking or when switching to a different stream. * - * @note for decoders, when refcounted frames are not used - * (i.e. avctx->refcounted_frames is 0), this invalidates the frames previously - * returned from the decoder. When refcounted frames are used, the decoder just - * releases any references it might keep internally, but the caller's reference - * remains valid. + * @note for decoders, this function just releases any references the decoder + * might keep internally, but the caller's references remain valid. * * @note for encoders, this function will only do something if the encoder * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder @@ -3971,32 +3115,6 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, */ void avcodec_flush_buffers(AVCodecContext *avctx); -/** - * Return codec bits per sample. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum AVCodecID codec_id); - -/** - * Return the PCM codec associated with a sample format. - * @param be endianness, 0 for little, 1 for big, - * -1 (or anything else) for native - * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE - */ -enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); - -/** - * Return codec bits per sample. - * Only return non-zero if the bits per sample is exactly correct, not an - * approximation. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_exact_bits_per_sample(enum AVCodecID codec_id); - /** * Return audio frame duration. * @@ -4007,69 +3125,6 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id); */ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); -/** - * This function is the same as av_get_audio_frame_duration(), except it works - * with AVCodecParameters instead of an AVCodecContext. - */ -int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); - -#if FF_API_OLD_BSF -typedef struct AVBitStreamFilterContext { - void *priv_data; - const struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; - /** - * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). - * Not for access by library users. - */ - char *args; -} AVBitStreamFilterContext; - -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -void av_register_bitstream_filter(AVBitStreamFilter *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init() - * from the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the - * new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); -#endif - -#if FF_API_NEXT -attribute_deprecated -const AVBitStreamFilter *av_bsf_next(void **opaque); -#endif - /* memory */ /** @@ -4087,96 +3142,12 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); */ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); -/** - * Encode extradata length to a buffer. Used by xiph codecs. - * - * @param s buffer to write to; must be at least (v/255+1) bytes long - * @param v size of extradata in bytes - * @return number of bytes written to the buffer. - */ -unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -#if FF_API_USER_VISIBLE_AVHWACCEL -/** - * Register the hardware accelerator hwaccel. - * - * @deprecated This function doesn't do anything. - */ -attribute_deprecated -void av_register_hwaccel(AVHWAccel *hwaccel); - -/** - * If hwaccel is NULL, returns the first registered hardware accelerator, - * if hwaccel is non-NULL, returns the next registered hardware accelerator - * after hwaccel, or NULL if hwaccel is the last one. - * - * @deprecated AVHWaccel structures contain no user-serviceable parts, so - * this function should not be used. - */ -attribute_deprecated -AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); -#endif - -#if FF_API_LOCKMGR -/** - * Lock operation used by lockmgr - * - * @deprecated Deprecated together with av_lockmgr_register(). - */ -enum AVLockOp { - AV_LOCK_CREATE, ///< Create a mutex - AV_LOCK_OBTAIN, ///< Lock the mutex - AV_LOCK_RELEASE, ///< Unlock the mutex - AV_LOCK_DESTROY, ///< Free mutex resources -}; - -/** - * Register a user provided lock manager supporting the operations - * specified by AVLockOp. The "mutex" argument to the function points - * to a (void *) where the lockmgr should store/get a pointer to a user - * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the - * value left by the last call for all other ops. If the lock manager is - * unable to perform the op then it should leave the mutex in the same - * state as when it was called and return a non-zero value. However, - * when called with AV_LOCK_DESTROY the mutex will always be assumed to - * have been successfully destroyed. If av_lockmgr_register succeeds - * it will return a non-negative value, if it fails it will return a - * negative value and destroy all mutex and unregister all callbacks. - * av_lockmgr_register is not thread-safe, it must be called from a - * single thread before any calls which make use of locking are used. - * - * @param cb User defined callback. av_lockmgr_register invokes calls - * to this callback and the previously registered callback. - * The callback will be used to create more than one mutex - * each of which must be backed by its own underlying locking - * mechanism (i.e. do not use a single static object to - * implement your lock manager). If cb is set to NULL the - * lockmgr will be unregistered. - * - * @deprecated This function does nothing, and always returns 0. Be sure to - * build with thread support to get basic thread safety. - */ -attribute_deprecated -int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); -#endif - /** * @return a positive value if s is open (i.e. avcodec_open2() was called on it * with no corresponding avcodec_close()), 0 otherwise. */ int avcodec_is_open(AVCodecContext *s); -/** - * Allocate a CPB properties structure and initialize its fields to default - * values. - * - * @param size if non-NULL, the size of the allocated struct will be written - * here. This is useful for embedding it in side data. - * - * @return the newly allocated struct or NULL on failure - */ -AVCPBProperties *av_cpb_properties_alloc(size_t *size); - /** * @} */ diff --git a/windows/include/x64/libavcodec/bsf.h b/windows/include/x64/libavcodec/bsf.h index 3b5faa8..8c5355d 100644 --- a/windows/include/x64/libavcodec/bsf.h +++ b/windows/include/x64/libavcodec/bsf.h @@ -34,8 +34,6 @@ * @{ */ -typedef struct AVBSFInternal AVBSFInternal; - /** * The bitstream filter state. * @@ -57,12 +55,6 @@ typedef struct AVBSFContext { */ const struct AVBitStreamFilter *filter; - /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - /** * Opaque filter-specific private data. If filter->priv_class is non-NULL, * this is an AVOptions-enabled struct. diff --git a/windows/include/x64/libavcodec/codec.h b/windows/include/x64/libavcodec/codec.h index 50a22f6..a8147ec 100644 --- a/windows/include/x64/libavcodec/codec.h +++ b/windows/include/x64/libavcodec/codec.h @@ -50,7 +50,12 @@ * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. */ #define AV_CODEC_CAP_DR1 (1 << 1) +#if FF_API_FLAG_TRUNCATED +/** + * @deprecated Use parsers to always send proper frames. + */ #define AV_CODEC_CAP_TRUNCATED (1 << 3) +#endif /** * Encoder or decoder requires flushing with NULL input at the end in order to * give the complete and correct output. @@ -214,12 +219,12 @@ typedef struct AVCodec { * see AV_CODEC_CAP_* */ int capabilities; + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder 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} @@ -242,10 +247,13 @@ typedef struct AVCodec { * New public fields should be added right above. ***************************************************************** */ + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; + int priv_data_size; -#if FF_API_NEXT - struct AVCodec *next; -#endif /** * @name Frame-level threading support functions * @{ @@ -258,6 +266,11 @@ typedef struct AVCodec { * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. */ int (*update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src); + + /** + * Copy variables back to the user-facing context + */ + int (*update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src); /** @} */ /** @@ -321,11 +334,6 @@ typedef struct AVCodec { * Will be called when seeking */ void (*flush)(struct AVCodecContext *); - /** - * Internal codec capabilities. - * See FF_CODEC_CAP_* in internal.h - */ - int caps_internal; /** * Decoding only, a comma-separated list of bitstream filters to apply to @@ -365,7 +373,7 @@ const AVCodec *av_codec_iterate(void **opaque); * @param id AVCodecID of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder(enum AVCodecID id); +const AVCodec *avcodec_find_decoder(enum AVCodecID id); /** * Find a registered decoder with the specified name. @@ -373,7 +381,7 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); * @param name name of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder_by_name(const char *name); +const AVCodec *avcodec_find_decoder_by_name(const char *name); /** * Find a registered encoder with a matching codec ID. @@ -381,7 +389,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); * @param id AVCodecID of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder(enum AVCodecID id); +const AVCodec *avcodec_find_encoder(enum AVCodecID id); /** * Find a registered encoder with the specified name. @@ -389,7 +397,7 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id); * @param name name of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder_by_name(const char *name); +const AVCodec *avcodec_find_encoder_by_name(const char *name); /** * @return a non-zero number if codec is an encoder, zero otherwise */ @@ -400,6 +408,15 @@ int av_codec_is_encoder(const AVCodec *codec); */ int av_codec_is_decoder(const AVCodec *codec); +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + enum { /** * The codec supports this format via the hw_device_ctx interface. diff --git a/windows/include/x64/libavcodec/codec_id.h b/windows/include/x64/libavcodec/codec_id.h index ab7bc68..ab265ec 100644 --- a/windows/include/x64/libavcodec/codec_id.h +++ b/windows/include/x64/libavcodec/codec_id.h @@ -22,6 +22,7 @@ #define AVCODEC_CODEC_ID_H #include "libavutil/avutil.h" +#include "libavutil/samplefmt.h" /** * @addtogroup lavc_core @@ -246,8 +247,7 @@ enum AVCodecID { AV_CODEC_ID_MSP2, AV_CODEC_ID_VVC, #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC - - AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_Y41P, AV_CODEC_ID_AVRP, AV_CODEC_ID_012V, AV_CODEC_ID_AVUI, @@ -307,6 +307,7 @@ enum AVCodecID { AV_CODEC_ID_CRI, AV_CODEC_ID_SIMBIOSIS_IMX, AV_CODEC_ID_SGA_VIDEO, + AV_CODEC_ID_GEM, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -341,8 +342,7 @@ enum AVCodecID { AV_CODEC_ID_PCM_S24LE_PLANAR, AV_CODEC_ID_PCM_S32LE_PLANAR, AV_CODEC_ID_PCM_S16BE_PLANAR, - - AV_CODEC_ID_PCM_S64LE = 0x10800, + AV_CODEC_ID_PCM_S64LE, AV_CODEC_ID_PCM_S64BE, AV_CODEC_ID_PCM_F16LE, AV_CODEC_ID_PCM_F24LE, @@ -381,8 +381,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, AV_CODEC_ID_ADPCM_VIMA, - - AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_AFC, AV_CODEC_ID_ADPCM_IMA_OKI, AV_CODEC_ID_ADPCM_DTK, AV_CODEC_ID_ADPCM_IMA_RAD, @@ -401,6 +400,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_IMA_MTF, AV_CODEC_ID_ADPCM_IMA_CUNNING, AV_CODEC_ID_ADPCM_IMA_MOFLEX, + AV_CODEC_ID_ADPCM_IMA_ACORN, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -415,8 +415,7 @@ enum AVCodecID { AV_CODEC_ID_INTERPLAY_DPCM, AV_CODEC_ID_XAN_DPCM, AV_CODEC_ID_SOL_DPCM, - - AV_CODEC_ID_SDX2_DPCM = 0x14800, + AV_CODEC_ID_SDX2_DPCM, AV_CODEC_ID_GREMLIN_DPCM, AV_CODEC_ID_DERF_DPCM, @@ -489,8 +488,7 @@ enum AVCodecID { AV_CODEC_ID_ON2AVC, AV_CODEC_ID_DSS_SP, AV_CODEC_ID_CODEC2, - - AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_FFWAVESYNTH, AV_CODEC_ID_SONIC, AV_CODEC_ID_SONIC_LS, AV_CODEC_ID_EVRC, @@ -517,6 +515,7 @@ enum AVCodecID { AV_CODEC_ID_SIREN, AV_CODEC_ID_HCA, AV_CODEC_ID_FASTAUDIO, + AV_CODEC_ID_MSNSIREN, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -529,8 +528,7 @@ enum AVCodecID { AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT, AV_CODEC_ID_SRT, - - AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_MICRODVD, AV_CODEC_ID_EIA_608, AV_CODEC_ID_JACOSUB, AV_CODEC_ID_SAMI, @@ -554,7 +552,7 @@ enum AVCodecID { AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. AV_CODEC_ID_EPG, - AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_BINTEXT, AV_CODEC_ID_XBIN, AV_CODEC_ID_IDF, AV_CODEC_ID_OTF, @@ -585,6 +583,45 @@ enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); */ const char *avcodec_get_name(enum AVCodecID id); +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + /** * @} */ diff --git a/windows/include/x64/libavcodec/codec_par.h b/windows/include/x64/libavcodec/codec_par.h index 948758e..10cf79d 100644 --- a/windows/include/x64/libavcodec/codec_par.h +++ b/windows/include/x64/libavcodec/codec_par.h @@ -221,6 +221,11 @@ void avcodec_parameters_free(AVCodecParameters **par); */ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); +/** + * This function is the same as av_get_audio_frame_duration(), except it works + * with AVCodecParameters instead of an AVCodecContext. + */ +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); /** * @} diff --git a/windows/include/x64/libavcodec/defs.h b/windows/include/x64/libavcodec/defs.h new file mode 100644 index 0000000..420a042 --- /dev/null +++ b/windows/include/x64/libavcodec/defs.h @@ -0,0 +1,170 @@ +/* + * + * 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_DEFS_H +#define AVCODEC_DEFS_H + +/** + * @file + * @ingroup libavc + * Misc types and constants that do not belong anywhere else. + */ + +#include +#include + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define AV_INPUT_BUFFER_PADDING_SIZE 64 + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int64_t buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** + * This structure supplies correlation between a packet timestamp and a wall clock + * production time. The definition follows the Producer Reference Time ('prft') + * as defined in ISO/IEC 14496-12 + */ +typedef struct AVProducerReferenceTime { + /** + * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). + */ + int64_t wallclock; + int flags; +} AVProducerReferenceTime; + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#endif // AVCODEC_DEFS_H diff --git a/windows/include/x64/libavcodec/dv_profile.h b/windows/include/x64/libavcodec/dv_profile.h index 9380a66..4365f1b 100644 --- a/windows/include/x64/libavcodec/dv_profile.h +++ b/windows/include/x64/libavcodec/dv_profile.h @@ -23,7 +23,6 @@ #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "avcodec.h" /* minimum number of bytes to read from a DV stream in order to * determine the profile */ diff --git a/windows/include/x64/libavcodec/packet.h b/windows/include/x64/libavcodec/packet.h index ca18ae6..4a349fe 100644 --- a/windows/include/x64/libavcodec/packet.h +++ b/windows/include/x64/libavcodec/packet.h @@ -290,6 +290,14 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_S12M_TIMECODE, + /** + * HDR10+ dynamic metadata associated with a video frame. The metadata is in + * the form of the AVDynamicHDRPlus struct and contains + * information for color volume transform - application 4 of + * SMPTE 2094-40:2016 standard. + */ + AV_PKT_DATA_DYNAMIC_HDR10_PLUS, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may @@ -305,11 +313,7 @@ enum AVPacketSideDataType { typedef struct AVPacketSideData { uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif enum AVPacketSideDataType type; } AVPacketSideData; @@ -388,15 +392,29 @@ typedef struct AVPacket { int64_t pos; ///< byte position in stream, -1 if unknown -#if FF_API_CONVERGENCE_DURATION /** - * @deprecated Same as the duration field, but as int64_t. This was required - * for Matroska subtitles, whose duration values could overflow when the - * duration field was still an int. + * for some private data of the user */ - attribute_deprecated - int64_t convergence_duration; -#endif + void *opaque; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the packet is unreferenced. av_packet_copy_props() calls create a new + * reference with av_buffer_ref() for the target packet's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * Time base of the packet's timestamps. + * In the future, this field may be set on packets output by encoders or + * demuxers, but its value will be by default ignored on input to decoders + * or muxers. + */ + AVRational time_base; } AVPacket; #if FF_API_INIT_PACKET @@ -529,45 +547,6 @@ int av_grow_packet(AVPacket *pkt, int grow_by); */ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); -#if FF_API_AVPACKET_OLD_API -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated. - * - * @deprecated Use av_packet_ref or av_packet_make_refcounted - */ -attribute_deprecated -int av_dup_packet(AVPacket *pkt); -/** - * Copy packet, including contents - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_ref - */ -attribute_deprecated -int av_copy_packet(AVPacket *dst, const AVPacket *src); - -/** - * Copy packet side data - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_copy_props - */ -attribute_deprecated -int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); - -/** - * Free a packet. - * - * @deprecated Use av_packet_unref - * - * @param pkt packet to free - */ -attribute_deprecated -void av_free_packet(AVPacket *pkt); -#endif /** * Allocate new information of a packet. * @@ -577,11 +556,7 @@ void av_free_packet(AVPacket *pkt); * @return pointer to fresh allocated data or NULL otherwise */ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Wrap an existing array as a packet side data. @@ -608,11 +583,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return 0 on success, < 0 on failure */ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Get side information from packet. @@ -624,19 +595,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return pointer to data if present or NULL otherwise */ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int *size); -#else size_t *size); -#endif - -#if FF_API_MERGE_SD_API -attribute_deprecated -int av_packet_merge_side_data(AVPacket *pkt); - -attribute_deprecated -int av_packet_split_side_data(AVPacket *pkt); -#endif const char *av_packet_side_data_name(enum AVPacketSideDataType type); @@ -647,11 +606,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type); * @param size pointer to store the size of the returned data * @return pointer to data if successful, NULL otherwise */ -#if FF_API_BUFFER_SIZE_T -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); -#else uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); -#endif /** * Unpack a dictionary from side_data. * @@ -660,12 +615,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); * @param dict the metadata storage dictionary * @return 0 on success, < 0 on failure */ -#if FF_API_BUFFER_SIZE_T -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); -#else int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict); -#endif /** * Convenience function to free all the side data stored. diff --git a/windows/include/x64/libavcodec/vaapi.h b/windows/include/x64/libavcodec/vaapi.h deleted file mode 100644 index 2cf7da5..0000000 --- a/windows/include/x64/libavcodec/vaapi.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Video Acceleration API (shared data between FFmpeg and the video player) - * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 - * - * Copyright (C) 2008-2009 Splitted-Desktop Systems - * - * 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_VAAPI_H -#define AVCODEC_VAAPI_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vaapi - * Public libavcodec VA API header. - */ - -#include -#include "libavutil/attributes.h" -#include "version.h" - -#if FF_API_STRUCT_VAAPI_CONTEXT - -/** - * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding - * @ingroup lavc_codec_hwaccel - * @{ - */ - -/** - * This structure is used to share data between the FFmpeg library and - * the client video application. - * This shall be zero-allocated and available as - * AVCodecContext.hwaccel_context. All user members can be set once - * during initialization or through each AVCodecContext.get_buffer() - * function call. In any case, they must be valid prior to calling - * decoding functions. - * - * Deprecated: use AVCodecContext.hw_frames_ctx instead. - */ -struct attribute_deprecated vaapi_context { - /** - * Window system dependent data - * - * - encoding: unused - * - decoding: Set by user - */ - void *display; - - /** - * Configuration ID - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t config_id; - - /** - * Context ID (video decode pipeline) - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t context_id; -}; - -/* @} */ - -#endif /* FF_API_STRUCT_VAAPI_CONTEXT */ - -#endif /* AVCODEC_VAAPI_H */ diff --git a/windows/include/x64/libavcodec/vdpau.h b/windows/include/x64/libavcodec/vdpau.h index 4d99943..3010094 100644 --- a/windows/include/x64/libavcodec/vdpau.h +++ b/windows/include/x64/libavcodec/vdpau.h @@ -55,7 +55,6 @@ #include "libavutil/attributes.h" #include "avcodec.h" -#include "version.h" struct AVCodecContext; struct AVFrame; @@ -153,24 +152,6 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, */ AVVDPAUContext *av_vdpau_alloc_context(void); -#if FF_API_VDPAU_PROFILE -/** - * Get a decoder profile that should be used for initializing a VDPAU decoder. - * Should be called from the AVCodecContext.get_format() callback. - * - * @deprecated Use av_vdpau_bind_context() instead. - * - * @param avctx the codec context being used for decoding the stream - * @param profile a pointer into which the result will be written on success. - * The contents of profile are undefined if this function returns - * an error. - * - * @return 0 on success (non-negative), a negative AVERROR on failure. - */ -attribute_deprecated -int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); -#endif - /* @}*/ #endif /* AVCODEC_VDPAU_H */ diff --git a/windows/include/x64/libavcodec/version.h b/windows/include/x64/libavcodec/version.h index cfdde46..4d77431 100644 --- a/windows/include/x64/libavcodec/version.h +++ b/windows/include/x64/libavcodec/version.h @@ -27,8 +27,8 @@ #include "libavutil/version.h" -#define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 134 +#define LIBAVCODEC_VERSION_MAJOR 59 +#define LIBAVCODEC_VERSION_MINOR 18 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -51,122 +51,17 @@ * at once through the bump. This improves the git bisect-ability of the change. */ -#ifndef FF_API_AVCTX_TIMEBASE -#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODED_FRAME -#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_SIDEDATA_ONLY_PKT -#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VDPAU_PROFILE -#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CONVERGENCE_DURATION -#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPICTURE -#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPACKET_OLD_API -#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_RTP_CALLBACK -#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VBV_DELAY -#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODER_TYPE -#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STAT_BITS -#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PRIVATE_OPT -#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_ASS_TIMING -#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_BSF -#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_COPY_CONTEXT -#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GET_CONTEXT_DEFAULTS -#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NVENC_OLD_NAME -#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STRUCT_VAAPI_CONTEXT -#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MERGE_SD_API -#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_TAG_STRING -#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GETCHROMA -#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODEC_GET_SET -#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_USER_VISIBLE_AVHWACCEL -#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_LOCKMGR -#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NEXT -#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNSANITIZED_BITRATES -#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_SLICE_MODE -#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_CABAC -#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNUSED_CODEC_CAPS -#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPRIV_PUT_BITS -#define FF_API_AVPRIV_PUT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_ENCDEC -#define FF_API_OLD_ENCDEC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVCODEC_PIX_FMT -#define FF_API_AVCODEC_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MPV_RC_STRATEGY -#define FF_API_MPV_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PARSER_CHANGE -#define FF_API_PARSER_CHANGE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_THREAD_SAFE_CALLBACKS +#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_GET_FRAME_CLASS #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_AUTO_THREADS #define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_INIT_PACKET #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) -#endif +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_MPEGVIDEO_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_H */ diff --git a/windows/include/x64/libavutil/adler32.h b/windows/include/x64/libavutil/adler32.h index e7a8f83..232d07f 100644 --- a/windows/include/x64/libavutil/adler32.h +++ b/windows/include/x64/libavutil/adler32.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_adler32 Adler-32 @@ -40,11 +39,7 @@ * @{ */ -#if FF_API_CRYPTO_SIZE_T -typedef unsigned long AVAdler; -#else typedef uint32_t AVAdler; -#endif /** * Calculate the Adler32 checksum of a buffer. @@ -59,11 +54,7 @@ typedef uint32_t AVAdler; * @return updated checksum */ AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, -#if FF_API_CRYPTO_SIZE_T - unsigned int len) av_pure; -#else size_t len) av_pure; -#endif /** * @} diff --git a/windows/include/x64/libavutil/aes.h b/windows/include/x64/libavutil/aes.h index 09efbda..d243286 100644 --- a/windows/include/x64/libavutil/aes.h +++ b/windows/include/x64/libavutil/aes.h @@ -24,7 +24,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_aes AES diff --git a/windows/include/x64/libavutil/aes_ctr.h b/windows/include/x64/libavutil/aes_ctr.h index e4aae12..4e9fda7 100644 --- a/windows/include/x64/libavutil/aes_ctr.h +++ b/windows/include/x64/libavutil/aes_ctr.h @@ -25,7 +25,6 @@ #include #include "attributes.h" -#include "version.h" #define AES_CTR_KEY_SIZE (16) #define AES_CTR_IV_SIZE (8) diff --git a/windows/include/x64/libavutil/buffer.h b/windows/include/x64/libavutil/buffer.h index 241a80e..e1ef5b7 100644 --- a/windows/include/x64/libavutil/buffer.h +++ b/windows/include/x64/libavutil/buffer.h @@ -28,8 +28,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_buffer AVBuffer * @ingroup lavu_data @@ -93,11 +91,7 @@ typedef struct AVBufferRef { /** * Size of data in bytes. */ -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif } AVBufferRef; /** @@ -105,21 +99,13 @@ typedef struct AVBufferRef { * * @return an AVBufferRef of given size or NULL when out of memory */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_alloc(int size); -#else AVBufferRef *av_buffer_alloc(size_t size); -#endif /** * Same as av_buffer_alloc(), except the returned buffer will be initialized * to zero. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_allocz(int size); -#else AVBufferRef *av_buffer_allocz(size_t size); -#endif /** * Always treat the buffer as read-only, even when it has only one @@ -142,11 +128,7 @@ AVBufferRef *av_buffer_allocz(size_t size); * * @return an AVBufferRef referring to data on success, NULL on failure. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_create(uint8_t *data, int size, -#else AVBufferRef *av_buffer_create(uint8_t *data, size_t size, -#endif void (*free)(void *opaque, uint8_t *data), void *opaque, int flags); @@ -163,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on * failure. */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); /** * Free a given reference and automatically free the buffer if there are no more @@ -214,11 +196,7 @@ int av_buffer_make_writable(AVBufferRef **buf); * reference to it (i.e. the one passed to this function). In all other cases * a new buffer is allocated and the data is copied. */ -#if FF_API_BUFFER_SIZE_T -int av_buffer_realloc(AVBufferRef **buf, int size); -#else int av_buffer_realloc(AVBufferRef **buf, size_t size); -#endif /** * Ensure dst refers to the same data as src. @@ -234,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); * @return 0 on success * AVERROR(ENOMEM) on memory allocation failure. */ -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); /** * @} @@ -285,11 +263,7 @@ typedef struct AVBufferPool AVBufferPool; * (av_buffer_alloc()). * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); -#else AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size)); -#endif /** * Allocate and initialize a buffer pool with a more complex allocator. @@ -306,13 +280,8 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size * data. May be NULL. * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), -#else AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, AVBufferRef* (*alloc)(void *opaque, size_t size), -#endif void (*pool_free)(void *opaque)); /** @@ -344,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); * therefore you have to use this function to access the original opaque * parameter of an allocated buffer. */ -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); /** * @} diff --git a/windows/include/x64/libavutil/common.h b/windows/include/x64/libavutil/common.h index aee353d..3eb9bc5 100644 --- a/windows/include/x64/libavutil/common.h +++ b/windows/include/x64/libavutil/common.h @@ -42,13 +42,6 @@ #include "attributes.h" #include "macros.h" #include "version.h" -#include "libavutil/avconfig.h" - -#if AV_HAVE_BIGENDIAN -# define AV_NE(be, le) (be) -#else -# define AV_NE(be, le) (le) -#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -89,25 +82,6 @@ #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) -/** - * Comparator. - * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 - * if x == y. This is useful for instance in a qsort comparator callback. - * Furthermore, compilers are able to optimize this to branchless code, and - * there is no risk of overflow with signed types. - * As with many macros, this evaluates its argument multiple times, it thus - * must not have a side-effect. - */ -#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) - /* misc math functions */ #ifdef HAVE_AV_CONFIG_H @@ -405,6 +379,8 @@ static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) { /** * Clip a float value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -415,13 +391,13 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** * Clip a double value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -432,9 +408,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** Compute ceil(log2(x)). @@ -475,9 +449,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v) return av_popcount(v) & 1; } -#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) -#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) - /** * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. * diff --git a/windows/include/x64/libavutil/cpu.h b/windows/include/x64/libavutil/cpu.h index 83099dd..ce9bf14 100644 --- a/windows/include/x64/libavutil/cpu.h +++ b/windows/include/x64/libavutil/cpu.h @@ -23,8 +23,6 @@ #include -#include "attributes.h" - #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ /* lower 16 bits - CPU features */ @@ -56,6 +54,7 @@ #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers. #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 @@ -74,6 +73,10 @@ #define AV_CPU_FLAG_MMI (1 << 0) #define AV_CPU_FLAG_MSA (1 << 1) +//Loongarch SIMD extension. +#define AV_CPU_FLAG_LSX (1 << 0) +#define AV_CPU_FLAG_LASX (1 << 1) + /** * Return the flags which specify extensions supported by the CPU. * The returned value is affected by av_force_cpu_flags() if that was used @@ -88,25 +91,6 @@ int av_get_cpu_flags(void); */ void av_force_cpu_flags(int flags); -/** - * Set a mask on flags returned by av_get_cpu_flags(). - * This function is mainly useful for testing. - * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible - */ -attribute_deprecated void av_set_cpu_flags_mask(int mask); - -/** - * Parse CPU flags from a string. - * - * The returned flags contain the specified flags as well as related unspecified flags. - * - * This function exists only for compatibility with libav. - * Please use av_parse_cpu_caps() when possible. - * @return a combination of AV_CPU_* flags, negative on error. - */ -attribute_deprecated -int av_parse_cpu_flags(const char *s); - /** * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. * @@ -119,6 +103,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s); */ int av_cpu_count(void); +/** + * Overrides cpu count detection and forces the specified count. + * Count < 1 disables forcing of specific count. + */ +void av_cpu_force_count(int count); + /** * Get the maximum data alignment that may be required by FFmpeg. * diff --git a/windows/include/x64/libavutil/crc.h b/windows/include/x64/libavutil/crc.h index 47e22b4..24a2e3c 100644 --- a/windows/include/x64/libavutil/crc.h +++ b/windows/include/x64/libavutil/crc.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_crc32 CRC diff --git a/windows/include/x64/libavutil/detection_bbox.h b/windows/include/x64/libavutil/detection_bbox.h new file mode 100644 index 0000000..c20c204 --- /dev/null +++ b/windows/include/x64/libavutil/detection_bbox.h @@ -0,0 +1,107 @@ +/* + * 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 AVUTIL_DETECTION_BBOX_H +#define AVUTIL_DETECTION_BBOX_H + +#include "rational.h" +#include "avassert.h" +#include "frame.h" + +typedef struct AVDetectionBBox { + /** + * Distance in pixels from the left/top edge of the frame, + * together with width and height, defining the bounding box. + */ + int x; + int y; + int w; + int h; + +#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64 + + /** + * Detect result with confidence + */ + char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational detect_confidence; + + /** + * At most 4 classifications based on the detected bounding box. + * For example, we can get max 4 different attributes with 4 different + * DNN models on one bounding box. + * classify_count is zero if no classification. + */ +#define AV_NUM_DETECTION_BBOX_CLASSIFY 4 + uint32_t classify_count; + char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY]; +} AVDetectionBBox; + +typedef struct AVDetectionBBoxHeader { + /** + * Information about how the bounding box is generated. + * for example, the DNN model name. + */ + char source[256]; + + /** + * Number of bounding boxes in the array. + */ + uint32_t nb_bboxes; + + /** + * Offset in bytes from the beginning of this structure at which + * the array of bounding boxes starts. + */ + size_t bboxes_offset; + + /** + * Size of each bounding box in bytes. + */ + size_t bbox_size; +} AVDetectionBBoxHeader; + +/* + * Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes. + */ +static av_always_inline AVDetectionBBox * +av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx) +{ + av_assert0(idx < header->nb_bboxes); + return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset + + idx * header->bbox_size); +} + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, and initializes the variables. + * Can be freed with a normal av_free() call. + * + * @param out_size if non-NULL, the size in bytes of the resulting data array is + * written here. + */ +AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size); + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type + * AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables. + */ +AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes); +#endif diff --git a/windows/include/x64/libavutil/dict.h b/windows/include/x64/libavutil/dict.h index 118f1f0..0d1afc6 100644 --- a/windows/include/x64/libavutil/dict.h +++ b/windows/include/x64/libavutil/dict.h @@ -32,8 +32,6 @@ #include -#include "version.h" - /** * @addtogroup lavu_dict AVDictionary * @ingroup lavu_data diff --git a/windows/include/x64/libavutil/display.h b/windows/include/x64/libavutil/display.h index 515adad..d87bf68 100644 --- a/windows/include/x64/libavutil/display.h +++ b/windows/include/x64/libavutil/display.h @@ -88,7 +88,7 @@ double av_display_rotation_get(const int32_t matrix[9]); /** - * Initialize a transformation matrix describing a pure counterclockwise + * Initialize a transformation matrix describing a pure clockwise * rotation by the specified angle (in degrees). * * @param matrix an allocated transformation matrix (will be fully overwritten diff --git a/windows/include/x64/libavutil/dovi_meta.h b/windows/include/x64/libavutil/dovi_meta.h index 299911d..3d11e02 100644 --- a/windows/include/x64/libavutil/dovi_meta.h +++ b/windows/include/x64/libavutil/dovi_meta.h @@ -29,6 +29,7 @@ #include #include +#include "rational.h" /* * DOVI configuration @@ -67,4 +68,169 @@ typedef struct AVDOVIDecoderConfigurationRecord { */ AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size); +/** + * Dolby Vision RPU data header. + * + * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI. + */ +typedef struct AVDOVIRpuDataHeader { + uint8_t rpu_type; + uint16_t rpu_format; + uint8_t vdr_rpu_profile; + uint8_t vdr_rpu_level; + uint8_t chroma_resampling_explicit_filter_flag; + uint8_t coef_data_type; /* informative, lavc always converts to fixed */ + uint8_t coef_log2_denom; + uint8_t vdr_rpu_normalized_idc; + uint8_t bl_video_full_range_flag; + uint8_t bl_bit_depth; /* [8, 16] */ + uint8_t el_bit_depth; /* [8, 16] */ + uint8_t vdr_bit_depth; /* [8, 16] */ + uint8_t spatial_resampling_filter_flag; + uint8_t el_spatial_resampling_filter_flag; + uint8_t disable_residual_flag; +} AVDOVIRpuDataHeader; + +enum AVDOVIMappingMethod { + AV_DOVI_MAPPING_POLYNOMIAL = 0, + AV_DOVI_MAPPING_MMR = 1, +}; + +/** + * Coefficients of a piece-wise function. The pieces of the function span the + * value ranges between two adjacent pivot values. + */ +#define AV_DOVI_MAX_PIECES 8 +typedef struct AVDOVIReshapingCurve { + uint8_t num_pivots; /* [2, 9] */ + uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */ + enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]; + /* AV_DOVI_MAPPING_POLYNOMIAL */ + uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */ + int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */ + /* AV_DOVI_MAPPING_MMR */ + uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */ + int64_t mmr_constant[AV_DOVI_MAX_PIECES]; + int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7]; +} AVDOVIReshapingCurve; + +enum AVDOVINLQMethod { + AV_DOVI_NLQ_NONE = -1, + AV_DOVI_NLQ_LINEAR_DZ = 0, +}; + +/** + * Coefficients of the non-linear inverse quantization. For the interpretation + * of these, see ETSI GS CCM 001. + */ +typedef struct AVDOVINLQParams { + uint16_t nlq_offset; + uint64_t vdr_in_max; + /* AV_DOVI_NLQ_LINEAR_DZ */ + uint64_t linear_deadzone_slope; + uint64_t linear_deadzone_threshold; +} AVDOVINLQParams; + +/** + * Dolby Vision RPU data mapping parameters. + * + * @note sizeof(AVDOVIDataMapping) is not part of the public ABI. + */ +typedef struct AVDOVIDataMapping { + uint8_t vdr_rpu_id; + uint8_t mapping_color_space; + uint8_t mapping_chroma_format_idc; + AVDOVIReshapingCurve curves[3]; /* per component */ + + /* Non-linear inverse quantization */ + enum AVDOVINLQMethod nlq_method_idc; + uint32_t num_x_partitions; + uint32_t num_y_partitions; + AVDOVINLQParams nlq[3]; /* per component */ +} AVDOVIDataMapping; + +/** + * Dolby Vision RPU colorspace metadata parameters. + * + * @note sizeof(AVDOVIColorMetadata) is not part of the public ABI. + */ +typedef struct AVDOVIColorMetadata { + uint8_t dm_metadata_id; + uint8_t scene_refresh_flag; + + /** + * Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be + * used instead of the matrices indicated by the frame's colorspace tags. + * The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB + * matrix based on a Hunt-Pointer-Estevez transform, but without any + * crosstalk. (See the definition of the ICtCp colorspace for more + * information.) + */ + AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */ + AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */ + AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */ + + /** + * Extra signal metadata (see Dolby patents for more info). + */ + uint16_t signal_eotf; + uint16_t signal_eotf_param0; + uint16_t signal_eotf_param1; + uint32_t signal_eotf_param2; + uint8_t signal_bit_depth; + uint8_t signal_color_space; + uint8_t signal_chroma_format; + uint8_t signal_full_range_flag; /* [0, 3] */ + uint16_t source_min_pq; + uint16_t source_max_pq; + uint16_t source_diagonal; +} AVDOVIColorMetadata; + +/** + * Combined struct representing a combination of header, mapping and color + * metadata, for attaching to frames as side data. + * + * @note The struct must be allocated with av_dovi_metadata_alloc() and + * its size is not a part of the public ABI. + */ + +typedef struct AVDOVIMetadata { + /** + * Offset in bytes from the beginning of this structure at which the + * respective structs start. + */ + size_t header_offset; /* AVDOVIRpuDataHeader */ + size_t mapping_offset; /* AVDOVIDataMapping */ + size_t color_offset; /* AVDOVIColorMetadata */ +} AVDOVIMetadata; + +static av_always_inline AVDOVIRpuDataHeader * +av_dovi_get_header(const AVDOVIMetadata *data) +{ + return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset); +} + +static av_always_inline AVDOVIDataMapping * +av_dovi_get_mapping(const AVDOVIMetadata *data) +{ + return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset); +} + +static av_always_inline AVDOVIColorMetadata * +av_dovi_get_color(const AVDOVIMetadata *data) +{ + return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset); +} + +/** + * Allocate an AVDOVIMetadata structure and initialize its + * fields to default values. + * + * @param size If this parameter is non-NULL, the size in bytes of the + * allocated struct will be written here on success + * + * @return the newly allocated struct or NULL on failure + */ +AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size); + #endif /* AVUTIL_DOVI_META_H */ diff --git a/windows/include/x64/libavutil/error.h b/windows/include/x64/libavutil/error.h index 71df4da..0d3269a 100644 --- a/windows/include/x64/libavutil/error.h +++ b/windows/include/x64/libavutil/error.h @@ -27,6 +27,8 @@ #include #include +#include "macros.h" + /** * @addtogroup lavu_error * diff --git a/windows/include/x64/libavutil/ffversion.h b/windows/include/x64/libavutil/ffversion.h index c2b610f..cb3926a 100644 --- a/windows/include/x64/libavutil/ffversion.h +++ b/windows/include/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "n4.4.1" +#define FFMPEG_VERSION "n5.0" #endif /* AVUTIL_FFVERSION_H */ diff --git a/windows/include/x64/libavutil/film_grain_params.h b/windows/include/x64/libavutil/film_grain_params.h index 7629e3a..f3bd0a4 100644 --- a/windows/include/x64/libavutil/film_grain_params.h +++ b/windows/include/x64/libavutil/film_grain_params.h @@ -28,6 +28,11 @@ enum AVFilmGrainParamsType { * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom) */ AV_FILM_GRAIN_PARAMS_AV1, + + /** + * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274) + */ + AV_FILM_GRAIN_PARAMS_H274, }; /** @@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams { int limit_output_range; } AVFilmGrainAOMParams; +/** + * This structure describes how to handle film grain synthesis for codecs using + * the ITU-T H.274 Versatile suplemental enhancement information message. + * + * @note The struct must be allocated as part of AVFilmGrainParams using + * av_film_grain_params_alloc(). Its size is not a part of the public ABI. + */ +typedef struct AVFilmGrainH274Params { + /** + * Specifies the film grain simulation mode. + * 0 = Frequency filtering, 1 = Auto-regression + */ + int model_id; + + /** + * Specifies the bit depth used for the luma component. + */ + int bit_depth_luma; + + /** + * Specifies the bit depth used for the chroma components. + */ + int bit_depth_chroma; + + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + + /** + * Specifies the blending mode used to blend the simulated film grain + * with the decoded images. + * + * 0 = Additive, 1 = Multiplicative + */ + int blending_mode_id; + + /** + * Specifies a scale factor used in the film grain characterization equations. + */ + int log2_scale_factor; + + /** + * Indicates if the modelling of film grain for a given component is present. + */ + int component_model_present[3 /* y, cb, cr */]; + + /** + * Specifies the number of intensity intervals for which a specific set of + * model values has been estimated, with a range of [1, 256]. + */ + uint16_t num_intensity_intervals[3 /* y, cb, cr */]; + + /** + * Specifies the number of model values present for each intensity interval + * in which the film grain has been modelled, with a range of [1, 6]. + */ + uint8_t num_model_values[3 /* y, cb, cr */]; + + /** + * Specifies the lower ounds of each intensity interval for whichthe set of + * model values applies for the component. + */ + uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the upper bound of each intensity interval for which the set of + * model values applies for the component. + */ + uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the model values for the component for each intensity interval. + * - When model_id == 0, the following applies: + * For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1] + * For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1] + * - Otherwise, the following applies: + * For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1] + * For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1] + */ + int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */]; +} AVFilmGrainH274Params; + /** * This structure describes how to handle film grain synthesis in video * for specific codecs. Must be present on every frame where film grain is @@ -133,6 +221,9 @@ typedef struct AVFilmGrainParams { /** * Seed to use for the synthesis process, if the codec allows for it. + * + * @note For H.264, this refers to `pic_offset` as defined in + * SMPTE RDD 5-2006. */ uint64_t seed; @@ -143,6 +234,7 @@ typedef struct AVFilmGrainParams { */ union { AVFilmGrainAOMParams aom; + AVFilmGrainH274Params h274; } codec; } AVFilmGrainParams; diff --git a/windows/include/x64/libavutil/frame.h b/windows/include/x64/libavutil/frame.h index 7d1f8e2..18e239f 100644 --- a/windows/include/x64/libavutil/frame.h +++ b/windows/include/x64/libavutil/frame.h @@ -142,23 +142,6 @@ enum AVFrameSideDataType { */ AV_FRAME_DATA_ICC_PROFILE, -#if FF_API_FRAME_QP - /** - * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA. - * The contents of this side data are undocumented and internal; use - * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a - * meaningful way instead. - */ - AV_FRAME_DATA_QP_TABLE_PROPERTIES, - - /** - * Raw QP table data. Its format is described by - * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and - * av_frame_get_qp_table() to access this instead. - */ - AV_FRAME_DATA_QP_TABLE_DATA, -#endif - /** * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t * where the first uint32_t describes how many (1-3) of the other timecodes are used. @@ -198,6 +181,26 @@ enum AVFrameSideDataType { * Must be present for every frame which should have film grain applied. */ AV_FRAME_DATA_FILM_GRAIN_PARAMS, + + /** + * Bounding boxes for object detection and classification, + * as described by AVDetectionBBoxHeader. + */ + AV_FRAME_DATA_DETECTION_BBOXES, + + /** + * Dolby Vision RPU raw data, suitable for passing to x265 + * or other libraries. Array of uint8_t, with NAL emulation + * bytes intact. + */ + AV_FRAME_DATA_DOVI_RPU_BUFFER, + + /** + * Parsed Dolby Vision metadata, suitable for passing to a software + * implementation. The payload is the AVDOVIMetadata struct defined in + * libavutil/dovi_meta.h. + */ + AV_FRAME_DATA_DOVI_METADATA, }; enum AVActiveFormatDescription { @@ -220,11 +223,7 @@ enum AVActiveFormatDescription { typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif AVDictionary *metadata; AVBufferRef *buf; } AVFrameSideData; @@ -319,21 +318,32 @@ typedef struct AVFrame { #define AV_NUM_DATA_POINTERS 8 /** * pointer to the picture/channel planes. - * This might be different from the first allocated byte + * This might be different from the first allocated byte. For video, + * it could even point to the end of the image data. + * + * All pointers in data and extended_data must point into one of the + * AVBufferRef in buf or extended_buf. * * Some decoders access areas outside 0,0 - width,height, please * see avcodec_align_dimensions2(). Some filters and swscale can read * up to 16 bytes beyond the planes, if these filters are to be used, * then 16 extra bytes must be allocated. * - * NOTE: Except for hwaccel formats, pointers not needed by the format - * MUST be set to NULL. + * NOTE: Pointers not needed by the format MUST be set to NULL. + * + * @attention In case of video, the data[] pointers can point to the + * end of image data in order to reverse line order, when used in + * combination with negative values in the linesize[] array. */ uint8_t *data[AV_NUM_DATA_POINTERS]; /** - * For video, size in bytes of each picture line. - * For audio, size in bytes of each plane. + * For video, a positive or negative value, which is typically indicating + * the size in bytes of each picture line, but it can also be: + * - the negative byte size of lines for vertical flipping + * (with data[n] pointing to the end of the data + * - a positive or negative multiple of the byte size as for accessing + * even and odd fields of a frame (possibly flipped) * * For audio, only linesize[0] may be set. For planar audio, each channel * plane must be the same size. @@ -345,6 +355,9 @@ typedef struct AVFrame { * * @note The linesize may be larger than the size of usable data -- there * may be extra padding present for performance reasons. + * + * @attention In case of video, line size values can be negative to achieve + * a vertically inverted iteration over image lines. */ int linesize[AV_NUM_DATA_POINTERS]; @@ -410,15 +423,6 @@ typedef struct AVFrame { */ int64_t pts; -#if FF_API_PKT_PTS - /** - * PTS copied from the AVPacket that was decoded to produce this frame. - * @deprecated use the pts field instead - */ - attribute_deprecated - int64_t pkt_pts; -#endif - /** * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) * This is also the Presentation time of this AVFrame calculated from @@ -426,6 +430,14 @@ typedef struct AVFrame { */ int64_t pkt_dts; + /** + * Time base for the timestamps in this frame. + * In the future, this field may be set on frames output by decoders or + * filters, but its value will be by default ignored on input to encoders + * or filters. + */ + AVRational time_base; + /** * picture number in bitstream order */ @@ -445,14 +457,6 @@ typedef struct AVFrame { */ void *opaque; -#if FF_API_ERROR_FRAME - /** - * @deprecated unused - */ - attribute_deprecated - uint64_t error[AV_NUM_DATA_POINTERS]; -#endif - /** * When decoding, this signals how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps) @@ -495,10 +499,10 @@ typedef struct AVFrame { uint64_t channel_layout; /** - * AVBuffer references backing the data for this frame. If all elements of - * this array are NULL, then this frame is not reference counted. This array - * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must - * also be non-NULL for all j < i. + * 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 + * extended_buf. This array must be filled contiguously -- if buf[i] is + * non-NULL then buf[j] must also be non-NULL for all j < i. * * There may be at most one AVBuffer per data plane, so for video this array * always contains all the references. For planar audio with more than @@ -632,24 +636,6 @@ typedef struct AVFrame { */ int pkt_size; -#if FF_API_FRAME_QP - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - attribute_deprecated - AVBufferRef *qp_table_buf; -#endif /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. @@ -697,69 +683,16 @@ typedef struct AVFrame { AVBufferRef *private_ref; } AVFrame; -#if FF_API_FRAME_GET_SET -/** - * Accessors for some AVFrame fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); -attribute_deprecated -void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_duration (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_pos (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_channel_layout (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channel_layout (AVFrame *frame, int64_t val); -attribute_deprecated -int av_frame_get_channels (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channels (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_sample_rate (const AVFrame *frame); -attribute_deprecated -void av_frame_set_sample_rate (AVFrame *frame, int val); -attribute_deprecated -AVDictionary *av_frame_get_metadata (const AVFrame *frame); -attribute_deprecated -void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); -attribute_deprecated -int av_frame_get_decode_error_flags (const AVFrame *frame); -attribute_deprecated -void av_frame_set_decode_error_flags (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_pkt_size(const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_size(AVFrame *frame, int val); -#if FF_API_FRAME_QP -attribute_deprecated -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); -attribute_deprecated -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); -#endif -attribute_deprecated -enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); -attribute_deprecated -void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); -attribute_deprecated -enum AVColorRange av_frame_get_color_range(const AVFrame *frame); -attribute_deprecated -void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); -#endif +#if FF_API_COLORSPACE_NAME /** * Get the name of a colorspace. * @return a static string identifying the colorspace; can be NULL. + * @deprecated use av_color_space_name() */ +attribute_deprecated const char *av_get_colorspace_name(enum AVColorSpace val); - +#endif /** * Allocate an AVFrame and set its fields to default values. The resulting * struct must be freed using av_frame_free(). @@ -917,11 +850,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); */ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Add a new side data to a frame from an existing AVBufferRef diff --git a/windows/include/x64/libavutil/hash.h b/windows/include/x64/libavutil/hash.h index af4719e..94151de 100644 --- a/windows/include/x64/libavutil/hash.h +++ b/windows/include/x64/libavutil/hash.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_hash Hash Functions * @ingroup lavu_crypto @@ -182,11 +180,7 @@ void av_hash_init(struct AVHashContext *ctx); * @param[in] src Data to be added to the hash context * @param[in] len Size of the additional data */ -#if FF_API_CRYPTO_SIZE_T -void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); -#else void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len); -#endif /** * Finalize a hash context and compute the actual hash value. diff --git a/windows/include/x64/libavutil/hmac.h b/windows/include/x64/libavutil/hmac.h index 412e950..ca4da6a 100644 --- a/windows/include/x64/libavutil/hmac.h +++ b/windows/include/x64/libavutil/hmac.h @@ -23,7 +23,6 @@ #include -#include "version.h" /** * @defgroup lavu_hmac HMAC * @ingroup lavu_crypto diff --git a/windows/include/x64/libavutil/hwcontext_d3d11va.h b/windows/include/x64/libavutil/hwcontext_d3d11va.h index 9f91e9b..77d2d72 100644 --- a/windows/include/x64/libavutil/hwcontext_d3d11va.h +++ b/windows/include/x64/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if a user-allocated texture is provided. */ UINT MiscFlags; + + /** + * In case if texture structure member above is not NULL contains the same texture + * pointer for all elements and different indexes into the array texture. + * In case if texture structure member above is NULL, all elements contains + * pointers to separate non-array textures and 0 indexes. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + AVD3D11FrameDescriptor *texture_infos; } AVD3D11VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/windows/include/x64/libavutil/hwcontext_videotoolbox.h b/windows/include/x64/libavutil/hwcontext_videotoolbox.h index 5074d79..b6bdcf2 100644 --- a/windows/include/x64/libavutil/hwcontext_videotoolbox.h +++ b/windows/include/x64/libavutil/hwcontext_videotoolbox.h @@ -29,11 +29,14 @@ * @file * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. * - * This API currently does not support frame allocation, as the raw VideoToolbox - * API does allocation, and FFmpeg itself never has the need to allocate frames. + * This API supports frame allocation using a native CVPixelBufferPool + * instead of an AVBufferPool. * * If the API user sets a custom pool, AVHWFramesContext.pool must return * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. + * Note that the underlying CVPixelBuffer could be retained by OS frameworks + * depending on application usage, so it is preferable to let CoreVideo manage + * the pool using the default implementation. * * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always * NULL. @@ -57,4 +60,36 @@ uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); */ uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); +/** + * Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc); + +/** + * Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space); + +/** + * Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri); + +/** + * Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer + * function string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc); + +/** + * Update a CVPixelBufferRef's metadata to based on an AVFrame. + * Returns 0 if no known equivalent was found. + */ +int av_vt_pixbuf_set_attachments(void *log_ctx, + CVPixelBufferRef pixbuf, const struct AVFrame *src); + #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ diff --git a/windows/include/x64/libavutil/hwcontext_vulkan.h b/windows/include/x64/libavutil/hwcontext_vulkan.h index 5cbeb8e..df86c85 100644 --- a/windows/include/x64/libavutil/hwcontext_vulkan.h +++ b/windows/include/x64/libavutil/hwcontext_vulkan.h @@ -19,6 +19,9 @@ #ifndef AVUTIL_HWCONTEXT_VULKAN_H #define AVUTIL_HWCONTEXT_VULKAN_H +#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR) +#define VK_USE_PLATFORM_WIN32_KHR +#endif #include #include "pixfmt.h" @@ -41,43 +44,37 @@ typedef struct AVVulkanDeviceContext { * Custom memory allocator, else NULL */ const VkAllocationCallbacks *alloc; + + /** + * Pointer to the instance-provided vkGetInstanceProcAddr loading function. + * If NULL, will pick either libvulkan or libvolk, depending on libavutil's + * compilation settings, and set this field. + */ + PFN_vkGetInstanceProcAddr get_proc_addr; + /** - * Vulkan instance. Must be at least version 1.1. + * Vulkan instance. Must be at least version 1.2. */ VkInstance inst; + /** * Physical device */ VkPhysicalDevice phys_dev; + /** * Active device */ VkDevice act_dev; + /** - * Queue family index for graphics - * @note av_hwdevice_create() will set all 3 queue indices if unset - * If there is no dedicated queue for compute or transfer operations, - * they will be set to the graphics queue index which can handle both. - * nb_graphics_queues indicates how many queues were enabled for the - * graphics queue (must be at least 1) - */ - int queue_family_index; - int nb_graphics_queues; - /** - * Queue family index to use for transfer operations, and the amount of queues - * enabled. In case there is no dedicated transfer queue, nb_tx_queues - * must be 0 and queue_family_tx_index must be the same as either the graphics - * queue or the compute queue, if available. - */ - int queue_family_tx_index; - int nb_tx_queues; - /** - * Queue family index for compute ops, and the amount of queues enabled. - * In case there are no dedicated compute queues, nb_comp_queues must be - * 0 and its queue family index must be set to the graphics queue. + * This structure should be set to the set of features that present and enabled + * during device creation. When a device is created by FFmpeg, it will default to + * enabling all that are present of the shaderImageGatherExtended, + * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. */ - int queue_family_comp_index; - int nb_comp_queues; + VkPhysicalDeviceFeatures2 device_features; + /** * Enabled instance extensions. * If supplying your own device context, set this to an array of strings, with @@ -87,6 +84,7 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_inst_extensions; int nb_enabled_inst_extensions; + /** * Enabled device extensions. By default, VK_KHR_external_memory_fd, * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier, @@ -97,32 +95,91 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_dev_extensions; int nb_enabled_dev_extensions; + /** - * This structure should be set to the set of features that present and enabled - * during device creation. When a device is created by FFmpeg, it will default to - * enabling all that are present of the shaderImageGatherExtended, - * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. + * Queue family index for graphics operations, and the number of queues + * enabled for it. If unavaiable, will be set to -1. Not required. + * av_hwdevice_create() will attempt to find a dedicated queue for each + * queue family, or pick the one with the least unrelated flags set. + * Queue indices here may overlap if a queue has to share capabilities. */ - VkPhysicalDeviceFeatures2 device_features; + int queue_family_index; + int nb_graphics_queues; + + /** + * Queue family index for transfer operations and the number of queues + * enabled. Required. + */ + int queue_family_tx_index; + int nb_tx_queues; + + /** + * Queue family index for compute operations and the number of queues + * enabled. Required. + */ + int queue_family_comp_index; + int nb_comp_queues; + + /** + * Queue family index for video encode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_encode_index will be -1. + * Not required. + */ + int queue_family_encode_index; + int nb_encode_queues; + + /** + * Queue family index for video decode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_decode_index will be -1. + * Not required. + */ + int queue_family_decode_index; + int nb_decode_queues; } AVVulkanDeviceContext; +/** + * Defines the behaviour of frame allocation. + */ +typedef enum AVVkFrameFlags { + /* Unless this flag is set, autodetected flags will be OR'd based on the + * device and tiling during av_hwframe_ctx_init(). */ + AV_VK_FRAME_FLAG_NONE = (1ULL << 0), + + /* Image planes will be allocated in a single VkDeviceMemory, rather + * than as per-plane VkDeviceMemory allocations. Required for exporting + * to VAAPI on Intel devices. */ + AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1), +} AVVkFrameFlags; + /** * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options */ typedef struct AVVulkanFramesContext { /** - * Controls the tiling of allocated frames. + * Controls the tiling of allocated frames. If left as optimal tiling, + * then during av_hwframe_ctx_init() will decide based on whether the device + * supports DRM modifiers, or if the linear_images flag is set, otherwise + * will allocate optimally-tiled images. */ VkImageTiling tiling; + /** * Defines extra usage of output frames. If left as 0, the following bits * are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE. */ VkImageUsageFlagBits usage; + /** * Extension data for image creation. + * If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain, + * and the device supports DRM modifiers, then images will be allocated + * with the specific requested DRM modifiers. + * Additional structures may be added at av_hwframe_ctx_init() time, + * which will be freed automatically on uninit(), so users need only free + * any structures they've allocated themselves. */ void *create_pnext; + /** * Extension data for memory allocation. Must have as many entries as * the number of planes of the sw_format. @@ -131,6 +188,13 @@ typedef struct AVVulkanFramesContext { * extensions are present in enabled_dev_extensions. */ void *alloc_pnext[AV_NUM_DATA_POINTERS]; + + /** + * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set, + * autodetected flags will be OR'd based on the device and tiling during + * av_hwframe_ctx_init(). + */ + AVVkFrameFlags flags; } AVVulkanFramesContext; /* @@ -139,7 +203,7 @@ typedef struct AVVulkanFramesContext { * 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 three queue family indices in the device context are the same, + * 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. * @@ -158,8 +222,9 @@ typedef struct AVVkFrame { VkImageTiling tiling; /** - * Memory backing the images. Could be less than the amount of images - * if importing from a DRM or VAAPI frame. + * Memory backing the images. Could be less than the amount of planes, + * in which case the offset value will indicate the binding offset of + * each plane in the memory. */ VkDeviceMemory mem[AV_NUM_DATA_POINTERS]; size_t size[AV_NUM_DATA_POINTERS]; @@ -176,17 +241,29 @@ typedef struct AVVkFrame { VkImageLayout layout[AV_NUM_DATA_POINTERS]; /** - * Synchronization semaphores. Must not be freed manually. Must be waited on - * and signalled at every queue submission. - * Could be less than the amount of images: either one per VkDeviceMemory - * or one for the entire frame. All others will be set to VK_NULL_HANDLE. + * Synchronization timeline semaphores, one for each sw_format plane. + * 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, + * using an incremented value. */ VkSemaphore sem[AV_NUM_DATA_POINTERS]; + /** + * Up to date semaphore value at which each image becomes accessible. + * Clients must wait on this value when submitting a command queue, + * and increment it when signalling. + */ + uint64_t sem_value[AV_NUM_DATA_POINTERS]; + /** * Internal data. */ struct AVVkFrameInternal *internal; + + /** + * Describes the binding offset of each plane to the VkDeviceMemory. + */ + ptrdiff_t offset[AV_NUM_DATA_POINTERS]; } AVVkFrame; /** diff --git a/windows/include/x64/libavutil/imgutils.h b/windows/include/x64/libavutil/imgutils.h index 5eccbf0..cb2d747 100644 --- a/windows/include/x64/libavutil/imgutils.h +++ b/windows/include/x64/libavutil/imgutils.h @@ -124,6 +124,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height); +/** + * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where + * available, this function will use special functionality for reading from such + * memory, which may result in greatly improved performance compared to plain + * av_image_copy_plane(). + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy_plane(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize, + ptrdiff_t bytewidth, int height); + /** * Copy image in src_data to dst_data. * diff --git a/windows/include/x64/libavutil/log.h b/windows/include/x64/libavutil/log.h index 8edd6bb..99625af 100644 --- a/windows/include/x64/libavutil/log.h +++ b/windows/include/x64/libavutil/log.h @@ -24,7 +24,6 @@ #include #include "avutil.h" #include "attributes.h" -#include "version.h" typedef enum { AV_CLASS_CATEGORY_NA = 0, @@ -107,24 +106,6 @@ typedef struct AVClass { */ int parent_log_context_offset; - /** - * Return next AVOptions-enabled child or NULL - */ - void* (*child_next)(void *obj, void *prev); - -#if FF_API_CHILD_CLASS_NEXT - /** - * Return an AVClass corresponding to the next potential - * AVOptions-enabled child. - * - * The difference between child_next and this is that - * child_next iterates over _already existing_ objects, while - * child_class_next iterates over _all possible_ children. - */ - attribute_deprecated - const struct AVClass* (*child_class_next)(const struct AVClass *prev); -#endif - /** * Category used for visualization (like color) * This is only set if the category is equal for all objects using this class. @@ -144,6 +125,11 @@ typedef struct AVClass { */ int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + /** * Iterate over the AVClasses corresponding to potential AVOptions-enabled * children. diff --git a/windows/include/x64/libavutil/macros.h b/windows/include/x64/libavutil/macros.h index 2007ee5..2a7567c 100644 --- a/windows/include/x64/libavutil/macros.h +++ b/windows/include/x64/libavutil/macros.h @@ -25,6 +25,36 @@ #ifndef AVUTIL_MACROS_H #define AVUTIL_MACROS_H +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + /** * @addtogroup preproc_misc Preprocessor String Macros * diff --git a/windows/include/x64/libavutil/md5.h b/windows/include/x64/libavutil/md5.h index ca72ccb..fc2eabd 100644 --- a/windows/include/x64/libavutil/md5.h +++ b/windows/include/x64/libavutil/md5.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_md5 MD5 @@ -64,11 +63,7 @@ void av_md5_init(struct AVMD5 *ctx); * @param src input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); -#else void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. @@ -85,11 +80,7 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); * @param src The data to hash * @param len The length of the data, in bytes */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); -#else void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); -#endif /** * @} diff --git a/windows/include/x64/libavutil/mem.h b/windows/include/x64/libavutil/mem.h index e21a1fe..b9fe807 100644 --- a/windows/include/x64/libavutil/mem.h +++ b/windows/include/x64/libavutil/mem.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "error.h" #include "avutil.h" #include "version.h" @@ -238,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); * @see av_mallocz() * @see av_malloc_array() */ -av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#if FF_API_AV_MALLOCZ_ARRAY /** - * Non-inlined equivalent of av_mallocz_array(). - * - * Created for symmetry with the calloc() C function. + * @deprecated use av_calloc() */ -void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; +attribute_deprecated +void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#endif /** * Allocate, reallocate, or free a block of memory. @@ -672,16 +672,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, * @param[out] r Pointer to the result of the operation * @return 0 on success, AVERROR(EINVAL) on overflow */ -static inline int av_size_mult(size_t a, size_t b, size_t *r) -{ - size_t t = a * b; - /* Hack inspired from glibc: don't try the division if nelem and elsize - * are both less than sqrt(SIZE_MAX). */ - if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) - return AVERROR(EINVAL); - *r = t; - return 0; -} +int av_size_mult(size_t a, size_t b, size_t *r); /** * Set the maximum size that may be allocated in one block. diff --git a/windows/include/x64/libavutil/murmur3.h b/windows/include/x64/libavutil/murmur3.h index b3b3a07..d90bc2f 100644 --- a/windows/include/x64/libavutil/murmur3.h +++ b/windows/include/x64/libavutil/murmur3.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_murmur3 Murmur3 * @ingroup lavu_hash @@ -100,11 +98,7 @@ void av_murmur3_init(struct AVMurMur3 *c); * @param[in] src Input data to update hash with * @param[in] len Number of bytes to read from `src` */ -#if FF_API_CRYPTO_SIZE_T -void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); -#else void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x64/libavutil/opt.h b/windows/include/x64/libavutil/opt.h index 8dc020a..2820435 100644 --- a/windows/include/x64/libavutil/opt.h +++ b/windows/include/x64/libavutil/opt.h @@ -33,7 +33,6 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" -#include "version.h" /** * @defgroup avoptions AVOptions @@ -648,19 +647,6 @@ const AVOption *av_opt_next(const void *obj, const AVOption *prev); */ void *av_opt_child_next(void *obj, void *prev); -#if FF_API_CHILD_CLASS_NEXT -/** - * Iterate over potential AVOptions-enabled children of parent. - * - * @param prev result of a previous call to this function or NULL - * @return AVClass corresponding to next potential child or NULL - * - * @deprecated use av_opt_child_class_iterate - */ -attribute_deprecated -const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); -#endif - /** * Iterate over potential AVOptions-enabled children of parent. * @@ -804,9 +790,16 @@ 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 diff --git a/windows/include/x64/libavutil/pixdesc.h b/windows/include/x64/libavutil/pixdesc.h index 9b9d386..f8a195f 100644 --- a/windows/include/x64/libavutil/pixdesc.h +++ b/windows/include/x64/libavutil/pixdesc.h @@ -26,7 +26,6 @@ #include "attributes.h" #include "pixfmt.h" -#include "version.h" typedef struct AVComponentDescriptor { /** @@ -56,17 +55,6 @@ typedef struct AVComponentDescriptor { * Number of bits in the component. */ int depth; - -#if FF_API_PLUS1_MINUS1 - /** deprecated, use step instead */ - attribute_deprecated int step_minus1; - - /** deprecated, use depth instead */ - attribute_deprecated int depth_minus1; - - /** deprecated, use offset instead */ - attribute_deprecated int offset_plus1; -#endif } AVComponentDescriptor; /** @@ -147,26 +135,6 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_RGB (1 << 5) -#if FF_API_PSEUDOPAL -/** - * The pixel format is "pseudo-paletted". This means that it contains a - * fixed palette in the 2nd plane but the palette is fixed/constant for each - * PIX_FMT. This allows interpreting the data as if it was PAL8, which can - * in some cases be simpler. Or the data can be interpreted purely based on - * the pixel format without using the palette. - * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 - * - * @deprecated This flag is deprecated, and will be removed. When it is removed, - * the extra palette allocation in AVFrame.data[1] is removed as well. Only - * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a - * palette. Starting with FFmpeg versions which have this flag deprecated, the - * extra "pseudo" palette is already ignored, and API users are not required to - * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required - * before the deprecation, though). - */ -#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) -#endif - /** * The pixel format has an alpha channel. This is set on all formats that * support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always diff --git a/windows/include/x64/libavutil/pixfmt.h b/windows/include/x64/libavutil/pixfmt.h index 46ef211..02e355e 100644 --- a/windows/include/x64/libavutil/pixfmt.h +++ b/windows/include/x64/libavutil/pixfmt.h @@ -112,21 +112,11 @@ enum AVPixelFormat { AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined -#if FF_API_VAAPI - /** @name Deprecated pixel formats */ - /**@{*/ - AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers - AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers - AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID - /**@}*/ - AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, -#else /** * Hardware acceleration through VA-API, data[3] contains a * VASurfaceID. */ AV_PIX_FMT_VAAPI, -#endif AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian @@ -360,6 +350,21 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian + + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, liddle-endian + + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian + AV_PIX_FMT_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 }; @@ -450,35 +455,41 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) + +#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_P216 AV_PIX_FMT_NE(P216BE, P216LE) +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) /** * Chromaticity coordinates of the source primaries. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. */ enum AVColorPrimaries { AVCOL_PRI_RESERVED0 = 0, - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B AVCOL_PRI_UNSPECIFIED = 2, AVCOL_PRI_RESERVED = 3, AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65 AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428, AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3 AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 - AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E / JEDEC P22 phosphors + AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213, AVCOL_PRI_NB ///< Not part of ABI }; /** * Color Transfer Characteristic. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2. */ enum AVColorTransferCharacteristic { AVCOL_TRC_RESERVED0 = 0, @@ -507,18 +518,18 @@ enum AVColorTransferCharacteristic { /** * YUV colorspace type. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3. */ enum AVColorSpace { - AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above - AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries + AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO, AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system @@ -540,9 +551,9 @@ enum AVColorSpace { * recommended, as it also defines the full range representation. * * Common definitions: - * - For RGB and luminance planes such as Y in YCbCr and I in ICtCp, + * - For RGB and luma planes such as Y in YCbCr and I in ICtCp, * 'E' is the original value in range of 0.0 to 1.0. - * - For chrominance planes such as Cb,Cr and Ct,Cp, 'E' is the original + * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original * value in range of -0.5 to 0.5. * - 'n' is the output bit depth. * - For additional definitions such as rounding and clipping to valid n @@ -554,13 +565,13 @@ enum AVColorRange { /** * Narrow or limited range content. * - * - For luminance planes: + * - For luma planes: * * (219 * E + 16) * 2^(n-8) * * F.ex. the range of 16-235 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (224 * E + 128) * 2^(n-8) * @@ -571,13 +582,13 @@ enum AVColorRange { /** * Full range content. * - * - For RGB and luminance planes: + * - For RGB and luma planes: * * (2^n - 1) * E * * F.ex. the range of 0-255 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (2^n - 1) * E + 2^(n - 1) * diff --git a/windows/include/x64/libavutil/ripemd.h b/windows/include/x64/libavutil/ripemd.h index 921aa66..9df9f90 100644 --- a/windows/include/x64/libavutil/ripemd.h +++ b/windows/include/x64/libavutil/ripemd.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_ripemd RIPEMD @@ -67,11 +66,7 @@ int av_ripemd_init(struct AVRIPEMD* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); -#else void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x64/libavutil/samplefmt.h b/windows/include/x64/libavutil/samplefmt.h index 8cd43ae..f270199 100644 --- a/windows/include/x64/libavutil/samplefmt.h +++ b/windows/include/x64/libavutil/samplefmt.h @@ -195,9 +195,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return >=0 on success or a negative error code on failure - * @todo return minimum size in bytes required for the buffer in case - * of success at the next bump + * @return minimum size in bytes required for the buffer on success, + * or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, diff --git a/windows/include/x64/libavutil/sha.h b/windows/include/x64/libavutil/sha.h index c0180e5..2e1220a 100644 --- a/windows/include/x64/libavutil/sha.h +++ b/windows/include/x64/libavutil/sha.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha SHA @@ -74,11 +73,7 @@ int av_sha_init(struct AVSHA* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len); -#else void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x64/libavutil/sha512.h b/windows/include/x64/libavutil/sha512.h index bef714b..a4a3f23 100644 --- a/windows/include/x64/libavutil/sha512.h +++ b/windows/include/x64/libavutil/sha512.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha512 SHA-512 @@ -76,11 +75,7 @@ int av_sha512_init(struct AVSHA512* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); -#else void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x64/libavutil/tree.h b/windows/include/x64/libavutil/tree.h index d5e0aeb..bbb8fbb 100644 --- a/windows/include/x64/libavutil/tree.h +++ b/windows/include/x64/libavutil/tree.h @@ -28,7 +28,6 @@ #define AVUTIL_TREE_H #include "attributes.h" -#include "version.h" /** * @addtogroup lavu_tree AVTree diff --git a/windows/include/x64/libavutil/tx.h b/windows/include/x64/libavutil/tx.h index bfc0c7f..5517381 100644 --- a/windows/include/x64/libavutil/tx.h +++ b/windows/include/x64/libavutil/tx.h @@ -49,11 +49,14 @@ enum AVTXType { * float. Length is the frame size, not the window size (which is 2x frame) * For forward transforms, the stride specifies the spacing between each * sample in the output array in bytes. The input must be a flat array. + * * For inverse transforms, the stride specifies the spacing between each * sample in the input array in bytes. The output will be a flat array. * Stride must be a non-zero multiple of sizeof(float). + * * NOTE: the inverse transform is half-length, meaning the output will not - * contain redundant data. This is what most codecs work with. + * contain redundant data. This is what most codecs work with. To do a full + * inverse transform, set the AV_TX_FULL_IMDCT flag on init. */ AV_TX_FLOAT_MDCT = 1, @@ -93,7 +96,7 @@ enum AVTXType { * @param stride the input or output stride in bytes * * The out and in arrays must be aligned to the maximum required by the CPU - * architecture. + * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init(). * The stride must follow the constraints the transform type has specified. */ typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride); @@ -108,6 +111,20 @@ enum AVTXFlags { * transform types. */ AV_TX_INPLACE = 1ULL << 0, + + /** + * Relaxes alignment requirement for the in and out arrays of av_tx_fn(). + * May be slower with certain transform types. + */ + AV_TX_UNALIGNED = 1ULL << 1, + + /** + * Performs a full inverse MDCT rather than leaving out samples that can be + * derived through symmetry. Requires an output array of 'len' floats, + * rather than the usual 'len/2' floats. + * Ignored for all transforms but inverse MDCTs. + */ + AV_TX_FULL_IMDCT = 1ULL << 2, }; /** diff --git a/windows/include/x64/libavutil/version.h b/windows/include/x64/libavutil/version.h index f888dbb..58c6179 100644 --- a/windows/include/x64/libavutil/version.h +++ b/windows/include/x64/libavutil/version.h @@ -78,8 +78,8 @@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 70 +#define LIBAVUTIL_VERSION_MAJOR 57 +#define LIBAVUTIL_VERSION_MINOR 17 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -105,42 +105,10 @@ * @{ */ -#ifndef FF_API_VAAPI -#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_QP -#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PLUS1_MINUS1 -#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_ERROR_FRAME -#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PKT_PTS -#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CRYPTO_SIZE_T -#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_GET_SET -#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PSEUDOPAL -#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CHILD_CLASS_NEXT -#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_BUFFER_SIZE_T -#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_D2STR #define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_DECLARE_ALIGNED #define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58) -#endif +#define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58) +#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58) /** * @} diff --git a/windows/include/x86/libavcodec/avcodec.h b/windows/include/x86/libavcodec/avcodec.h index 8a71c04..7ee8bc2 100644 --- a/windows/include/x86/libavcodec/avcodec.h +++ b/windows/include/x86/libavcodec/avcodec.h @@ -27,25 +27,21 @@ * Libavcodec external API header */ -#include #include "libavutil/samplefmt.h" #include "libavutil/attributes.h" #include "libavutil/avutil.h" #include "libavutil/buffer.h" -#include "libavutil/cpu.h" -#include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/frame.h" -#include "libavutil/hwcontext.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "bsf.h" #include "codec.h" #include "codec_desc.h" #include "codec_par.h" #include "codec_id.h" +#include "defs.h" #include "packet.h" #include "version.h" @@ -155,29 +151,6 @@ * at least will not fail with AVERROR(EAGAIN). In general, no codec will * permit unlimited buffering of input or output. * - * This API replaces the following legacy functions: - * - avcodec_decode_video2() and avcodec_decode_audio4(): - * Use avcodec_send_packet() to feed input to the decoder, then use - * avcodec_receive_frame() to receive decoded frames after each packet. - * Unlike with the old video decoding API, multiple frames might result from - * a packet. For audio, splitting the input packet into frames by partially - * decoding packets becomes transparent to the API user. You never need to - * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then - * no data was read from the packet). - * Additionally, sending a flush/draining packet is required only once. - * - avcodec_encode_video2()/avcodec_encode_audio2(): - * Use avcodec_send_frame() to feed input to the encoder, then use - * avcodec_receive_packet() to receive encoded packets. - * Providing user-allocated buffers for avcodec_receive_packet() is not - * possible. - * - The new API does not handle subtitles yet. - * - * Mixing new and old function calls on the same AVCodecContext is not allowed, - * and will result in undefined behavior. - * - * Some codecs might require using the new API; using the old API will return - * an error when calling it. All codecs support the new API. - * * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This * would be an invalid state, which could put the codec user into an endless * loop. The API has no concept of time either: it cannot happen that trying to @@ -204,16 +177,6 @@ * @{ */ -/** - * @ingroup lavc_decoding - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * This is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end.
- * Note: If the first 23 bits of the additional bytes are not 0, then damaged - * MPEG bitstreams could cause overread and segfault. - */ -#define AV_INPUT_BUFFER_PADDING_SIZE 64 - /** * @ingroup lavc_encoding * minimum encoding buffer size @@ -221,34 +184,6 @@ */ #define AV_INPUT_BUFFER_MIN_SIZE 16384 -/** - * @ingroup lavc_decoding - */ -enum AVDiscard{ - /* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). */ - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONINTRA= 24, ///< discard all non intra frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -enum AVAudioServiceType { - AV_AUDIO_SERVICE_TYPE_MAIN = 0, - AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, - AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, - AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, - AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, - AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, - AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, - AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, - AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, - AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI -}; - /** * @ingroup lavc_encoding */ @@ -310,11 +245,15 @@ typedef struct RcOverride{ * error[?] variables will be set during encoding. */ #define AV_CODEC_FLAG_PSNR (1 << 15) +#if FF_API_FLAG_TRUNCATED /** * Input bitstream might be truncated at a random location * instead of only at frame boundaries. + * + * @deprecated use codec parsers for packetizing input */ #define AV_CODEC_FLAG_TRUNCATED (1 << 16) +#endif /** * Use interlaced DCT. */ @@ -416,98 +355,6 @@ typedef struct RcOverride{ */ #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) -/** - * Pan Scan area. - * This specifies the area which should be displayed. - * Note there may be multiple such areas for one frame. - */ -typedef struct AVPanScan { - /** - * id - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int16_t position[3][2]; -} AVPanScan; - -/** - * This structure describes the bitrate properties of an encoded bitstream. It - * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD - * parameters for H.264/HEVC. - */ -typedef struct AVCPBProperties { - /** - * Maximum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int max_bitrate; -#else - int64_t max_bitrate; -#endif - /** - * Minimum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int min_bitrate; -#else - int64_t min_bitrate; -#endif - /** - * Average bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ -#if FF_API_UNSANITIZED_BITRATES - int avg_bitrate; -#else - int64_t avg_bitrate; -#endif - - /** - * The size of the buffer to which the ratecontrol is applied, in bits. - * Zero if unknown or unspecified. - */ - int buffer_size; - - /** - * The delay between the time the packet this structure is associated with - * is received and the time when it should be decoded, in periods of a 27MHz - * clock. - * - * UINT64_MAX when unknown or unspecified. - */ - uint64_t vbv_delay; -} AVCPBProperties; - -/** - * This structure supplies correlation between a packet timestamp and a wall clock - * production time. The definition follows the Producer Reference Time ('prft') - * as defined in ISO/IEC 14496-12 - */ -typedef struct AVProducerReferenceTime { - /** - * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). - */ - int64_t wallclock; - int flags; -} AVProducerReferenceTime; - /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -697,7 +544,7 @@ typedef struct AVCodecContext { * picture width / height. * * @note Those fields may not match the values of the last - * AVFrame output by avcodec_decode_video2 due frame + * AVFrame output by avcodec_receive_frame() due frame * reordering. * * - encoding: MUST be set by user. @@ -773,17 +620,29 @@ typedef struct AVCodecContext { int y, int type, int height); /** - * callback to negotiate the pixelFormat - * @param fmt is the list of formats which are supported by the codec, - * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. - * The first is always the native one. - * @note The callback may be called again immediately if initialization for - * the selected (hardware-accelerated) pixel format failed. - * @warning Behavior is undefined if the callback returns a value not - * in the fmt list of formats. - * @return the chosen format - * - encoding: unused - * - decoding: Set by user, if not set the native format will be chosen. + * Callback to negotiate the pixel format. Decoding only, may be set by the + * caller before avcodec_open2(). + * + * Called by some decoders to select the pixel format that will be used for + * the output frames. This is mainly used to set up hardware acceleration, + * then the provided format list contains the corresponding hwaccel pixel + * formats alongside the "software" one. The software pixel format may also + * be retrieved from \ref sw_pix_fmt. + * + * This callback will be called when the coded frame properties (such as + * resolution, pixel format, etc.) change and more than one output format is + * supported for those new properties. If a hardware pixel format is chosen + * and initialization for it fails, the callback may be called again + * immediately. + * + * This callback may be called from different threads if the decoder is + * multi-threaded, but not from more than one thread simultaneously. + * + * @param fmt list of formats which may be used in the current + * configuration, terminated by AV_PIX_FMT_NONE. + * @warning Behavior is undefined if the callback returns a value other + * than one of the formats in fmt or AV_PIX_FMT_NONE. + * @return the chosen format or AV_PIX_FMT_NONE */ enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); @@ -804,12 +663,6 @@ typedef struct AVCodecContext { */ float b_quant_factor; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_frame_strategy; -#endif - /** * qscale offset between IP and B-frames * - encoding: Set by user. @@ -825,12 +678,6 @@ typedef struct AVCodecContext { */ int has_b_frames; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int mpeg_quant; -#endif - /** * qscale factor between P- and I-frames * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). @@ -889,15 +736,6 @@ typedef struct AVCodecContext { */ int slice_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 -#endif - /** * slice offsets in the frame in bytes * - encoding: Set/allocated by libavcodec. @@ -970,12 +808,6 @@ typedef struct AVCodecContext { */ int last_predictor_count; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int pre_me; -#endif - /** * motion estimation prepass comparison function * - encoding: Set by user. @@ -1044,16 +876,6 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int scenechange_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int noise_reduction; -#endif - /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. @@ -1089,26 +911,12 @@ typedef struct AVCodecContext { */ int mb_lmax; -#if FF_API_PRIVATE_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int me_penalty_compensation; -#endif - /** * - encoding: Set by user. * - decoding: unused */ int bidir_refine; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int brd_scale; -#endif - /** * minimum GOP size * - encoding: Set by user. @@ -1123,12 +931,6 @@ typedef struct AVCodecContext { */ int refs; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int chromaoffset; -#endif - /** * Note: Value depends upon the compare function used for fullpel ME. * - encoding: Set by user. @@ -1136,12 +938,6 @@ typedef struct AVCodecContext { */ int mv0_threshold; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_sensitivity; -#endif - /** * Chromaticity coordinates of the source primaries. * - encoding: Set by user @@ -1350,24 +1146,6 @@ typedef struct AVCodecContext { */ int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); -#if FF_API_OLD_ENCDEC - /** - * If non-zero, the decoded audio and video frames returned from - * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted - * and are valid indefinitely. The caller must free them with - * av_frame_unref() when they are not needed anymore. - * Otherwise, the decoded frames must not be freed by the caller and are - * only valid until the next decode call. - * - * This is always automatically enabled if avcodec_receive_frame() is used. - * - * - encoding: unused - * - decoding: set by the caller before avcodec_open2(). - */ - attribute_deprecated - int refcounted_frames; -#endif - /* - encoding parameters */ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) float qblur; ///< amount of qscale smoothing over time (0.0-1.0) @@ -1443,42 +1221,6 @@ typedef struct AVCodecContext { */ int rc_initial_buffer_occupancy; -#if FF_API_CODER_TYPE -#define FF_CODER_TYPE_VLC 0 -#define FF_CODER_TYPE_AC 1 -#define FF_CODER_TYPE_RAW 2 -#define FF_CODER_TYPE_RLE 3 - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int coder_type; -#endif /* FF_API_CODER_TYPE */ - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int context_model; -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_factor; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_exp; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_cmp; -#endif /* FF_API_PRIVATE_OPT */ - /** * trellis RD quantization * - encoding: Set by user. @@ -1486,69 +1228,6 @@ typedef struct AVCodecContext { */ int trellis; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int min_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int max_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int64_t timecode_frame_start; -#endif - -#if FF_API_RTP_CALLBACK - /** - * @deprecated unused - */ - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send. */ - /* It depends on the encoder if the data starts */ - /* with a Start Code (it should). H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload. */ - attribute_deprecated - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do its best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263. */ - /* This doesn't take account of any particular */ - /* headers inside the transmitted RTP payload. */ -#endif - -#if FF_API_STAT_BITS - /* statistics, used for 2-pass encoding */ - attribute_deprecated - int mv_bits; - attribute_deprecated - int header_bits; - attribute_deprecated - int i_tex_bits; - attribute_deprecated - int p_tex_bits; - attribute_deprecated - int i_count; - attribute_deprecated - int p_count; - attribute_deprecated - int skip_count; - attribute_deprecated - int misc_bits; - - /** @deprecated this field is unused */ - attribute_deprecated - int frame_bits; -#endif - /** * pass1 encoding statistics output buffer * - encoding: Set by libavcodec. @@ -1684,8 +1363,7 @@ typedef struct AVCodecContext { * For some hardware accelerators, a global context needs to be * provided by the user. In that case, this holds display-dependent * data FFmpeg cannot instantiate itself. Please refer to the - * FFmpeg HW accelerator documentation to know how to fill this - * is. e.g. for VA API, this is a struct vaapi_context. + * FFmpeg HW accelerator documentation to know how to fill this. * - encoding: unused * - decoding: Set by user */ @@ -1753,17 +1431,6 @@ typedef struct AVCodecContext { */ int lowres; -#if FF_API_CODED_FRAME - /** - * the picture in the bitstream - * - encoding: Set by libavcodec. - * - decoding: unused - * - * @deprecated use the quality factor packet side data instead - */ - attribute_deprecated AVFrame *coded_frame; -#endif - /** * thread count * is used to decide how many independent tasks should be passed to execute() @@ -2016,34 +1683,6 @@ typedef struct AVCodecContext { uint8_t *subtitle_header; int subtitle_header_size; -#if FF_API_VBV_DELAY - /** - * VBV delay coded in the last frame (in periods of a 27 MHz clock). - * Used for compliant TS muxing. - * - encoding: Set by libavcodec. - * - decoding: unused. - * @deprecated this value is now exported as a part of - * AV_PKT_DATA_CPB_PROPERTIES packet side data - */ - attribute_deprecated - uint64_t vbv_delay; -#endif - -#if FF_API_SIDEDATA_ONLY_PKT - /** - * Encoding only and set by default. Allow encoders to output packets - * that do not contain any encoded data, only side data. - * - * Some encoders need to output such packets, e.g. to update some stream - * parameters at the end of encoding. - * - * @deprecated this field disables the default behaviour and - * it is kept only for compatibility. - */ - attribute_deprecated - int side_data_only_packets; -#endif - /** * Audio only. The number of "priming" samples (padding) inserted by the * encoder at the beginning of the audio. I.e. this number of leading @@ -2183,6 +1822,7 @@ typedef struct AVCodecContext { unsigned properties; #define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004 /** * Additional data associated with the entire coded stream. @@ -2217,15 +1857,13 @@ typedef struct AVCodecContext { */ AVBufferRef *hw_frames_ctx; +#if FF_API_SUB_TEXT_FORMAT /** - * Control the form of AVSubtitle.rects[N]->ass - * - decoding: set by user - * - encoding: unused + * @deprecated unused */ + attribute_deprecated int sub_text_format; #define FF_SUB_TEXT_FMT_ASS 0 -#if FF_API_ASS_TIMING -#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 #endif /** @@ -2355,6 +1993,10 @@ typedef struct AVCodecContext { * This callback must use the above value to calculate the required buffer size, * which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes. * + * In some specific cases, the encoder may not use the entire buffer allocated by this + * callback. This will be reflected in the size value in the packet once returned by + * avcodec_receive_packet(). + * * This callback must fill the following fields in the packet: * - data: alignment requirements for AVPacket apply, if any. Some architectures and * encoders may benefit from having aligned data. @@ -2384,47 +2026,6 @@ typedef struct AVCodecContext { int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags); } AVCodecContext; -#if FF_API_CODEC_GET_SET -/** - * Accessors for some AVCodecContext fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); - -attribute_deprecated -const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); - -attribute_deprecated -unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); - -attribute_deprecated -int av_codec_get_lowres(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_lowres(AVCodecContext *avctx, int val); - -attribute_deprecated -int av_codec_get_seek_preroll(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); - -attribute_deprecated -uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); -attribute_deprecated -void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); -#endif - -struct AVSubtitle; - -#if FF_API_CODEC_GET_SET -attribute_deprecated -int av_codec_get_max_lowres(const AVCodec *codec); -#endif - struct MpegEncContext; /** @@ -2637,33 +2238,6 @@ typedef struct AVHWAccel { * @} */ -#if FF_API_AVPICTURE -/** - * @defgroup lavc_picture AVPicture - * - * Functions for working with AVPicture - * @{ - */ - -/** - * Picture data structure. - * - * Up to four components can be stored into it, the last component is - * alpha. - * @deprecated use AVFrame or imgutils functions instead - */ -typedef struct AVPicture { - attribute_deprecated - uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes - attribute_deprecated - int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line -} AVPicture; - -/** - * @} - */ -#endif - enum AVSubtitleType { SUBTITLE_NONE, @@ -2691,13 +2265,6 @@ typedef struct AVSubtitleRect { int h; ///< height of pict, undefined when pict is not set int nb_colors; ///< number of colors in pict, undefined when pict is not set -#if FF_API_AVPICTURE - /** - * @deprecated unused - */ - attribute_deprecated - AVPicture pict; -#endif /** * data+linesize for the bitmap of this subtitle. * Can be set for text/ass as well once they are rendered. @@ -2728,16 +2295,6 @@ typedef struct AVSubtitle { int64_t pts; ///< Same as packet pts, in AV_TIME_BASE } AVSubtitle; -#if FF_API_NEXT -/** - * If c is NULL, returns the first registered codec, - * if c is non-NULL, returns the next registered codec after c, - * or NULL if c is the last one. - */ -attribute_deprecated -AVCodec *av_codec_next(const AVCodec *c); -#endif - /** * Return the LIBAVCODEC_VERSION_INT constant. */ @@ -2753,20 +2310,6 @@ const char *avcodec_configuration(void); */ const char *avcodec_license(void); -#if FF_API_NEXT -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register(AVCodec *codec); - -/** - * @deprecated Calling this function is unnecessary. - */ -attribute_deprecated -void avcodec_register_all(void); -#endif - /** * Allocate an AVCodecContext and set its fields to default values. The * resulting struct should be freed with avcodec_free_context(). @@ -2788,15 +2331,6 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); */ void avcodec_free_context(AVCodecContext **avctx); -#if FF_API_GET_CONTEXT_DEFAULTS -/** - * @deprecated This function should not be used, as closing and opening a codec - * context multiple time is not supported. A new codec context should be - * allocated for each new use. - */ -int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); -#endif - /** * Get the AVClass for AVCodecContext. It can be used in combination with * AV_OPT_SEARCH_FAKE_OBJ for examining options. @@ -2821,28 +2355,6 @@ const AVClass *avcodec_get_frame_class(void); */ const AVClass *avcodec_get_subtitle_rect_class(void); -#if FF_API_COPY_CONTEXT -/** - * Copy the settings of the source AVCodecContext into the destination - * AVCodecContext. The resulting destination codec context will be - * unopened, i.e. you are required to call avcodec_open2() before you - * can use this AVCodecContext to decode/encode video/audio data. - * - * @param dest target codec context, should be initialized with - * avcodec_alloc_context3(NULL), but otherwise uninitialized - * @param src source codec context - * @return AVERROR() on error (e.g. memory allocation error), 0 on success - * - * @deprecated The semantics of this function are ill-defined and it should not - * be used. If you need to transfer the stream parameters from one codec context - * to another, use an intermediate AVCodecParameters instance and the - * avcodec_parameters_from_context() / avcodec_parameters_to_context() - * functions. - */ -attribute_deprecated -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#endif - /** * Fill the parameters struct based on the values from the supplied codec * context. Any allocated fields in par are freed and replaced with duplicates @@ -2989,115 +2501,6 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); */ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); -#if FF_API_OLD_ENCDEC -/** - * Decode the audio frame of size avpkt->size from avpkt->data into frame. - * - * Some decoders may support multiple frames in a single AVPacket. Such - * decoders would then just decode the first frame and the return value would be - * less than the packet size. In this case, avcodec_decode_audio4 has to be - * called again with an AVPacket containing the remaining data in order to - * decode the second frame, etc... Even if no frames are returned, the packet - * needs to be fed to the decoder with remaining data until it is completely - * consumed or an error occurs. - * - * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input - * and output. This means that for some packets they will not immediately - * produce decoded output and need to be flushed at the end of decoding to get - * all the decoded data. Flushing is done by calling this function with packets - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops - * returning samples. It is safe to flush even those decoders that are not - * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. - * - * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE - * larger than the actual read bytes because some optimized bitstream - * readers read 32 or 64 bits at once and could read over the end. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] frame The AVFrame in which to store decoded audio samples. - * The decoder will allocate a buffer for the decoded frame by - * calling the AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is - * non-zero. Note that this field being set to zero - * does not mean that an error has occurred. For - * decoders with AV_CODEC_CAP_DELAY set, no given decode - * call is guaranteed to produce a frame. - * @param[in] avpkt The input AVPacket containing the input buffer. - * At least avpkt->data and avpkt->size should be set. Some - * decoders might also require additional fields to be set. - * @return A negative error code is returned if an error occurred during - * decoding, otherwise the number of bytes consumed from the input - * AVPacket is returned. - * -* @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, - int *got_frame_ptr, const AVPacket *avpkt); - -/** - * Decode the video frame of size avpkt->size from avpkt->data into picture. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * - * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * Use av_frame_alloc() to get an AVFrame. The codec will - * allocate memory for the actual bitmap by calling the - * AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields like - * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least - * fields possible. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - * - * @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const AVPacket *avpkt); -#endif - /** * Decode a subtitle message. * Return a negative value on error, otherwise return the number of bytes used. @@ -3141,10 +2544,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * - * @warning Do not mix this API with the legacy API (like avcodec_decode_video2()) - * on the same AVCodecContext. It will return unexpected results now - * or in future libavcodec versions. - * * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() * before packets may be fed to the decoder. * @@ -3234,8 +2633,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); * the call will not fail with EAGAIN). * AVERROR_EOF: the encoder has been flushed, and no new frames can * be sent to it - * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a - * decoder, or requires flush + * AVERROR(EINVAL): codec not opened, it is a decoder, or requires flush * AVERROR(ENOMEM): failed to add packet to internal queue, or similar * other errors: legitimate encoding errors */ @@ -3376,7 +2774,7 @@ enum AVPictureStructure { typedef struct AVCodecParserContext { void *priv_data; - struct AVCodecParser *parser; + const struct AVCodecParser *parser; int64_t frame_offset; /* offset of the current frame */ int64_t cur_offset; /* current offset (incremented by each av_parser_parse()) */ @@ -3425,14 +2823,6 @@ typedef struct AVCodecParserContext { */ int key_frame; -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated unused - */ - attribute_deprecated - int64_t convergence_duration; -#endif - // Timestamp generation support: /** * Synchronization point for start of timestamp generation. @@ -3542,7 +2932,7 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ + int codec_ids[7]; /* several codec IDs are permitted */ int priv_data_size; int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that @@ -3553,10 +2943,6 @@ typedef struct AVCodecParser { const uint8_t *buf, int buf_size); void (*parser_close)(AVCodecParserContext *s); int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); -#if FF_API_NEXT - attribute_deprecated - struct AVCodecParser *next; -#endif } AVCodecParser; /** @@ -3570,13 +2956,6 @@ typedef struct AVCodecParser { */ const AVCodecParser *av_parser_iterate(void **opaque); -#if FF_API_NEXT -attribute_deprecated -AVCodecParser *av_parser_next(const AVCodecParser *c); - -attribute_deprecated -void av_register_codec_parser(AVCodecParser *parser); -#endif AVCodecParserContext *av_parser_init(int codec_id); /** @@ -3617,18 +2996,6 @@ int av_parser_parse2(AVCodecParserContext *s, int64_t pts, int64_t dts, int64_t pos); -#if FF_API_PARSER_CHANGE -/** - * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed - * @deprecated Use dump_extradata, remove_extra or extract_extradata - * bitstream filters instead. - */ -attribute_deprecated -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -#endif void av_parser_close(AVCodecParserContext *s); /** @@ -3641,95 +3008,6 @@ void av_parser_close(AVCodecParserContext *s); * @{ */ -#if FF_API_OLD_ENCDEC -/** - * Encode a frame of audio. - * - * Takes input samples from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay, split, and combine input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. If avpkt->data and - * avpkt->size are set, avpkt->destruct must also be set. All - * other AVPacket fields will be reset by the encoder using - * av_init_packet(). If avpkt->data is NULL, the encoder will - * allocate it. The encoder will set avpkt->size to the size - * of the output packet. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw audio data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame - * can have any number of samples. - * If it is not set, frame->nb_samples must be equal to - * avctx->frame_size for all frames except the last. - * The final frame may be smaller than avctx->frame_size. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); - -/** - * Encode a frame of video. - * - * Takes input raw video data from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay and reorder input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. All other AVPacket fields - * will be reset by the encoder using av_init_packet(). If - * avpkt->data is NULL, the encoder will allocate it. - * The encoder will set avpkt->size to the size of the - * output packet. The returned data (if any) belongs to the - * caller, he is responsible for freeing it. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw video data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead. - * If allowed and required, set AVCodecContext.get_encode_buffer to - * a custom function to pass user supplied output buffers. - */ -attribute_deprecated -int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); -#endif - int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub); @@ -3738,71 +3016,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ -#if FF_API_AVPICTURE -/** - * @addtogroup lavc_picture - * @{ - */ - -/** - * @deprecated unused - */ -attribute_deprecated -int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -void avpicture_free(AVPicture *picture); - -/** - * @deprecated use av_image_fill_arrays() instead. - */ -attribute_deprecated -int avpicture_fill(AVPicture *picture, const uint8_t *ptr, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated use av_image_copy_to_buffer() instead. - */ -attribute_deprecated -int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, - int width, int height, - unsigned char *dest, int dest_size); - -/** - * @deprecated use av_image_get_buffer_size() instead. - */ -attribute_deprecated -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated av_image_copy() instead. - */ -attribute_deprecated -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int top_band, int left_band); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -/** - * @} - */ -#endif - /** * @defgroup lavc_misc Utility functions * @ingroup libavc @@ -3819,15 +3032,6 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -#if FF_API_GETCHROMA -/** - * @deprecated Use av_pix_fmt_get_chroma_sub_sample - */ - -attribute_deprecated -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); -#endif - /** * Return a value representing the fourCC code associated to the * pixel format pix_fmt, or 0 if no associated fourCC code can be @@ -3856,71 +3060,14 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#if FF_API_AVCODEC_PIX_FMT -/** - * @deprecated see av_get_pix_fmt_loss() - */ -attribute_deprecated -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, - int has_alpha); -/** - * @deprecated see av_find_best_pix_fmt_of_2() - */ -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#endif - enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); /** * @} */ -#if FF_API_TAG_STRING -/** - * Put a string representing the codec tag codec_tag in buf. - * - * @param buf buffer to place codec tag in - * @param buf_size size in bytes of buf - * @param codec_tag codec tag to assign - * @return the length of the string that would have been generated if - * enough space had been available, excluding the trailing null - * - * @deprecated see av_fourcc_make_string() and av_fourcc2str(). - */ -attribute_deprecated -size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); -#endif - void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); -/** - * Return a name for the specified profile, if available. - * - * @param codec the codec that is searched for the given profile - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - */ -const char *av_get_profile_name(const AVCodec *codec, int profile); - -/** - * Return a name for the specified profile, if available. - * - * @param codec_id the ID of the codec to which the requested profile belongs - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - * - * @note unlike av_get_profile_name(), which searches a list of profiles - * supported by a specific decoder or encoder implementation, this - * function searches the list of profiles from the AVCodecDescriptor - */ -const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); - int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -3956,11 +3103,8 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, * Reset the internal codec state / flush internal buffers. Should be called * e.g. when seeking or when switching to a different stream. * - * @note for decoders, when refcounted frames are not used - * (i.e. avctx->refcounted_frames is 0), this invalidates the frames previously - * returned from the decoder. When refcounted frames are used, the decoder just - * releases any references it might keep internally, but the caller's reference - * remains valid. + * @note for decoders, this function just releases any references the decoder + * might keep internally, but the caller's references remain valid. * * @note for encoders, this function will only do something if the encoder * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder @@ -3971,32 +3115,6 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, */ void avcodec_flush_buffers(AVCodecContext *avctx); -/** - * Return codec bits per sample. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum AVCodecID codec_id); - -/** - * Return the PCM codec associated with a sample format. - * @param be endianness, 0 for little, 1 for big, - * -1 (or anything else) for native - * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE - */ -enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); - -/** - * Return codec bits per sample. - * Only return non-zero if the bits per sample is exactly correct, not an - * approximation. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_exact_bits_per_sample(enum AVCodecID codec_id); - /** * Return audio frame duration. * @@ -4007,69 +3125,6 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id); */ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); -/** - * This function is the same as av_get_audio_frame_duration(), except it works - * with AVCodecParameters instead of an AVCodecContext. - */ -int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); - -#if FF_API_OLD_BSF -typedef struct AVBitStreamFilterContext { - void *priv_data; - const struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; - /** - * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). - * Not for access by library users. - */ - char *args; -} AVBitStreamFilterContext; - -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -void av_register_bitstream_filter(AVBitStreamFilter *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init() - * from the new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the - * new bitstream filtering API (using AVBSFContext). - */ -attribute_deprecated -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); -/** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using - * AVBSFContext). - */ -attribute_deprecated -const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); -#endif - -#if FF_API_NEXT -attribute_deprecated -const AVBitStreamFilter *av_bsf_next(void **opaque); -#endif - /* memory */ /** @@ -4087,96 +3142,12 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); */ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); -/** - * Encode extradata length to a buffer. Used by xiph codecs. - * - * @param s buffer to write to; must be at least (v/255+1) bytes long - * @param v size of extradata in bytes - * @return number of bytes written to the buffer. - */ -unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -#if FF_API_USER_VISIBLE_AVHWACCEL -/** - * Register the hardware accelerator hwaccel. - * - * @deprecated This function doesn't do anything. - */ -attribute_deprecated -void av_register_hwaccel(AVHWAccel *hwaccel); - -/** - * If hwaccel is NULL, returns the first registered hardware accelerator, - * if hwaccel is non-NULL, returns the next registered hardware accelerator - * after hwaccel, or NULL if hwaccel is the last one. - * - * @deprecated AVHWaccel structures contain no user-serviceable parts, so - * this function should not be used. - */ -attribute_deprecated -AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); -#endif - -#if FF_API_LOCKMGR -/** - * Lock operation used by lockmgr - * - * @deprecated Deprecated together with av_lockmgr_register(). - */ -enum AVLockOp { - AV_LOCK_CREATE, ///< Create a mutex - AV_LOCK_OBTAIN, ///< Lock the mutex - AV_LOCK_RELEASE, ///< Unlock the mutex - AV_LOCK_DESTROY, ///< Free mutex resources -}; - -/** - * Register a user provided lock manager supporting the operations - * specified by AVLockOp. The "mutex" argument to the function points - * to a (void *) where the lockmgr should store/get a pointer to a user - * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the - * value left by the last call for all other ops. If the lock manager is - * unable to perform the op then it should leave the mutex in the same - * state as when it was called and return a non-zero value. However, - * when called with AV_LOCK_DESTROY the mutex will always be assumed to - * have been successfully destroyed. If av_lockmgr_register succeeds - * it will return a non-negative value, if it fails it will return a - * negative value and destroy all mutex and unregister all callbacks. - * av_lockmgr_register is not thread-safe, it must be called from a - * single thread before any calls which make use of locking are used. - * - * @param cb User defined callback. av_lockmgr_register invokes calls - * to this callback and the previously registered callback. - * The callback will be used to create more than one mutex - * each of which must be backed by its own underlying locking - * mechanism (i.e. do not use a single static object to - * implement your lock manager). If cb is set to NULL the - * lockmgr will be unregistered. - * - * @deprecated This function does nothing, and always returns 0. Be sure to - * build with thread support to get basic thread safety. - */ -attribute_deprecated -int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); -#endif - /** * @return a positive value if s is open (i.e. avcodec_open2() was called on it * with no corresponding avcodec_close()), 0 otherwise. */ int avcodec_is_open(AVCodecContext *s); -/** - * Allocate a CPB properties structure and initialize its fields to default - * values. - * - * @param size if non-NULL, the size of the allocated struct will be written - * here. This is useful for embedding it in side data. - * - * @return the newly allocated struct or NULL on failure - */ -AVCPBProperties *av_cpb_properties_alloc(size_t *size); - /** * @} */ diff --git a/windows/include/x86/libavcodec/bsf.h b/windows/include/x86/libavcodec/bsf.h index 3b5faa8..8c5355d 100644 --- a/windows/include/x86/libavcodec/bsf.h +++ b/windows/include/x86/libavcodec/bsf.h @@ -34,8 +34,6 @@ * @{ */ -typedef struct AVBSFInternal AVBSFInternal; - /** * The bitstream filter state. * @@ -57,12 +55,6 @@ typedef struct AVBSFContext { */ const struct AVBitStreamFilter *filter; - /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - /** * Opaque filter-specific private data. If filter->priv_class is non-NULL, * this is an AVOptions-enabled struct. diff --git a/windows/include/x86/libavcodec/codec.h b/windows/include/x86/libavcodec/codec.h index 50a22f6..a8147ec 100644 --- a/windows/include/x86/libavcodec/codec.h +++ b/windows/include/x86/libavcodec/codec.h @@ -50,7 +50,12 @@ * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. */ #define AV_CODEC_CAP_DR1 (1 << 1) +#if FF_API_FLAG_TRUNCATED +/** + * @deprecated Use parsers to always send proper frames. + */ #define AV_CODEC_CAP_TRUNCATED (1 << 3) +#endif /** * Encoder or decoder requires flushing with NULL input at the end in order to * give the complete and correct output. @@ -214,12 +219,12 @@ typedef struct AVCodec { * see AV_CODEC_CAP_* */ int capabilities; + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder 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} @@ -242,10 +247,13 @@ typedef struct AVCodec { * New public fields should be added right above. ***************************************************************** */ + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; + int priv_data_size; -#if FF_API_NEXT - struct AVCodec *next; -#endif /** * @name Frame-level threading support functions * @{ @@ -258,6 +266,11 @@ typedef struct AVCodec { * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. */ int (*update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src); + + /** + * Copy variables back to the user-facing context + */ + int (*update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src); /** @} */ /** @@ -321,11 +334,6 @@ typedef struct AVCodec { * Will be called when seeking */ void (*flush)(struct AVCodecContext *); - /** - * Internal codec capabilities. - * See FF_CODEC_CAP_* in internal.h - */ - int caps_internal; /** * Decoding only, a comma-separated list of bitstream filters to apply to @@ -365,7 +373,7 @@ const AVCodec *av_codec_iterate(void **opaque); * @param id AVCodecID of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder(enum AVCodecID id); +const AVCodec *avcodec_find_decoder(enum AVCodecID id); /** * Find a registered decoder with the specified name. @@ -373,7 +381,7 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); * @param name name of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder_by_name(const char *name); +const AVCodec *avcodec_find_decoder_by_name(const char *name); /** * Find a registered encoder with a matching codec ID. @@ -381,7 +389,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); * @param id AVCodecID of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder(enum AVCodecID id); +const AVCodec *avcodec_find_encoder(enum AVCodecID id); /** * Find a registered encoder with the specified name. @@ -389,7 +397,7 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id); * @param name name of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder_by_name(const char *name); +const AVCodec *avcodec_find_encoder_by_name(const char *name); /** * @return a non-zero number if codec is an encoder, zero otherwise */ @@ -400,6 +408,15 @@ int av_codec_is_encoder(const AVCodec *codec); */ int av_codec_is_decoder(const AVCodec *codec); +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + enum { /** * The codec supports this format via the hw_device_ctx interface. diff --git a/windows/include/x86/libavcodec/codec_id.h b/windows/include/x86/libavcodec/codec_id.h index ab7bc68..ab265ec 100644 --- a/windows/include/x86/libavcodec/codec_id.h +++ b/windows/include/x86/libavcodec/codec_id.h @@ -22,6 +22,7 @@ #define AVCODEC_CODEC_ID_H #include "libavutil/avutil.h" +#include "libavutil/samplefmt.h" /** * @addtogroup lavc_core @@ -246,8 +247,7 @@ enum AVCodecID { AV_CODEC_ID_MSP2, AV_CODEC_ID_VVC, #define AV_CODEC_ID_H266 AV_CODEC_ID_VVC - - AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_Y41P, AV_CODEC_ID_AVRP, AV_CODEC_ID_012V, AV_CODEC_ID_AVUI, @@ -307,6 +307,7 @@ enum AVCodecID { AV_CODEC_ID_CRI, AV_CODEC_ID_SIMBIOSIS_IMX, AV_CODEC_ID_SGA_VIDEO, + AV_CODEC_ID_GEM, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -341,8 +342,7 @@ enum AVCodecID { AV_CODEC_ID_PCM_S24LE_PLANAR, AV_CODEC_ID_PCM_S32LE_PLANAR, AV_CODEC_ID_PCM_S16BE_PLANAR, - - AV_CODEC_ID_PCM_S64LE = 0x10800, + AV_CODEC_ID_PCM_S64LE, AV_CODEC_ID_PCM_S64BE, AV_CODEC_ID_PCM_F16LE, AV_CODEC_ID_PCM_F24LE, @@ -381,8 +381,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, AV_CODEC_ID_ADPCM_VIMA, - - AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_AFC, AV_CODEC_ID_ADPCM_IMA_OKI, AV_CODEC_ID_ADPCM_DTK, AV_CODEC_ID_ADPCM_IMA_RAD, @@ -401,6 +400,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_IMA_MTF, AV_CODEC_ID_ADPCM_IMA_CUNNING, AV_CODEC_ID_ADPCM_IMA_MOFLEX, + AV_CODEC_ID_ADPCM_IMA_ACORN, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -415,8 +415,7 @@ enum AVCodecID { AV_CODEC_ID_INTERPLAY_DPCM, AV_CODEC_ID_XAN_DPCM, AV_CODEC_ID_SOL_DPCM, - - AV_CODEC_ID_SDX2_DPCM = 0x14800, + AV_CODEC_ID_SDX2_DPCM, AV_CODEC_ID_GREMLIN_DPCM, AV_CODEC_ID_DERF_DPCM, @@ -489,8 +488,7 @@ enum AVCodecID { AV_CODEC_ID_ON2AVC, AV_CODEC_ID_DSS_SP, AV_CODEC_ID_CODEC2, - - AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_FFWAVESYNTH, AV_CODEC_ID_SONIC, AV_CODEC_ID_SONIC_LS, AV_CODEC_ID_EVRC, @@ -517,6 +515,7 @@ enum AVCodecID { AV_CODEC_ID_SIREN, AV_CODEC_ID_HCA, AV_CODEC_ID_FASTAUDIO, + AV_CODEC_ID_MSNSIREN, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -529,8 +528,7 @@ enum AVCodecID { AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT, AV_CODEC_ID_SRT, - - AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_MICRODVD, AV_CODEC_ID_EIA_608, AV_CODEC_ID_JACOSUB, AV_CODEC_ID_SAMI, @@ -554,7 +552,7 @@ enum AVCodecID { AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. AV_CODEC_ID_EPG, - AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_BINTEXT, AV_CODEC_ID_XBIN, AV_CODEC_ID_IDF, AV_CODEC_ID_OTF, @@ -585,6 +583,45 @@ enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); */ const char *avcodec_get_name(enum AVCodecID id); +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + /** * @} */ diff --git a/windows/include/x86/libavcodec/codec_par.h b/windows/include/x86/libavcodec/codec_par.h index 948758e..10cf79d 100644 --- a/windows/include/x86/libavcodec/codec_par.h +++ b/windows/include/x86/libavcodec/codec_par.h @@ -221,6 +221,11 @@ void avcodec_parameters_free(AVCodecParameters **par); */ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); +/** + * This function is the same as av_get_audio_frame_duration(), except it works + * with AVCodecParameters instead of an AVCodecContext. + */ +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); /** * @} diff --git a/windows/include/x86/libavcodec/defs.h b/windows/include/x86/libavcodec/defs.h new file mode 100644 index 0000000..420a042 --- /dev/null +++ b/windows/include/x86/libavcodec/defs.h @@ -0,0 +1,170 @@ +/* + * + * 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_DEFS_H +#define AVCODEC_DEFS_H + +/** + * @file + * @ingroup libavc + * Misc types and constants that do not belong anywhere else. + */ + +#include +#include + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define AV_INPUT_BUFFER_PADDING_SIZE 64 + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int64_t buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** + * This structure supplies correlation between a packet timestamp and a wall clock + * production time. The definition follows the Producer Reference Time ('prft') + * as defined in ISO/IEC 14496-12 + */ +typedef struct AVProducerReferenceTime { + /** + * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). + */ + int64_t wallclock; + int flags; +} AVProducerReferenceTime; + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#endif // AVCODEC_DEFS_H diff --git a/windows/include/x86/libavcodec/dv_profile.h b/windows/include/x86/libavcodec/dv_profile.h index 9380a66..4365f1b 100644 --- a/windows/include/x86/libavcodec/dv_profile.h +++ b/windows/include/x86/libavcodec/dv_profile.h @@ -23,7 +23,6 @@ #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "avcodec.h" /* minimum number of bytes to read from a DV stream in order to * determine the profile */ diff --git a/windows/include/x86/libavcodec/packet.h b/windows/include/x86/libavcodec/packet.h index ca18ae6..4a349fe 100644 --- a/windows/include/x86/libavcodec/packet.h +++ b/windows/include/x86/libavcodec/packet.h @@ -290,6 +290,14 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_S12M_TIMECODE, + /** + * HDR10+ dynamic metadata associated with a video frame. The metadata is in + * the form of the AVDynamicHDRPlus struct and contains + * information for color volume transform - application 4 of + * SMPTE 2094-40:2016 standard. + */ + AV_PKT_DATA_DYNAMIC_HDR10_PLUS, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may @@ -305,11 +313,7 @@ enum AVPacketSideDataType { typedef struct AVPacketSideData { uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif enum AVPacketSideDataType type; } AVPacketSideData; @@ -388,15 +392,29 @@ typedef struct AVPacket { int64_t pos; ///< byte position in stream, -1 if unknown -#if FF_API_CONVERGENCE_DURATION /** - * @deprecated Same as the duration field, but as int64_t. This was required - * for Matroska subtitles, whose duration values could overflow when the - * duration field was still an int. + * for some private data of the user */ - attribute_deprecated - int64_t convergence_duration; -#endif + void *opaque; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the packet is unreferenced. av_packet_copy_props() calls create a new + * reference with av_buffer_ref() for the target packet's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * Time base of the packet's timestamps. + * In the future, this field may be set on packets output by encoders or + * demuxers, but its value will be by default ignored on input to decoders + * or muxers. + */ + AVRational time_base; } AVPacket; #if FF_API_INIT_PACKET @@ -529,45 +547,6 @@ int av_grow_packet(AVPacket *pkt, int grow_by); */ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); -#if FF_API_AVPACKET_OLD_API -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated. - * - * @deprecated Use av_packet_ref or av_packet_make_refcounted - */ -attribute_deprecated -int av_dup_packet(AVPacket *pkt); -/** - * Copy packet, including contents - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_ref - */ -attribute_deprecated -int av_copy_packet(AVPacket *dst, const AVPacket *src); - -/** - * Copy packet side data - * - * @return 0 on success, negative AVERROR on fail - * - * @deprecated Use av_packet_copy_props - */ -attribute_deprecated -int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); - -/** - * Free a packet. - * - * @deprecated Use av_packet_unref - * - * @param pkt packet to free - */ -attribute_deprecated -void av_free_packet(AVPacket *pkt); -#endif /** * Allocate new information of a packet. * @@ -577,11 +556,7 @@ void av_free_packet(AVPacket *pkt); * @return pointer to fresh allocated data or NULL otherwise */ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Wrap an existing array as a packet side data. @@ -608,11 +583,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return 0 on success, < 0 on failure */ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Get side information from packet. @@ -624,19 +595,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return pointer to data if present or NULL otherwise */ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, -#if FF_API_BUFFER_SIZE_T - int *size); -#else size_t *size); -#endif - -#if FF_API_MERGE_SD_API -attribute_deprecated -int av_packet_merge_side_data(AVPacket *pkt); - -attribute_deprecated -int av_packet_split_side_data(AVPacket *pkt); -#endif const char *av_packet_side_data_name(enum AVPacketSideDataType type); @@ -647,11 +606,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type); * @param size pointer to store the size of the returned data * @return pointer to data if successful, NULL otherwise */ -#if FF_API_BUFFER_SIZE_T -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); -#else uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); -#endif /** * Unpack a dictionary from side_data. * @@ -660,12 +615,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); * @param dict the metadata storage dictionary * @return 0 on success, < 0 on failure */ -#if FF_API_BUFFER_SIZE_T -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); -#else int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict); -#endif /** * Convenience function to free all the side data stored. diff --git a/windows/include/x86/libavcodec/vaapi.h b/windows/include/x86/libavcodec/vaapi.h deleted file mode 100644 index 2cf7da5..0000000 --- a/windows/include/x86/libavcodec/vaapi.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Video Acceleration API (shared data between FFmpeg and the video player) - * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 - * - * Copyright (C) 2008-2009 Splitted-Desktop Systems - * - * 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_VAAPI_H -#define AVCODEC_VAAPI_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vaapi - * Public libavcodec VA API header. - */ - -#include -#include "libavutil/attributes.h" -#include "version.h" - -#if FF_API_STRUCT_VAAPI_CONTEXT - -/** - * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding - * @ingroup lavc_codec_hwaccel - * @{ - */ - -/** - * This structure is used to share data between the FFmpeg library and - * the client video application. - * This shall be zero-allocated and available as - * AVCodecContext.hwaccel_context. All user members can be set once - * during initialization or through each AVCodecContext.get_buffer() - * function call. In any case, they must be valid prior to calling - * decoding functions. - * - * Deprecated: use AVCodecContext.hw_frames_ctx instead. - */ -struct attribute_deprecated vaapi_context { - /** - * Window system dependent data - * - * - encoding: unused - * - decoding: Set by user - */ - void *display; - - /** - * Configuration ID - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t config_id; - - /** - * Context ID (video decode pipeline) - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t context_id; -}; - -/* @} */ - -#endif /* FF_API_STRUCT_VAAPI_CONTEXT */ - -#endif /* AVCODEC_VAAPI_H */ diff --git a/windows/include/x86/libavcodec/vdpau.h b/windows/include/x86/libavcodec/vdpau.h index 4d99943..3010094 100644 --- a/windows/include/x86/libavcodec/vdpau.h +++ b/windows/include/x86/libavcodec/vdpau.h @@ -55,7 +55,6 @@ #include "libavutil/attributes.h" #include "avcodec.h" -#include "version.h" struct AVCodecContext; struct AVFrame; @@ -153,24 +152,6 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, */ AVVDPAUContext *av_vdpau_alloc_context(void); -#if FF_API_VDPAU_PROFILE -/** - * Get a decoder profile that should be used for initializing a VDPAU decoder. - * Should be called from the AVCodecContext.get_format() callback. - * - * @deprecated Use av_vdpau_bind_context() instead. - * - * @param avctx the codec context being used for decoding the stream - * @param profile a pointer into which the result will be written on success. - * The contents of profile are undefined if this function returns - * an error. - * - * @return 0 on success (non-negative), a negative AVERROR on failure. - */ -attribute_deprecated -int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); -#endif - /* @}*/ #endif /* AVCODEC_VDPAU_H */ diff --git a/windows/include/x86/libavcodec/version.h b/windows/include/x86/libavcodec/version.h index cfdde46..4d77431 100644 --- a/windows/include/x86/libavcodec/version.h +++ b/windows/include/x86/libavcodec/version.h @@ -27,8 +27,8 @@ #include "libavutil/version.h" -#define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 134 +#define LIBAVCODEC_VERSION_MAJOR 59 +#define LIBAVCODEC_VERSION_MINOR 18 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -51,122 +51,17 @@ * at once through the bump. This improves the git bisect-ability of the change. */ -#ifndef FF_API_AVCTX_TIMEBASE -#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODED_FRAME -#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_SIDEDATA_ONLY_PKT -#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VDPAU_PROFILE -#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CONVERGENCE_DURATION -#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPICTURE -#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPACKET_OLD_API -#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_RTP_CALLBACK -#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VBV_DELAY -#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODER_TYPE -#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STAT_BITS -#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PRIVATE_OPT -#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_ASS_TIMING -#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_BSF -#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_COPY_CONTEXT -#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GET_CONTEXT_DEFAULTS -#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NVENC_OLD_NAME -#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STRUCT_VAAPI_CONTEXT -#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MERGE_SD_API -#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_TAG_STRING -#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GETCHROMA -#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODEC_GET_SET -#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_USER_VISIBLE_AVHWACCEL -#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_LOCKMGR -#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NEXT -#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNSANITIZED_BITRATES -#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_SLICE_MODE -#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OPENH264_CABAC -#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_UNUSED_CODEC_CAPS -#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPRIV_PUT_BITS -#define FF_API_AVPRIV_PUT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_ENCDEC -#define FF_API_OLD_ENCDEC (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVCODEC_PIX_FMT -#define FF_API_AVCODEC_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MPV_RC_STRATEGY -#define FF_API_MPV_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PARSER_CHANGE -#define FF_API_PARSER_CHANGE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_THREAD_SAFE_CALLBACKS +#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_GET_FRAME_CLASS #define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_AUTO_THREADS #define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60) -#endif -#ifndef FF_API_INIT_PACKET #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) -#endif +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_MPEGVIDEO_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_H */ diff --git a/windows/include/x86/libavutil/adler32.h b/windows/include/x86/libavutil/adler32.h index e7a8f83..232d07f 100644 --- a/windows/include/x86/libavutil/adler32.h +++ b/windows/include/x86/libavutil/adler32.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_adler32 Adler-32 @@ -40,11 +39,7 @@ * @{ */ -#if FF_API_CRYPTO_SIZE_T -typedef unsigned long AVAdler; -#else typedef uint32_t AVAdler; -#endif /** * Calculate the Adler32 checksum of a buffer. @@ -59,11 +54,7 @@ typedef uint32_t AVAdler; * @return updated checksum */ AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, -#if FF_API_CRYPTO_SIZE_T - unsigned int len) av_pure; -#else size_t len) av_pure; -#endif /** * @} diff --git a/windows/include/x86/libavutil/aes.h b/windows/include/x86/libavutil/aes.h index 09efbda..d243286 100644 --- a/windows/include/x86/libavutil/aes.h +++ b/windows/include/x86/libavutil/aes.h @@ -24,7 +24,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_aes AES diff --git a/windows/include/x86/libavutil/aes_ctr.h b/windows/include/x86/libavutil/aes_ctr.h index e4aae12..4e9fda7 100644 --- a/windows/include/x86/libavutil/aes_ctr.h +++ b/windows/include/x86/libavutil/aes_ctr.h @@ -25,7 +25,6 @@ #include #include "attributes.h" -#include "version.h" #define AES_CTR_KEY_SIZE (16) #define AES_CTR_IV_SIZE (8) diff --git a/windows/include/x86/libavutil/buffer.h b/windows/include/x86/libavutil/buffer.h index 241a80e..e1ef5b7 100644 --- a/windows/include/x86/libavutil/buffer.h +++ b/windows/include/x86/libavutil/buffer.h @@ -28,8 +28,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_buffer AVBuffer * @ingroup lavu_data @@ -93,11 +91,7 @@ typedef struct AVBufferRef { /** * Size of data in bytes. */ -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif } AVBufferRef; /** @@ -105,21 +99,13 @@ typedef struct AVBufferRef { * * @return an AVBufferRef of given size or NULL when out of memory */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_alloc(int size); -#else AVBufferRef *av_buffer_alloc(size_t size); -#endif /** * Same as av_buffer_alloc(), except the returned buffer will be initialized * to zero. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_allocz(int size); -#else AVBufferRef *av_buffer_allocz(size_t size); -#endif /** * Always treat the buffer as read-only, even when it has only one @@ -142,11 +128,7 @@ AVBufferRef *av_buffer_allocz(size_t size); * * @return an AVBufferRef referring to data on success, NULL on failure. */ -#if FF_API_BUFFER_SIZE_T -AVBufferRef *av_buffer_create(uint8_t *data, int size, -#else AVBufferRef *av_buffer_create(uint8_t *data, size_t size, -#endif void (*free)(void *opaque, uint8_t *data), void *opaque, int flags); @@ -163,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on * failure. */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); /** * Free a given reference and automatically free the buffer if there are no more @@ -214,11 +196,7 @@ int av_buffer_make_writable(AVBufferRef **buf); * reference to it (i.e. the one passed to this function). In all other cases * a new buffer is allocated and the data is copied. */ -#if FF_API_BUFFER_SIZE_T -int av_buffer_realloc(AVBufferRef **buf, int size); -#else int av_buffer_realloc(AVBufferRef **buf, size_t size); -#endif /** * Ensure dst refers to the same data as src. @@ -234,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); * @return 0 on success * AVERROR(ENOMEM) on memory allocation failure. */ -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); /** * @} @@ -285,11 +263,7 @@ typedef struct AVBufferPool AVBufferPool; * (av_buffer_alloc()). * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); -#else AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size)); -#endif /** * Allocate and initialize a buffer pool with a more complex allocator. @@ -306,13 +280,8 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size * data. May be NULL. * @return newly created buffer pool on success, NULL on error. */ -#if FF_API_BUFFER_SIZE_T -AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), -#else AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, AVBufferRef* (*alloc)(void *opaque, size_t size), -#endif void (*pool_free)(void *opaque)); /** @@ -344,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); * therefore you have to use this function to access the original opaque * parameter of an allocated buffer. */ -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); /** * @} diff --git a/windows/include/x86/libavutil/common.h b/windows/include/x86/libavutil/common.h index aee353d..3eb9bc5 100644 --- a/windows/include/x86/libavutil/common.h +++ b/windows/include/x86/libavutil/common.h @@ -42,13 +42,6 @@ #include "attributes.h" #include "macros.h" #include "version.h" -#include "libavutil/avconfig.h" - -#if AV_HAVE_BIGENDIAN -# define AV_NE(be, le) (be) -#else -# define AV_NE(be, le) (le) -#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -89,25 +82,6 @@ #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) -/** - * Comparator. - * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 - * if x == y. This is useful for instance in a qsort comparator callback. - * Furthermore, compilers are able to optimize this to branchless code, and - * there is no risk of overflow with signed types. - * As with many macros, this evaluates its argument multiple times, it thus - * must not have a side-effect. - */ -#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) - /* misc math functions */ #ifdef HAVE_AV_CONFIG_H @@ -405,6 +379,8 @@ static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) { /** * Clip a float value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -415,13 +391,13 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** * Clip a double value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range @@ -432,9 +408,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double #if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 if (amin > amax) abort(); #endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; + return FFMIN(FFMAX(a, amin), amax); } /** Compute ceil(log2(x)). @@ -475,9 +449,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v) return av_popcount(v) & 1; } -#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) -#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) - /** * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. * diff --git a/windows/include/x86/libavutil/cpu.h b/windows/include/x86/libavutil/cpu.h index 83099dd..ce9bf14 100644 --- a/windows/include/x86/libavutil/cpu.h +++ b/windows/include/x86/libavutil/cpu.h @@ -23,8 +23,6 @@ #include -#include "attributes.h" - #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ /* lower 16 bits - CPU features */ @@ -56,6 +54,7 @@ #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers. #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 @@ -74,6 +73,10 @@ #define AV_CPU_FLAG_MMI (1 << 0) #define AV_CPU_FLAG_MSA (1 << 1) +//Loongarch SIMD extension. +#define AV_CPU_FLAG_LSX (1 << 0) +#define AV_CPU_FLAG_LASX (1 << 1) + /** * Return the flags which specify extensions supported by the CPU. * The returned value is affected by av_force_cpu_flags() if that was used @@ -88,25 +91,6 @@ int av_get_cpu_flags(void); */ void av_force_cpu_flags(int flags); -/** - * Set a mask on flags returned by av_get_cpu_flags(). - * This function is mainly useful for testing. - * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible - */ -attribute_deprecated void av_set_cpu_flags_mask(int mask); - -/** - * Parse CPU flags from a string. - * - * The returned flags contain the specified flags as well as related unspecified flags. - * - * This function exists only for compatibility with libav. - * Please use av_parse_cpu_caps() when possible. - * @return a combination of AV_CPU_* flags, negative on error. - */ -attribute_deprecated -int av_parse_cpu_flags(const char *s); - /** * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. * @@ -119,6 +103,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s); */ int av_cpu_count(void); +/** + * Overrides cpu count detection and forces the specified count. + * Count < 1 disables forcing of specific count. + */ +void av_cpu_force_count(int count); + /** * Get the maximum data alignment that may be required by FFmpeg. * diff --git a/windows/include/x86/libavutil/crc.h b/windows/include/x86/libavutil/crc.h index 47e22b4..24a2e3c 100644 --- a/windows/include/x86/libavutil/crc.h +++ b/windows/include/x86/libavutil/crc.h @@ -30,7 +30,6 @@ #include #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_crc32 CRC diff --git a/windows/include/x86/libavutil/detection_bbox.h b/windows/include/x86/libavutil/detection_bbox.h new file mode 100644 index 0000000..c20c204 --- /dev/null +++ b/windows/include/x86/libavutil/detection_bbox.h @@ -0,0 +1,107 @@ +/* + * 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 AVUTIL_DETECTION_BBOX_H +#define AVUTIL_DETECTION_BBOX_H + +#include "rational.h" +#include "avassert.h" +#include "frame.h" + +typedef struct AVDetectionBBox { + /** + * Distance in pixels from the left/top edge of the frame, + * together with width and height, defining the bounding box. + */ + int x; + int y; + int w; + int h; + +#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64 + + /** + * Detect result with confidence + */ + char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational detect_confidence; + + /** + * At most 4 classifications based on the detected bounding box. + * For example, we can get max 4 different attributes with 4 different + * DNN models on one bounding box. + * classify_count is zero if no classification. + */ +#define AV_NUM_DETECTION_BBOX_CLASSIFY 4 + uint32_t classify_count; + char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]; + AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY]; +} AVDetectionBBox; + +typedef struct AVDetectionBBoxHeader { + /** + * Information about how the bounding box is generated. + * for example, the DNN model name. + */ + char source[256]; + + /** + * Number of bounding boxes in the array. + */ + uint32_t nb_bboxes; + + /** + * Offset in bytes from the beginning of this structure at which + * the array of bounding boxes starts. + */ + size_t bboxes_offset; + + /** + * Size of each bounding box in bytes. + */ + size_t bbox_size; +} AVDetectionBBoxHeader; + +/* + * Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes. + */ +static av_always_inline AVDetectionBBox * +av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx) +{ + av_assert0(idx < header->nb_bboxes); + return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset + + idx * header->bbox_size); +} + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, and initializes the variables. + * Can be freed with a normal av_free() call. + * + * @param out_size if non-NULL, the size in bytes of the resulting data array is + * written here. + */ +AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size); + +/** + * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes} + * AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type + * AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables. + */ +AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes); +#endif diff --git a/windows/include/x86/libavutil/dict.h b/windows/include/x86/libavutil/dict.h index 118f1f0..0d1afc6 100644 --- a/windows/include/x86/libavutil/dict.h +++ b/windows/include/x86/libavutil/dict.h @@ -32,8 +32,6 @@ #include -#include "version.h" - /** * @addtogroup lavu_dict AVDictionary * @ingroup lavu_data diff --git a/windows/include/x86/libavutil/display.h b/windows/include/x86/libavutil/display.h index 515adad..d87bf68 100644 --- a/windows/include/x86/libavutil/display.h +++ b/windows/include/x86/libavutil/display.h @@ -88,7 +88,7 @@ double av_display_rotation_get(const int32_t matrix[9]); /** - * Initialize a transformation matrix describing a pure counterclockwise + * Initialize a transformation matrix describing a pure clockwise * rotation by the specified angle (in degrees). * * @param matrix an allocated transformation matrix (will be fully overwritten diff --git a/windows/include/x86/libavutil/dovi_meta.h b/windows/include/x86/libavutil/dovi_meta.h index 299911d..3d11e02 100644 --- a/windows/include/x86/libavutil/dovi_meta.h +++ b/windows/include/x86/libavutil/dovi_meta.h @@ -29,6 +29,7 @@ #include #include +#include "rational.h" /* * DOVI configuration @@ -67,4 +68,169 @@ typedef struct AVDOVIDecoderConfigurationRecord { */ AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size); +/** + * Dolby Vision RPU data header. + * + * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI. + */ +typedef struct AVDOVIRpuDataHeader { + uint8_t rpu_type; + uint16_t rpu_format; + uint8_t vdr_rpu_profile; + uint8_t vdr_rpu_level; + uint8_t chroma_resampling_explicit_filter_flag; + uint8_t coef_data_type; /* informative, lavc always converts to fixed */ + uint8_t coef_log2_denom; + uint8_t vdr_rpu_normalized_idc; + uint8_t bl_video_full_range_flag; + uint8_t bl_bit_depth; /* [8, 16] */ + uint8_t el_bit_depth; /* [8, 16] */ + uint8_t vdr_bit_depth; /* [8, 16] */ + uint8_t spatial_resampling_filter_flag; + uint8_t el_spatial_resampling_filter_flag; + uint8_t disable_residual_flag; +} AVDOVIRpuDataHeader; + +enum AVDOVIMappingMethod { + AV_DOVI_MAPPING_POLYNOMIAL = 0, + AV_DOVI_MAPPING_MMR = 1, +}; + +/** + * Coefficients of a piece-wise function. The pieces of the function span the + * value ranges between two adjacent pivot values. + */ +#define AV_DOVI_MAX_PIECES 8 +typedef struct AVDOVIReshapingCurve { + uint8_t num_pivots; /* [2, 9] */ + uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */ + enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]; + /* AV_DOVI_MAPPING_POLYNOMIAL */ + uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */ + int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */ + /* AV_DOVI_MAPPING_MMR */ + uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */ + int64_t mmr_constant[AV_DOVI_MAX_PIECES]; + int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7]; +} AVDOVIReshapingCurve; + +enum AVDOVINLQMethod { + AV_DOVI_NLQ_NONE = -1, + AV_DOVI_NLQ_LINEAR_DZ = 0, +}; + +/** + * Coefficients of the non-linear inverse quantization. For the interpretation + * of these, see ETSI GS CCM 001. + */ +typedef struct AVDOVINLQParams { + uint16_t nlq_offset; + uint64_t vdr_in_max; + /* AV_DOVI_NLQ_LINEAR_DZ */ + uint64_t linear_deadzone_slope; + uint64_t linear_deadzone_threshold; +} AVDOVINLQParams; + +/** + * Dolby Vision RPU data mapping parameters. + * + * @note sizeof(AVDOVIDataMapping) is not part of the public ABI. + */ +typedef struct AVDOVIDataMapping { + uint8_t vdr_rpu_id; + uint8_t mapping_color_space; + uint8_t mapping_chroma_format_idc; + AVDOVIReshapingCurve curves[3]; /* per component */ + + /* Non-linear inverse quantization */ + enum AVDOVINLQMethod nlq_method_idc; + uint32_t num_x_partitions; + uint32_t num_y_partitions; + AVDOVINLQParams nlq[3]; /* per component */ +} AVDOVIDataMapping; + +/** + * Dolby Vision RPU colorspace metadata parameters. + * + * @note sizeof(AVDOVIColorMetadata) is not part of the public ABI. + */ +typedef struct AVDOVIColorMetadata { + uint8_t dm_metadata_id; + uint8_t scene_refresh_flag; + + /** + * Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be + * used instead of the matrices indicated by the frame's colorspace tags. + * The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB + * matrix based on a Hunt-Pointer-Estevez transform, but without any + * crosstalk. (See the definition of the ICtCp colorspace for more + * information.) + */ + AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */ + AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */ + AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */ + + /** + * Extra signal metadata (see Dolby patents for more info). + */ + uint16_t signal_eotf; + uint16_t signal_eotf_param0; + uint16_t signal_eotf_param1; + uint32_t signal_eotf_param2; + uint8_t signal_bit_depth; + uint8_t signal_color_space; + uint8_t signal_chroma_format; + uint8_t signal_full_range_flag; /* [0, 3] */ + uint16_t source_min_pq; + uint16_t source_max_pq; + uint16_t source_diagonal; +} AVDOVIColorMetadata; + +/** + * Combined struct representing a combination of header, mapping and color + * metadata, for attaching to frames as side data. + * + * @note The struct must be allocated with av_dovi_metadata_alloc() and + * its size is not a part of the public ABI. + */ + +typedef struct AVDOVIMetadata { + /** + * Offset in bytes from the beginning of this structure at which the + * respective structs start. + */ + size_t header_offset; /* AVDOVIRpuDataHeader */ + size_t mapping_offset; /* AVDOVIDataMapping */ + size_t color_offset; /* AVDOVIColorMetadata */ +} AVDOVIMetadata; + +static av_always_inline AVDOVIRpuDataHeader * +av_dovi_get_header(const AVDOVIMetadata *data) +{ + return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset); +} + +static av_always_inline AVDOVIDataMapping * +av_dovi_get_mapping(const AVDOVIMetadata *data) +{ + return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset); +} + +static av_always_inline AVDOVIColorMetadata * +av_dovi_get_color(const AVDOVIMetadata *data) +{ + return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset); +} + +/** + * Allocate an AVDOVIMetadata structure and initialize its + * fields to default values. + * + * @param size If this parameter is non-NULL, the size in bytes of the + * allocated struct will be written here on success + * + * @return the newly allocated struct or NULL on failure + */ +AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size); + #endif /* AVUTIL_DOVI_META_H */ diff --git a/windows/include/x86/libavutil/error.h b/windows/include/x86/libavutil/error.h index 71df4da..0d3269a 100644 --- a/windows/include/x86/libavutil/error.h +++ b/windows/include/x86/libavutil/error.h @@ -27,6 +27,8 @@ #include #include +#include "macros.h" + /** * @addtogroup lavu_error * diff --git a/windows/include/x86/libavutil/ffversion.h b/windows/include/x86/libavutil/ffversion.h index c2b610f..cb3926a 100644 --- a/windows/include/x86/libavutil/ffversion.h +++ b/windows/include/x86/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "n4.4.1" +#define FFMPEG_VERSION "n5.0" #endif /* AVUTIL_FFVERSION_H */ diff --git a/windows/include/x86/libavutil/film_grain_params.h b/windows/include/x86/libavutil/film_grain_params.h index 7629e3a..f3bd0a4 100644 --- a/windows/include/x86/libavutil/film_grain_params.h +++ b/windows/include/x86/libavutil/film_grain_params.h @@ -28,6 +28,11 @@ enum AVFilmGrainParamsType { * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom) */ AV_FILM_GRAIN_PARAMS_AV1, + + /** + * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274) + */ + AV_FILM_GRAIN_PARAMS_H274, }; /** @@ -117,6 +122,89 @@ typedef struct AVFilmGrainAOMParams { int limit_output_range; } AVFilmGrainAOMParams; +/** + * This structure describes how to handle film grain synthesis for codecs using + * the ITU-T H.274 Versatile suplemental enhancement information message. + * + * @note The struct must be allocated as part of AVFilmGrainParams using + * av_film_grain_params_alloc(). Its size is not a part of the public ABI. + */ +typedef struct AVFilmGrainH274Params { + /** + * Specifies the film grain simulation mode. + * 0 = Frequency filtering, 1 = Auto-regression + */ + int model_id; + + /** + * Specifies the bit depth used for the luma component. + */ + int bit_depth_luma; + + /** + * Specifies the bit depth used for the chroma components. + */ + int bit_depth_chroma; + + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + + /** + * Specifies the blending mode used to blend the simulated film grain + * with the decoded images. + * + * 0 = Additive, 1 = Multiplicative + */ + int blending_mode_id; + + /** + * Specifies a scale factor used in the film grain characterization equations. + */ + int log2_scale_factor; + + /** + * Indicates if the modelling of film grain for a given component is present. + */ + int component_model_present[3 /* y, cb, cr */]; + + /** + * Specifies the number of intensity intervals for which a specific set of + * model values has been estimated, with a range of [1, 256]. + */ + uint16_t num_intensity_intervals[3 /* y, cb, cr */]; + + /** + * Specifies the number of model values present for each intensity interval + * in which the film grain has been modelled, with a range of [1, 6]. + */ + uint8_t num_model_values[3 /* y, cb, cr */]; + + /** + * Specifies the lower ounds of each intensity interval for whichthe set of + * model values applies for the component. + */ + uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the upper bound of each intensity interval for which the set of + * model values applies for the component. + */ + uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */]; + + /** + * Specifies the model values for the component for each intensity interval. + * - When model_id == 0, the following applies: + * For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1] + * For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1] + * - Otherwise, the following applies: + * For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1] + * For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1] + */ + int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */]; +} AVFilmGrainH274Params; + /** * This structure describes how to handle film grain synthesis in video * for specific codecs. Must be present on every frame where film grain is @@ -133,6 +221,9 @@ typedef struct AVFilmGrainParams { /** * Seed to use for the synthesis process, if the codec allows for it. + * + * @note For H.264, this refers to `pic_offset` as defined in + * SMPTE RDD 5-2006. */ uint64_t seed; @@ -143,6 +234,7 @@ typedef struct AVFilmGrainParams { */ union { AVFilmGrainAOMParams aom; + AVFilmGrainH274Params h274; } codec; } AVFilmGrainParams; diff --git a/windows/include/x86/libavutil/frame.h b/windows/include/x86/libavutil/frame.h index 7d1f8e2..18e239f 100644 --- a/windows/include/x86/libavutil/frame.h +++ b/windows/include/x86/libavutil/frame.h @@ -142,23 +142,6 @@ enum AVFrameSideDataType { */ AV_FRAME_DATA_ICC_PROFILE, -#if FF_API_FRAME_QP - /** - * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA. - * The contents of this side data are undocumented and internal; use - * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a - * meaningful way instead. - */ - AV_FRAME_DATA_QP_TABLE_PROPERTIES, - - /** - * Raw QP table data. Its format is described by - * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and - * av_frame_get_qp_table() to access this instead. - */ - AV_FRAME_DATA_QP_TABLE_DATA, -#endif - /** * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t * where the first uint32_t describes how many (1-3) of the other timecodes are used. @@ -198,6 +181,26 @@ enum AVFrameSideDataType { * Must be present for every frame which should have film grain applied. */ AV_FRAME_DATA_FILM_GRAIN_PARAMS, + + /** + * Bounding boxes for object detection and classification, + * as described by AVDetectionBBoxHeader. + */ + AV_FRAME_DATA_DETECTION_BBOXES, + + /** + * Dolby Vision RPU raw data, suitable for passing to x265 + * or other libraries. Array of uint8_t, with NAL emulation + * bytes intact. + */ + AV_FRAME_DATA_DOVI_RPU_BUFFER, + + /** + * Parsed Dolby Vision metadata, suitable for passing to a software + * implementation. The payload is the AVDOVIMetadata struct defined in + * libavutil/dovi_meta.h. + */ + AV_FRAME_DATA_DOVI_METADATA, }; enum AVActiveFormatDescription { @@ -220,11 +223,7 @@ enum AVActiveFormatDescription { typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; -#if FF_API_BUFFER_SIZE_T - int size; -#else size_t size; -#endif AVDictionary *metadata; AVBufferRef *buf; } AVFrameSideData; @@ -319,21 +318,32 @@ typedef struct AVFrame { #define AV_NUM_DATA_POINTERS 8 /** * pointer to the picture/channel planes. - * This might be different from the first allocated byte + * This might be different from the first allocated byte. For video, + * it could even point to the end of the image data. + * + * All pointers in data and extended_data must point into one of the + * AVBufferRef in buf or extended_buf. * * Some decoders access areas outside 0,0 - width,height, please * see avcodec_align_dimensions2(). Some filters and swscale can read * up to 16 bytes beyond the planes, if these filters are to be used, * then 16 extra bytes must be allocated. * - * NOTE: Except for hwaccel formats, pointers not needed by the format - * MUST be set to NULL. + * NOTE: Pointers not needed by the format MUST be set to NULL. + * + * @attention In case of video, the data[] pointers can point to the + * end of image data in order to reverse line order, when used in + * combination with negative values in the linesize[] array. */ uint8_t *data[AV_NUM_DATA_POINTERS]; /** - * For video, size in bytes of each picture line. - * For audio, size in bytes of each plane. + * For video, a positive or negative value, which is typically indicating + * the size in bytes of each picture line, but it can also be: + * - the negative byte size of lines for vertical flipping + * (with data[n] pointing to the end of the data + * - a positive or negative multiple of the byte size as for accessing + * even and odd fields of a frame (possibly flipped) * * For audio, only linesize[0] may be set. For planar audio, each channel * plane must be the same size. @@ -345,6 +355,9 @@ typedef struct AVFrame { * * @note The linesize may be larger than the size of usable data -- there * may be extra padding present for performance reasons. + * + * @attention In case of video, line size values can be negative to achieve + * a vertically inverted iteration over image lines. */ int linesize[AV_NUM_DATA_POINTERS]; @@ -410,15 +423,6 @@ typedef struct AVFrame { */ int64_t pts; -#if FF_API_PKT_PTS - /** - * PTS copied from the AVPacket that was decoded to produce this frame. - * @deprecated use the pts field instead - */ - attribute_deprecated - int64_t pkt_pts; -#endif - /** * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) * This is also the Presentation time of this AVFrame calculated from @@ -426,6 +430,14 @@ typedef struct AVFrame { */ int64_t pkt_dts; + /** + * Time base for the timestamps in this frame. + * In the future, this field may be set on frames output by decoders or + * filters, but its value will be by default ignored on input to encoders + * or filters. + */ + AVRational time_base; + /** * picture number in bitstream order */ @@ -445,14 +457,6 @@ typedef struct AVFrame { */ void *opaque; -#if FF_API_ERROR_FRAME - /** - * @deprecated unused - */ - attribute_deprecated - uint64_t error[AV_NUM_DATA_POINTERS]; -#endif - /** * When decoding, this signals how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps) @@ -495,10 +499,10 @@ typedef struct AVFrame { uint64_t channel_layout; /** - * AVBuffer references backing the data for this frame. If all elements of - * this array are NULL, then this frame is not reference counted. This array - * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must - * also be non-NULL for all j < i. + * 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 + * extended_buf. This array must be filled contiguously -- if buf[i] is + * non-NULL then buf[j] must also be non-NULL for all j < i. * * There may be at most one AVBuffer per data plane, so for video this array * always contains all the references. For planar audio with more than @@ -632,24 +636,6 @@ typedef struct AVFrame { */ int pkt_size; -#if FF_API_FRAME_QP - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - attribute_deprecated - AVBufferRef *qp_table_buf; -#endif /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. @@ -697,69 +683,16 @@ typedef struct AVFrame { AVBufferRef *private_ref; } AVFrame; -#if FF_API_FRAME_GET_SET -/** - * Accessors for some AVFrame fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); -attribute_deprecated -void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_duration (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_pos (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_channel_layout (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channel_layout (AVFrame *frame, int64_t val); -attribute_deprecated -int av_frame_get_channels (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channels (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_sample_rate (const AVFrame *frame); -attribute_deprecated -void av_frame_set_sample_rate (AVFrame *frame, int val); -attribute_deprecated -AVDictionary *av_frame_get_metadata (const AVFrame *frame); -attribute_deprecated -void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); -attribute_deprecated -int av_frame_get_decode_error_flags (const AVFrame *frame); -attribute_deprecated -void av_frame_set_decode_error_flags (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_pkt_size(const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_size(AVFrame *frame, int val); -#if FF_API_FRAME_QP -attribute_deprecated -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); -attribute_deprecated -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); -#endif -attribute_deprecated -enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); -attribute_deprecated -void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); -attribute_deprecated -enum AVColorRange av_frame_get_color_range(const AVFrame *frame); -attribute_deprecated -void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); -#endif +#if FF_API_COLORSPACE_NAME /** * Get the name of a colorspace. * @return a static string identifying the colorspace; can be NULL. + * @deprecated use av_color_space_name() */ +attribute_deprecated const char *av_get_colorspace_name(enum AVColorSpace val); - +#endif /** * Allocate an AVFrame and set its fields to default values. The resulting * struct must be freed using av_frame_free(). @@ -917,11 +850,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); */ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, -#if FF_API_BUFFER_SIZE_T - int size); -#else size_t size); -#endif /** * Add a new side data to a frame from an existing AVBufferRef diff --git a/windows/include/x86/libavutil/hash.h b/windows/include/x86/libavutil/hash.h index af4719e..94151de 100644 --- a/windows/include/x86/libavutil/hash.h +++ b/windows/include/x86/libavutil/hash.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_hash Hash Functions * @ingroup lavu_crypto @@ -182,11 +180,7 @@ void av_hash_init(struct AVHashContext *ctx); * @param[in] src Data to be added to the hash context * @param[in] len Size of the additional data */ -#if FF_API_CRYPTO_SIZE_T -void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); -#else void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len); -#endif /** * Finalize a hash context and compute the actual hash value. diff --git a/windows/include/x86/libavutil/hmac.h b/windows/include/x86/libavutil/hmac.h index 412e950..ca4da6a 100644 --- a/windows/include/x86/libavutil/hmac.h +++ b/windows/include/x86/libavutil/hmac.h @@ -23,7 +23,6 @@ #include -#include "version.h" /** * @defgroup lavu_hmac HMAC * @ingroup lavu_crypto diff --git a/windows/include/x86/libavutil/hwcontext_d3d11va.h b/windows/include/x86/libavutil/hwcontext_d3d11va.h index 9f91e9b..77d2d72 100644 --- a/windows/include/x86/libavutil/hwcontext_d3d11va.h +++ b/windows/include/x86/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if a user-allocated texture is provided. */ UINT MiscFlags; + + /** + * In case if texture structure member above is not NULL contains the same texture + * pointer for all elements and different indexes into the array texture. + * In case if texture structure member above is NULL, all elements contains + * pointers to separate non-array textures and 0 indexes. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + AVD3D11FrameDescriptor *texture_infos; } AVD3D11VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/windows/include/x86/libavutil/hwcontext_videotoolbox.h b/windows/include/x86/libavutil/hwcontext_videotoolbox.h index 5074d79..b6bdcf2 100644 --- a/windows/include/x86/libavutil/hwcontext_videotoolbox.h +++ b/windows/include/x86/libavutil/hwcontext_videotoolbox.h @@ -29,11 +29,14 @@ * @file * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. * - * This API currently does not support frame allocation, as the raw VideoToolbox - * API does allocation, and FFmpeg itself never has the need to allocate frames. + * This API supports frame allocation using a native CVPixelBufferPool + * instead of an AVBufferPool. * * If the API user sets a custom pool, AVHWFramesContext.pool must return * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. + * Note that the underlying CVPixelBuffer could be retained by OS frameworks + * depending on application usage, so it is preferable to let CoreVideo manage + * the pool using the default implementation. * * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always * NULL. @@ -57,4 +60,36 @@ uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); */ uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); +/** + * Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc); + +/** + * Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space); + +/** + * Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri); + +/** + * Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer + * function string. + * Returns 0 if no known equivalent was found. + */ +CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc); + +/** + * Update a CVPixelBufferRef's metadata to based on an AVFrame. + * Returns 0 if no known equivalent was found. + */ +int av_vt_pixbuf_set_attachments(void *log_ctx, + CVPixelBufferRef pixbuf, const struct AVFrame *src); + #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ diff --git a/windows/include/x86/libavutil/hwcontext_vulkan.h b/windows/include/x86/libavutil/hwcontext_vulkan.h index 5cbeb8e..df86c85 100644 --- a/windows/include/x86/libavutil/hwcontext_vulkan.h +++ b/windows/include/x86/libavutil/hwcontext_vulkan.h @@ -19,6 +19,9 @@ #ifndef AVUTIL_HWCONTEXT_VULKAN_H #define AVUTIL_HWCONTEXT_VULKAN_H +#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR) +#define VK_USE_PLATFORM_WIN32_KHR +#endif #include #include "pixfmt.h" @@ -41,43 +44,37 @@ typedef struct AVVulkanDeviceContext { * Custom memory allocator, else NULL */ const VkAllocationCallbacks *alloc; + + /** + * Pointer to the instance-provided vkGetInstanceProcAddr loading function. + * If NULL, will pick either libvulkan or libvolk, depending on libavutil's + * compilation settings, and set this field. + */ + PFN_vkGetInstanceProcAddr get_proc_addr; + /** - * Vulkan instance. Must be at least version 1.1. + * Vulkan instance. Must be at least version 1.2. */ VkInstance inst; + /** * Physical device */ VkPhysicalDevice phys_dev; + /** * Active device */ VkDevice act_dev; + /** - * Queue family index for graphics - * @note av_hwdevice_create() will set all 3 queue indices if unset - * If there is no dedicated queue for compute or transfer operations, - * they will be set to the graphics queue index which can handle both. - * nb_graphics_queues indicates how many queues were enabled for the - * graphics queue (must be at least 1) - */ - int queue_family_index; - int nb_graphics_queues; - /** - * Queue family index to use for transfer operations, and the amount of queues - * enabled. In case there is no dedicated transfer queue, nb_tx_queues - * must be 0 and queue_family_tx_index must be the same as either the graphics - * queue or the compute queue, if available. - */ - int queue_family_tx_index; - int nb_tx_queues; - /** - * Queue family index for compute ops, and the amount of queues enabled. - * In case there are no dedicated compute queues, nb_comp_queues must be - * 0 and its queue family index must be set to the graphics queue. + * This structure should be set to the set of features that present and enabled + * during device creation. When a device is created by FFmpeg, it will default to + * enabling all that are present of the shaderImageGatherExtended, + * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. */ - int queue_family_comp_index; - int nb_comp_queues; + VkPhysicalDeviceFeatures2 device_features; + /** * Enabled instance extensions. * If supplying your own device context, set this to an array of strings, with @@ -87,6 +84,7 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_inst_extensions; int nb_enabled_inst_extensions; + /** * Enabled device extensions. By default, VK_KHR_external_memory_fd, * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier, @@ -97,32 +95,91 @@ typedef struct AVVulkanDeviceContext { */ const char * const *enabled_dev_extensions; int nb_enabled_dev_extensions; + /** - * This structure should be set to the set of features that present and enabled - * during device creation. When a device is created by FFmpeg, it will default to - * enabling all that are present of the shaderImageGatherExtended, - * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. + * Queue family index for graphics operations, and the number of queues + * enabled for it. If unavaiable, will be set to -1. Not required. + * av_hwdevice_create() will attempt to find a dedicated queue for each + * queue family, or pick the one with the least unrelated flags set. + * Queue indices here may overlap if a queue has to share capabilities. */ - VkPhysicalDeviceFeatures2 device_features; + int queue_family_index; + int nb_graphics_queues; + + /** + * Queue family index for transfer operations and the number of queues + * enabled. Required. + */ + int queue_family_tx_index; + int nb_tx_queues; + + /** + * Queue family index for compute operations and the number of queues + * enabled. Required. + */ + int queue_family_comp_index; + int nb_comp_queues; + + /** + * Queue family index for video encode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_encode_index will be -1. + * Not required. + */ + int queue_family_encode_index; + int nb_encode_queues; + + /** + * Queue family index for video decode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_decode_index will be -1. + * Not required. + */ + int queue_family_decode_index; + int nb_decode_queues; } AVVulkanDeviceContext; +/** + * Defines the behaviour of frame allocation. + */ +typedef enum AVVkFrameFlags { + /* Unless this flag is set, autodetected flags will be OR'd based on the + * device and tiling during av_hwframe_ctx_init(). */ + AV_VK_FRAME_FLAG_NONE = (1ULL << 0), + + /* Image planes will be allocated in a single VkDeviceMemory, rather + * than as per-plane VkDeviceMemory allocations. Required for exporting + * to VAAPI on Intel devices. */ + AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1), +} AVVkFrameFlags; + /** * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options */ typedef struct AVVulkanFramesContext { /** - * Controls the tiling of allocated frames. + * Controls the tiling of allocated frames. If left as optimal tiling, + * then during av_hwframe_ctx_init() will decide based on whether the device + * supports DRM modifiers, or if the linear_images flag is set, otherwise + * will allocate optimally-tiled images. */ VkImageTiling tiling; + /** * Defines extra usage of output frames. If left as 0, the following bits * are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE. */ VkImageUsageFlagBits usage; + /** * Extension data for image creation. + * If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain, + * and the device supports DRM modifiers, then images will be allocated + * with the specific requested DRM modifiers. + * Additional structures may be added at av_hwframe_ctx_init() time, + * which will be freed automatically on uninit(), so users need only free + * any structures they've allocated themselves. */ void *create_pnext; + /** * Extension data for memory allocation. Must have as many entries as * the number of planes of the sw_format. @@ -131,6 +188,13 @@ typedef struct AVVulkanFramesContext { * extensions are present in enabled_dev_extensions. */ void *alloc_pnext[AV_NUM_DATA_POINTERS]; + + /** + * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set, + * autodetected flags will be OR'd based on the device and tiling during + * av_hwframe_ctx_init(). + */ + AVVkFrameFlags flags; } AVVulkanFramesContext; /* @@ -139,7 +203,7 @@ typedef struct AVVulkanFramesContext { * 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 three queue family indices in the device context are the same, + * 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. * @@ -158,8 +222,9 @@ typedef struct AVVkFrame { VkImageTiling tiling; /** - * Memory backing the images. Could be less than the amount of images - * if importing from a DRM or VAAPI frame. + * Memory backing the images. Could be less than the amount of planes, + * in which case the offset value will indicate the binding offset of + * each plane in the memory. */ VkDeviceMemory mem[AV_NUM_DATA_POINTERS]; size_t size[AV_NUM_DATA_POINTERS]; @@ -176,17 +241,29 @@ typedef struct AVVkFrame { VkImageLayout layout[AV_NUM_DATA_POINTERS]; /** - * Synchronization semaphores. Must not be freed manually. Must be waited on - * and signalled at every queue submission. - * Could be less than the amount of images: either one per VkDeviceMemory - * or one for the entire frame. All others will be set to VK_NULL_HANDLE. + * Synchronization timeline semaphores, one for each sw_format plane. + * 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, + * using an incremented value. */ VkSemaphore sem[AV_NUM_DATA_POINTERS]; + /** + * Up to date semaphore value at which each image becomes accessible. + * Clients must wait on this value when submitting a command queue, + * and increment it when signalling. + */ + uint64_t sem_value[AV_NUM_DATA_POINTERS]; + /** * Internal data. */ struct AVVkFrameInternal *internal; + + /** + * Describes the binding offset of each plane to the VkDeviceMemory. + */ + ptrdiff_t offset[AV_NUM_DATA_POINTERS]; } AVVkFrame; /** diff --git a/windows/include/x86/libavutil/imgutils.h b/windows/include/x86/libavutil/imgutils.h index 5eccbf0..cb2d747 100644 --- a/windows/include/x86/libavutil/imgutils.h +++ b/windows/include/x86/libavutil/imgutils.h @@ -124,6 +124,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height); +/** + * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where + * available, this function will use special functionality for reading from such + * memory, which may result in greatly improved performance compared to plain + * av_image_copy_plane(). + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy_plane(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize, + ptrdiff_t bytewidth, int height); + /** * Copy image in src_data to dst_data. * diff --git a/windows/include/x86/libavutil/log.h b/windows/include/x86/libavutil/log.h index 8edd6bb..99625af 100644 --- a/windows/include/x86/libavutil/log.h +++ b/windows/include/x86/libavutil/log.h @@ -24,7 +24,6 @@ #include #include "avutil.h" #include "attributes.h" -#include "version.h" typedef enum { AV_CLASS_CATEGORY_NA = 0, @@ -107,24 +106,6 @@ typedef struct AVClass { */ int parent_log_context_offset; - /** - * Return next AVOptions-enabled child or NULL - */ - void* (*child_next)(void *obj, void *prev); - -#if FF_API_CHILD_CLASS_NEXT - /** - * Return an AVClass corresponding to the next potential - * AVOptions-enabled child. - * - * The difference between child_next and this is that - * child_next iterates over _already existing_ objects, while - * child_class_next iterates over _all possible_ children. - */ - attribute_deprecated - const struct AVClass* (*child_class_next)(const struct AVClass *prev); -#endif - /** * Category used for visualization (like color) * This is only set if the category is equal for all objects using this class. @@ -144,6 +125,11 @@ typedef struct AVClass { */ int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + /** * Iterate over the AVClasses corresponding to potential AVOptions-enabled * children. diff --git a/windows/include/x86/libavutil/macros.h b/windows/include/x86/libavutil/macros.h index 2007ee5..2a7567c 100644 --- a/windows/include/x86/libavutil/macros.h +++ b/windows/include/x86/libavutil/macros.h @@ -25,6 +25,36 @@ #ifndef AVUTIL_MACROS_H #define AVUTIL_MACROS_H +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + /** * @addtogroup preproc_misc Preprocessor String Macros * diff --git a/windows/include/x86/libavutil/md5.h b/windows/include/x86/libavutil/md5.h index ca72ccb..fc2eabd 100644 --- a/windows/include/x86/libavutil/md5.h +++ b/windows/include/x86/libavutil/md5.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_md5 MD5 @@ -64,11 +63,7 @@ void av_md5_init(struct AVMD5 *ctx); * @param src input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); -#else void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. @@ -85,11 +80,7 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); * @param src The data to hash * @param len The length of the data, in bytes */ -#if FF_API_CRYPTO_SIZE_T -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); -#else void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); -#endif /** * @} diff --git a/windows/include/x86/libavutil/mem.h b/windows/include/x86/libavutil/mem.h index e21a1fe..b9fe807 100644 --- a/windows/include/x86/libavutil/mem.h +++ b/windows/include/x86/libavutil/mem.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "error.h" #include "avutil.h" #include "version.h" @@ -238,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); * @see av_mallocz() * @see av_malloc_array() */ -av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#if FF_API_AV_MALLOCZ_ARRAY /** - * Non-inlined equivalent of av_mallocz_array(). - * - * Created for symmetry with the calloc() C function. + * @deprecated use av_calloc() */ -void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; +attribute_deprecated +void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); +#endif /** * Allocate, reallocate, or free a block of memory. @@ -672,16 +672,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, * @param[out] r Pointer to the result of the operation * @return 0 on success, AVERROR(EINVAL) on overflow */ -static inline int av_size_mult(size_t a, size_t b, size_t *r) -{ - size_t t = a * b; - /* Hack inspired from glibc: don't try the division if nelem and elsize - * are both less than sqrt(SIZE_MAX). */ - if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) - return AVERROR(EINVAL); - *r = t; - return 0; -} +int av_size_mult(size_t a, size_t b, size_t *r); /** * Set the maximum size that may be allocated in one block. diff --git a/windows/include/x86/libavutil/murmur3.h b/windows/include/x86/libavutil/murmur3.h index b3b3a07..d90bc2f 100644 --- a/windows/include/x86/libavutil/murmur3.h +++ b/windows/include/x86/libavutil/murmur3.h @@ -30,8 +30,6 @@ #include #include -#include "version.h" - /** * @defgroup lavu_murmur3 Murmur3 * @ingroup lavu_hash @@ -100,11 +98,7 @@ void av_murmur3_init(struct AVMurMur3 *c); * @param[in] src Input data to update hash with * @param[in] len Number of bytes to read from `src` */ -#if FF_API_CRYPTO_SIZE_T -void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); -#else void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x86/libavutil/opt.h b/windows/include/x86/libavutil/opt.h index 8dc020a..2820435 100644 --- a/windows/include/x86/libavutil/opt.h +++ b/windows/include/x86/libavutil/opt.h @@ -33,7 +33,6 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" -#include "version.h" /** * @defgroup avoptions AVOptions @@ -648,19 +647,6 @@ const AVOption *av_opt_next(const void *obj, const AVOption *prev); */ void *av_opt_child_next(void *obj, void *prev); -#if FF_API_CHILD_CLASS_NEXT -/** - * Iterate over potential AVOptions-enabled children of parent. - * - * @param prev result of a previous call to this function or NULL - * @return AVClass corresponding to next potential child or NULL - * - * @deprecated use av_opt_child_class_iterate - */ -attribute_deprecated -const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); -#endif - /** * Iterate over potential AVOptions-enabled children of parent. * @@ -804,9 +790,16 @@ 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 diff --git a/windows/include/x86/libavutil/pixdesc.h b/windows/include/x86/libavutil/pixdesc.h index 9b9d386..f8a195f 100644 --- a/windows/include/x86/libavutil/pixdesc.h +++ b/windows/include/x86/libavutil/pixdesc.h @@ -26,7 +26,6 @@ #include "attributes.h" #include "pixfmt.h" -#include "version.h" typedef struct AVComponentDescriptor { /** @@ -56,17 +55,6 @@ typedef struct AVComponentDescriptor { * Number of bits in the component. */ int depth; - -#if FF_API_PLUS1_MINUS1 - /** deprecated, use step instead */ - attribute_deprecated int step_minus1; - - /** deprecated, use depth instead */ - attribute_deprecated int depth_minus1; - - /** deprecated, use offset instead */ - attribute_deprecated int offset_plus1; -#endif } AVComponentDescriptor; /** @@ -147,26 +135,6 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_RGB (1 << 5) -#if FF_API_PSEUDOPAL -/** - * The pixel format is "pseudo-paletted". This means that it contains a - * fixed palette in the 2nd plane but the palette is fixed/constant for each - * PIX_FMT. This allows interpreting the data as if it was PAL8, which can - * in some cases be simpler. Or the data can be interpreted purely based on - * the pixel format without using the palette. - * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 - * - * @deprecated This flag is deprecated, and will be removed. When it is removed, - * the extra palette allocation in AVFrame.data[1] is removed as well. Only - * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a - * palette. Starting with FFmpeg versions which have this flag deprecated, the - * extra "pseudo" palette is already ignored, and API users are not required to - * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required - * before the deprecation, though). - */ -#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) -#endif - /** * The pixel format has an alpha channel. This is set on all formats that * support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always diff --git a/windows/include/x86/libavutil/pixfmt.h b/windows/include/x86/libavutil/pixfmt.h index 46ef211..02e355e 100644 --- a/windows/include/x86/libavutil/pixfmt.h +++ b/windows/include/x86/libavutil/pixfmt.h @@ -112,21 +112,11 @@ enum AVPixelFormat { AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined -#if FF_API_VAAPI - /** @name Deprecated pixel formats */ - /**@{*/ - AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers - AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers - AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID - /**@}*/ - AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, -#else /** * Hardware acceleration through VA-API, data[3] contains a * VASurfaceID. */ AV_PIX_FMT_VAAPI, -#endif AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian @@ -360,6 +350,21 @@ enum AVPixelFormat { AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian + + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, liddle-endian + + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian + AV_PIX_FMT_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 }; @@ -450,35 +455,41 @@ enum AVPixelFormat { #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) + +#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_P216 AV_PIX_FMT_NE(P216BE, P216LE) +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) /** * Chromaticity coordinates of the source primaries. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. */ enum AVColorPrimaries { AVCOL_PRI_RESERVED0 = 0, - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B AVCOL_PRI_UNSPECIFIED = 2, AVCOL_PRI_RESERVED = 3, AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65 AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428, AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3 AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 - AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E / JEDEC P22 phosphors + AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213, AVCOL_PRI_NB ///< Not part of ABI }; /** * Color Transfer Characteristic. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2. */ enum AVColorTransferCharacteristic { AVCOL_TRC_RESERVED0 = 0, @@ -507,18 +518,18 @@ enum AVColorTransferCharacteristic { /** * YUV colorspace type. - * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3. */ enum AVColorSpace { - AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above - AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries + AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO, AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system @@ -540,9 +551,9 @@ enum AVColorSpace { * recommended, as it also defines the full range representation. * * Common definitions: - * - For RGB and luminance planes such as Y in YCbCr and I in ICtCp, + * - For RGB and luma planes such as Y in YCbCr and I in ICtCp, * 'E' is the original value in range of 0.0 to 1.0. - * - For chrominance planes such as Cb,Cr and Ct,Cp, 'E' is the original + * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original * value in range of -0.5 to 0.5. * - 'n' is the output bit depth. * - For additional definitions such as rounding and clipping to valid n @@ -554,13 +565,13 @@ enum AVColorRange { /** * Narrow or limited range content. * - * - For luminance planes: + * - For luma planes: * * (219 * E + 16) * 2^(n-8) * * F.ex. the range of 16-235 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (224 * E + 128) * 2^(n-8) * @@ -571,13 +582,13 @@ enum AVColorRange { /** * Full range content. * - * - For RGB and luminance planes: + * - For RGB and luma planes: * * (2^n - 1) * E * * F.ex. the range of 0-255 for 8 bits * - * - For chrominance planes: + * - For chroma planes: * * (2^n - 1) * E + 2^(n - 1) * diff --git a/windows/include/x86/libavutil/ripemd.h b/windows/include/x86/libavutil/ripemd.h index 921aa66..9df9f90 100644 --- a/windows/include/x86/libavutil/ripemd.h +++ b/windows/include/x86/libavutil/ripemd.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_ripemd RIPEMD @@ -67,11 +66,7 @@ int av_ripemd_init(struct AVRIPEMD* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); -#else void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x86/libavutil/samplefmt.h b/windows/include/x86/libavutil/samplefmt.h index 8cd43ae..f270199 100644 --- a/windows/include/x86/libavutil/samplefmt.h +++ b/windows/include/x86/libavutil/samplefmt.h @@ -195,9 +195,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return >=0 on success or a negative error code on failure - * @todo return minimum size in bytes required for the buffer in case - * of success at the next bump + * @return minimum size in bytes required for the buffer on success, + * or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, diff --git a/windows/include/x86/libavutil/sha.h b/windows/include/x86/libavutil/sha.h index c0180e5..2e1220a 100644 --- a/windows/include/x86/libavutil/sha.h +++ b/windows/include/x86/libavutil/sha.h @@ -31,7 +31,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha SHA @@ -74,11 +73,7 @@ int av_sha_init(struct AVSHA* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len); -#else void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x86/libavutil/sha512.h b/windows/include/x86/libavutil/sha512.h index bef714b..a4a3f23 100644 --- a/windows/include/x86/libavutil/sha512.h +++ b/windows/include/x86/libavutil/sha512.h @@ -32,7 +32,6 @@ #include #include "attributes.h" -#include "version.h" /** * @defgroup lavu_sha512 SHA-512 @@ -76,11 +75,7 @@ int av_sha512_init(struct AVSHA512* context, int bits); * @param data input data to update hash with * @param len input data length */ -#if FF_API_CRYPTO_SIZE_T -void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); -#else void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len); -#endif /** * Finish hashing and output digest value. diff --git a/windows/include/x86/libavutil/tree.h b/windows/include/x86/libavutil/tree.h index d5e0aeb..bbb8fbb 100644 --- a/windows/include/x86/libavutil/tree.h +++ b/windows/include/x86/libavutil/tree.h @@ -28,7 +28,6 @@ #define AVUTIL_TREE_H #include "attributes.h" -#include "version.h" /** * @addtogroup lavu_tree AVTree diff --git a/windows/include/x86/libavutil/tx.h b/windows/include/x86/libavutil/tx.h index bfc0c7f..5517381 100644 --- a/windows/include/x86/libavutil/tx.h +++ b/windows/include/x86/libavutil/tx.h @@ -49,11 +49,14 @@ enum AVTXType { * float. Length is the frame size, not the window size (which is 2x frame) * For forward transforms, the stride specifies the spacing between each * sample in the output array in bytes. The input must be a flat array. + * * For inverse transforms, the stride specifies the spacing between each * sample in the input array in bytes. The output will be a flat array. * Stride must be a non-zero multiple of sizeof(float). + * * NOTE: the inverse transform is half-length, meaning the output will not - * contain redundant data. This is what most codecs work with. + * contain redundant data. This is what most codecs work with. To do a full + * inverse transform, set the AV_TX_FULL_IMDCT flag on init. */ AV_TX_FLOAT_MDCT = 1, @@ -93,7 +96,7 @@ enum AVTXType { * @param stride the input or output stride in bytes * * The out and in arrays must be aligned to the maximum required by the CPU - * architecture. + * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init(). * The stride must follow the constraints the transform type has specified. */ typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride); @@ -108,6 +111,20 @@ enum AVTXFlags { * transform types. */ AV_TX_INPLACE = 1ULL << 0, + + /** + * Relaxes alignment requirement for the in and out arrays of av_tx_fn(). + * May be slower with certain transform types. + */ + AV_TX_UNALIGNED = 1ULL << 1, + + /** + * Performs a full inverse MDCT rather than leaving out samples that can be + * derived through symmetry. Requires an output array of 'len' floats, + * rather than the usual 'len/2' floats. + * Ignored for all transforms but inverse MDCTs. + */ + AV_TX_FULL_IMDCT = 1ULL << 2, }; /** diff --git a/windows/include/x86/libavutil/version.h b/windows/include/x86/libavutil/version.h index f888dbb..58c6179 100644 --- a/windows/include/x86/libavutil/version.h +++ b/windows/include/x86/libavutil/version.h @@ -78,8 +78,8 @@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 70 +#define LIBAVUTIL_VERSION_MAJOR 57 +#define LIBAVUTIL_VERSION_MINOR 17 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -105,42 +105,10 @@ * @{ */ -#ifndef FF_API_VAAPI -#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_QP -#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PLUS1_MINUS1 -#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_ERROR_FRAME -#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PKT_PTS -#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CRYPTO_SIZE_T -#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_FRAME_GET_SET -#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_PSEUDOPAL -#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CHILD_CLASS_NEXT -#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_BUFFER_SIZE_T -#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_D2STR #define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_DECLARE_ALIGNED #define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58) -#endif +#define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58) +#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58) /** * @} diff --git a/windows/lib/arm64/avcodec-58.dll b/windows/lib/arm64/avcodec-59.dll similarity index 69% rename from windows/lib/arm64/avcodec-58.dll rename to windows/lib/arm64/avcodec-59.dll index c9971e0..57de68b 100644 Binary files a/windows/lib/arm64/avcodec-58.dll and b/windows/lib/arm64/avcodec-59.dll differ diff --git a/windows/lib/arm64/avcodec-58.pdb b/windows/lib/arm64/avcodec-59.pdb similarity index 59% rename from windows/lib/arm64/avcodec-58.pdb rename to windows/lib/arm64/avcodec-59.pdb index 4e9293c..f87d152 100644 Binary files a/windows/lib/arm64/avcodec-58.pdb and b/windows/lib/arm64/avcodec-59.pdb differ diff --git a/windows/lib/arm64/avcodec.lib b/windows/lib/arm64/avcodec.lib index 74c8ba0..80c1359 100644 Binary files a/windows/lib/arm64/avcodec.lib and b/windows/lib/arm64/avcodec.lib differ diff --git a/windows/lib/arm64/avutil-56.dll b/windows/lib/arm64/avutil-57.dll similarity index 61% rename from windows/lib/arm64/avutil-56.dll rename to windows/lib/arm64/avutil-57.dll index bf7f8f6..746a80d 100644 Binary files a/windows/lib/arm64/avutil-56.dll and b/windows/lib/arm64/avutil-57.dll differ diff --git a/windows/lib/arm64/avutil-56.pdb b/windows/lib/arm64/avutil-57.pdb similarity index 56% rename from windows/lib/arm64/avutil-56.pdb rename to windows/lib/arm64/avutil-57.pdb index a319a17..ccbe864 100644 Binary files a/windows/lib/arm64/avutil-56.pdb and b/windows/lib/arm64/avutil-57.pdb differ diff --git a/windows/lib/arm64/avutil.lib b/windows/lib/arm64/avutil.lib index 9cece99..1a0fd4a 100644 Binary files a/windows/lib/arm64/avutil.lib and b/windows/lib/arm64/avutil.lib differ diff --git a/windows/lib/x64/avcodec-58.dll b/windows/lib/x64/avcodec-59.dll similarity index 65% rename from windows/lib/x64/avcodec-58.dll rename to windows/lib/x64/avcodec-59.dll index 29bd761..5df9814 100644 Binary files a/windows/lib/x64/avcodec-58.dll and b/windows/lib/x64/avcodec-59.dll differ diff --git a/windows/lib/x64/avcodec-58.pdb b/windows/lib/x64/avcodec-59.pdb similarity index 60% rename from windows/lib/x64/avcodec-58.pdb rename to windows/lib/x64/avcodec-59.pdb index 4c6e930..cca4657 100644 Binary files a/windows/lib/x64/avcodec-58.pdb and b/windows/lib/x64/avcodec-59.pdb differ diff --git a/windows/lib/x64/avcodec.lib b/windows/lib/x64/avcodec.lib index f70b5c8..bea8fc0 100644 Binary files a/windows/lib/x64/avcodec.lib and b/windows/lib/x64/avcodec.lib differ diff --git a/windows/lib/x64/avutil-56.dll b/windows/lib/x64/avutil-56.dll deleted file mode 100644 index d717f51..0000000 Binary files a/windows/lib/x64/avutil-56.dll and /dev/null differ diff --git a/windows/lib/x64/avutil-57.dll b/windows/lib/x64/avutil-57.dll new file mode 100644 index 0000000..02b6445 Binary files /dev/null and b/windows/lib/x64/avutil-57.dll differ diff --git a/windows/lib/x64/avutil-56.pdb b/windows/lib/x64/avutil-57.pdb similarity index 55% rename from windows/lib/x64/avutil-56.pdb rename to windows/lib/x64/avutil-57.pdb index a9ef8ab..3e9be00 100644 Binary files a/windows/lib/x64/avutil-56.pdb and b/windows/lib/x64/avutil-57.pdb differ diff --git a/windows/lib/x64/avutil.lib b/windows/lib/x64/avutil.lib index 0c9ec62..e0f5f0b 100644 Binary files a/windows/lib/x64/avutil.lib and b/windows/lib/x64/avutil.lib differ diff --git a/windows/lib/x86/avcodec-58.dll b/windows/lib/x86/avcodec-59.dll similarity index 61% rename from windows/lib/x86/avcodec-58.dll rename to windows/lib/x86/avcodec-59.dll index 644c124..467a7d8 100644 Binary files a/windows/lib/x86/avcodec-58.dll and b/windows/lib/x86/avcodec-59.dll differ diff --git a/windows/lib/x86/avcodec-58.pdb b/windows/lib/x86/avcodec-59.pdb similarity index 60% rename from windows/lib/x86/avcodec-58.pdb rename to windows/lib/x86/avcodec-59.pdb index 0aa4197..444fbdd 100644 Binary files a/windows/lib/x86/avcodec-58.pdb and b/windows/lib/x86/avcodec-59.pdb differ diff --git a/windows/lib/x86/avcodec.lib b/windows/lib/x86/avcodec.lib index 07a1961..3153201 100644 Binary files a/windows/lib/x86/avcodec.lib and b/windows/lib/x86/avcodec.lib differ diff --git a/windows/lib/x86/avutil-56.dll b/windows/lib/x86/avutil-56.dll deleted file mode 100644 index 6925c04..0000000 Binary files a/windows/lib/x86/avutil-56.dll and /dev/null differ diff --git a/windows/lib/x86/avutil-57.dll b/windows/lib/x86/avutil-57.dll new file mode 100644 index 0000000..5bc1f8f Binary files /dev/null and b/windows/lib/x86/avutil-57.dll differ diff --git a/windows/lib/x86/avutil-56.pdb b/windows/lib/x86/avutil-57.pdb similarity index 57% rename from windows/lib/x86/avutil-56.pdb rename to windows/lib/x86/avutil-57.pdb index cdd1599..63ee535 100644 Binary files a/windows/lib/x86/avutil-56.pdb and b/windows/lib/x86/avutil-57.pdb differ diff --git a/windows/lib/x86/avutil.lib b/windows/lib/x86/avutil.lib index 4ba6e7e..6ad2b5e 100644 Binary files a/windows/lib/x86/avutil.lib and b/windows/lib/x86/avutil.lib differ