Updated FFmpeg to version 3.2.2.
parent
2771809af6
commit
0d6447f3d2
|
@ -43,7 +43,9 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup libavc Encoding/Decoding Library
|
* @defgroup libavc libavcodec
|
||||||
|
* Encoding/Decoding Library
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* @defgroup lavc_decoding Decoding
|
* @defgroup lavc_decoding Decoding
|
||||||
|
@ -443,9 +445,9 @@ enum AVCodecID {
|
||||||
AV_CODEC_ID_PCM_S24LE_PLANAR,
|
AV_CODEC_ID_PCM_S24LE_PLANAR,
|
||||||
AV_CODEC_ID_PCM_S32LE_PLANAR,
|
AV_CODEC_ID_PCM_S32LE_PLANAR,
|
||||||
AV_CODEC_ID_PCM_S16BE_PLANAR,
|
AV_CODEC_ID_PCM_S16BE_PLANAR,
|
||||||
/* new PCM "codecs" should be added right below this line starting with
|
|
||||||
* an explicit value of for example 0x10800
|
AV_CODEC_ID_PCM_S64LE = 0x10800,
|
||||||
*/
|
AV_CODEC_ID_PCM_S64BE,
|
||||||
|
|
||||||
/* various ADPCM codecs */
|
/* various ADPCM codecs */
|
||||||
AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
|
AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
|
||||||
|
@ -629,6 +631,7 @@ enum AVCodecID {
|
||||||
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||||
AV_CODEC_ID_TTF = 0x18000,
|
AV_CODEC_ID_TTF = 0x18000,
|
||||||
|
|
||||||
|
AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
|
||||||
AV_CODEC_ID_BINTEXT = 0x18800,
|
AV_CODEC_ID_BINTEXT = 0x18800,
|
||||||
AV_CODEC_ID_XBIN,
|
AV_CODEC_ID_XBIN,
|
||||||
AV_CODEC_ID_IDF,
|
AV_CODEC_ID_IDF,
|
||||||
|
@ -1033,6 +1036,16 @@ typedef struct RcOverride{
|
||||||
* Audio encoder supports receiving a different number of samples in each call.
|
* Audio encoder supports receiving a different number of samples in each call.
|
||||||
*/
|
*/
|
||||||
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
|
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
|
||||||
|
/**
|
||||||
|
* Decoder is not a preferred choice for probing.
|
||||||
|
* This indicates that the decoder is not a good choice for probing.
|
||||||
|
* It could for example be an expensive to spin up hardware decoder,
|
||||||
|
* or it could simply not provide a lot of useful information about
|
||||||
|
* the stream.
|
||||||
|
* A decoder marked with this flag should only be used as last resort
|
||||||
|
* choice for probing.
|
||||||
|
*/
|
||||||
|
#define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
|
||||||
/**
|
/**
|
||||||
* Codec is intra only.
|
* Codec is intra only.
|
||||||
*/
|
*/
|
||||||
|
@ -1348,6 +1361,14 @@ typedef struct AVCPBProperties {
|
||||||
*/
|
*/
|
||||||
enum AVPacketSideDataType {
|
enum AVPacketSideDataType {
|
||||||
AV_PKT_DATA_PALETTE,
|
AV_PKT_DATA_PALETTE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
|
||||||
|
* that the extradata buffer was changed and the receiving side should
|
||||||
|
* act upon it appropriately. The new extradata is embedded in the side
|
||||||
|
* data buffer and should be immediately used for processing the current
|
||||||
|
* frame or packet.
|
||||||
|
*/
|
||||||
AV_PKT_DATA_NEW_EXTRADATA,
|
AV_PKT_DATA_NEW_EXTRADATA,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1611,6 +1632,12 @@ typedef struct AVPacket {
|
||||||
} AVPacket;
|
} AVPacket;
|
||||||
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
|
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
|
||||||
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
|
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
|
||||||
|
/**
|
||||||
|
* Flag is used to discard packets which are required to maintain valid
|
||||||
|
* decoder state but are not required for output and should be dropped
|
||||||
|
* after decoding.
|
||||||
|
**/
|
||||||
|
#define AV_PKT_FLAG_DISCARD 0x0004
|
||||||
|
|
||||||
enum AVSideDataParamChangeFlags {
|
enum AVSideDataParamChangeFlags {
|
||||||
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
|
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
|
||||||
|
@ -2098,6 +2125,7 @@ typedef struct AVCodecContext {
|
||||||
#define FF_CMP_W97 12
|
#define FF_CMP_W97 12
|
||||||
#define FF_CMP_DCTMAX 13
|
#define FF_CMP_DCTMAX 13
|
||||||
#define FF_CMP_DCT264 14
|
#define FF_CMP_DCT264 14
|
||||||
|
#define FF_CMP_MEDIAN_SAD 15
|
||||||
#define FF_CMP_CHROMA 256
|
#define FF_CMP_CHROMA 256
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2850,6 +2878,7 @@ typedef struct AVCodecContext {
|
||||||
#define FF_BUG_DC_CLIP 4096
|
#define FF_BUG_DC_CLIP 4096
|
||||||
#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
|
#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
|
||||||
#define FF_BUG_TRUNCATED 16384
|
#define FF_BUG_TRUNCATED 16384
|
||||||
|
#define FF_BUG_IEDGE 32768
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* strictly follow the standard (MPEG-4, ...).
|
* strictly follow the standard (MPEG-4, ...).
|
||||||
|
@ -3165,6 +3194,13 @@ typedef struct AVCodecContext {
|
||||||
#define FF_PROFILE_MPEG2_AAC_LOW 128
|
#define FF_PROFILE_MPEG2_AAC_LOW 128
|
||||||
#define FF_PROFILE_MPEG2_AAC_HE 131
|
#define FF_PROFILE_MPEG2_AAC_HE 131
|
||||||
|
|
||||||
|
#define FF_PROFILE_DNXHD 0
|
||||||
|
#define FF_PROFILE_DNXHR_LB 1
|
||||||
|
#define FF_PROFILE_DNXHR_SQ 2
|
||||||
|
#define FF_PROFILE_DNXHR_HQ 3
|
||||||
|
#define FF_PROFILE_DNXHR_HQX 4
|
||||||
|
#define FF_PROFILE_DNXHR_444 5
|
||||||
|
|
||||||
#define FF_PROFILE_DTS 20
|
#define FF_PROFILE_DTS 20
|
||||||
#define FF_PROFILE_DTS_ES 30
|
#define FF_PROFILE_DTS_ES 30
|
||||||
#define FF_PROFILE_DTS_96_24 40
|
#define FF_PROFILE_DTS_96_24 40
|
||||||
|
@ -3189,8 +3225,10 @@ typedef struct AVCodecContext {
|
||||||
#define FF_PROFILE_H264_HIGH 100
|
#define FF_PROFILE_H264_HIGH 100
|
||||||
#define FF_PROFILE_H264_HIGH_10 110
|
#define FF_PROFILE_H264_HIGH_10 110
|
||||||
#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
|
#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
|
||||||
|
#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
|
||||||
#define FF_PROFILE_H264_HIGH_422 122
|
#define FF_PROFILE_H264_HIGH_422 122
|
||||||
#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
|
#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
|
||||||
|
#define FF_PROFILE_H264_STEREO_HIGH 128
|
||||||
#define FF_PROFILE_H264_HIGH_444 144
|
#define FF_PROFILE_H264_HIGH_444 144
|
||||||
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
|
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
|
||||||
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
|
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
|
||||||
|
@ -3482,15 +3520,25 @@ typedef struct AVCodecContext {
|
||||||
int nb_coded_side_data;
|
int nb_coded_side_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encoding only.
|
* A reference to the AVHWFramesContext describing the input (for encoding)
|
||||||
|
* or output (decoding) frames. The reference is set by the caller and
|
||||||
|
* afterwards owned (and freed) by libavcodec.
|
||||||
*
|
*
|
||||||
* For hardware encoders configured to use a hwaccel pixel format, this
|
* - decoding: This field should be set by the caller from the get_format()
|
||||||
* field should be set by the caller to a reference to the AVHWFramesContext
|
* callback. The previous reference (if any) will always be
|
||||||
* describing input frames. AVHWFramesContext.format must be equal to
|
* unreffed by libavcodec before the get_format() call.
|
||||||
|
*
|
||||||
|
* If the default get_buffer2() is used with a hwaccel pixel
|
||||||
|
* format, then this AVHWFramesContext will be used for
|
||||||
|
* allocating the frame buffers.
|
||||||
|
*
|
||||||
|
* - encoding: For hardware encoders configured to use a hwaccel pixel
|
||||||
|
* format, this field should be set by the caller to a reference
|
||||||
|
* to the AVHWFramesContext describing input frames.
|
||||||
|
* AVHWFramesContext.format must be equal to
|
||||||
* AVCodecContext.pix_fmt.
|
* AVCodecContext.pix_fmt.
|
||||||
*
|
*
|
||||||
* This field should be set before avcodec_open2() is called and is
|
* This field should be set before avcodec_open2() is called.
|
||||||
* afterwards owned and managed by libavcodec.
|
|
||||||
*/
|
*/
|
||||||
AVBufferRef *hw_frames_ctx;
|
AVBufferRef *hw_frames_ctx;
|
||||||
|
|
||||||
|
@ -3505,6 +3553,17 @@ typedef struct AVCodecContext {
|
||||||
#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
|
#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio only. The amount of padding (in samples) appended by the encoder to
|
||||||
|
* the end of the audio. I.e. this number of decoded samples must be
|
||||||
|
* discarded by the caller from the end of the stream to get the original
|
||||||
|
* audio without any trailing padding.
|
||||||
|
*
|
||||||
|
* - decoding: unused
|
||||||
|
* - encoding: unused
|
||||||
|
*/
|
||||||
|
int trailing_padding;
|
||||||
|
|
||||||
} AVCodecContext;
|
} AVCodecContext;
|
||||||
|
|
||||||
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
|
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
|
||||||
|
@ -5115,7 +5174,10 @@ AVCodecParserContext *av_parser_init(int codec_id);
|
||||||
* @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
|
* @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
|
||||||
* @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
|
* @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
|
||||||
* @param buf input buffer.
|
* @param buf input buffer.
|
||||||
* @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output).
|
* @param buf_size buffer size in bytes without the padding. I.e. the full buffer
|
||||||
|
size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
|
||||||
|
To signal EOF, this should be 0 (so that the last frame
|
||||||
|
can be output).
|
||||||
* @param pts input presentation timestamp.
|
* @param pts input presentation timestamp.
|
||||||
* @param dts input decoding timestamp.
|
* @param dts input decoding timestamp.
|
||||||
* @param pos input byte position in stream.
|
* @param pos input byte position in stream.
|
||||||
|
@ -5505,15 +5567,8 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt
|
||||||
enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
|
enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
|
||||||
|
|
||||||
attribute_deprecated
|
attribute_deprecated
|
||||||
#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
|
|
||||||
enum AVPixelFormat avcodec_find_best_pix_fmt2(const enum AVPixelFormat *pix_fmt_list,
|
|
||||||
enum AVPixelFormat src_pix_fmt,
|
|
||||||
int has_alpha, int *loss_ptr);
|
|
||||||
#else
|
|
||||||
enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
|
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);
|
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);
|
enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
|
||||||
|
|
||||||
|
@ -5881,7 +5936,8 @@ int av_bsf_init(AVBSFContext *ctx);
|
||||||
* av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
|
* av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
|
||||||
* AVERROR_EOF.
|
* AVERROR_EOF.
|
||||||
*
|
*
|
||||||
* @param pkt the packet to filter. The bitstream filter will take ownership of
|
* @param pkt the packet to filter. pkt must contain some payload (i.e data or
|
||||||
|
* side data must be present in pkt). The bitstream filter will take ownership of
|
||||||
* the packet and reset the contents of pkt. pkt is not touched if an error occurs.
|
* the packet and reset the contents of pkt. pkt is not touched if an error occurs.
|
||||||
* This parameter may be NULL, which signals the end of the stream (i.e. no more
|
* This parameter may be NULL, which signals the end of the stream (i.e. no more
|
||||||
* packets will be sent). That will cause the filter to output any packets it
|
* packets will be sent). That will cause the filter to output any packets it
|
||||||
|
@ -5931,6 +5987,91 @@ void av_bsf_free(AVBSFContext **ctx);
|
||||||
*/
|
*/
|
||||||
const AVClass *av_bsf_get_class(void);
|
const AVClass *av_bsf_get_class(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure for chain/list of bitstream filters.
|
||||||
|
* Empty list can be allocated by av_bsf_list_alloc().
|
||||||
|
*/
|
||||||
|
typedef struct AVBSFList AVBSFList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate empty list of bitstream filters.
|
||||||
|
* The list must be later freed by av_bsf_list_free()
|
||||||
|
* or finalized by av_bsf_list_finalize().
|
||||||
|
*
|
||||||
|
* @return Pointer to @ref AVBSFList on success, NULL in case of failure
|
||||||
|
*/
|
||||||
|
AVBSFList *av_bsf_list_alloc(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free list of bitstream filters.
|
||||||
|
*
|
||||||
|
* @param lst Pointer to pointer returned by av_bsf_list_alloc()
|
||||||
|
*/
|
||||||
|
void av_bsf_list_free(AVBSFList **lst);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append bitstream filter to the list of bitstream filters.
|
||||||
|
*
|
||||||
|
* @param lst List to append to
|
||||||
|
* @param bsf Filter context to be appended
|
||||||
|
*
|
||||||
|
* @return >=0 on success, negative AVERROR in case of failure
|
||||||
|
*/
|
||||||
|
int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct new bitstream filter context given it's name and options
|
||||||
|
* and append it to the list of bitstream filters.
|
||||||
|
*
|
||||||
|
* @param lst List to append to
|
||||||
|
* @param bsf_name Name of the bitstream filter
|
||||||
|
* @param options Options for the bitstream filter, can be set to NULL
|
||||||
|
*
|
||||||
|
* @return >=0 on success, negative AVERROR in case of failure
|
||||||
|
*/
|
||||||
|
int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
|
||||||
|
/**
|
||||||
|
* Finalize list of bitstream filters.
|
||||||
|
*
|
||||||
|
* This function will transform @ref AVBSFList to single @ref AVBSFContext,
|
||||||
|
* so the whole chain of bitstream filters can be treated as single filter
|
||||||
|
* freshly allocated by av_bsf_alloc().
|
||||||
|
* If the call is successful, @ref AVBSFList structure is freed and lst
|
||||||
|
* will be set to NULL. In case of failure, caller is responsible for
|
||||||
|
* freeing the structure by av_bsf_list_free()
|
||||||
|
*
|
||||||
|
* @param lst Filter list structure to be transformed
|
||||||
|
* @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
|
||||||
|
* representing the chain of bitstream filters
|
||||||
|
*
|
||||||
|
* @return >=0 on success, negative AVERROR in case of failure
|
||||||
|
*/
|
||||||
|
int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse string describing list of bitstream filters and create single
|
||||||
|
* @ref AVBSFContext describing the whole chain of bitstream filters.
|
||||||
|
* Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
|
||||||
|
* allocated by av_bsf_alloc().
|
||||||
|
*
|
||||||
|
* @param str String describing chain of bitstream filters in format
|
||||||
|
* `bsf1[=opt1=val1:opt2=val2][,bsf2]`
|
||||||
|
* @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
|
||||||
|
* representing the chain of bitstream filters
|
||||||
|
*
|
||||||
|
* @return >=0 on success, negative AVERROR in case of failure
|
||||||
|
*/
|
||||||
|
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get null/pass-through bitstream filter.
|
||||||
|
*
|
||||||
|
* @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int av_bsf_get_null_filter(AVBSFContext **bsf);
|
||||||
|
|
||||||
/* memory */
|
/* memory */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* Android MediaCodec public API
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
|
||||||
|
*
|
||||||
|
* 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_MEDIACODEC_H
|
||||||
|
#define AVCODEC_MEDIACODEC_H
|
||||||
|
|
||||||
|
#include "libavcodec/avcodec.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This structure holds a reference to a android/view/Surface object that will
|
||||||
|
* be used as output by the decoder.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct AVMediaCodecContext {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android/view/Surface object reference.
|
||||||
|
*/
|
||||||
|
void *surface;
|
||||||
|
|
||||||
|
} AVMediaCodecContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate and initialize a MediaCodec context.
|
||||||
|
*
|
||||||
|
* When decoding with MediaCodec is finished, the caller must free the
|
||||||
|
* MediaCodec context with av_mediacodec_default_free.
|
||||||
|
*
|
||||||
|
* @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise
|
||||||
|
*/
|
||||||
|
AVMediaCodecContext *av_mediacodec_alloc_context(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function that sets up the MediaCodec context.
|
||||||
|
*
|
||||||
|
* @param avctx codec context
|
||||||
|
* @param ctx MediaCodec context to initialize
|
||||||
|
* @param surface reference to an android/view/Surface
|
||||||
|
* @return 0 on success, < 0 otherwise
|
||||||
|
*/
|
||||||
|
int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function must be called to free the MediaCodec context initialized with
|
||||||
|
* av_mediacodec_default_init().
|
||||||
|
*
|
||||||
|
* @param avctx codec context
|
||||||
|
*/
|
||||||
|
void av_mediacodec_default_free(AVCodecContext *avctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opaque structure representing a MediaCodec buffer to render.
|
||||||
|
*/
|
||||||
|
typedef struct MediaCodecBuffer AVMediaCodecBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release a MediaCodec buffer and render it to the surface that is associated
|
||||||
|
* with the decoder. This function should only be called once on a given
|
||||||
|
* buffer, once released the underlying buffer returns to the codec, thus
|
||||||
|
* subsequent calls to this function will have no effect.
|
||||||
|
*
|
||||||
|
* @param buffer the buffer to render
|
||||||
|
* @param render 1 to release and render the buffer to the surface or 0 to
|
||||||
|
* discard the buffer
|
||||||
|
* @return 0 on success, < 0 otherwise
|
||||||
|
*/
|
||||||
|
int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
|
||||||
|
|
||||||
|
#endif /* AVCODEC_MEDIACODEC_H */
|
|
@ -28,7 +28,7 @@
|
||||||
#include "libavutil/version.h"
|
#include "libavutil/version.h"
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 57
|
#define LIBAVCODEC_VERSION_MAJOR 57
|
||||||
#define LIBAVCODEC_VERSION_MINOR 48
|
#define LIBAVCODEC_VERSION_MINOR 64
|
||||||
#define LIBAVCODEC_VERSION_MICRO 101
|
#define LIBAVCODEC_VERSION_MICRO 101
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup libavf I/O and Muxing/Demuxing Library
|
* @defgroup libavf libavformat
|
||||||
* @{
|
* I/O and Muxing/Demuxing Library
|
||||||
*
|
*
|
||||||
* Libavformat (lavf) is a library for dealing with various media container
|
* Libavformat (lavf) is a library for dealing with various media container
|
||||||
* formats. Its main two purposes are demuxing - i.e. splitting a media file
|
* formats. Its main two purposes are demuxing - i.e. splitting a media file
|
||||||
|
@ -90,6 +90,8 @@
|
||||||
* both local and remote files, parts of them, concatenations of them, local
|
* both local and remote files, parts of them, concatenations of them, local
|
||||||
* audio and video devices and so on.
|
* audio and video devices and so on.
|
||||||
*
|
*
|
||||||
|
* @{
|
||||||
|
*
|
||||||
* @defgroup lavf_decoding Demuxing
|
* @defgroup lavf_decoding Demuxing
|
||||||
* @{
|
* @{
|
||||||
* Demuxers read a media file and split it into chunks of data (@em packets). A
|
* Demuxers read a media file and split it into chunks of data (@em packets). A
|
||||||
|
@ -616,6 +618,8 @@ typedef struct AVOutputFormat {
|
||||||
* AVStream parameters that need to be set before packets are sent.
|
* AVStream parameters that need to be set before packets are sent.
|
||||||
* This method must not write output.
|
* This method must not write output.
|
||||||
*
|
*
|
||||||
|
* Return 0 if streams were fully configured, 1 if not, negative AVERROR on failure
|
||||||
|
*
|
||||||
* Any allocations made here must be freed in deinit().
|
* Any allocations made here must be freed in deinit().
|
||||||
*/
|
*/
|
||||||
int (*init)(struct AVFormatContext *);
|
int (*init)(struct AVFormatContext *);
|
||||||
|
@ -812,6 +816,9 @@ typedef struct AVIndexEntry {
|
||||||
* is known
|
* is known
|
||||||
*/
|
*/
|
||||||
#define AVINDEX_KEYFRAME 0x0001
|
#define AVINDEX_KEYFRAME 0x0001
|
||||||
|
#define AVINDEX_DISCARD_FRAME 0x0002 /**
|
||||||
|
* Flag is used to indicate which frame should be discarded after decoding.
|
||||||
|
*/
|
||||||
int flags:2;
|
int flags:2;
|
||||||
int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment).
|
int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment).
|
||||||
int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
|
int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
|
||||||
|
@ -835,11 +842,17 @@ typedef struct AVIndexEntry {
|
||||||
#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */
|
#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */
|
||||||
/**
|
/**
|
||||||
* The stream is stored in the file as an attached picture/"cover art" (e.g.
|
* The stream is stored in the file as an attached picture/"cover art" (e.g.
|
||||||
* APIC frame in ID3v2). The single packet associated with it will be returned
|
* APIC frame in ID3v2). The first (usually only) packet associated with it
|
||||||
* among the first few packets read from the file unless seeking takes place.
|
* will be returned among the first few packets read from the file unless
|
||||||
* It can also be accessed at any time in AVStream.attached_pic.
|
* seeking takes place. It can also be accessed at any time in
|
||||||
|
* AVStream.attached_pic.
|
||||||
*/
|
*/
|
||||||
#define AV_DISPOSITION_ATTACHED_PIC 0x0400
|
#define AV_DISPOSITION_ATTACHED_PIC 0x0400
|
||||||
|
/**
|
||||||
|
* The stream is sparse, and contains thumbnail images, often corresponding
|
||||||
|
* to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC.
|
||||||
|
*/
|
||||||
|
#define AV_DISPOSITION_TIMED_THUMBNAILS 0x0800
|
||||||
|
|
||||||
typedef struct AVStreamInternal AVStreamInternal;
|
typedef struct AVStreamInternal AVStreamInternal;
|
||||||
|
|
||||||
|
@ -1446,6 +1459,8 @@ typedef struct AVFormatContext {
|
||||||
#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)
|
#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)
|
||||||
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
|
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
|
||||||
#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
|
#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
|
||||||
|
#define AVFMT_FLAG_SHORTEST 0x100000 ///< Stop muxing when the shortest stream stops.
|
||||||
|
#define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Wait for packet data before writing a header, and add bitstream filters as requested by the muxer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum size of the data read from input for determining
|
* Maximum size of the data read from input for determining
|
||||||
|
@ -2051,8 +2066,13 @@ uint8_t *av_stream_new_side_data(AVStream *stream,
|
||||||
* @param size pointer for side information size to store (optional)
|
* @param size pointer for side information size to store (optional)
|
||||||
* @return pointer to data if present or NULL otherwise
|
* @return pointer to data if present or NULL otherwise
|
||||||
*/
|
*/
|
||||||
|
#if FF_API_NOCONST_GET_SIDE_DATA
|
||||||
uint8_t *av_stream_get_side_data(AVStream *stream,
|
uint8_t *av_stream_get_side_data(AVStream *stream,
|
||||||
enum AVPacketSideDataType type, int *size);
|
enum AVPacketSideDataType type, int *size);
|
||||||
|
#else
|
||||||
|
uint8_t *av_stream_get_side_data(const AVStream *stream,
|
||||||
|
enum AVPacketSideDataType type, int *size);
|
||||||
|
#endif
|
||||||
|
|
||||||
AVProgram *av_new_program(AVFormatContext *s, int id);
|
AVProgram *av_new_program(AVFormatContext *s, int id);
|
||||||
|
|
||||||
|
@ -2362,6 +2382,10 @@ void avformat_close_input(AVFormatContext **s);
|
||||||
* @addtogroup lavf_encoding
|
* @addtogroup lavf_encoding
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in avformat_write_header
|
||||||
|
#define AVSTREAM_INIT_IN_INIT_OUTPUT 1 ///< stream parameters initialized in avformat_init_output
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate the stream private data and write the stream header to
|
* Allocate the stream private data and write the stream header to
|
||||||
* an output media file.
|
* an output media file.
|
||||||
|
@ -2373,13 +2397,37 @@ void avformat_close_input(AVFormatContext **s);
|
||||||
* On return this parameter will be destroyed and replaced with a dict containing
|
* On return this parameter will be destroyed and replaced with a dict containing
|
||||||
* options that were not found. May be NULL.
|
* options that were not found. May be NULL.
|
||||||
*
|
*
|
||||||
* @return 0 on success, negative AVERROR on failure.
|
* @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not already been fully initialized in avformat_init,
|
||||||
|
* AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec had already been fully initialized in avformat_init,
|
||||||
|
* negative AVERROR on failure.
|
||||||
*
|
*
|
||||||
* @see av_opt_find, av_dict_set, avio_open, av_oformat_next.
|
* @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output.
|
||||||
*/
|
*/
|
||||||
av_warn_unused_result
|
av_warn_unused_result
|
||||||
int avformat_write_header(AVFormatContext *s, AVDictionary **options);
|
int avformat_write_header(AVFormatContext *s, AVDictionary **options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate the stream private data and initialize the codec, but do not write the header.
|
||||||
|
* May optionally be used before avformat_write_header to initialize stream parameters
|
||||||
|
* before actually writing the header.
|
||||||
|
* If using this function, do not pass the same options to avformat_write_header.
|
||||||
|
*
|
||||||
|
* @param s Media file handle, must be allocated with avformat_alloc_context().
|
||||||
|
* Its oformat field must be set to the desired output format;
|
||||||
|
* Its pb field must be set to an already opened AVIOContext.
|
||||||
|
* @param options An AVDictionary filled with AVFormatContext and muxer-private options.
|
||||||
|
* On return this parameter will be destroyed and replaced with a dict containing
|
||||||
|
* options that were not found. May be NULL.
|
||||||
|
*
|
||||||
|
* @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires avformat_write_header to fully initialize,
|
||||||
|
* AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec has been fully initialized,
|
||||||
|
* negative AVERROR on failure.
|
||||||
|
*
|
||||||
|
* @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_write_header.
|
||||||
|
*/
|
||||||
|
av_warn_unused_result
|
||||||
|
int avformat_init_output(AVFormatContext *s, AVDictionary **options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a packet to an output media file.
|
* Write a packet to an output media file.
|
||||||
*
|
*
|
||||||
|
@ -2718,6 +2766,9 @@ void av_dump_format(AVFormatContext *ic,
|
||||||
const char *url,
|
const char *url,
|
||||||
int is_output);
|
int is_output);
|
||||||
|
|
||||||
|
|
||||||
|
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return in 'buf' the path with '%d' replaced by a number.
|
* Return in 'buf' the path with '%d' replaced by a number.
|
||||||
*
|
*
|
||||||
|
@ -2728,8 +2779,12 @@ void av_dump_format(AVFormatContext *ic,
|
||||||
* @param buf_size destination buffer size
|
* @param buf_size destination buffer size
|
||||||
* @param path numbered sequence string
|
* @param path numbered sequence string
|
||||||
* @param number frame number
|
* @param number frame number
|
||||||
|
* @param flags AV_FRAME_FILENAME_FLAGS_*
|
||||||
* @return 0 if OK, -1 on format error
|
* @return 0 if OK, -1 on format error
|
||||||
*/
|
*/
|
||||||
|
int av_get_frame_filename2(char *buf, int buf_size,
|
||||||
|
const char *path, int number, int flags);
|
||||||
|
|
||||||
int av_get_frame_filename(char *buf, int buf_size,
|
int av_get_frame_filename(char *buf, int buf_size,
|
||||||
const char *path, int number);
|
const char *path, int number);
|
||||||
|
|
||||||
|
@ -2879,6 +2934,36 @@ int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
|
||||||
AVBitStreamFilterContext *bsfc);
|
AVBitStreamFilterContext *bsfc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum AVTimebaseSource {
|
||||||
|
AVFMT_TBCF_AUTO = -1,
|
||||||
|
AVFMT_TBCF_DECODER,
|
||||||
|
AVFMT_TBCF_DEMUXER,
|
||||||
|
#if FF_API_R_FRAME_RATE
|
||||||
|
AVFMT_TBCF_R_FRAMERATE,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transfer internal timing information from one stream to another.
|
||||||
|
*
|
||||||
|
* This function is useful when doing stream copy.
|
||||||
|
*
|
||||||
|
* @param ofmt target output format for ost
|
||||||
|
* @param ost output stream which needs timings copy and adjustments
|
||||||
|
* @param ist reference input stream to copy timings from
|
||||||
|
* @param copy_tb define from where the stream codec timebase needs to be imported
|
||||||
|
*/
|
||||||
|
int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
|
||||||
|
AVStream *ost, const AVStream *ist,
|
||||||
|
enum AVTimebaseSource copy_tb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the internal codec timebase from a stream.
|
||||||
|
*
|
||||||
|
* @param st input stream to extract the timebase from
|
||||||
|
*/
|
||||||
|
AVRational av_stream_get_codec_timebase(const AVStream *st);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include "libavutil/version.h"
|
#include "libavutil/version.h"
|
||||||
|
|
||||||
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
|
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
|
||||||
// Also please add any ticket numbers that you belive might be affected here
|
// Also please add any ticket numbers that you believe might be affected here
|
||||||
#define LIBAVFORMAT_VERSION_MAJOR 57
|
#define LIBAVFORMAT_VERSION_MAJOR 57
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 41
|
#define LIBAVFORMAT_VERSION_MINOR 56
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
#define LIBAVFORMAT_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
|
@ -79,6 +79,12 @@
|
||||||
#ifndef FF_API_LAVF_AVCTX
|
#ifndef FF_API_LAVF_AVCTX
|
||||||
#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 58)
|
#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 58)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_NOCONST_GET_SIDE_DATA
|
||||||
|
#define FF_API_NOCONST_GET_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 58)
|
||||||
|
#endif
|
||||||
|
#ifndef FF_API_HTTP_USER_AGENT
|
||||||
|
#define FF_API_HTTP_USER_AGENT (LIBAVFORMAT_VERSION_MAJOR < 58)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FF_API_R_FRAME_RATE
|
#ifndef FF_API_R_FRAME_RATE
|
||||||
#define FF_API_R_FRAME_RATE 1
|
#define FF_API_R_FRAME_RATE 1
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_adler32
|
||||||
|
* Public header for Adler-32 hash function implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_ADLER32_H
|
#ifndef AVUTIL_ADLER32_H
|
||||||
#define AVUTIL_ADLER32_H
|
#define AVUTIL_ADLER32_H
|
||||||
|
|
||||||
|
@ -25,11 +31,10 @@
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @defgroup lavu_adler32 Adler-32
|
||||||
* Public header for libavutil Adler32 hasher
|
* @ingroup lavu_hash
|
||||||
|
* Adler-32 hash function implementation.
|
||||||
*
|
*
|
||||||
* @defgroup lavu_adler32 Adler32
|
|
||||||
* @ingroup lavu_crypto
|
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,17 @@
|
||||||
*/
|
*/
|
||||||
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
|
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
|
||||||
#define av_assert2(cond) av_assert0(cond)
|
#define av_assert2(cond) av_assert0(cond)
|
||||||
|
#define av_assert2_fpu() av_assert0_fpu()
|
||||||
#else
|
#else
|
||||||
#define av_assert2(cond) ((void)0)
|
#define av_assert2(cond) ((void)0)
|
||||||
|
#define av_assert2_fpu() ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assert that floating point opperations can be executed.
|
||||||
|
*
|
||||||
|
* This will av_assert0() that the cpu is not in MMX state on X86
|
||||||
|
*/
|
||||||
|
void av_assert0_fpu(void);
|
||||||
|
|
||||||
#endif /* AVUTIL_AVASSERT_H */
|
#endif /* AVUTIL_AVASSERT_H */
|
||||||
|
|
|
@ -3,5 +3,4 @@
|
||||||
#define AVUTIL_AVCONFIG_H
|
#define AVUTIL_AVCONFIG_H
|
||||||
#define AV_HAVE_BIGENDIAN 0
|
#define AV_HAVE_BIGENDIAN 0
|
||||||
#define AV_HAVE_FAST_UNALIGNED 1
|
#define AV_HAVE_FAST_UNALIGNED 1
|
||||||
#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
|
|
||||||
#endif /* AVUTIL_AVCONFIG_H */
|
#endif /* AVUTIL_AVCONFIG_H */
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* external API header
|
* @ingroup lavu
|
||||||
|
* Convenience header that includes @ref lavu "libavutil"'s core.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,14 +79,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu Common utility functions
|
* @defgroup lavu libavutil
|
||||||
|
* Common code shared across all FFmpeg libraries.
|
||||||
*
|
*
|
||||||
* @brief
|
* @note
|
||||||
* libavutil contains the code shared across all the other FFmpeg
|
* libavutil is designed to be modular. In most cases, in order to use the
|
||||||
* libraries
|
* functions provided by one component of libavutil you must explicitly include
|
||||||
*
|
* the specific header containing that feature. If you are only using
|
||||||
* @note In order to use the functions provided by avutil you must include
|
* media-related components, you could simply include libavutil/avutil.h, which
|
||||||
* the specific header.
|
* brings in most of the "core" components.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
|
@ -94,7 +96,7 @@
|
||||||
* @{
|
* @{
|
||||||
* @}
|
* @}
|
||||||
*
|
*
|
||||||
* @defgroup lavu_math Maths
|
* @defgroup lavu_math Mathematics
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* @}
|
* @}
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_crc32
|
||||||
|
* Public header for CRC hash function implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_CRC_H
|
#ifndef AVUTIL_CRC_H
|
||||||
#define AVUTIL_CRC_H
|
#define AVUTIL_CRC_H
|
||||||
|
|
||||||
|
@ -27,8 +33,14 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_crc32 CRC32
|
* @defgroup lavu_crc32 CRC
|
||||||
* @ingroup lavu_crypto
|
* @ingroup lavu_hash
|
||||||
|
* CRC (Cyclic Redundancy Check) hash function implementation.
|
||||||
|
*
|
||||||
|
* This module supports numerous CRC polynomials, in addition to the most
|
||||||
|
* widely used CRC-32-IEEE. See @ref AVCRCId for a list of available
|
||||||
|
* polynomials.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Automatically generated by version.sh, do not manually edit! */
|
/* Automatically generated by version.sh, do not manually edit! */
|
||||||
#ifndef AVUTIL_FFVERSION_H
|
#ifndef AVUTIL_FFVERSION_H
|
||||||
#define AVUTIL_FFVERSION_H
|
#define AVUTIL_FFVERSION_H
|
||||||
#define FFMPEG_VERSION "n3.1.4-3-g2a8f172"
|
#define FFMPEG_VERSION "n3.2.2"
|
||||||
#endif /* AVUTIL_FFVERSION_H */
|
#endif /* AVUTIL_FFVERSION_H */
|
||||||
|
|
|
@ -178,7 +178,7 @@ typedef struct AVFrameSideData {
|
||||||
* without breaking compatibility with each other.
|
* without breaking compatibility with each other.
|
||||||
*
|
*
|
||||||
* Fields can be accessed through AVOptions, the name string used, matches the
|
* Fields can be accessed through AVOptions, the name string used, matches the
|
||||||
* C structure field name for fields accessable through AVOptions. The AVClass
|
* C structure field name for fields accessible through AVOptions. The AVClass
|
||||||
* for AVFrame can be obtained from avcodec_get_frame_class()
|
* for AVFrame can be obtained from avcodec_get_frame_class()
|
||||||
*/
|
*/
|
||||||
typedef struct AVFrame {
|
typedef struct AVFrame {
|
||||||
|
@ -267,10 +267,14 @@ typedef struct AVFrame {
|
||||||
*/
|
*/
|
||||||
int64_t pts;
|
int64_t pts;
|
||||||
|
|
||||||
|
#if FF_API_PKT_PTS
|
||||||
/**
|
/**
|
||||||
* PTS copied from the AVPacket that was decoded to produce this frame.
|
* PTS copied from the AVPacket that was decoded to produce this frame.
|
||||||
|
* @deprecated use the pts field instead
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
int64_t pkt_pts;
|
int64_t pkt_pts;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
|
* DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
|
||||||
|
@ -385,6 +389,7 @@ typedef struct AVFrame {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_frame_flags AV_FRAME_FLAGS
|
* @defgroup lavu_frame_flags AV_FRAME_FLAGS
|
||||||
|
* @ingroup lavu_frame
|
||||||
* Flags describing additional frame properties.
|
* Flags describing additional frame properties.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
|
@ -394,6 +399,10 @@ typedef struct AVFrame {
|
||||||
* The frame data may be corrupted, e.g. due to decoding errors.
|
* The frame data may be corrupted, e.g. due to decoding errors.
|
||||||
*/
|
*/
|
||||||
#define AV_FRAME_FLAG_CORRUPT (1 << 0)
|
#define AV_FRAME_FLAG_CORRUPT (1 << 0)
|
||||||
|
/**
|
||||||
|
* A flag to mark the frames which need to be decoded, but shouldn't be output.
|
||||||
|
*/
|
||||||
|
#define AV_FRAME_FLAG_DISCARD (1 << 2)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,18 +18,108 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_hash_generic
|
||||||
|
* Generic hashing API
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_HASH_H
|
#ifndef AVUTIL_HASH_H
|
||||||
#define AVUTIL_HASH_H
|
#define AVUTIL_HASH_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup lavu_hash Hash Functions
|
||||||
|
* @ingroup lavu_crypto
|
||||||
|
* Hash functions useful in multimedia.
|
||||||
|
*
|
||||||
|
* Hash functions are widely used in multimedia, from error checking and
|
||||||
|
* concealment to internal regression testing. libavutil has efficient
|
||||||
|
* implementations of a variety of hash functions that may be useful for
|
||||||
|
* FFmpeg and other multimedia applications.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @defgroup lavu_hash_generic Generic Hashing API
|
||||||
|
* An abstraction layer for all hash functions supported by libavutil.
|
||||||
|
*
|
||||||
|
* If your application needs to support a wide range of different hash
|
||||||
|
* functions, then the Generic Hashing API is for you. It provides a generic,
|
||||||
|
* reusable API for @ref lavu_hash "all hash functions" implemented in libavutil.
|
||||||
|
* If you just need to use one particular hash function, use the @ref lavu_hash
|
||||||
|
* "individual hash" directly.
|
||||||
|
*
|
||||||
|
* @section Sample Code
|
||||||
|
*
|
||||||
|
* A basic template for using the Generic Hashing API follows:
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* struct AVHashContext *ctx = NULL;
|
||||||
|
* const char *hash_name = NULL;
|
||||||
|
* uint8_t *output_buf = NULL;
|
||||||
|
*
|
||||||
|
* // Select from a string returned by av_hash_names()
|
||||||
|
* hash_name = ...;
|
||||||
|
*
|
||||||
|
* // Allocate a hash context
|
||||||
|
* ret = av_hash_alloc(&ctx, hash_name);
|
||||||
|
* if (ret < 0)
|
||||||
|
* return ret;
|
||||||
|
*
|
||||||
|
* // Initialize the hash context
|
||||||
|
* av_hash_init(ctx);
|
||||||
|
*
|
||||||
|
* // Update the hash context with data
|
||||||
|
* while (data_left) {
|
||||||
|
* av_hash_update(ctx, data, size);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Now we have no more data, so it is time to finalize the hash and get the
|
||||||
|
* // output. But we need to first allocate an output buffer. Note that you can
|
||||||
|
* // use any memory allocation function, including malloc(), not just
|
||||||
|
* // av_malloc().
|
||||||
|
* output_buf = av_malloc(av_hash_get_size(ctx));
|
||||||
|
* if (!output_buf)
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
*
|
||||||
|
* // Finalize the hash context.
|
||||||
|
* // You can use any of the av_hash_final*() functions provided, for other
|
||||||
|
* // output formats. If you do so, be sure to adjust the memory allocation
|
||||||
|
* // above. See the function documentation below for the exact amount of extra
|
||||||
|
* // memory needed.
|
||||||
|
* av_hash_final(ctx, output_buffer);
|
||||||
|
*
|
||||||
|
* // Free the context
|
||||||
|
* av_hash_freep(&ctx);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @section Hash Function-Specific Information
|
||||||
|
* If the CRC32 hash is selected, the #AV_CRC_32_IEEE polynomial will be
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* If the Murmur3 hash is selected, the default seed will be used. See @ref
|
||||||
|
* lavu_murmur3_seedinfo "Murmur3" for more information.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example ffhash.c
|
||||||
|
* This example is a simple command line application that takes one or more
|
||||||
|
* arguments. It demonstrates a typical use of the hashing API with allocation,
|
||||||
|
* initialization, updating, and finalizing.
|
||||||
|
*/
|
||||||
|
|
||||||
struct AVHashContext;
|
struct AVHashContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a hash context for the algorithm specified by name.
|
* Allocate a hash context for the algorithm specified by name.
|
||||||
*
|
*
|
||||||
* @return >= 0 for success, a negative error code for failure
|
* @return >= 0 for success, a negative error code for failure
|
||||||
* @note The context is not initialized, you must call av_hash_init().
|
*
|
||||||
|
* @note The context is not initialized after a call to this function; you must
|
||||||
|
* call av_hash_init() to do so.
|
||||||
*/
|
*/
|
||||||
int av_hash_alloc(struct AVHashContext **ctx, const char *name);
|
int av_hash_alloc(struct AVHashContext **ctx, const char *name);
|
||||||
|
|
||||||
|
@ -38,8 +128,8 @@ int av_hash_alloc(struct AVHashContext **ctx, const char *name);
|
||||||
*
|
*
|
||||||
* This function can be used to enumerate the algorithms.
|
* This function can be used to enumerate the algorithms.
|
||||||
*
|
*
|
||||||
* @param i index of the hash algorithm, starting from 0
|
* @param[in] i Index of the hash algorithm, starting from 0
|
||||||
* @return a pointer to a static string or NULL if i is out of range
|
* @return Pointer to a static string or `NULL` if `i` is out of range
|
||||||
*/
|
*/
|
||||||
const char *av_hash_names(int i);
|
const char *av_hash_names(int i);
|
||||||
|
|
||||||
|
@ -49,64 +139,125 @@ const char *av_hash_names(int i);
|
||||||
const char *av_hash_get_name(const struct AVHashContext *ctx);
|
const char *av_hash_get_name(const struct AVHashContext *ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum value that av_hash_get_size will currently return.
|
* Maximum value that av_hash_get_size() will currently return.
|
||||||
*
|
*
|
||||||
* You can use this if you absolutely want or need to use static allocation
|
* You can use this if you absolutely want or need to use static allocation for
|
||||||
* and are fine with not supporting hashes newly added to libavutil without
|
* the output buffer and are fine with not supporting hashes newly added to
|
||||||
* recompilation.
|
* libavutil without recompilation.
|
||||||
* Note that you still need to check against av_hash_get_size, adding new hashes
|
*
|
||||||
* with larger sizes will not be considered an ABI change and should not cause
|
* @warning
|
||||||
* your code to overflow a buffer.
|
* Adding new hashes with larger sizes, and increasing the macro while doing
|
||||||
|
* so, will not be considered an ABI change. To prevent your code from
|
||||||
|
* overflowing a buffer, either dynamically allocate the output buffer with
|
||||||
|
* av_hash_get_size(), or limit your use of the Hashing API to hashes that are
|
||||||
|
* already in FFmpeg during the time of compilation.
|
||||||
*/
|
*/
|
||||||
#define AV_HASH_MAX_SIZE 64
|
#define AV_HASH_MAX_SIZE 64
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the resulting hash value in bytes.
|
* Get the size of the resulting hash value in bytes.
|
||||||
*
|
*
|
||||||
* The pointer passed to av_hash_final have space for at least this many bytes.
|
* The maximum value this function will currently return is available as macro
|
||||||
|
* #AV_HASH_MAX_SIZE.
|
||||||
|
*
|
||||||
|
* @param[in] ctx Hash context
|
||||||
|
* @return Size of the hash value in bytes
|
||||||
*/
|
*/
|
||||||
int av_hash_get_size(const struct AVHashContext *ctx);
|
int av_hash_get_size(const struct AVHashContext *ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize or reset a hash context.
|
* Initialize or reset a hash context.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Hash context
|
||||||
*/
|
*/
|
||||||
void av_hash_init(struct AVHashContext *ctx);
|
void av_hash_init(struct AVHashContext *ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a hash context with additional data.
|
* Update a hash context with additional data.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Hash context
|
||||||
|
* @param[in] src Data to be added to the hash context
|
||||||
|
* @param[in] len Size of the additional data
|
||||||
*/
|
*/
|
||||||
void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len);
|
void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a hash context and compute the actual hash value.
|
* Finalize a hash context and compute the actual hash value.
|
||||||
|
*
|
||||||
|
* The minimum size of `dst` buffer is given by av_hash_get_size() or
|
||||||
|
* #AV_HASH_MAX_SIZE. The use of the latter macro is discouraged.
|
||||||
|
*
|
||||||
|
* It is not safe to update or finalize a hash context again, if it has already
|
||||||
|
* been finalized.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Hash context
|
||||||
|
* @param[out] dst Where the final hash value will be stored
|
||||||
|
*
|
||||||
|
* @see av_hash_final_bin() provides an alternative API
|
||||||
*/
|
*/
|
||||||
void av_hash_final(struct AVHashContext *ctx, uint8_t *dst);
|
void av_hash_final(struct AVHashContext *ctx, uint8_t *dst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a hash context and compute the actual hash value.
|
* Finalize a hash context and store the actual hash value in a buffer.
|
||||||
* If size is smaller than the hash size, the hash is truncated;
|
*
|
||||||
* if size is larger, the buffer is padded with 0.
|
* It is not safe to update or finalize a hash context again, if it has already
|
||||||
|
* been finalized.
|
||||||
|
*
|
||||||
|
* If `size` is smaller than the hash size (given by av_hash_get_size()), the
|
||||||
|
* hash is truncated; if size is larger, the buffer is padded with 0.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Hash context
|
||||||
|
* @param[out] dst Where the final hash value will be stored
|
||||||
|
* @param[in] size Number of bytes to write to `dst`
|
||||||
*/
|
*/
|
||||||
void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size);
|
void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a hash context and compute the actual hash value as a hex string.
|
* Finalize a hash context and store the hexadecimal representation of the
|
||||||
|
* actual hash value as a string.
|
||||||
|
*
|
||||||
|
* It is not safe to update or finalize a hash context again, if it has already
|
||||||
|
* been finalized.
|
||||||
|
*
|
||||||
* The string is always 0-terminated.
|
* The string is always 0-terminated.
|
||||||
* If size is smaller than 2 * hash_size + 1, the hex string is truncated.
|
*
|
||||||
|
* If `size` is smaller than `2 * hash_size + 1`, where `hash_size` is the
|
||||||
|
* value returned by av_hash_get_size(), the string will be truncated.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Hash context
|
||||||
|
* @param[out] dst Where the string will be stored
|
||||||
|
* @param[in] size Maximum number of bytes to write to `dst`
|
||||||
*/
|
*/
|
||||||
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size);
|
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a hash context and compute the actual hash value as a base64 string.
|
* Finalize a hash context and store the Base64 representation of the
|
||||||
|
* actual hash value as a string.
|
||||||
|
*
|
||||||
|
* It is not safe to update or finalize a hash context again, if it has already
|
||||||
|
* been finalized.
|
||||||
|
*
|
||||||
* The string is always 0-terminated.
|
* The string is always 0-terminated.
|
||||||
* If size is smaller than AV_BASE64_SIZE(hash_size), the base64 string is
|
*
|
||||||
* truncated.
|
* If `size` is smaller than AV_BASE64_SIZE(hash_size), where `hash_size` is
|
||||||
|
* the value returned by av_hash_get_size(), the string will be truncated.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Hash context
|
||||||
|
* @param[out] dst Where the final hash value will be stored
|
||||||
|
* @param[in] size Maximum number of bytes to write to `dst`
|
||||||
*/
|
*/
|
||||||
void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size);
|
void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free hash context.
|
* Free hash context and set hash context pointer to `NULL`.
|
||||||
|
*
|
||||||
|
* @param[in,out] ctx Pointer to hash context
|
||||||
*/
|
*/
|
||||||
void av_hash_freep(struct AVHashContext **ctx);
|
void av_hash_freep(struct AVHashContext **ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
#endif /* AVUTIL_HASH_H */
|
#endif /* AVUTIL_HASH_H */
|
||||||
|
|
|
@ -29,6 +29,7 @@ enum AVHWDeviceType {
|
||||||
AV_HWDEVICE_TYPE_CUDA,
|
AV_HWDEVICE_TYPE_CUDA,
|
||||||
AV_HWDEVICE_TYPE_VAAPI,
|
AV_HWDEVICE_TYPE_VAAPI,
|
||||||
AV_HWDEVICE_TYPE_DXVA2,
|
AV_HWDEVICE_TYPE_DXVA2,
|
||||||
|
AV_HWDEVICE_TYPE_QSV,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
|
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* 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_HWCONTEXT_QSV_H
|
||||||
|
#define AVUTIL_HWCONTEXT_QSV_H
|
||||||
|
|
||||||
|
#include <mfx/mfxvideo.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* An API-specific header for AV_HWDEVICE_TYPE_QSV.
|
||||||
|
*
|
||||||
|
* This API does not support dynamic frame pools. AVHWFramesContext.pool must
|
||||||
|
* contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct is allocated as AVHWDeviceContext.hwctx
|
||||||
|
*/
|
||||||
|
typedef struct AVQSVDeviceContext {
|
||||||
|
mfxSession session;
|
||||||
|
} AVQSVDeviceContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct is allocated as AVHWFramesContext.hwctx
|
||||||
|
*/
|
||||||
|
typedef struct AVQSVFramesContext {
|
||||||
|
mfxFrameSurface1 *surfaces;
|
||||||
|
int nb_surfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A combination of MFX_MEMTYPE_* describing the frame pool.
|
||||||
|
*/
|
||||||
|
int frame_type;
|
||||||
|
} AVQSVFramesContext;
|
||||||
|
|
||||||
|
#endif /* AVUTIL_HWCONTEXT_QSV_H */
|
||||||
|
|
|
@ -44,7 +44,7 @@ typedef enum {
|
||||||
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
|
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
|
||||||
AV_CLASS_CATEGORY_DEVICE_OUTPUT,
|
AV_CLASS_CATEGORY_DEVICE_OUTPUT,
|
||||||
AV_CLASS_CATEGORY_DEVICE_INPUT,
|
AV_CLASS_CATEGORY_DEVICE_INPUT,
|
||||||
AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
|
AV_CLASS_CATEGORY_NB ///< not part of ABI/API
|
||||||
}AVClassCategory;
|
}AVClassCategory;
|
||||||
|
|
||||||
#define AV_IS_INPUT_DEVICE(category) \
|
#define AV_IS_INPUT_DEVICE(category) \
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @addtogroup lavu_math
|
||||||
|
* Mathematical utilities for working with timestamp and time base.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_MATHEMATICS_H
|
#ifndef AVUTIL_MATHEMATICS_H
|
||||||
#define AVUTIL_MATHEMATICS_H
|
#define AVUTIL_MATHEMATICS_H
|
||||||
|
|
||||||
|
@ -63,84 +69,155 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup lavu_math
|
* @addtogroup lavu_math
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounding methods.
|
||||||
|
*/
|
||||||
enum AVRounding {
|
enum AVRounding {
|
||||||
AV_ROUND_ZERO = 0, ///< Round toward zero.
|
AV_ROUND_ZERO = 0, ///< Round toward zero.
|
||||||
AV_ROUND_INF = 1, ///< Round away from zero.
|
AV_ROUND_INF = 1, ///< Round away from zero.
|
||||||
AV_ROUND_DOWN = 2, ///< Round toward -infinity.
|
AV_ROUND_DOWN = 2, ///< Round toward -infinity.
|
||||||
AV_ROUND_UP = 3, ///< Round toward +infinity.
|
AV_ROUND_UP = 3, ///< Round toward +infinity.
|
||||||
AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
|
AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
|
||||||
AV_ROUND_PASS_MINMAX = 8192, ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE
|
/**
|
||||||
|
* Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
|
||||||
|
* unchanged, avoiding special cases for #AV_NOPTS_VALUE.
|
||||||
|
*
|
||||||
|
* Unlike other values of the enumeration AVRounding, this value is a
|
||||||
|
* bitmask that must be used in conjunction with another value of the
|
||||||
|
* enumeration through a bitwise OR, in order to set behavior for normal
|
||||||
|
* cases.
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
|
||||||
|
* // Rescaling 3:
|
||||||
|
* // Calculating 3 * 1 / 2
|
||||||
|
* // 3 / 2 is rounded up to 2
|
||||||
|
* // => 2
|
||||||
|
*
|
||||||
|
* av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
|
||||||
|
* // Rescaling AV_NOPTS_VALUE:
|
||||||
|
* // AV_NOPTS_VALUE == INT64_MIN
|
||||||
|
* // AV_NOPTS_VALUE is passed through
|
||||||
|
* // => AV_NOPTS_VALUE
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
AV_ROUND_PASS_MINMAX = 8192,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the greatest common divisor of a and b.
|
* Compute the greatest common divisor of two integer operands.
|
||||||
*
|
*
|
||||||
* @return gcd of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
|
* @param a,b Operands
|
||||||
|
* @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
|
||||||
* if a == 0 and b == 0, returns 0.
|
* if a == 0 and b == 0, returns 0.
|
||||||
*/
|
*/
|
||||||
int64_t av_const av_gcd(int64_t a, int64_t b);
|
int64_t av_const av_gcd(int64_t a, int64_t b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rescale a 64-bit integer with rounding to nearest.
|
* Rescale a 64-bit integer with rounding to nearest.
|
||||||
* A simple a*b/c isn't possible as it can overflow.
|
*
|
||||||
|
* The operation is mathematically equivalent to `a * b / c`, but writing that
|
||||||
|
* directly can overflow.
|
||||||
|
*
|
||||||
|
* This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
|
||||||
|
*
|
||||||
|
* @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
|
||||||
*/
|
*/
|
||||||
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
|
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rescale a 64-bit integer with specified rounding.
|
* Rescale a 64-bit integer with specified rounding.
|
||||||
* A simple a*b/c isn't possible as it can overflow.
|
|
||||||
*
|
*
|
||||||
* @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is
|
* The operation is mathematically equivalent to `a * b / c`, but writing that
|
||||||
* INT64_MIN or INT64_MAX then a is passed through unchanged.
|
* directly can overflow, and does not support different rounding methods.
|
||||||
|
*
|
||||||
|
* @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
|
||||||
*/
|
*/
|
||||||
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
|
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rescale a 64-bit integer by 2 rational numbers.
|
* Rescale a 64-bit integer by 2 rational numbers.
|
||||||
|
*
|
||||||
|
* The operation is mathematically equivalent to `a * bq / cq`.
|
||||||
|
*
|
||||||
|
* This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
|
||||||
|
*
|
||||||
|
* @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
|
||||||
*/
|
*/
|
||||||
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
|
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rescale a 64-bit integer by 2 rational numbers with specified rounding.
|
* Rescale a 64-bit integer by 2 rational numbers with specified rounding.
|
||||||
*
|
*
|
||||||
* @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is
|
* The operation is mathematically equivalent to `a * bq / cq`.
|
||||||
* INT64_MIN or INT64_MAX then a is passed through unchanged.
|
*
|
||||||
|
* @see av_rescale(), av_rescale_rnd(), av_rescale_q()
|
||||||
*/
|
*/
|
||||||
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
|
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
|
||||||
enum AVRounding) av_const;
|
enum AVRounding rnd) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare 2 timestamps each in its own timebases.
|
* Compare two timestamps each in its own time base.
|
||||||
* The result of the function is undefined if one of the timestamps
|
*
|
||||||
* is outside the int64_t range when represented in the others timebase.
|
* @return One of the following values:
|
||||||
* @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
|
* - -1 if `ts_a` is before `ts_b`
|
||||||
|
* - 1 if `ts_a` is after `ts_b`
|
||||||
|
* - 0 if they represent the same position
|
||||||
|
*
|
||||||
|
* @warning
|
||||||
|
* The result of the function is undefined if one of the timestamps is outside
|
||||||
|
* the `int64_t` range when represented in the other's timebase.
|
||||||
*/
|
*/
|
||||||
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
|
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare 2 integers modulo mod.
|
* Compare the remainders of two integer operands divided by a common divisor.
|
||||||
* That is we compare integers a and b for which only the least
|
|
||||||
* significant log2(mod) bits are known.
|
|
||||||
*
|
*
|
||||||
* @param mod must be a power of 2
|
* In other words, compare the least significant `log2(mod)` bits of integers
|
||||||
* @return a negative value if a is smaller than b
|
* `a` and `b`.
|
||||||
* a positive value if a is greater than b
|
*
|
||||||
* 0 if a equals b
|
* @code{.c}
|
||||||
|
* av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2)
|
||||||
|
* av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param a,b Operands
|
||||||
|
* @param mod Divisor; must be a power of 2
|
||||||
|
* @return
|
||||||
|
* - a negative value if `a % mod < b % mod`
|
||||||
|
* - a positive value if `a % mod > b % mod`
|
||||||
|
* - zero if `a % mod == b % mod`
|
||||||
*/
|
*/
|
||||||
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
|
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rescale a timestamp while preserving known durations.
|
* Rescale a timestamp while preserving known durations.
|
||||||
*
|
*
|
||||||
* @param in_ts Input timestamp
|
* This function is designed to be called per audio packet to scale the input
|
||||||
* @param in_tb Input timebase
|
* timestamp to a different time base. Compared to a simple av_rescale_q()
|
||||||
* @param fs_tb Duration and *last timebase
|
* call, this function is robust against possible inconsistent frame durations.
|
||||||
* @param duration duration till the next call
|
*
|
||||||
* @param out_tb Output timebase
|
* The `last` parameter is a state variable that must be preserved for all
|
||||||
|
* subsequent calls for the same stream. For the first call, `*last` should be
|
||||||
|
* initialized to #AV_NOPTS_VALUE.
|
||||||
|
*
|
||||||
|
* @param[in] in_tb Input time base
|
||||||
|
* @param[in] in_ts Input timestamp
|
||||||
|
* @param[in] fs_tb Duration time base; typically this is finer-grained
|
||||||
|
* (greater) than `in_tb` and `out_tb`
|
||||||
|
* @param[in] duration Duration till the next call to this function (i.e.
|
||||||
|
* duration of the current packet/frame)
|
||||||
|
* @param[in,out] last Pointer to a timestamp expressed in terms of
|
||||||
|
* `fs_tb`, acting as a state variable
|
||||||
|
* @param[in] out_tb Output timebase
|
||||||
|
* @return Timestamp expressed in terms of `out_tb`
|
||||||
|
*
|
||||||
|
* @note In the context of this function, "duration" is in term of samples, not
|
||||||
|
* seconds.
|
||||||
*/
|
*/
|
||||||
int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
|
int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
|
||||||
|
|
||||||
|
@ -150,10 +227,10 @@ int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int
|
||||||
* This function guarantees that when the same value is repeatly added that
|
* This function guarantees that when the same value is repeatly added that
|
||||||
* no accumulation of rounding errors occurs.
|
* no accumulation of rounding errors occurs.
|
||||||
*
|
*
|
||||||
* @param ts Input timestamp
|
* @param[in] ts Input timestamp
|
||||||
* @param ts_tb Input timestamp timebase
|
* @param[in] ts_tb Input timestamp time base
|
||||||
* @param inc value to add to ts
|
* @param[in] inc Value to be added
|
||||||
* @param inc_tb inc timebase
|
* @param[in] inc_tb Time base of `inc`
|
||||||
*/
|
*/
|
||||||
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
|
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_md5
|
||||||
|
* Public header for MD5 hash function implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_MD5_H
|
#ifndef AVUTIL_MD5_H
|
||||||
#define AVUTIL_MD5_H
|
#define AVUTIL_MD5_H
|
||||||
|
|
||||||
|
@ -28,7 +34,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_md5 MD5
|
* @defgroup lavu_md5 MD5
|
||||||
* @ingroup lavu_crypto
|
* @ingroup lavu_hash
|
||||||
|
* MD5 hash function implementation.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* memory handling functions
|
* @ingroup lavu_mem
|
||||||
|
* Memory handling functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_MEM_H
|
#ifndef AVUTIL_MEM_H
|
||||||
|
@ -35,9 +36,56 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup lavu_mem
|
* @addtogroup lavu_mem
|
||||||
|
* Utilities for manipulating memory.
|
||||||
|
*
|
||||||
|
* FFmpeg has several applications of memory that are not required of a typical
|
||||||
|
* program. For example, the computing-heavy components like video decoding and
|
||||||
|
* encoding can be sped up significantly through the use of aligned memory.
|
||||||
|
*
|
||||||
|
* However, for each of FFmpeg's applications of memory, there might not be a
|
||||||
|
* recognized or standardized API for that specific use. Memory alignment, for
|
||||||
|
* instance, varies wildly depending on operating systems, architectures, and
|
||||||
|
* compilers. Hence, this component of @ref libavutil is created to make
|
||||||
|
* dealing with memory consistently possible on all platforms.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @defgroup lavu_mem_macros Alignment Macros
|
||||||
|
* Helper macros for declaring aligned variables.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def DECLARE_ALIGNED(n,t,v)
|
||||||
|
* Declare a variable that is aligned in memory.
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
|
||||||
|
* DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
|
||||||
|
*
|
||||||
|
* // The default-alignment equivalent would be
|
||||||
|
* uint16_t aligned_int = 42;
|
||||||
|
* uint8_t aligned_array[128];
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param n Minimum alignment in bytes
|
||||||
|
* @param t Type of the variable (or array element)
|
||||||
|
* @param v Name of the variable
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def DECLARE_ASM_CONST(n,t,v)
|
||||||
|
* Declare a static constant aligned variable appropriate for use in inline
|
||||||
|
* assembly code.
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param n Minimum alignment in bytes
|
||||||
|
* @param t Type of the variable (or array element)
|
||||||
|
* @param v Name of the variable
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
|
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
|
||||||
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
|
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
|
||||||
|
@ -60,12 +108,47 @@
|
||||||
#define DECLARE_ASM_CONST(n,t,v) static const t v
|
#define DECLARE_ASM_CONST(n,t,v) static const t v
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup lavu_mem_attrs Function Attributes
|
||||||
|
* Function attributes applicable to memory handling functions.
|
||||||
|
*
|
||||||
|
* These function attributes can help compilers emit more useful warnings, or
|
||||||
|
* generate better code.
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def av_malloc_attrib
|
||||||
|
* Function attribute denoting a malloc-like function.
|
||||||
|
*
|
||||||
|
* @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251">Function attribute `malloc` in GCC's documentation</a>
|
||||||
|
*/
|
||||||
|
|
||||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||||
#define av_malloc_attrib __attribute__((__malloc__))
|
#define av_malloc_attrib __attribute__((__malloc__))
|
||||||
#else
|
#else
|
||||||
#define av_malloc_attrib
|
#define av_malloc_attrib
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def av_alloc_size(...)
|
||||||
|
* Function attribute used on a function that allocates memory, whose size is
|
||||||
|
* given by the specified parameter(s).
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* void *av_malloc(size_t size) av_alloc_size(1);
|
||||||
|
* void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param ... One or two parameter indexes, separated by a comma
|
||||||
|
*
|
||||||
|
* @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220">Function attribute `alloc_size` in GCC's documentation</a>
|
||||||
|
*/
|
||||||
|
|
||||||
#if AV_GCC_VERSION_AT_LEAST(4,3)
|
#if AV_GCC_VERSION_AT_LEAST(4,3)
|
||||||
#define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
|
#define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
|
||||||
#else
|
#else
|
||||||
|
@ -73,21 +156,51 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a block of size bytes with alignment suitable for all
|
* @}
|
||||||
* memory accesses (including vectors if available on the CPU).
|
*/
|
||||||
* @param size Size in bytes for the memory block to be allocated.
|
|
||||||
* @return Pointer to the allocated block, NULL if the block cannot
|
/**
|
||||||
* be allocated.
|
* @defgroup lavu_mem_funcs Heap Management
|
||||||
|
* Functions responsible for allocating, freeing, and copying memory.
|
||||||
|
*
|
||||||
|
* All memory allocation functions have a built-in upper limit of `INT_MAX`
|
||||||
|
* bytes. This may be changed with av_max_alloc(), although exercise extreme
|
||||||
|
* caution when doing so.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a memory block with alignment suitable for all memory accesses
|
||||||
|
* (including vectors if available on the CPU).
|
||||||
|
*
|
||||||
|
* @param size Size in bytes for the memory block to be allocated
|
||||||
|
* @return Pointer to the allocated block, or `NULL` if the block cannot
|
||||||
|
* be allocated
|
||||||
* @see av_mallocz()
|
* @see av_mallocz()
|
||||||
*/
|
*/
|
||||||
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
|
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a block of size * nmemb bytes with av_malloc().
|
* Allocate a memory block with alignment suitable for all memory accesses
|
||||||
* @param nmemb Number of elements
|
* (including vectors if available on the CPU) and zero all the bytes of the
|
||||||
* @param size Size of the single element
|
* block.
|
||||||
* @return Pointer to the allocated block, NULL if the block cannot
|
*
|
||||||
* be allocated.
|
* @param size Size in bytes for the memory block to be allocated
|
||||||
|
* @return Pointer to the allocated block, or `NULL` if it cannot be allocated
|
||||||
|
* @see av_malloc()
|
||||||
|
*/
|
||||||
|
void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a memory block for an array with av_malloc().
|
||||||
|
*
|
||||||
|
* The allocated memory will have size `size * nmemb` bytes.
|
||||||
|
*
|
||||||
|
* @param nmemb Number of element
|
||||||
|
* @param size Size of a single element
|
||||||
|
* @return Pointer to the allocated block, or `NULL` if the block cannot
|
||||||
|
* be allocated
|
||||||
* @see av_malloc()
|
* @see av_malloc()
|
||||||
*/
|
*/
|
||||||
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
|
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
|
||||||
|
@ -98,131 +211,15 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate or reallocate a block of memory.
|
* Allocate a memory block for an array with av_mallocz().
|
||||||
* If ptr is NULL and size > 0, allocate a new block. If
|
*
|
||||||
* size is zero, free the memory block pointed to by ptr.
|
* The allocated memory will have size `size * nmemb` bytes.
|
||||||
* @param ptr Pointer to a memory block already allocated with
|
*
|
||||||
* av_realloc() or NULL.
|
|
||||||
* @param size Size in bytes of the memory block to be allocated or
|
|
||||||
* reallocated.
|
|
||||||
* @return Pointer to a newly-reallocated block or NULL if the block
|
|
||||||
* cannot be reallocated or the function is used to free the memory block.
|
|
||||||
* @warning Pointers originating from the av_malloc() family of functions must
|
|
||||||
* not be passed to av_realloc(). The former can be implemented using
|
|
||||||
* memalign() (or other functions), and there is no guarantee that
|
|
||||||
* pointers from such functions can be passed to realloc() at all.
|
|
||||||
* The situation is undefined according to POSIX and may crash with
|
|
||||||
* some libc implementations.
|
|
||||||
* @see av_fast_realloc()
|
|
||||||
*/
|
|
||||||
void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate or reallocate a block of memory.
|
|
||||||
* This function does the same thing as av_realloc, except:
|
|
||||||
* - It takes two arguments and checks the result of the multiplication for
|
|
||||||
* integer overflow.
|
|
||||||
* - It frees the input block in case of failure, thus avoiding the memory
|
|
||||||
* leak with the classic "buf = realloc(buf); if (!buf) return -1;".
|
|
||||||
*/
|
|
||||||
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate or reallocate a block of memory.
|
|
||||||
* If *ptr is NULL and size > 0, allocate a new block. If
|
|
||||||
* size is zero, free the memory block pointed to by ptr.
|
|
||||||
* @param ptr Pointer to a pointer to a memory block already allocated
|
|
||||||
* with av_realloc(), or pointer to a pointer to NULL.
|
|
||||||
* The pointer is updated on success, or freed on failure.
|
|
||||||
* @param size Size in bytes for the memory block to be allocated or
|
|
||||||
* reallocated
|
|
||||||
* @return Zero on success, an AVERROR error code on failure.
|
|
||||||
* @warning Pointers originating from the av_malloc() family of functions must
|
|
||||||
* not be passed to av_reallocp(). The former can be implemented using
|
|
||||||
* memalign() (or other functions), and there is no guarantee that
|
|
||||||
* pointers from such functions can be passed to realloc() at all.
|
|
||||||
* The situation is undefined according to POSIX and may crash with
|
|
||||||
* some libc implementations.
|
|
||||||
*/
|
|
||||||
av_warn_unused_result
|
|
||||||
int av_reallocp(void *ptr, size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate or reallocate an array.
|
|
||||||
* If ptr is NULL and nmemb > 0, allocate a new block. If
|
|
||||||
* nmemb is zero, free the memory block pointed to by ptr.
|
|
||||||
* @param ptr Pointer to a memory block already allocated with
|
|
||||||
* av_realloc() or NULL.
|
|
||||||
* @param nmemb Number of elements
|
* @param nmemb Number of elements
|
||||||
* @param size Size of the single element
|
* @param size Size of the single element
|
||||||
* @return Pointer to a newly-reallocated block or NULL if the block
|
* @return Pointer to the allocated block, or `NULL` if the block cannot
|
||||||
* cannot be reallocated or the function is used to free the memory block.
|
* be allocated
|
||||||
* @warning Pointers originating from the av_malloc() family of functions must
|
*
|
||||||
* not be passed to av_realloc(). The former can be implemented using
|
|
||||||
* memalign() (or other functions), and there is no guarantee that
|
|
||||||
* pointers from such functions can be passed to realloc() at all.
|
|
||||||
* The situation is undefined according to POSIX and may crash with
|
|
||||||
* some libc implementations.
|
|
||||||
*/
|
|
||||||
av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate or reallocate an array through a pointer to a pointer.
|
|
||||||
* If *ptr is NULL and nmemb > 0, allocate a new block. If
|
|
||||||
* nmemb is zero, free the memory block pointed to by ptr.
|
|
||||||
* @param ptr Pointer to a pointer to a memory block already allocated
|
|
||||||
* with av_realloc(), or pointer to a pointer to NULL.
|
|
||||||
* The pointer is updated on success, or freed on failure.
|
|
||||||
* @param nmemb Number of elements
|
|
||||||
* @param size Size of the single element
|
|
||||||
* @return Zero on success, an AVERROR error code on failure.
|
|
||||||
* @warning Pointers originating from the av_malloc() family of functions must
|
|
||||||
* not be passed to av_realloc(). The former can be implemented using
|
|
||||||
* memalign() (or other functions), and there is no guarantee that
|
|
||||||
* pointers from such functions can be passed to realloc() at all.
|
|
||||||
* The situation is undefined according to POSIX and may crash with
|
|
||||||
* some libc implementations.
|
|
||||||
*/
|
|
||||||
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free a memory block which has been allocated with av_malloc(z)() or
|
|
||||||
* av_realloc().
|
|
||||||
* @param ptr Pointer to the memory block which should be freed.
|
|
||||||
* @note ptr = NULL is explicitly allowed.
|
|
||||||
* @note It is recommended that you use av_freep() instead.
|
|
||||||
* @see av_freep()
|
|
||||||
*/
|
|
||||||
void av_free(void *ptr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a block of size bytes with alignment suitable for all
|
|
||||||
* memory accesses (including vectors if available on the CPU) and
|
|
||||||
* zero all the bytes of the block.
|
|
||||||
* @param size Size in bytes for the memory block to be allocated.
|
|
||||||
* @return Pointer to the allocated block, NULL if it cannot be allocated.
|
|
||||||
* @see av_malloc()
|
|
||||||
*/
|
|
||||||
void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a block of nmemb * size bytes with alignment suitable for all
|
|
||||||
* memory accesses (including vectors if available on the CPU) and
|
|
||||||
* zero all the bytes of the block.
|
|
||||||
* The allocation will fail if nmemb * size is greater than or equal
|
|
||||||
* to INT_MAX.
|
|
||||||
* @param nmemb
|
|
||||||
* @param size
|
|
||||||
* @return Pointer to the allocated block, NULL if it cannot be allocated.
|
|
||||||
*/
|
|
||||||
void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a block of size * nmemb bytes with av_mallocz().
|
|
||||||
* @param nmemb Number of elements
|
|
||||||
* @param size Size of the single element
|
|
||||||
* @return Pointer to the allocated block, NULL if the block cannot
|
|
||||||
* be allocated.
|
|
||||||
* @see av_mallocz()
|
* @see av_mallocz()
|
||||||
* @see av_malloc_array()
|
* @see av_malloc_array()
|
||||||
*/
|
*/
|
||||||
|
@ -234,43 +231,358 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicate the string s.
|
* Non-inlined equivalent of av_mallocz_array().
|
||||||
* @param s string to be duplicated
|
*
|
||||||
* @return Pointer to a newly-allocated string containing a
|
* Created for symmetry with the calloc() C function.
|
||||||
* copy of s or NULL if the string cannot be allocated.
|
|
||||||
*/
|
*/
|
||||||
char *av_strdup(const char *s) av_malloc_attrib;
|
void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicate a substring of the string s.
|
* Allocate, reallocate, or free a block of memory.
|
||||||
* @param s string to be duplicated
|
*
|
||||||
* @param len the maximum length of the resulting string (not counting the
|
* If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
|
||||||
* terminating byte).
|
* zero, free the memory block pointed to by `ptr`. Otherwise, expand or
|
||||||
* @return Pointer to a newly-allocated string containing a
|
* shrink that block of memory according to `size`.
|
||||||
* copy of s or NULL if the string cannot be allocated.
|
*
|
||||||
|
* @param ptr Pointer to a memory block already allocated with
|
||||||
|
* av_realloc() or `NULL`
|
||||||
|
* @param size Size in bytes of the memory block to be allocated or
|
||||||
|
* reallocated
|
||||||
|
*
|
||||||
|
* @return Pointer to a newly-reallocated block or `NULL` if the block
|
||||||
|
* cannot be reallocated or the function is used to free the memory block
|
||||||
|
*
|
||||||
|
* @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
|
||||||
|
* correctly aligned.
|
||||||
|
* @see av_fast_realloc()
|
||||||
|
* @see av_reallocp()
|
||||||
*/
|
*/
|
||||||
char *av_strndup(const char *s, size_t len) av_malloc_attrib;
|
void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicate the buffer p.
|
* Allocate, reallocate, or free a block of memory through a pointer to a
|
||||||
* @param p buffer to be duplicated
|
* pointer.
|
||||||
* @return Pointer to a newly allocated buffer containing a
|
*
|
||||||
* copy of p or NULL if the buffer cannot be allocated.
|
* If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
|
||||||
|
* zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
|
||||||
|
* shrink that block of memory according to `size`.
|
||||||
|
*
|
||||||
|
* @param[in,out] ptr Pointer to a pointer to a memory block already allocated
|
||||||
|
* with av_realloc(), or a pointer to `NULL`. The pointer
|
||||||
|
* is updated on success, or freed on failure.
|
||||||
|
* @param[in] size Size in bytes for the memory block to be allocated or
|
||||||
|
* reallocated
|
||||||
|
*
|
||||||
|
* @return Zero on success, an AVERROR error code on failure
|
||||||
|
*
|
||||||
|
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||||
|
* correctly aligned.
|
||||||
*/
|
*/
|
||||||
void *av_memdup(const void *p, size_t size);
|
av_warn_unused_result
|
||||||
|
int av_reallocp(void *ptr, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free a memory block which has been allocated with av_malloc(z)() or
|
* Allocate, reallocate, or free a block of memory.
|
||||||
* av_realloc() and set the pointer pointing to it to NULL.
|
*
|
||||||
* @param ptr Pointer to the pointer to the memory block which should
|
* This function does the same thing as av_realloc(), except:
|
||||||
* be freed.
|
* - It takes two size arguments and allocates `nelem * elsize` bytes,
|
||||||
* @note passing a pointer to a NULL pointer is safe and leads to no action.
|
* after checking the result of the multiplication for integer overflow.
|
||||||
|
* - It frees the input block in case of failure, thus avoiding the memory
|
||||||
|
* leak with the classic
|
||||||
|
* @code{.c}
|
||||||
|
* buf = realloc(buf);
|
||||||
|
* if (!buf)
|
||||||
|
* return -1;
|
||||||
|
* @endcode
|
||||||
|
* pattern.
|
||||||
|
*/
|
||||||
|
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate, reallocate, or free an array.
|
||||||
|
*
|
||||||
|
* If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
|
||||||
|
* `nmemb` is zero, free the memory block pointed to by `ptr`.
|
||||||
|
*
|
||||||
|
* @param ptr Pointer to a memory block already allocated with
|
||||||
|
* av_realloc() or `NULL`
|
||||||
|
* @param nmemb Number of elements in the array
|
||||||
|
* @param size Size of the single element of the array
|
||||||
|
*
|
||||||
|
* @return Pointer to a newly-reallocated block or NULL if the block
|
||||||
|
* cannot be reallocated or the function is used to free the memory block
|
||||||
|
*
|
||||||
|
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||||
|
* correctly aligned.
|
||||||
|
* @see av_reallocp_array()
|
||||||
|
*/
|
||||||
|
av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate, reallocate, or free an array through a pointer to a pointer.
|
||||||
|
*
|
||||||
|
* If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
|
||||||
|
* zero, free the memory block pointed to by `*ptr`.
|
||||||
|
*
|
||||||
|
* @param[in,out] ptr Pointer to a pointer to a memory block already
|
||||||
|
* allocated with av_realloc(), or a pointer to `NULL`.
|
||||||
|
* The pointer is updated on success, or freed on failure.
|
||||||
|
* @param[in] nmemb Number of elements
|
||||||
|
* @param[in] size Size of the single element
|
||||||
|
*
|
||||||
|
* @return Zero on success, an AVERROR error code on failure
|
||||||
|
*
|
||||||
|
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||||
|
* correctly aligned.
|
||||||
|
*/
|
||||||
|
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reallocate the given buffer if it is not large enough, otherwise do nothing.
|
||||||
|
*
|
||||||
|
* If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
|
||||||
|
*
|
||||||
|
* If the given buffer is not large enough, and reallocation fails, `NULL` is
|
||||||
|
* returned and `*size` is set to 0, but the original buffer is not changed or
|
||||||
|
* freed.
|
||||||
|
*
|
||||||
|
* A typical use pattern follows:
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* uint8_t *buf = ...;
|
||||||
|
* uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed);
|
||||||
|
* if (!new_buf) {
|
||||||
|
* // Allocation failed; clean up original buffer
|
||||||
|
* av_freep(&buf);
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param[in,out] ptr Already allocated buffer, or `NULL`
|
||||||
|
* @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
|
||||||
|
* changed to `min_size` in case of success or 0 in
|
||||||
|
* case of failure
|
||||||
|
* @param[in] min_size New size of buffer `ptr`
|
||||||
|
* @return `ptr` if the buffer is large enough, a pointer to newly reallocated
|
||||||
|
* buffer if the buffer was not large enough, or `NULL` in case of
|
||||||
|
* error
|
||||||
|
* @see av_realloc()
|
||||||
|
* @see av_fast_malloc()
|
||||||
|
*/
|
||||||
|
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a buffer, reusing the given one if large enough.
|
||||||
|
*
|
||||||
|
* Contrary to av_fast_realloc(), the current buffer contents might not be
|
||||||
|
* preserved and on error the old buffer is freed, thus no special handling to
|
||||||
|
* avoid memleaks is necessary.
|
||||||
|
*
|
||||||
|
* `*ptr` is allowed to be `NULL`, in which case allocation always happens if
|
||||||
|
* `size_needed` is greater than 0.
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* uint8_t *buf = ...;
|
||||||
|
* av_fast_malloc(&buf, ¤t_size, size_needed);
|
||||||
|
* if (!buf) {
|
||||||
|
* // Allocation failed; buf already freed
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
|
||||||
|
* `*ptr` will be overwritten with pointer to new
|
||||||
|
* buffer on success or `NULL` on failure
|
||||||
|
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
|
||||||
|
* changed to `min_size` in case of success or 0 in
|
||||||
|
* case of failure
|
||||||
|
* @param[in] min_size New size of buffer `*ptr`
|
||||||
|
* @see av_realloc()
|
||||||
|
* @see av_fast_mallocz()
|
||||||
|
*/
|
||||||
|
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate and clear a buffer, reusing the given one if large enough.
|
||||||
|
*
|
||||||
|
* Like av_fast_malloc(), but all newly allocated space is initially cleared.
|
||||||
|
* Reused buffer is not cleared.
|
||||||
|
*
|
||||||
|
* `*ptr` is allowed to be `NULL`, in which case allocation always happens if
|
||||||
|
* `size_needed` is greater than 0.
|
||||||
|
*
|
||||||
|
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
|
||||||
|
* `*ptr` will be overwritten with pointer to new
|
||||||
|
* buffer on success or `NULL` on failure
|
||||||
|
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
|
||||||
|
* changed to `min_size` in case of success or 0 in
|
||||||
|
* case of failure
|
||||||
|
* @param[in] min_size New size of buffer `*ptr`
|
||||||
|
* @see av_fast_malloc()
|
||||||
|
*/
|
||||||
|
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free a memory block which has been allocated with a function of av_malloc()
|
||||||
|
* or av_realloc() family.
|
||||||
|
*
|
||||||
|
* @param ptr Pointer to the memory block which should be freed.
|
||||||
|
*
|
||||||
|
* @note `ptr = NULL` is explicitly allowed.
|
||||||
|
* @note It is recommended that you use av_freep() instead, to prevent leaving
|
||||||
|
* behind dangling pointers.
|
||||||
|
* @see av_freep()
|
||||||
|
*/
|
||||||
|
void av_free(void *ptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free a memory block which has been allocated with a function of av_malloc()
|
||||||
|
* or av_realloc() family, and set the pointer pointing to it to `NULL`.
|
||||||
|
*
|
||||||
|
* @code{.c}
|
||||||
|
* uint8_t *buf = av_malloc(16);
|
||||||
|
* av_free(buf);
|
||||||
|
* // buf now contains a dangling pointer to freed memory, and accidental
|
||||||
|
* // dereference of buf will result in a use-after-free, which may be a
|
||||||
|
* // security risk.
|
||||||
|
*
|
||||||
|
* uint8_t *buf = av_malloc(16);
|
||||||
|
* av_freep(&buf);
|
||||||
|
* // buf is now NULL, and accidental dereference will only result in a
|
||||||
|
* // NULL-pointer dereference.
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @param ptr Pointer to the pointer to the memory block which should be freed
|
||||||
|
* @note `*ptr = NULL` is safe and leads to no action.
|
||||||
* @see av_free()
|
* @see av_free()
|
||||||
*/
|
*/
|
||||||
void av_freep(void *ptr);
|
void av_freep(void *ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an element to a dynamic array.
|
* Duplicate a string.
|
||||||
|
*
|
||||||
|
* @param s String to be duplicated
|
||||||
|
* @return Pointer to a newly-allocated string containing a
|
||||||
|
* copy of `s` or `NULL` if the string cannot be allocated
|
||||||
|
* @see av_strndup()
|
||||||
|
*/
|
||||||
|
char *av_strdup(const char *s) av_malloc_attrib;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicate a substring of a string.
|
||||||
|
*
|
||||||
|
* @param s String to be duplicated
|
||||||
|
* @param len Maximum length of the resulting string (not counting the
|
||||||
|
* terminating byte)
|
||||||
|
* @return Pointer to a newly-allocated string containing a
|
||||||
|
* substring of `s` or `NULL` if the string cannot be allocated
|
||||||
|
*/
|
||||||
|
char *av_strndup(const char *s, size_t len) av_malloc_attrib;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicate a buffer with av_malloc().
|
||||||
|
*
|
||||||
|
* @param p Buffer to be duplicated
|
||||||
|
* @param size Size in bytes of the buffer copied
|
||||||
|
* @return Pointer to a newly allocated buffer containing a
|
||||||
|
* copy of `p` or `NULL` if the buffer cannot be allocated
|
||||||
|
*/
|
||||||
|
void *av_memdup(const void *p, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overlapping memcpy() implementation.
|
||||||
|
*
|
||||||
|
* @param dst Destination buffer
|
||||||
|
* @param back Number of bytes back to start copying (i.e. the initial size of
|
||||||
|
* the overlapping window); must be > 0
|
||||||
|
* @param cnt Number of bytes to copy; must be >= 0
|
||||||
|
*
|
||||||
|
* @note `cnt > back` is valid, this will copy the bytes we just copied,
|
||||||
|
* thus creating a repeating pattern with a period length of `back`.
|
||||||
|
*/
|
||||||
|
void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup lavu_mem_dynarray Dynamic Array
|
||||||
|
*
|
||||||
|
* Utilities to make an array grow when needed.
|
||||||
|
*
|
||||||
|
* Sometimes, the programmer would want to have an array that can grow when
|
||||||
|
* needed. The libavutil dynamic array utilities fill that need.
|
||||||
|
*
|
||||||
|
* libavutil supports two systems of appending elements onto a dynamically
|
||||||
|
* allocated array, the first one storing the pointer to the value in the
|
||||||
|
* array, and the second storing the value directly. In both systems, the
|
||||||
|
* caller is responsible for maintaining a variable containing the length of
|
||||||
|
* the array, as well as freeing of the array after use.
|
||||||
|
*
|
||||||
|
* The first system stores pointers to values in a block of dynamically
|
||||||
|
* allocated memory. Since only pointers are stored, the function does not need
|
||||||
|
* to know the size of the type. Both av_dynarray_add() and
|
||||||
|
* av_dynarray_add_nofree() implement this system.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* type **array = NULL; //< an array of pointers to values
|
||||||
|
* int nb = 0; //< a variable to keep track of the length of the array
|
||||||
|
*
|
||||||
|
* type to_be_added = ...;
|
||||||
|
* type to_be_added2 = ...;
|
||||||
|
*
|
||||||
|
* av_dynarray_add(&array, &nb, &to_be_added);
|
||||||
|
* if (nb == 0)
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
*
|
||||||
|
* av_dynarray_add(&array, &nb, &to_be_added2);
|
||||||
|
* if (nb == 0)
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
*
|
||||||
|
* // Now:
|
||||||
|
* // nb == 2
|
||||||
|
* // &to_be_added == array[0]
|
||||||
|
* // &to_be_added2 == array[1]
|
||||||
|
*
|
||||||
|
* av_freep(&array);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* The second system stores the value directly in a block of memory. As a
|
||||||
|
* result, the function has to know the size of the type. av_dynarray2_add()
|
||||||
|
* implements this mechanism.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* type *array = NULL; //< an array of values
|
||||||
|
* int nb = 0; //< a variable to keep track of the length of the array
|
||||||
|
*
|
||||||
|
* type to_be_added = ...;
|
||||||
|
* type to_be_added2 = ...;
|
||||||
|
*
|
||||||
|
* type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
|
||||||
|
* if (!addr)
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
* memcpy(addr, &to_be_added, sizeof(to_be_added));
|
||||||
|
*
|
||||||
|
* // Shortcut of the above.
|
||||||
|
* type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
|
||||||
|
* (const void *)&to_be_added2);
|
||||||
|
* if (!addr)
|
||||||
|
* return AVERROR(ENOMEM);
|
||||||
|
*
|
||||||
|
* // Now:
|
||||||
|
* // nb == 2
|
||||||
|
* // to_be_added == array[0]
|
||||||
|
* // to_be_added2 == array[1]
|
||||||
|
*
|
||||||
|
* av_freep(&array);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the pointer to an element to a dynamic array.
|
||||||
*
|
*
|
||||||
* The array to grow is supposed to be an array of pointers to
|
* The array to grow is supposed to be an array of pointers to
|
||||||
* structures, and the element to add must be a pointer to an already
|
* structures, and the element to add must be a pointer to an already
|
||||||
|
@ -280,14 +592,14 @@ void av_freep(void *ptr);
|
||||||
* Therefore, the amortized cost of adding an element is constant.
|
* Therefore, the amortized cost of adding an element is constant.
|
||||||
*
|
*
|
||||||
* In case of success, the pointer to the array is updated in order to
|
* In case of success, the pointer to the array is updated in order to
|
||||||
* point to the new grown array, and the number pointed to by nb_ptr
|
* point to the new grown array, and the number pointed to by `nb_ptr`
|
||||||
* is incremented.
|
* is incremented.
|
||||||
* In case of failure, the array is freed, *tab_ptr is set to NULL and
|
* In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
|
||||||
* *nb_ptr is set to 0.
|
* `*nb_ptr` is set to 0.
|
||||||
*
|
*
|
||||||
* @param tab_ptr pointer to the array to grow
|
* @param[in,out] tab_ptr Pointer to the array to grow
|
||||||
* @param nb_ptr pointer to the number of elements in the array
|
* @param[in,out] nb_ptr Pointer to the number of elements in the array
|
||||||
* @param elem element to add
|
* @param[in] elem Element to add
|
||||||
* @see av_dynarray_add_nofree(), av_dynarray2_add()
|
* @see av_dynarray_add_nofree(), av_dynarray2_add()
|
||||||
*/
|
*/
|
||||||
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
|
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
|
||||||
|
@ -299,48 +611,62 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
|
||||||
* but it doesn't free memory on fails. It returns error code
|
* but it doesn't free memory on fails. It returns error code
|
||||||
* instead and leave current buffer untouched.
|
* instead and leave current buffer untouched.
|
||||||
*
|
*
|
||||||
* @param tab_ptr pointer to the array to grow
|
* @return >=0 on success, negative otherwise
|
||||||
* @param nb_ptr pointer to the number of elements in the array
|
|
||||||
* @param elem element to add
|
|
||||||
* @return >=0 on success, negative otherwise.
|
|
||||||
* @see av_dynarray_add(), av_dynarray2_add()
|
* @see av_dynarray_add(), av_dynarray2_add()
|
||||||
*/
|
*/
|
||||||
av_warn_unused_result
|
av_warn_unused_result
|
||||||
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
|
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an element of size elem_size to a dynamic array.
|
* Add an element of size `elem_size` to a dynamic array.
|
||||||
*
|
*
|
||||||
* The array is reallocated when its number of elements reaches powers of 2.
|
* The array is reallocated when its number of elements reaches powers of 2.
|
||||||
* Therefore, the amortized cost of adding an element is constant.
|
* Therefore, the amortized cost of adding an element is constant.
|
||||||
*
|
*
|
||||||
* In case of success, the pointer to the array is updated in order to
|
* In case of success, the pointer to the array is updated in order to
|
||||||
* point to the new grown array, and the number pointed to by nb_ptr
|
* point to the new grown array, and the number pointed to by `nb_ptr`
|
||||||
* is incremented.
|
* is incremented.
|
||||||
* In case of failure, the array is freed, *tab_ptr is set to NULL and
|
* In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
|
||||||
* *nb_ptr is set to 0.
|
* `*nb_ptr` is set to 0.
|
||||||
*
|
*
|
||||||
* @param tab_ptr pointer to the array to grow
|
* @param[in,out] tab_ptr Pointer to the array to grow
|
||||||
* @param nb_ptr pointer to the number of elements in the array
|
* @param[in,out] nb_ptr Pointer to the number of elements in the array
|
||||||
* @param elem_size size in bytes of the elements in the array
|
* @param[in] elem_size Size in bytes of an element in the array
|
||||||
* @param elem_data pointer to the data of the element to add. If NULL, the space of
|
* @param[in] elem_data Pointer to the data of the element to add. If
|
||||||
* the new added element is not filled.
|
* `NULL`, the space of the newly added element is
|
||||||
* @return pointer to the data of the element to copy in the new allocated space.
|
* allocated but left uninitialized.
|
||||||
* If NULL, the new allocated space is left uninitialized."
|
*
|
||||||
|
* @return Pointer to the data of the element to copy in the newly allocated
|
||||||
|
* space
|
||||||
* @see av_dynarray_add(), av_dynarray_add_nofree()
|
* @see av_dynarray_add(), av_dynarray_add_nofree()
|
||||||
*/
|
*/
|
||||||
void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
|
void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
|
||||||
const uint8_t *elem_data);
|
const uint8_t *elem_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply two size_t values checking for overflow.
|
* @}
|
||||||
* @return 0 if success, AVERROR(EINVAL) if overflow.
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup lavu_mem_misc Miscellaneous Functions
|
||||||
|
*
|
||||||
|
* Other functions related to memory allocation.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiply two `size_t` values checking for overflow.
|
||||||
|
*
|
||||||
|
* @param[in] a,b Operands of multiplication
|
||||||
|
* @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)
|
static inline int av_size_mult(size_t a, size_t b, size_t *r)
|
||||||
{
|
{
|
||||||
size_t t = a * b;
|
size_t t = a * b;
|
||||||
/* Hack inspired from glibc: only try the division if nelem and elsize
|
/* Hack inspired from glibc: don't try the division if nelem and elsize
|
||||||
* are both greater than sqrt(SIZE_MAX). */
|
* are both less than sqrt(SIZE_MAX). */
|
||||||
if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
|
if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
*r = t;
|
*r = t;
|
||||||
|
@ -348,58 +674,22 @@ static inline int av_size_mult(size_t a, size_t b, size_t *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the maximum size that may me allocated in one block.
|
* Set the maximum size that may be allocated in one block.
|
||||||
|
*
|
||||||
|
* The value specified with this function is effective for all libavutil's @ref
|
||||||
|
* lavu_mem_funcs "heap management functions."
|
||||||
|
*
|
||||||
|
* By default, the max value is defined as `INT_MAX`.
|
||||||
|
*
|
||||||
|
* @param max Value to be set as the new maximum size
|
||||||
|
*
|
||||||
|
* @warning Exercise extreme caution when using this function. Don't touch
|
||||||
|
* this if you do not understand the full consequence of doing so.
|
||||||
*/
|
*/
|
||||||
void av_max_alloc(size_t max);
|
void av_max_alloc(size_t max);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deliberately overlapping memcpy implementation
|
* @}
|
||||||
* @param dst destination buffer
|
|
||||||
* @param back how many bytes back we start (the initial size of the overlapping window), must be > 0
|
|
||||||
* @param cnt number of bytes to copy, must be >= 0
|
|
||||||
*
|
|
||||||
* cnt > back is valid, this will copy the bytes we just copied,
|
|
||||||
* thus creating a repeating pattern with a period length of back.
|
|
||||||
*/
|
|
||||||
void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reallocate the given block if it is not large enough, otherwise do nothing.
|
|
||||||
*
|
|
||||||
* @see av_realloc
|
|
||||||
*/
|
|
||||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a buffer, reusing the given one if large enough.
|
|
||||||
*
|
|
||||||
* Contrary to av_fast_realloc the current buffer contents might not be
|
|
||||||
* preserved and on error the old buffer is freed, thus no special
|
|
||||||
* handling to avoid memleaks is necessary.
|
|
||||||
*
|
|
||||||
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
|
||||||
* @param size size of the buffer *ptr points to
|
|
||||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
|
||||||
* *size 0 if an error occurred.
|
|
||||||
*/
|
|
||||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a buffer, reusing the given one if large enough.
|
|
||||||
*
|
|
||||||
* All newly allocated space is initially cleared
|
|
||||||
* Contrary to av_fast_realloc the current buffer contents might not be
|
|
||||||
* preserved and on error the old buffer is freed, thus no special
|
|
||||||
* handling to avoid memleaks is necessary.
|
|
||||||
*
|
|
||||||
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
|
||||||
* @param size size of the buffer *ptr points to
|
|
||||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
|
||||||
* *size 0 if an error occurred.
|
|
||||||
*/
|
|
||||||
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,97 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_murmur3
|
||||||
|
* Public header for MurmurHash3 hash function implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_MURMUR3_H
|
#ifndef AVUTIL_MURMUR3_H
|
||||||
#define AVUTIL_MURMUR3_H
|
#define AVUTIL_MURMUR3_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup lavu_murmur3 Murmur3
|
||||||
|
* @ingroup lavu_hash
|
||||||
|
* MurmurHash3 hash function implementation.
|
||||||
|
*
|
||||||
|
* MurmurHash3 is a non-cryptographic hash function, of which three
|
||||||
|
* incompatible versions were created by its inventor Austin Appleby:
|
||||||
|
*
|
||||||
|
* - 32-bit output
|
||||||
|
* - 128-bit output for 32-bit platforms
|
||||||
|
* - 128-bit output for 64-bit platforms
|
||||||
|
*
|
||||||
|
* FFmpeg only implements the last variant: 128-bit output designed for 64-bit
|
||||||
|
* platforms. Even though the hash function was designed for 64-bit platforms,
|
||||||
|
* the function in reality works on 32-bit systems too, only with reduced
|
||||||
|
* performance.
|
||||||
|
*
|
||||||
|
* @anchor lavu_murmur3_seedinfo
|
||||||
|
* By design, MurmurHash3 requires a seed to operate. In response to this,
|
||||||
|
* libavutil provides two functions for hash initiation, one that requires a
|
||||||
|
* seed (av_murmur3_init_seeded()) and one that uses a fixed arbitrary integer
|
||||||
|
* as the seed, and therefore does not (av_murmur3_init()).
|
||||||
|
*
|
||||||
|
* To make hashes comparable, you should provide the same seed for all calls to
|
||||||
|
* this hash function -- if you are supplying one yourself, that is.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate an AVMurMur3 hash context.
|
||||||
|
*
|
||||||
|
* @return Uninitialized hash context or `NULL` in case of error
|
||||||
|
*/
|
||||||
struct AVMurMur3 *av_murmur3_alloc(void);
|
struct AVMurMur3 *av_murmur3_alloc(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize or reinitialize an AVMurMur3 hash context with a seed.
|
||||||
|
*
|
||||||
|
* @param[out] c Hash context
|
||||||
|
* @param[in] seed Random seed
|
||||||
|
*
|
||||||
|
* @see av_murmur3_init()
|
||||||
|
* @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of
|
||||||
|
* seeds for MurmurHash3.
|
||||||
|
*/
|
||||||
void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed);
|
void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize or reinitialize an AVMurMur3 hash context.
|
||||||
|
*
|
||||||
|
* Equivalent to av_murmur3_init_seeded() with a built-in seed.
|
||||||
|
*
|
||||||
|
* @param[out] c Hash context
|
||||||
|
*
|
||||||
|
* @see av_murmur3_init_seeded()
|
||||||
|
* @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of
|
||||||
|
* seeds for MurmurHash3.
|
||||||
|
*/
|
||||||
void av_murmur3_init(struct AVMurMur3 *c);
|
void av_murmur3_init(struct AVMurMur3 *c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update hash context with new data.
|
||||||
|
*
|
||||||
|
* @param[out] c Hash context
|
||||||
|
* @param[in] src Input data to update hash with
|
||||||
|
* @param[in] len Number of bytes to read from `src`
|
||||||
|
*/
|
||||||
void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len);
|
void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finish hashing and output digest value.
|
||||||
|
*
|
||||||
|
* @param[in,out] c Hash context
|
||||||
|
* @param[out] dst Buffer where output digest value is stored
|
||||||
|
*/
|
||||||
void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]);
|
void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
#endif /* AVUTIL_MURMUR3_H */
|
#endif /* AVUTIL_MURMUR3_H */
|
||||||
|
|
|
@ -172,78 +172,6 @@ typedef struct AVPixFmtDescriptor {
|
||||||
*/
|
*/
|
||||||
#define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
|
#define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
|
||||||
|
|
||||||
/**
|
|
||||||
* Read a line from an image, and write the values of the
|
|
||||||
* pixel format component c to dst.
|
|
||||||
*
|
|
||||||
* @param data the array containing the pointers to the planes of the image
|
|
||||||
* @param linesize the array containing the linesizes of the image
|
|
||||||
* @param desc the pixel format descriptor for the image
|
|
||||||
* @param x the horizontal coordinate of the first pixel to read
|
|
||||||
* @param y the vertical coordinate of the first pixel to read
|
|
||||||
* @param w the width of the line to read, that is the number of
|
|
||||||
* values to write to dst
|
|
||||||
* @param read_pal_component if not zero and the format is a paletted
|
|
||||||
* format writes the values corresponding to the palette
|
|
||||||
* component c in data[1] to dst, rather than the palette indexes in
|
|
||||||
* data[0]. The behavior is undefined if the format is not paletted.
|
|
||||||
*/
|
|
||||||
void av_read_image_line(uint16_t *dst, const uint8_t *data[4],
|
|
||||||
const int linesize[4], const AVPixFmtDescriptor *desc,
|
|
||||||
int x, int y, int c, int w, int read_pal_component);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the values from src to the pixel format component c of an
|
|
||||||
* image line.
|
|
||||||
*
|
|
||||||
* @param src array containing the values to write
|
|
||||||
* @param data the array containing the pointers to the planes of the
|
|
||||||
* image to write into. It is supposed to be zeroed.
|
|
||||||
* @param linesize the array containing the linesizes of the image
|
|
||||||
* @param desc the pixel format descriptor for the image
|
|
||||||
* @param x the horizontal coordinate of the first pixel to write
|
|
||||||
* @param y the vertical coordinate of the first pixel to write
|
|
||||||
* @param w the width of the line to write, that is the number of
|
|
||||||
* values to write to the image line
|
|
||||||
*/
|
|
||||||
void av_write_image_line(const uint16_t *src, uint8_t *data[4],
|
|
||||||
const int linesize[4], const AVPixFmtDescriptor *desc,
|
|
||||||
int x, int y, int c, int w);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the pixel format corresponding to name.
|
|
||||||
*
|
|
||||||
* If there is no pixel format with name name, then looks for a
|
|
||||||
* pixel format with the name corresponding to the native endian
|
|
||||||
* format of name.
|
|
||||||
* For example in a little-endian system, first looks for "gray16",
|
|
||||||
* then for "gray16le".
|
|
||||||
*
|
|
||||||
* Finally if no pixel format has been found, returns AV_PIX_FMT_NONE.
|
|
||||||
*/
|
|
||||||
enum AVPixelFormat av_get_pix_fmt(const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the short name for a pixel format, NULL in case pix_fmt is
|
|
||||||
* unknown.
|
|
||||||
*
|
|
||||||
* @see av_get_pix_fmt(), av_get_pix_fmt_string()
|
|
||||||
*/
|
|
||||||
const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print in buf the string corresponding to the pixel format with
|
|
||||||
* number pix_fmt, or a header if pix_fmt is negative.
|
|
||||||
*
|
|
||||||
* @param buf the buffer where to write the string
|
|
||||||
* @param buf_size the size of buf
|
|
||||||
* @param pix_fmt the number of the pixel format to print the
|
|
||||||
* corresponding info string, or a negative value to print the
|
|
||||||
* corresponding header.
|
|
||||||
*/
|
|
||||||
char *av_get_pix_fmt_string(char *buf, int buf_size,
|
|
||||||
enum AVPixelFormat pix_fmt);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of bits per pixel used by the pixel format
|
* Return the number of bits per pixel used by the pixel format
|
||||||
* described by pixdesc. Note that this is not the same as the number
|
* described by pixdesc. Note that this is not the same as the number
|
||||||
|
@ -306,6 +234,103 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
|
||||||
*/
|
*/
|
||||||
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
|
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name for provided color range or NULL if unknown.
|
||||||
|
*/
|
||||||
|
const char *av_color_range_name(enum AVColorRange range);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name for provided color primaries or NULL if unknown.
|
||||||
|
*/
|
||||||
|
const char *av_color_primaries_name(enum AVColorPrimaries primaries);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name for provided color transfer or NULL if unknown.
|
||||||
|
*/
|
||||||
|
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name for provided color space or NULL if unknown.
|
||||||
|
*/
|
||||||
|
const char *av_color_space_name(enum AVColorSpace space);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name for provided chroma location or NULL if unknown.
|
||||||
|
*/
|
||||||
|
const char *av_chroma_location_name(enum AVChromaLocation location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the pixel format corresponding to name.
|
||||||
|
*
|
||||||
|
* If there is no pixel format with name name, then looks for a
|
||||||
|
* pixel format with the name corresponding to the native endian
|
||||||
|
* format of name.
|
||||||
|
* For example in a little-endian system, first looks for "gray16",
|
||||||
|
* then for "gray16le".
|
||||||
|
*
|
||||||
|
* Finally if no pixel format has been found, returns AV_PIX_FMT_NONE.
|
||||||
|
*/
|
||||||
|
enum AVPixelFormat av_get_pix_fmt(const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the short name for a pixel format, NULL in case pix_fmt is
|
||||||
|
* unknown.
|
||||||
|
*
|
||||||
|
* @see av_get_pix_fmt(), av_get_pix_fmt_string()
|
||||||
|
*/
|
||||||
|
const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print in buf the string corresponding to the pixel format with
|
||||||
|
* number pix_fmt, or a header if pix_fmt is negative.
|
||||||
|
*
|
||||||
|
* @param buf the buffer where to write the string
|
||||||
|
* @param buf_size the size of buf
|
||||||
|
* @param pix_fmt the number of the pixel format to print the
|
||||||
|
* corresponding info string, or a negative value to print the
|
||||||
|
* corresponding header.
|
||||||
|
*/
|
||||||
|
char *av_get_pix_fmt_string(char *buf, int buf_size,
|
||||||
|
enum AVPixelFormat pix_fmt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a line from an image, and write the values of the
|
||||||
|
* pixel format component c to dst.
|
||||||
|
*
|
||||||
|
* @param data the array containing the pointers to the planes of the image
|
||||||
|
* @param linesize the array containing the linesizes of the image
|
||||||
|
* @param desc the pixel format descriptor for the image
|
||||||
|
* @param x the horizontal coordinate of the first pixel to read
|
||||||
|
* @param y the vertical coordinate of the first pixel to read
|
||||||
|
* @param w the width of the line to read, that is the number of
|
||||||
|
* values to write to dst
|
||||||
|
* @param read_pal_component if not zero and the format is a paletted
|
||||||
|
* format writes the values corresponding to the palette
|
||||||
|
* component c in data[1] to dst, rather than the palette indexes in
|
||||||
|
* data[0]. The behavior is undefined if the format is not paletted.
|
||||||
|
*/
|
||||||
|
void av_read_image_line(uint16_t *dst, const uint8_t *data[4],
|
||||||
|
const int linesize[4], const AVPixFmtDescriptor *desc,
|
||||||
|
int x, int y, int c, int w, int read_pal_component);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the values from src to the pixel format component c of an
|
||||||
|
* image line.
|
||||||
|
*
|
||||||
|
* @param src array containing the values to write
|
||||||
|
* @param data the array containing the pointers to the planes of the
|
||||||
|
* image to write into. It is supposed to be zeroed.
|
||||||
|
* @param linesize the array containing the linesizes of the image
|
||||||
|
* @param desc the pixel format descriptor for the image
|
||||||
|
* @param x the horizontal coordinate of the first pixel to write
|
||||||
|
* @param y the vertical coordinate of the first pixel to write
|
||||||
|
* @param w the width of the line to write, that is the number of
|
||||||
|
* values to write to the image line
|
||||||
|
*/
|
||||||
|
void av_write_image_line(const uint16_t *src, uint8_t *data[4],
|
||||||
|
const int linesize[4], const AVPixFmtDescriptor *desc,
|
||||||
|
int x, int y, int c, int w);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function to swap the endianness of a pixel format.
|
* Utility function to swap the endianness of a pixel format.
|
||||||
*
|
*
|
||||||
|
@ -366,29 +391,4 @@ int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
|
||||||
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
|
enum AVPixelFormat av_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);
|
enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name for provided color range or NULL if unknown.
|
|
||||||
*/
|
|
||||||
const char *av_color_range_name(enum AVColorRange range);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name for provided color primaries or NULL if unknown.
|
|
||||||
*/
|
|
||||||
const char *av_color_primaries_name(enum AVColorPrimaries primaries);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name for provided color transfer or NULL if unknown.
|
|
||||||
*/
|
|
||||||
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name for provided color space or NULL if unknown.
|
|
||||||
*/
|
|
||||||
const char *av_color_space_name(enum AVColorSpace space);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the name for provided chroma location or NULL if unknown.
|
|
||||||
*/
|
|
||||||
const char *av_chroma_location_name(enum AVChromaLocation location);
|
|
||||||
|
|
||||||
#endif /* AVUTIL_PIXDESC_H */
|
#endif /* AVUTIL_PIXDESC_H */
|
||||||
|
|
|
@ -77,7 +77,7 @@ enum AVPixelFormat {
|
||||||
#if FF_API_XVMC
|
#if FF_API_XVMC
|
||||||
AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
|
AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
|
||||||
AV_PIX_FMT_XVMC_MPEG2_IDCT,
|
AV_PIX_FMT_XVMC_MPEG2_IDCT,
|
||||||
#define AV_PIX_FMT_XVMC AV_PIX_FMT_XVMC_MPEG2_IDCT
|
AV_PIX_FMT_XVMC = AV_PIX_FMT_XVMC_MPEG2_IDCT,
|
||||||
#endif /* FF_API_XVMC */
|
#endif /* FF_API_XVMC */
|
||||||
AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
|
AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
|
||||||
AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
|
AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
|
||||||
|
@ -178,6 +178,7 @@ enum AVPixelFormat {
|
||||||
AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||||
AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
|
AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
|
||||||
AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
|
AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
|
||||||
|
AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
|
||||||
AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
|
AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
|
||||||
AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
|
AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
|
||||||
AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
|
AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
|
||||||
|
@ -303,11 +304,10 @@ enum AVPixelFormat {
|
||||||
AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
|
AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
|
||||||
AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian
|
AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, 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
|
AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
|
||||||
};
|
|
||||||
|
|
||||||
#define AV_PIX_FMT_Y400A AV_PIX_FMT_GRAY8A
|
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
|
||||||
#define AV_PIX_FMT_GBR24P AV_PIX_FMT_GBRP
|
};
|
||||||
|
|
||||||
#if AV_HAVE_BIGENDIAN
|
#if AV_HAVE_BIGENDIAN
|
||||||
# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
|
# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
|
||||||
|
@ -399,7 +399,9 @@ enum AVColorPrimaries {
|
||||||
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
|
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
|
||||||
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
|
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
|
||||||
AVCOL_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
AVCOL_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
||||||
AVCOL_PRI_NB, ///< Not part of ABI
|
AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011)
|
||||||
|
AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 D65 (2010)
|
||||||
|
AVCOL_PRI_NB ///< Not part of ABI
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -425,7 +427,7 @@ enum AVColorTransferCharacteristic {
|
||||||
AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
|
AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
|
||||||
AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
|
AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
|
||||||
AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
|
AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
|
||||||
AVCOL_TRC_NB, ///< Not part of ABI
|
AVCOL_TRC_NB ///< Not part of ABI
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -443,7 +445,8 @@ enum AVColorSpace {
|
||||||
AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
||||||
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
|
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
|
||||||
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
|
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
|
||||||
AVCOL_SPC_NB, ///< Not part of ABI
|
AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
|
||||||
|
AVCOL_SPC_NB ///< Not part of ABI
|
||||||
};
|
};
|
||||||
#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG
|
#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG
|
||||||
|
|
||||||
|
@ -455,7 +458,7 @@ enum AVColorRange {
|
||||||
AVCOL_RANGE_UNSPECIFIED = 0,
|
AVCOL_RANGE_UNSPECIFIED = 0,
|
||||||
AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
|
AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
|
||||||
AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
|
AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
|
||||||
AVCOL_RANGE_NB, ///< Not part of ABI
|
AVCOL_RANGE_NB ///< Not part of ABI
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -481,7 +484,7 @@ enum AVChromaLocation {
|
||||||
AVCHROMA_LOC_TOP = 4,
|
AVCHROMA_LOC_TOP = 4,
|
||||||
AVCHROMA_LOC_BOTTOMLEFT = 5,
|
AVCHROMA_LOC_BOTTOMLEFT = 5,
|
||||||
AVCHROMA_LOC_BOTTOM = 6,
|
AVCHROMA_LOC_BOTTOM = 6,
|
||||||
AVCHROMA_LOC_NB, ///< Not part of ABI
|
AVCHROMA_LOC_NB ///< Not part of ABI
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AVUTIL_PIXFMT_H */
|
#endif /* AVUTIL_PIXFMT_H */
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* rational numbers
|
* @ingroup lavu_math_rational
|
||||||
|
* Utilties for rational number calculation.
|
||||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,22 +34,39 @@
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup lavu_math
|
* @defgroup lavu_math_rational AVRational
|
||||||
|
* @ingroup lavu_math
|
||||||
|
* Rational number calculation.
|
||||||
|
*
|
||||||
|
* While rational numbers can be expressed as floating-point numbers, the
|
||||||
|
* conversion process is a lossy one, so are floating-point operations. On the
|
||||||
|
* other hand, the nature of FFmpeg demands highly accurate calculation of
|
||||||
|
* timestamps. This set of rational number utilities serves as a generic
|
||||||
|
* interface for manipulating rational numbers as pairs of numerators and
|
||||||
|
* denominators.
|
||||||
|
*
|
||||||
|
* Many of the functions that operate on AVRational's have the suffix `_q`, in
|
||||||
|
* reference to the mathematical symbol "ℚ" (Q) which denotes the set of all
|
||||||
|
* rational numbers.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rational number numerator/denominator
|
* Rational number (pair of numerator and denominator).
|
||||||
*/
|
*/
|
||||||
typedef struct AVRational{
|
typedef struct AVRational{
|
||||||
int num; ///< numerator
|
int num; ///< Numerator
|
||||||
int den; ///< denominator
|
int den; ///< Denominator
|
||||||
} AVRational;
|
} AVRational;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a rational.
|
* Create an AVRational.
|
||||||
|
*
|
||||||
* Useful for compilers that do not support compound literals.
|
* Useful for compilers that do not support compound literals.
|
||||||
|
*
|
||||||
* @note The return value is not reduced.
|
* @note The return value is not reduced.
|
||||||
|
* @see av_reduce()
|
||||||
*/
|
*/
|
||||||
static inline AVRational av_make_q(int num, int den)
|
static inline AVRational av_make_q(int num, int den)
|
||||||
{
|
{
|
||||||
|
@ -58,10 +76,15 @@ static inline AVRational av_make_q(int num, int den)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two rationals.
|
* Compare two rationals.
|
||||||
* @param a first rational
|
*
|
||||||
* @param b second rational
|
* @param a First rational
|
||||||
* @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the
|
* @param b Second rational
|
||||||
* values is of the form 0/0
|
*
|
||||||
|
* @return One of the following values:
|
||||||
|
* - 0 if `a == b`
|
||||||
|
* - 1 if `a > b`
|
||||||
|
* - -1 if `a < b`
|
||||||
|
* - `INT_MIN` if one of the values is of the form `0 / 0`
|
||||||
*/
|
*/
|
||||||
static inline int av_cmp_q(AVRational a, AVRational b){
|
static inline int av_cmp_q(AVRational a, AVRational b){
|
||||||
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
|
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
|
||||||
|
@ -73,9 +96,10 @@ static inline int av_cmp_q(AVRational a, AVRational b){
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert rational to double.
|
* Convert an AVRational to a `double`.
|
||||||
* @param a rational to convert
|
* @param a AVRational to convert
|
||||||
* @return (double) a
|
* @return `a` in floating-point form
|
||||||
|
* @see av_d2q()
|
||||||
*/
|
*/
|
||||||
static inline double av_q2d(AVRational a){
|
static inline double av_q2d(AVRational a){
|
||||||
return a.num / (double) a.den;
|
return a.num / (double) a.den;
|
||||||
|
@ -83,44 +107,46 @@ static inline double av_q2d(AVRational a){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce a fraction.
|
* Reduce a fraction.
|
||||||
|
*
|
||||||
* This is useful for framerate calculations.
|
* This is useful for framerate calculations.
|
||||||
* @param dst_num destination numerator
|
*
|
||||||
* @param dst_den destination denominator
|
* @param[out] dst_num Destination numerator
|
||||||
* @param num source numerator
|
* @param[out] dst_den Destination denominator
|
||||||
* @param den source denominator
|
* @param[in] num Source numerator
|
||||||
* @param max the maximum allowed for dst_num & dst_den
|
* @param[in] den Source denominator
|
||||||
* @return 1 if exact, 0 otherwise
|
* @param[in] max Maximum allowed values for `dst_num` & `dst_den`
|
||||||
|
* @return 1 if the operation is exact, 0 otherwise
|
||||||
*/
|
*/
|
||||||
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
|
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply two rationals.
|
* Multiply two rationals.
|
||||||
* @param b first rational
|
* @param b First rational
|
||||||
* @param c second rational
|
* @param c Second rational
|
||||||
* @return b*c
|
* @return b*c
|
||||||
*/
|
*/
|
||||||
AVRational av_mul_q(AVRational b, AVRational c) av_const;
|
AVRational av_mul_q(AVRational b, AVRational c) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide one rational by another.
|
* Divide one rational by another.
|
||||||
* @param b first rational
|
* @param b First rational
|
||||||
* @param c second rational
|
* @param c Second rational
|
||||||
* @return b/c
|
* @return b/c
|
||||||
*/
|
*/
|
||||||
AVRational av_div_q(AVRational b, AVRational c) av_const;
|
AVRational av_div_q(AVRational b, AVRational c) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add two rationals.
|
* Add two rationals.
|
||||||
* @param b first rational
|
* @param b First rational
|
||||||
* @param c second rational
|
* @param c Second rational
|
||||||
* @return b+c
|
* @return b+c
|
||||||
*/
|
*/
|
||||||
AVRational av_add_q(AVRational b, AVRational c) av_const;
|
AVRational av_add_q(AVRational b, AVRational c) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subtract one rational from another.
|
* Subtract one rational from another.
|
||||||
* @param b first rational
|
* @param b First rational
|
||||||
* @param c second rational
|
* @param c Second rational
|
||||||
* @return b-c
|
* @return b-c
|
||||||
*/
|
*/
|
||||||
AVRational av_sub_q(AVRational b, AVRational c) av_const;
|
AVRational av_sub_q(AVRational b, AVRational c) av_const;
|
||||||
|
@ -138,31 +164,46 @@ static av_always_inline AVRational av_inv_q(AVRational q)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a double precision floating point number to a rational.
|
* Convert a double precision floating point number to a rational.
|
||||||
* inf is expressed as {1,0} or {-1,0} depending on the sign.
|
|
||||||
*
|
*
|
||||||
* @param d double to convert
|
* In case of infinity, the returned value is expressed as `{1, 0}` or
|
||||||
* @param max the maximum allowed numerator and denominator
|
* `{-1, 0}` depending on the sign.
|
||||||
* @return (AVRational) d
|
*
|
||||||
|
* @param d `double` to convert
|
||||||
|
* @param max Maximum allowed numerator and denominator
|
||||||
|
* @return `d` in AVRational form
|
||||||
|
* @see av_q2d()
|
||||||
*/
|
*/
|
||||||
AVRational av_d2q(double d, int max) av_const;
|
AVRational av_d2q(double d, int max) av_const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
|
* Find which of the two rationals is closer to another rational.
|
||||||
* than q1, 0 if they have the same distance.
|
*
|
||||||
|
* @param q Rational to be compared against
|
||||||
|
* @param q1,q2 Rationals to be tested
|
||||||
|
* @return One of the following values:
|
||||||
|
* - 1 if `q1` is nearer to `q` than `q2`
|
||||||
|
* - -1 if `q2` is nearer to `q` than `q1`
|
||||||
|
* - 0 if they have the same distance
|
||||||
*/
|
*/
|
||||||
int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
|
int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the nearest value in q_list to q.
|
* Find the value in a list of rationals nearest a given reference rational.
|
||||||
* @param q_list an array of rationals terminated by {0, 0}
|
*
|
||||||
* @return the index of the nearest value found in the array
|
* @param q Reference rational
|
||||||
|
* @param q_list Array of rationals terminated by `{0, 0}`
|
||||||
|
* @return Index of the nearest value found in the array
|
||||||
*/
|
*/
|
||||||
int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
|
int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a AVRational to a IEEE 32bit float.
|
* Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
|
||||||
|
* format.
|
||||||
*
|
*
|
||||||
* The float is returned in a uint32_t and its value is platform indepenant.
|
* @param q Rational to be converted
|
||||||
|
* @return Equivalent floating-point value, expressed as an unsigned 32-bit
|
||||||
|
* integer.
|
||||||
|
* @note The returned value is platform-indepedant.
|
||||||
*/
|
*/
|
||||||
uint32_t av_q2intfloat(AVRational q);
|
uint32_t av_q2intfloat(AVRational q);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_ripemd
|
||||||
|
* Public header for RIPEMD hash function implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_RIPEMD_H
|
#ifndef AVUTIL_RIPEMD_H
|
||||||
#define AVUTIL_RIPEMD_H
|
#define AVUTIL_RIPEMD_H
|
||||||
|
|
||||||
|
@ -29,7 +35,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_ripemd RIPEMD
|
* @defgroup lavu_ripemd RIPEMD
|
||||||
* @ingroup lavu_crypto
|
* @ingroup lavu_hash
|
||||||
|
* RIPEMD hash function implementation.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ enum AVSampleFormat {
|
||||||
AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
|
AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
|
||||||
AV_SAMPLE_FMT_FLTP, ///< float, planar
|
AV_SAMPLE_FMT_FLTP, ///< float, planar
|
||||||
AV_SAMPLE_FMT_DBLP, ///< double, planar
|
AV_SAMPLE_FMT_DBLP, ///< double, planar
|
||||||
|
AV_SAMPLE_FMT_S64, ///< signed 64 bits
|
||||||
|
AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
|
||||||
|
|
||||||
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
|
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_sha
|
||||||
|
* Public header for SHA-1 & SHA-256 hash function implementations.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_SHA_H
|
#ifndef AVUTIL_SHA_H
|
||||||
#define AVUTIL_SHA_H
|
#define AVUTIL_SHA_H
|
||||||
|
|
||||||
|
@ -28,7 +34,17 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_sha SHA
|
* @defgroup lavu_sha SHA
|
||||||
* @ingroup lavu_crypto
|
* @ingroup lavu_hash
|
||||||
|
* SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations.
|
||||||
|
*
|
||||||
|
* This module supports the following SHA hash functions:
|
||||||
|
*
|
||||||
|
* - SHA-1: 160 bits
|
||||||
|
* - SHA-224: 224 bits, as a variant of SHA-2
|
||||||
|
* - SHA-256: 256 bits, as a variant of SHA-2
|
||||||
|
*
|
||||||
|
* @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu_sha512
|
||||||
|
* Public header for SHA-512 implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_SHA512_H
|
#ifndef AVUTIL_SHA512_H
|
||||||
#define AVUTIL_SHA512_H
|
#define AVUTIL_SHA512_H
|
||||||
|
|
||||||
|
@ -28,8 +34,19 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_sha512 SHA512
|
* @defgroup lavu_sha512 SHA-512
|
||||||
* @ingroup lavu_crypto
|
* @ingroup lavu_hash
|
||||||
|
* SHA-512 (Secure Hash Algorithm) hash function implementations.
|
||||||
|
*
|
||||||
|
* This module supports the following SHA-2 hash functions:
|
||||||
|
*
|
||||||
|
* - SHA-512/224: 224 bits
|
||||||
|
* - SHA-512/256: 256 bits
|
||||||
|
* - SHA-384: 384 bits
|
||||||
|
* - SHA-512: 512 bits
|
||||||
|
*
|
||||||
|
* @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct AVTreeNode *av_tree_node_alloc(void);
|
||||||
* then the corresponding entry in next is unchanged.
|
* then the corresponding entry in next is unchanged.
|
||||||
* @param cmp compare function used to compare elements in the tree,
|
* @param cmp compare function used to compare elements in the tree,
|
||||||
* API identical to that of Standard C's qsort
|
* API identical to that of Standard C's qsort
|
||||||
* It is guranteed that the first and only the first argument to cmp()
|
* It is guaranteed that the first and only the first argument to cmp()
|
||||||
* will be the key parameter to av_tree_find(), thus it could if the
|
* will be the key parameter to av_tree_find(), thus it could if the
|
||||||
* user wants, be a different type (like an opaque context).
|
* user wants, be a different type (like an opaque context).
|
||||||
* @return An element with cmp(key, elem) == 0 or NULL if no such element
|
* @return An element with cmp(key, elem) == 0 or NULL if no such element
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @ingroup lavu
|
||||||
|
* Libavutil version macros
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_VERSION_H
|
#ifndef AVUTIL_VERSION_H
|
||||||
#define AVUTIL_VERSION_H
|
#define AVUTIL_VERSION_H
|
||||||
|
|
||||||
|
@ -29,6 +35,21 @@
|
||||||
* Useful to check and match library version in order to maintain
|
* Useful to check and match library version in order to maintain
|
||||||
* backward compatibility.
|
* backward compatibility.
|
||||||
*
|
*
|
||||||
|
* The FFmpeg libraries follow a versioning sheme very similar to
|
||||||
|
* Semantic Versioning (http://semver.org/)
|
||||||
|
* The difference is that the component called PATCH is called MICRO in FFmpeg
|
||||||
|
* and its value is reset to 100 instead of 0 to keep it above or equal to 100.
|
||||||
|
* Also we do not increase MICRO for every bugfix or change in git master.
|
||||||
|
*
|
||||||
|
* Prior to FFmpeg 3.2 point releases did not change any lib version number to
|
||||||
|
* avoid aliassing different git master checkouts.
|
||||||
|
* Starting with FFmpeg 3.2, the released library versions will occupy
|
||||||
|
* a separate MAJOR.MINOR that is not used on the master development branch.
|
||||||
|
* That is if we branch a release of master 55.10.123 we will bump to 55.11.100
|
||||||
|
* for the release and master will continue at 55.12.100 after it. Each new
|
||||||
|
* point release will then bump the MICRO improving the usefulness of the lib
|
||||||
|
* versions.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -48,12 +69,6 @@
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* @ingroup lavu
|
|
||||||
* Libavutil version macros
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup lavu_ver Version and Build diagnostics
|
* @defgroup lavu_ver Version and Build diagnostics
|
||||||
*
|
*
|
||||||
|
@ -64,7 +79,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 55
|
#define LIBAVUTIL_VERSION_MAJOR 55
|
||||||
#define LIBAVUTIL_VERSION_MINOR 28
|
#define LIBAVUTIL_VERSION_MINOR 34
|
||||||
#define LIBAVUTIL_VERSION_MICRO 100
|
#define LIBAVUTIL_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
|
@ -78,9 +93,7 @@
|
||||||
#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
|
#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @defgroup lavu_depr_guards Deprecation Guards
|
||||||
*
|
|
||||||
* @defgroup depr_guards Deprecation guards
|
|
||||||
* FF_API_* defines may be placed below to indicate public API that will be
|
* FF_API_* defines may be placed below to indicate public API that will be
|
||||||
* dropped at a future version bump. The defines themselves are not part of
|
* dropped at a future version bump. The defines themselves are not part of
|
||||||
* the public API and may change, break or disappear at any time.
|
* the public API and may change, break or disappear at any time.
|
||||||
|
@ -119,9 +132,13 @@
|
||||||
#ifndef FF_API_CRC_BIG_TABLE
|
#ifndef FF_API_CRC_BIG_TABLE
|
||||||
#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56)
|
#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_PKT_PTS
|
||||||
|
#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @}
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,14 +1,14 @@
|
||||||
prefix=/Users/Chris/Source/Repos/cog/ThirdParty/ffmpeg
|
prefix=/Users/chris/Source/Repos/cog/ThirdParty/ffmpeg
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
libdir=${prefix}/lib
|
libdir=${prefix}/lib
|
||||||
includedir=${prefix}/include
|
includedir=${prefix}/include
|
||||||
|
|
||||||
Name: libavcodec
|
Name: libavcodec
|
||||||
Description: FFmpeg codec library
|
Description: FFmpeg codec library
|
||||||
Version: 57.48.101
|
Version: 57.64.101
|
||||||
Requires: libavutil >= 55.28.100
|
Requires: libavutil >= 55.34.100
|
||||||
Requires.private:
|
Requires.private:
|
||||||
Conflicts:
|
Conflicts:
|
||||||
Libs: -L${libdir} -lavcodec -framework QuartzCore -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework CoreFoundation -framework AudioToolbox -framework CoreMedia -framework VideoDecodeAcceleration -framework CoreFoundation -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lm -lbz2 -lz -pthread -framework CoreServices
|
Libs: -L${libdir} -lavcodec -framework QuartzCore -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework CoreFoundation -framework AudioToolbox -framework CoreMedia -framework VideoDecodeAcceleration -framework CoreFoundation -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDL2 -lm -lbz2 -lz -pthread -framework CoreServices
|
||||||
Libs.private:
|
Libs.private:
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
prefix=/Users/Chris/Source/Repos/cog/ThirdParty/ffmpeg
|
prefix=/Users/chris/Source/Repos/cog/ThirdParty/ffmpeg
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
libdir=${prefix}/lib
|
libdir=${prefix}/lib
|
||||||
includedir=${prefix}/include
|
includedir=${prefix}/include
|
||||||
|
|
||||||
Name: libavformat
|
Name: libavformat
|
||||||
Description: FFmpeg container format library
|
Description: FFmpeg container format library
|
||||||
Version: 57.41.100
|
Version: 57.56.100
|
||||||
Requires: libavcodec >= 57.48.101, libavutil >= 55.28.100
|
Requires: libavcodec >= 57.64.101, libavutil >= 55.34.100
|
||||||
Requires.private:
|
Requires.private:
|
||||||
Conflicts:
|
Conflicts:
|
||||||
Libs: -L${libdir} -lavformat -framework QuartzCore -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework CoreFoundation -framework AudioToolbox -framework CoreMedia -framework VideoDecodeAcceleration -framework CoreFoundation -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lm -lbz2 -lz -pthread -framework CoreServices
|
Libs: -L${libdir} -lavformat -framework QuartzCore -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework CoreFoundation -framework AudioToolbox -framework CoreMedia -framework VideoDecodeAcceleration -framework CoreFoundation -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDL2 -lm -lbz2 -lz -pthread -framework CoreServices
|
||||||
Libs.private:
|
Libs.private:
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
prefix=/Users/Chris/Source/Repos/cog/ThirdParty/ffmpeg
|
prefix=/Users/chris/Source/Repos/cog/ThirdParty/ffmpeg
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
libdir=${prefix}/lib
|
libdir=${prefix}/lib
|
||||||
includedir=${prefix}/include
|
includedir=${prefix}/include
|
||||||
|
|
||||||
Name: libavutil
|
Name: libavutil
|
||||||
Description: FFmpeg utility library
|
Description: FFmpeg utility library
|
||||||
Version: 55.28.100
|
Version: 55.34.100
|
||||||
Requires:
|
Requires:
|
||||||
Requires.private:
|
Requires.private:
|
||||||
Conflicts:
|
Conflicts:
|
||||||
|
|
Loading…
Reference in New Issue