forked from dolphin-emu/dolphin
Update Windows ffmpeg to 3.2.4
This commit is contained in:
+985
-162
File diff suppressed because it is too large
Load Diff
+18
@@ -33,6 +33,17 @@
|
||||
|
||||
#include "avcodec.h"
|
||||
|
||||
/**
|
||||
* The spec limits the number of wavelet decompositions to 4 for both
|
||||
* level 1 (VC-2) and 128 (long-gop default).
|
||||
* 5 decompositions is the maximum before >16-bit buffers are needed.
|
||||
* Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting
|
||||
* the others to 4 decompositions (or 3 for the fidelity filter).
|
||||
*
|
||||
* We use this instead of MAX_DECOMPOSITIONS to save some memory.
|
||||
*/
|
||||
#define MAX_DWT_LEVELS 5
|
||||
|
||||
/**
|
||||
* Parse code values:
|
||||
*
|
||||
@@ -52,6 +63,13 @@ enum DiracParseCodes {
|
||||
DIRAC_PCODE_PICTURE_RAW = 0x48,
|
||||
DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8,
|
||||
DIRAC_PCODE_PICTURE_HQ = 0xE8,
|
||||
DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A,
|
||||
DIRAC_PCODE_INTER_NOREF_CO2 = 0x09,
|
||||
DIRAC_PCODE_INTER_REF_CO1 = 0x0D,
|
||||
DIRAC_PCODE_INTER_REF_CO2 = 0x0E,
|
||||
DIRAC_PCODE_INTRA_REF_CO = 0x0C,
|
||||
DIRAC_PCODE_INTRA_REF_RAW = 0x4C,
|
||||
DIRAC_PCODE_INTRA_REF_PICT = 0xCC,
|
||||
DIRAC_PCODE_MAGIC = 0x42424344,
|
||||
};
|
||||
|
||||
|
||||
+3
-3
@@ -20,8 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_DXVA_H
|
||||
#define AVCODEC_DXVA_H
|
||||
#ifndef AVCODEC_DXVA2_H
|
||||
#define AVCODEC_DXVA2_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
@@ -90,4 +90,4 @@ struct dxva_context {
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVCODEC_DXVA_H */
|
||||
#endif /* AVCODEC_DXVA2_H */
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* JNI public API functions
|
||||
*
|
||||
* Copyright (c) 2015-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_JNI_H
|
||||
#define AVCODEC_JNI_H
|
||||
|
||||
/*
|
||||
* Manually set a Java virtual machine which will be used to retrieve the JNI
|
||||
* environment. Once a Java VM is set it cannot be changed afterwards, meaning
|
||||
* you can call multiple times av_jni_set_java_vm with the same Java VM pointer
|
||||
* however it will error out if you try to set a different Java VM.
|
||||
*
|
||||
* @param vm Java virtual machine
|
||||
* @param log_ctx context used for logging, can be NULL
|
||||
* @return 0 on success, < 0 otherwise
|
||||
*/
|
||||
int av_jni_set_java_vm(void *vm, void *log_ctx);
|
||||
|
||||
/*
|
||||
* Get the Java virtual machine which has been set with av_jni_set_java_vm.
|
||||
*
|
||||
* @param vm Java virtual machine
|
||||
* @return a pointer to the Java virtual machine
|
||||
*/
|
||||
void *av_jni_get_java_vm(void *log_ctx);
|
||||
|
||||
#endif /* AVCODEC_JNI_H */
|
||||
@@ -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 */
|
||||
-397
@@ -1,397 +0,0 @@
|
||||
/*
|
||||
* 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_OLD_CODEC_IDS_H
|
||||
#define AVCODEC_OLD_CODEC_IDS_H
|
||||
|
||||
/*
|
||||
* This header exists to prevent new codec IDs from being accidentally added to
|
||||
* the deprecated list.
|
||||
* Do not include it directly. It will be removed on next major bump
|
||||
*
|
||||
* Do not add new items to this list. Use the AVCodecID enum instead.
|
||||
*/
|
||||
|
||||
CODEC_ID_NONE = AV_CODEC_ID_NONE,
|
||||
|
||||
/* video codecs */
|
||||
CODEC_ID_MPEG1VIDEO,
|
||||
CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
||||
#if FF_API_XVMC
|
||||
CODEC_ID_MPEG2VIDEO_XVMC,
|
||||
#endif
|
||||
CODEC_ID_H261,
|
||||
CODEC_ID_H263,
|
||||
CODEC_ID_RV10,
|
||||
CODEC_ID_RV20,
|
||||
CODEC_ID_MJPEG,
|
||||
CODEC_ID_MJPEGB,
|
||||
CODEC_ID_LJPEG,
|
||||
CODEC_ID_SP5X,
|
||||
CODEC_ID_JPEGLS,
|
||||
CODEC_ID_MPEG4,
|
||||
CODEC_ID_RAWVIDEO,
|
||||
CODEC_ID_MSMPEG4V1,
|
||||
CODEC_ID_MSMPEG4V2,
|
||||
CODEC_ID_MSMPEG4V3,
|
||||
CODEC_ID_WMV1,
|
||||
CODEC_ID_WMV2,
|
||||
CODEC_ID_H263P,
|
||||
CODEC_ID_H263I,
|
||||
CODEC_ID_FLV1,
|
||||
CODEC_ID_SVQ1,
|
||||
CODEC_ID_SVQ3,
|
||||
CODEC_ID_DVVIDEO,
|
||||
CODEC_ID_HUFFYUV,
|
||||
CODEC_ID_CYUV,
|
||||
CODEC_ID_H264,
|
||||
CODEC_ID_INDEO3,
|
||||
CODEC_ID_VP3,
|
||||
CODEC_ID_THEORA,
|
||||
CODEC_ID_ASV1,
|
||||
CODEC_ID_ASV2,
|
||||
CODEC_ID_FFV1,
|
||||
CODEC_ID_4XM,
|
||||
CODEC_ID_VCR1,
|
||||
CODEC_ID_CLJR,
|
||||
CODEC_ID_MDEC,
|
||||
CODEC_ID_ROQ,
|
||||
CODEC_ID_INTERPLAY_VIDEO,
|
||||
CODEC_ID_XAN_WC3,
|
||||
CODEC_ID_XAN_WC4,
|
||||
CODEC_ID_RPZA,
|
||||
CODEC_ID_CINEPAK,
|
||||
CODEC_ID_WS_VQA,
|
||||
CODEC_ID_MSRLE,
|
||||
CODEC_ID_MSVIDEO1,
|
||||
CODEC_ID_IDCIN,
|
||||
CODEC_ID_8BPS,
|
||||
CODEC_ID_SMC,
|
||||
CODEC_ID_FLIC,
|
||||
CODEC_ID_TRUEMOTION1,
|
||||
CODEC_ID_VMDVIDEO,
|
||||
CODEC_ID_MSZH,
|
||||
CODEC_ID_ZLIB,
|
||||
CODEC_ID_QTRLE,
|
||||
CODEC_ID_TSCC,
|
||||
CODEC_ID_ULTI,
|
||||
CODEC_ID_QDRAW,
|
||||
CODEC_ID_VIXL,
|
||||
CODEC_ID_QPEG,
|
||||
CODEC_ID_PNG,
|
||||
CODEC_ID_PPM,
|
||||
CODEC_ID_PBM,
|
||||
CODEC_ID_PGM,
|
||||
CODEC_ID_PGMYUV,
|
||||
CODEC_ID_PAM,
|
||||
CODEC_ID_FFVHUFF,
|
||||
CODEC_ID_RV30,
|
||||
CODEC_ID_RV40,
|
||||
CODEC_ID_VC1,
|
||||
CODEC_ID_WMV3,
|
||||
CODEC_ID_LOCO,
|
||||
CODEC_ID_WNV1,
|
||||
CODEC_ID_AASC,
|
||||
CODEC_ID_INDEO2,
|
||||
CODEC_ID_FRAPS,
|
||||
CODEC_ID_TRUEMOTION2,
|
||||
CODEC_ID_BMP,
|
||||
CODEC_ID_CSCD,
|
||||
CODEC_ID_MMVIDEO,
|
||||
CODEC_ID_ZMBV,
|
||||
CODEC_ID_AVS,
|
||||
CODEC_ID_SMACKVIDEO,
|
||||
CODEC_ID_NUV,
|
||||
CODEC_ID_KMVC,
|
||||
CODEC_ID_FLASHSV,
|
||||
CODEC_ID_CAVS,
|
||||
CODEC_ID_JPEG2000,
|
||||
CODEC_ID_VMNC,
|
||||
CODEC_ID_VP5,
|
||||
CODEC_ID_VP6,
|
||||
CODEC_ID_VP6F,
|
||||
CODEC_ID_TARGA,
|
||||
CODEC_ID_DSICINVIDEO,
|
||||
CODEC_ID_TIERTEXSEQVIDEO,
|
||||
CODEC_ID_TIFF,
|
||||
CODEC_ID_GIF,
|
||||
CODEC_ID_DXA,
|
||||
CODEC_ID_DNXHD,
|
||||
CODEC_ID_THP,
|
||||
CODEC_ID_SGI,
|
||||
CODEC_ID_C93,
|
||||
CODEC_ID_BETHSOFTVID,
|
||||
CODEC_ID_PTX,
|
||||
CODEC_ID_TXD,
|
||||
CODEC_ID_VP6A,
|
||||
CODEC_ID_AMV,
|
||||
CODEC_ID_VB,
|
||||
CODEC_ID_PCX,
|
||||
CODEC_ID_SUNRAST,
|
||||
CODEC_ID_INDEO4,
|
||||
CODEC_ID_INDEO5,
|
||||
CODEC_ID_MIMIC,
|
||||
CODEC_ID_RL2,
|
||||
CODEC_ID_ESCAPE124,
|
||||
CODEC_ID_DIRAC,
|
||||
CODEC_ID_BFI,
|
||||
CODEC_ID_CMV,
|
||||
CODEC_ID_MOTIONPIXELS,
|
||||
CODEC_ID_TGV,
|
||||
CODEC_ID_TGQ,
|
||||
CODEC_ID_TQI,
|
||||
CODEC_ID_AURA,
|
||||
CODEC_ID_AURA2,
|
||||
CODEC_ID_V210X,
|
||||
CODEC_ID_TMV,
|
||||
CODEC_ID_V210,
|
||||
CODEC_ID_DPX,
|
||||
CODEC_ID_MAD,
|
||||
CODEC_ID_FRWU,
|
||||
CODEC_ID_FLASHSV2,
|
||||
CODEC_ID_CDGRAPHICS,
|
||||
CODEC_ID_R210,
|
||||
CODEC_ID_ANM,
|
||||
CODEC_ID_BINKVIDEO,
|
||||
CODEC_ID_IFF_ILBM,
|
||||
CODEC_ID_IFF_BYTERUN1,
|
||||
CODEC_ID_KGV1,
|
||||
CODEC_ID_YOP,
|
||||
CODEC_ID_VP8,
|
||||
CODEC_ID_PICTOR,
|
||||
CODEC_ID_ANSI,
|
||||
CODEC_ID_A64_MULTI,
|
||||
CODEC_ID_A64_MULTI5,
|
||||
CODEC_ID_R10K,
|
||||
CODEC_ID_MXPEG,
|
||||
CODEC_ID_LAGARITH,
|
||||
CODEC_ID_PRORES,
|
||||
CODEC_ID_JV,
|
||||
CODEC_ID_DFA,
|
||||
CODEC_ID_WMV3IMAGE,
|
||||
CODEC_ID_VC1IMAGE,
|
||||
CODEC_ID_UTVIDEO,
|
||||
CODEC_ID_BMV_VIDEO,
|
||||
CODEC_ID_VBLE,
|
||||
CODEC_ID_DXTORY,
|
||||
CODEC_ID_V410,
|
||||
CODEC_ID_XWD,
|
||||
CODEC_ID_CDXL,
|
||||
CODEC_ID_XBM,
|
||||
CODEC_ID_ZEROCODEC,
|
||||
CODEC_ID_MSS1,
|
||||
CODEC_ID_MSA1,
|
||||
CODEC_ID_TSCC2,
|
||||
CODEC_ID_MTS2,
|
||||
CODEC_ID_CLLC,
|
||||
CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
|
||||
CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
|
||||
CODEC_ID_EXR = MKBETAG('0','E','X','R'),
|
||||
CODEC_ID_AVRP = MKBETAG('A','V','R','P'),
|
||||
|
||||
CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'),
|
||||
CODEC_ID_AVUI = MKBETAG('A','V','U','I'),
|
||||
CODEC_ID_AYUV = MKBETAG('A','Y','U','V'),
|
||||
CODEC_ID_V308 = MKBETAG('V','3','0','8'),
|
||||
CODEC_ID_V408 = MKBETAG('V','4','0','8'),
|
||||
CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'),
|
||||
CODEC_ID_SANM = MKBETAG('S','A','N','M'),
|
||||
CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'),
|
||||
CODEC_ID_SNOW = AV_CODEC_ID_SNOW,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||
CODEC_ID_PCM_S16LE = 0x10000,
|
||||
CODEC_ID_PCM_S16BE,
|
||||
CODEC_ID_PCM_U16LE,
|
||||
CODEC_ID_PCM_U16BE,
|
||||
CODEC_ID_PCM_S8,
|
||||
CODEC_ID_PCM_U8,
|
||||
CODEC_ID_PCM_MULAW,
|
||||
CODEC_ID_PCM_ALAW,
|
||||
CODEC_ID_PCM_S32LE,
|
||||
CODEC_ID_PCM_S32BE,
|
||||
CODEC_ID_PCM_U32LE,
|
||||
CODEC_ID_PCM_U32BE,
|
||||
CODEC_ID_PCM_S24LE,
|
||||
CODEC_ID_PCM_S24BE,
|
||||
CODEC_ID_PCM_U24LE,
|
||||
CODEC_ID_PCM_U24BE,
|
||||
CODEC_ID_PCM_S24DAUD,
|
||||
CODEC_ID_PCM_ZORK,
|
||||
CODEC_ID_PCM_S16LE_PLANAR,
|
||||
CODEC_ID_PCM_DVD,
|
||||
CODEC_ID_PCM_F32BE,
|
||||
CODEC_ID_PCM_F32LE,
|
||||
CODEC_ID_PCM_F64BE,
|
||||
CODEC_ID_PCM_F64LE,
|
||||
CODEC_ID_PCM_BLURAY,
|
||||
CODEC_ID_PCM_LXF,
|
||||
CODEC_ID_S302M,
|
||||
CODEC_ID_PCM_S8_PLANAR,
|
||||
|
||||
/* various ADPCM codecs */
|
||||
CODEC_ID_ADPCM_IMA_QT = 0x11000,
|
||||
CODEC_ID_ADPCM_IMA_WAV,
|
||||
CODEC_ID_ADPCM_IMA_DK3,
|
||||
CODEC_ID_ADPCM_IMA_DK4,
|
||||
CODEC_ID_ADPCM_IMA_WS,
|
||||
CODEC_ID_ADPCM_IMA_SMJPEG,
|
||||
CODEC_ID_ADPCM_MS,
|
||||
CODEC_ID_ADPCM_4XM,
|
||||
CODEC_ID_ADPCM_XA,
|
||||
CODEC_ID_ADPCM_ADX,
|
||||
CODEC_ID_ADPCM_EA,
|
||||
CODEC_ID_ADPCM_G726,
|
||||
CODEC_ID_ADPCM_CT,
|
||||
CODEC_ID_ADPCM_SWF,
|
||||
CODEC_ID_ADPCM_YAMAHA,
|
||||
CODEC_ID_ADPCM_SBPRO_4,
|
||||
CODEC_ID_ADPCM_SBPRO_3,
|
||||
CODEC_ID_ADPCM_SBPRO_2,
|
||||
CODEC_ID_ADPCM_THP,
|
||||
CODEC_ID_ADPCM_IMA_AMV,
|
||||
CODEC_ID_ADPCM_EA_R1,
|
||||
CODEC_ID_ADPCM_EA_R3,
|
||||
CODEC_ID_ADPCM_EA_R2,
|
||||
CODEC_ID_ADPCM_IMA_EA_SEAD,
|
||||
CODEC_ID_ADPCM_IMA_EA_EACS,
|
||||
CODEC_ID_ADPCM_EA_XAS,
|
||||
CODEC_ID_ADPCM_EA_MAXIS_XA,
|
||||
CODEC_ID_ADPCM_IMA_ISS,
|
||||
CODEC_ID_ADPCM_G722,
|
||||
CODEC_ID_ADPCM_IMA_APC,
|
||||
CODEC_ID_VIMA = MKBETAG('V','I','M','A'),
|
||||
|
||||
/* AMR */
|
||||
CODEC_ID_AMR_NB = 0x12000,
|
||||
CODEC_ID_AMR_WB,
|
||||
|
||||
/* RealAudio codecs*/
|
||||
CODEC_ID_RA_144 = 0x13000,
|
||||
CODEC_ID_RA_288,
|
||||
|
||||
/* various DPCM codecs */
|
||||
CODEC_ID_ROQ_DPCM = 0x14000,
|
||||
CODEC_ID_INTERPLAY_DPCM,
|
||||
CODEC_ID_XAN_DPCM,
|
||||
CODEC_ID_SOL_DPCM,
|
||||
|
||||
/* audio codecs */
|
||||
CODEC_ID_MP2 = 0x15000,
|
||||
CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
|
||||
CODEC_ID_AAC,
|
||||
CODEC_ID_AC3,
|
||||
CODEC_ID_DTS,
|
||||
CODEC_ID_VORBIS,
|
||||
CODEC_ID_DVAUDIO,
|
||||
CODEC_ID_WMAV1,
|
||||
CODEC_ID_WMAV2,
|
||||
CODEC_ID_MACE3,
|
||||
CODEC_ID_MACE6,
|
||||
CODEC_ID_VMDAUDIO,
|
||||
CODEC_ID_FLAC,
|
||||
CODEC_ID_MP3ADU,
|
||||
CODEC_ID_MP3ON4,
|
||||
CODEC_ID_SHORTEN,
|
||||
CODEC_ID_ALAC,
|
||||
CODEC_ID_WESTWOOD_SND1,
|
||||
CODEC_ID_GSM, ///< as in Berlin toast format
|
||||
CODEC_ID_QDM2,
|
||||
CODEC_ID_COOK,
|
||||
CODEC_ID_TRUESPEECH,
|
||||
CODEC_ID_TTA,
|
||||
CODEC_ID_SMACKAUDIO,
|
||||
CODEC_ID_QCELP,
|
||||
CODEC_ID_WAVPACK,
|
||||
CODEC_ID_DSICINAUDIO,
|
||||
CODEC_ID_IMC,
|
||||
CODEC_ID_MUSEPACK7,
|
||||
CODEC_ID_MLP,
|
||||
CODEC_ID_GSM_MS, /* as found in WAV */
|
||||
CODEC_ID_ATRAC3,
|
||||
CODEC_ID_VOXWARE,
|
||||
CODEC_ID_APE,
|
||||
CODEC_ID_NELLYMOSER,
|
||||
CODEC_ID_MUSEPACK8,
|
||||
CODEC_ID_SPEEX,
|
||||
CODEC_ID_WMAVOICE,
|
||||
CODEC_ID_WMAPRO,
|
||||
CODEC_ID_WMALOSSLESS,
|
||||
CODEC_ID_ATRAC3P,
|
||||
CODEC_ID_EAC3,
|
||||
CODEC_ID_SIPR,
|
||||
CODEC_ID_MP1,
|
||||
CODEC_ID_TWINVQ,
|
||||
CODEC_ID_TRUEHD,
|
||||
CODEC_ID_MP4ALS,
|
||||
CODEC_ID_ATRAC1,
|
||||
CODEC_ID_BINKAUDIO_RDFT,
|
||||
CODEC_ID_BINKAUDIO_DCT,
|
||||
CODEC_ID_AAC_LATM,
|
||||
CODEC_ID_QDMC,
|
||||
CODEC_ID_CELT,
|
||||
CODEC_ID_G723_1,
|
||||
CODEC_ID_G729,
|
||||
CODEC_ID_8SVX_EXP,
|
||||
CODEC_ID_8SVX_FIB,
|
||||
CODEC_ID_BMV_AUDIO,
|
||||
CODEC_ID_RALF,
|
||||
CODEC_ID_IAC,
|
||||
CODEC_ID_ILBC,
|
||||
CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
|
||||
CODEC_ID_SONIC = MKBETAG('S','O','N','C'),
|
||||
CODEC_ID_SONIC_LS = MKBETAG('S','O','N','L'),
|
||||
CODEC_ID_PAF_AUDIO = MKBETAG('P','A','F','A'),
|
||||
CODEC_ID_OPUS = MKBETAG('O','P','U','S'),
|
||||
|
||||
/* subtitle codecs */
|
||||
CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
|
||||
CODEC_ID_DVD_SUBTITLE = 0x17000,
|
||||
CODEC_ID_DVB_SUBTITLE,
|
||||
CODEC_ID_TEXT, ///< raw UTF-8 text
|
||||
CODEC_ID_XSUB,
|
||||
CODEC_ID_SSA,
|
||||
CODEC_ID_MOV_TEXT,
|
||||
CODEC_ID_HDMV_PGS_SUBTITLE,
|
||||
CODEC_ID_DVB_TELETEXT,
|
||||
CODEC_ID_SRT,
|
||||
CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'),
|
||||
CODEC_ID_EIA_608 = MKBETAG('c','6','0','8'),
|
||||
CODEC_ID_JACOSUB = MKBETAG('J','S','U','B'),
|
||||
CODEC_ID_SAMI = MKBETAG('S','A','M','I'),
|
||||
CODEC_ID_REALTEXT = MKBETAG('R','T','X','T'),
|
||||
CODEC_ID_SUBVIEWER = MKBETAG('S','u','b','V'),
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
CODEC_ID_TTF = 0x18000,
|
||||
CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'),
|
||||
CODEC_ID_XBIN = MKBETAG('X','B','I','N'),
|
||||
CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'),
|
||||
CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'),
|
||||
|
||||
CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
|
||||
|
||||
CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
|
||||
* stream (only used by libavformat) */
|
||||
CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
|
||||
* stream (only used by libavformat) */
|
||||
CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
|
||||
|
||||
#endif /* AVCODEC_OLD_CODEC_IDS_H */
|
||||
+23
-3
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
@@ -29,8 +28,8 @@
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 57
|
||||
#define LIBAVCODEC_VERSION_MINOR 21
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
#define LIBAVCODEC_VERSION_MINOR 64
|
||||
#define LIBAVCODEC_VERSION_MICRO 101
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
@@ -61,6 +60,9 @@
|
||||
#ifndef FF_API_AVCODEC_RESAMPLE
|
||||
#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT
|
||||
#endif
|
||||
#ifndef FF_API_GETCHROMA
|
||||
#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_MISSING_SAMPLE
|
||||
#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
@@ -206,5 +208,23 @@
|
||||
#ifndef FF_API_STAT_BITS
|
||||
#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_PRIVATE_OPT
|
||||
#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_ASS_TIMING
|
||||
#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_BSF
|
||||
#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_COPY_CONTEXT
|
||||
#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_GET_CONTEXT_DEFAULTS
|
||||
#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_NVENC_OLD_NAME
|
||||
#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
||||
#endif /* AVCODEC_VERSION_H */
|
||||
|
||||
+3
-4
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
@@ -24,8 +23,8 @@
|
||||
* Determines the duration for each packet.
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_VORBIS_PARSE_H
|
||||
#define AVCODEC_VORBIS_PARSE_H
|
||||
#ifndef AVCODEC_VORBIS_PARSER_H
|
||||
#define AVCODEC_VORBIS_PARSER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -75,4 +74,4 @@ int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf,
|
||||
|
||||
void av_vorbis_parse_reset(AVVorbisParseContext *s);
|
||||
|
||||
#endif /* AVCODEC_VORBIS_PARSE_H */
|
||||
#endif /* AVCODEC_VORBIS_PARSER_H */
|
||||
|
||||
+209
-37
@@ -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
|
||||
* formats. Its main two purposes are demuxing - i.e. splitting a media file
|
||||
@@ -78,6 +78,20 @@
|
||||
* if its AVClass is non-NULL, and the protocols layer. See the discussion on
|
||||
* nesting in @ref avoptions documentation to learn how to access those.
|
||||
*
|
||||
* @section urls
|
||||
* URL strings in libavformat are made of a scheme/protocol, a ':', and a
|
||||
* scheme specific string. URLs without a scheme and ':' used for local files
|
||||
* are supported but deprecated. "file:" should be used for local files.
|
||||
*
|
||||
* It is important that the scheme string is not taken from untrusted
|
||||
* sources without checks.
|
||||
*
|
||||
* Note that some schemes/protocols are quite powerful, allowing access to
|
||||
* both local and remote files, parts of them, concatenations of them, local
|
||||
* audio and video devices and so on.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup lavf_decoding Demuxing
|
||||
* @{
|
||||
* Demuxers read a media file and split it into chunks of data (@em packets). A
|
||||
@@ -88,10 +102,10 @@
|
||||
* cleanup.
|
||||
*
|
||||
* @section lavf_decoding_open Opening a media file
|
||||
* The minimum information required to open a file is its URL or filename, which
|
||||
* The minimum information required to open a file is its URL, which
|
||||
* is passed to avformat_open_input(), as in the following code:
|
||||
* @code
|
||||
* const char *url = "in.mp3";
|
||||
* const char *url = "file:in.mp3";
|
||||
* AVFormatContext *s = NULL;
|
||||
* int ret = avformat_open_input(&s, url, NULL, NULL);
|
||||
* if (ret < 0)
|
||||
@@ -149,8 +163,8 @@
|
||||
* av_read_frame() on it. Each call, if successful, will return an AVPacket
|
||||
* containing encoded data for one AVStream, identified by
|
||||
* AVPacket.stream_index. This packet may be passed straight into the libavcodec
|
||||
* decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or
|
||||
* avcodec_decode_subtitle2() if the caller wishes to decode the data.
|
||||
* decoding functions avcodec_send_packet() or avcodec_decode_subtitle2() if the
|
||||
* caller wishes to decode the data.
|
||||
*
|
||||
* AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be
|
||||
* set if known. They may also be unset (i.e. AV_NOPTS_VALUE for
|
||||
@@ -191,15 +205,15 @@
|
||||
* avio_open2() or a custom one.
|
||||
* - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must
|
||||
* be created with the avformat_new_stream() function. The caller should fill
|
||||
* the @ref AVStream.codec "stream codec context" information, such as the
|
||||
* codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id
|
||||
* the @ref AVStream.codecpar "stream codec parameters" information, such as the
|
||||
* codec @ref AVCodecParameters.codec_type "type", @ref AVCodecParameters.codec_id
|
||||
* "id" and other parameters (e.g. width / height, the pixel or sample format,
|
||||
* etc.) as known. The @ref AVStream.time_base "stream timebase" should
|
||||
* be set to the timebase that the caller desires to use for this stream (note
|
||||
* that the timebase actually used by the muxer can be different, as will be
|
||||
* described later).
|
||||
* - It is advised to manually initialize only the relevant fields in
|
||||
* AVCodecContext, rather than using @ref avcodec_copy_context() during
|
||||
* AVCodecParameters, rather than using @ref avcodec_parameters_copy() during
|
||||
* remuxing: there is no guarantee that the codec context values remain valid
|
||||
* for both input and output format contexts.
|
||||
* - The caller may fill in additional information, such as @ref
|
||||
@@ -298,7 +312,6 @@
|
||||
* @{
|
||||
* @}
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
@@ -516,7 +529,7 @@ typedef struct AVOutputFormat {
|
||||
* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER,
|
||||
* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
|
||||
* AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,
|
||||
* AVFMT_TS_NONSTRICT
|
||||
* AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE
|
||||
*/
|
||||
int flags;
|
||||
|
||||
@@ -605,6 +618,8 @@ typedef struct AVOutputFormat {
|
||||
* AVStream parameters that need to be set before packets are sent.
|
||||
* 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().
|
||||
*/
|
||||
int (*init)(struct AVFormatContext *);
|
||||
@@ -801,6 +816,9 @@ typedef struct AVIndexEntry {
|
||||
* is known
|
||||
*/
|
||||
#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 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. */
|
||||
@@ -824,11 +842,17 @@ typedef struct AVIndexEntry {
|
||||
#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */
|
||||
/**
|
||||
* 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
|
||||
* among the first few packets read from the file unless seeking takes place.
|
||||
* It can also be accessed at any time in AVStream.attached_pic.
|
||||
* APIC frame in ID3v2). The first (usually only) packet associated with it
|
||||
* will be returned among the first few packets read from the file unless
|
||||
* seeking takes place. It can also be accessed at any time in
|
||||
* AVStream.attached_pic.
|
||||
*/
|
||||
#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;
|
||||
|
||||
@@ -861,18 +885,13 @@ typedef struct AVStream {
|
||||
* encoding: set by the user, replaced by libavformat if left unset
|
||||
*/
|
||||
int id;
|
||||
#if FF_API_LAVF_AVCTX
|
||||
/**
|
||||
* Codec context associated with this stream. Allocated and freed by
|
||||
* libavformat.
|
||||
*
|
||||
* - decoding: The demuxer exports codec information stored in the headers
|
||||
* here.
|
||||
* - encoding: The user sets codec information, the muxer writes it to the
|
||||
* output. Mandatory fields as specified in AVCodecContext
|
||||
* documentation must be set even if this AVCodecContext is
|
||||
* not actually used for encoding.
|
||||
* @deprecated use the codecpar struct instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
AVCodecContext *codec;
|
||||
#endif
|
||||
void *priv_data;
|
||||
|
||||
#if FF_API_LAVF_FRAC
|
||||
@@ -990,7 +1009,7 @@ typedef struct AVStream {
|
||||
/**
|
||||
* Stream information used internally by av_find_stream_info()
|
||||
*/
|
||||
#define MAX_STD_TIMEBASES (30*12+7+6)
|
||||
#define MAX_STD_TIMEBASES (30*12+30+3+6)
|
||||
struct {
|
||||
int64_t last_dts;
|
||||
int64_t duration_gcd;
|
||||
@@ -1200,6 +1219,17 @@ typedef struct AVStream {
|
||||
* Must not be accessed in any way by callers.
|
||||
*/
|
||||
AVStreamInternal *internal;
|
||||
|
||||
/*
|
||||
* Codec parameters associated with this stream. Allocated and freed by
|
||||
* libavformat in avformat_new_stream() and avformat_free_context()
|
||||
* respectively.
|
||||
*
|
||||
* - demuxing: filled by libavformat on stream creation or in
|
||||
* avformat_find_stream_info()
|
||||
* - muxing: filled by the caller before avformat_write_header()
|
||||
*/
|
||||
AVCodecParameters *codecpar;
|
||||
} AVStream;
|
||||
|
||||
AVRational av_stream_get_r_frame_rate(const AVStream *s);
|
||||
@@ -1288,6 +1318,12 @@ typedef struct AVFormatInternal AVFormatInternal;
|
||||
* version bump.
|
||||
* sizeof(AVFormatContext) must not be used outside libav*, use
|
||||
* avformat_alloc_context() to create an AVFormatContext.
|
||||
*
|
||||
* Fields can be accessed through AVOptions (av_opt*),
|
||||
* the name string used matches the associated command line parameter name and
|
||||
* can be found in libavformat/options_table.h.
|
||||
* The AVOption/command line parameter names differ in some cases from the C
|
||||
* structure field names for historic reasons or brevity.
|
||||
*/
|
||||
typedef struct AVFormatContext {
|
||||
/**
|
||||
@@ -1423,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_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_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
|
||||
@@ -1768,7 +1806,6 @@ typedef struct AVFormatContext {
|
||||
/**
|
||||
* User data.
|
||||
* This is a place for some private data of the user.
|
||||
* Mostly usable with control_message_cb or any future callbacks in device's context.
|
||||
*/
|
||||
void *opaque;
|
||||
|
||||
@@ -1799,6 +1836,7 @@ typedef struct AVFormatContext {
|
||||
*/
|
||||
enum AVCodecID data_codec_id;
|
||||
|
||||
#if FF_API_OLD_OPEN_CALLBACKS
|
||||
/**
|
||||
* Called to open further IO contexts when needed for demuxing.
|
||||
*
|
||||
@@ -1813,8 +1851,61 @@ typedef struct AVFormatContext {
|
||||
* @See av_format_set_open_cb()
|
||||
*
|
||||
* Demuxing: Set by user.
|
||||
*
|
||||
* @deprecated Use io_open and io_close.
|
||||
*/
|
||||
attribute_deprecated
|
||||
int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ',' separated list of allowed protocols.
|
||||
* - encoding: unused
|
||||
* - decoding: set by user through AVOptions (NO direct access)
|
||||
*/
|
||||
char *protocol_whitelist;
|
||||
|
||||
/*
|
||||
* A callback for opening new IO streams.
|
||||
*
|
||||
* Whenever a muxer or a demuxer needs to open an IO stream (typically from
|
||||
* avformat_open_input() for demuxers, but for certain formats can happen at
|
||||
* other times as well), it will call this callback to obtain an IO context.
|
||||
*
|
||||
* @param s the format context
|
||||
* @param pb on success, the newly opened IO context should be returned here
|
||||
* @param url the url to open
|
||||
* @param flags a combination of AVIO_FLAG_*
|
||||
* @param options a dictionary of additional options, with the same
|
||||
* semantics as in avio_open2()
|
||||
* @return 0 on success, a negative AVERROR code on failure
|
||||
*
|
||||
* @note Certain muxers and demuxers do nesting, i.e. they open one or more
|
||||
* additional internal format contexts. Thus the AVFormatContext pointer
|
||||
* passed to this callback may be different from the one facing the caller.
|
||||
* It will, however, have the same 'opaque' field.
|
||||
*/
|
||||
int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url,
|
||||
int flags, AVDictionary **options);
|
||||
|
||||
/**
|
||||
* A callback for closing the streams opened with AVFormatContext.io_open().
|
||||
*/
|
||||
void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
|
||||
|
||||
/**
|
||||
* ',' separated list of disallowed protocols.
|
||||
* - encoding: unused
|
||||
* - decoding: set by user through AVOptions (NO direct access)
|
||||
*/
|
||||
char *protocol_blacklist;
|
||||
|
||||
/**
|
||||
* The maximum number of streams.
|
||||
* - encoding: unused
|
||||
* - decoding: set by user through AVOptions (NO direct access)
|
||||
*/
|
||||
int max_streams;
|
||||
} AVFormatContext;
|
||||
|
||||
int av_format_get_probe_score(const AVFormatContext *s);
|
||||
@@ -1832,8 +1923,10 @@ void * av_format_get_opaque(const AVFormatContext *s);
|
||||
void av_format_set_opaque(AVFormatContext *s, void *opaque);
|
||||
av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s);
|
||||
void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback);
|
||||
AVOpenCallback av_format_get_open_cb(const AVFormatContext *s);
|
||||
void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback);
|
||||
#if FF_API_OLD_OPEN_CALLBACKS
|
||||
attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s);
|
||||
attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function will cause global side data to be injected in the next packet
|
||||
@@ -1980,8 +2073,13 @@ uint8_t *av_stream_new_side_data(AVStream *stream,
|
||||
* @param size pointer for side information size to store (optional)
|
||||
* @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,
|
||||
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);
|
||||
|
||||
@@ -2059,7 +2157,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
||||
*
|
||||
* @param pb the bytestream to probe
|
||||
* @param fmt the input format is put here
|
||||
* @param filename the filename of the stream
|
||||
* @param url the url of the stream
|
||||
* @param logctx the log context
|
||||
* @param offset the offset within the bytestream to probe from
|
||||
* @param max_probe_size the maximum probe buffer size (zero for default)
|
||||
@@ -2068,14 +2166,14 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
||||
* AVERROR code otherwise
|
||||
*/
|
||||
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
|
||||
const char *filename, void *logctx,
|
||||
const char *url, void *logctx,
|
||||
unsigned int offset, unsigned int max_probe_size);
|
||||
|
||||
/**
|
||||
* Like av_probe_input_buffer2() but returns 0 on success
|
||||
*/
|
||||
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
const char *filename, void *logctx,
|
||||
const char *url, void *logctx,
|
||||
unsigned int offset, unsigned int max_probe_size);
|
||||
|
||||
/**
|
||||
@@ -2086,7 +2184,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
* May be a pointer to NULL, in which case an AVFormatContext is allocated by this
|
||||
* function and written into ps.
|
||||
* Note that a user-supplied AVFormatContext will be freed on failure.
|
||||
* @param filename Name of the stream to open.
|
||||
* @param url URL of the stream to open.
|
||||
* @param fmt If non-NULL, this parameter forces a specific input format.
|
||||
* Otherwise the format is autodetected.
|
||||
* @param options A dictionary filled with AVFormatContext and demuxer-private options.
|
||||
@@ -2097,7 +2195,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
*
|
||||
* @note If you want to use custom IO, preallocate the format context and set its pb field.
|
||||
*/
|
||||
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
|
||||
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);
|
||||
|
||||
attribute_deprecated
|
||||
int av_demuxer_open(AVFormatContext *ic);
|
||||
@@ -2291,6 +2389,10 @@ void avformat_close_input(AVFormatContext **s);
|
||||
* @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
|
||||
* an output media file.
|
||||
@@ -2302,13 +2404,37 @@ void avformat_close_input(AVFormatContext **s);
|
||||
* On return this parameter will be destroyed and replaced with a dict containing
|
||||
* options that were not found. May be NULL.
|
||||
*
|
||||
* @return 0 on success, 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
|
||||
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.
|
||||
*
|
||||
@@ -2356,6 +2482,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
|
||||
* increasing dts. Callers doing their own interleaving should call
|
||||
* av_write_frame() instead of this function.
|
||||
*
|
||||
* Using this function instead of av_write_frame() can give muxers advance
|
||||
* knowledge of future packets, improving e.g. the behaviour of the mp4
|
||||
* muxer for VFR content in fragmenting mode.
|
||||
*
|
||||
* @param s media file handle
|
||||
* @param pkt The packet containing the data to be written.
|
||||
* <br>
|
||||
@@ -2390,7 +2520,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
|
||||
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Write a uncoded frame to an output media file.
|
||||
* Write an uncoded frame to an output media file.
|
||||
*
|
||||
* The frame must be correctly interleaved according to the container
|
||||
* specification; if not, then av_interleaved_write_frame() must be used.
|
||||
@@ -2401,7 +2531,7 @@ int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
|
||||
AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Write a uncoded frame to an output media file.
|
||||
* Write an uncoded frame to an output media file.
|
||||
*
|
||||
* If the muxer supports it, this function makes it possible to write an AVFrame
|
||||
* structure directly, without encoding it into a packet.
|
||||
@@ -2643,6 +2773,9 @@ void av_dump_format(AVFormatContext *ic,
|
||||
const char *url,
|
||||
int is_output);
|
||||
|
||||
|
||||
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d
|
||||
|
||||
/**
|
||||
* Return in 'buf' the path with '%d' replaced by a number.
|
||||
*
|
||||
@@ -2653,8 +2786,12 @@ void av_dump_format(AVFormatContext *ic,
|
||||
* @param buf_size destination buffer size
|
||||
* @param path numbered sequence string
|
||||
* @param number frame number
|
||||
* @param flags AV_FRAME_FILENAME_FLAGS_*
|
||||
* @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,
|
||||
const char *path, int number);
|
||||
|
||||
@@ -2791,13 +2928,48 @@ int avformat_queue_attached_pictures(AVFormatContext *s);
|
||||
* Apply a list of bitstream filters to a packet.
|
||||
*
|
||||
* @param codec AVCodecContext, usually from an AVStream
|
||||
* @param pkt the packet to apply filters to
|
||||
* @param pkt the packet to apply filters to. If, on success, the returned
|
||||
* packet has size == 0 and side_data_elems == 0, it indicates that
|
||||
* the packet should be dropped
|
||||
* @param bsfc a NULL-terminated list of filters to apply
|
||||
* @return >=0 on success;
|
||||
* AVERROR code on failure
|
||||
*/
|
||||
#if FF_API_OLD_BSF
|
||||
attribute_deprecated
|
||||
int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
|
||||
AVBitStreamFilterContext *bsfc);
|
||||
#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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
+78
-4
@@ -96,6 +96,42 @@ typedef struct AVIODirContext {
|
||||
struct URLContext *url_context;
|
||||
} AVIODirContext;
|
||||
|
||||
/**
|
||||
* Different data types that can be returned via the AVIO
|
||||
* write_data_type callback.
|
||||
*/
|
||||
enum AVIODataMarkerType {
|
||||
/**
|
||||
* Header data; this needs to be present for the stream to be decodeable.
|
||||
*/
|
||||
AVIO_DATA_MARKER_HEADER,
|
||||
/**
|
||||
* A point in the output bytestream where a decoder can start decoding
|
||||
* (i.e. a keyframe). A demuxer/decoder given the data flagged with
|
||||
* AVIO_DATA_MARKER_HEADER, followed by any AVIO_DATA_MARKER_SYNC_POINT,
|
||||
* should give decodeable results.
|
||||
*/
|
||||
AVIO_DATA_MARKER_SYNC_POINT,
|
||||
/**
|
||||
* A point in the output bytestream where a demuxer can start parsing
|
||||
* (for non self synchronizing bytestream formats). That is, any
|
||||
* non-keyframe packet start point.
|
||||
*/
|
||||
AVIO_DATA_MARKER_BOUNDARY_POINT,
|
||||
/**
|
||||
* This is any, unlabelled data. It can either be a muxer not marking
|
||||
* any positions at all, it can be an actual boundary/sync point
|
||||
* that the muxer chooses not to mark, or a later part of a packet/fragment
|
||||
* that is cut into multiple write callbacks due to limited IO buffer size.
|
||||
*/
|
||||
AVIO_DATA_MARKER_UNKNOWN,
|
||||
/**
|
||||
* Trailer data, which doesn't contain actual content, but only for
|
||||
* finalizing the output file.
|
||||
*/
|
||||
AVIO_DATA_MARKER_TRAILER
|
||||
};
|
||||
|
||||
/**
|
||||
* Bytestream IO Context.
|
||||
* New fields can be added to the end with minor version bumps.
|
||||
@@ -249,9 +285,35 @@ typedef struct AVIOContext {
|
||||
* This is current internal only, do not use from outside.
|
||||
*/
|
||||
int short_seek_threshold;
|
||||
} AVIOContext;
|
||||
|
||||
/* unbuffered I/O */
|
||||
/**
|
||||
* ',' separated list of allowed protocols.
|
||||
*/
|
||||
const char *protocol_whitelist;
|
||||
|
||||
/**
|
||||
* ',' separated list of disallowed protocols.
|
||||
*/
|
||||
const char *protocol_blacklist;
|
||||
|
||||
/**
|
||||
* A callback that is used instead of write_packet.
|
||||
*/
|
||||
int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,
|
||||
enum AVIODataMarkerType type, int64_t time);
|
||||
/**
|
||||
* If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,
|
||||
* but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly
|
||||
* small chunks of data returned from the callback).
|
||||
*/
|
||||
int ignore_boundary_point;
|
||||
|
||||
/**
|
||||
* Internal, not meant to be used from outside of AVIOContext.
|
||||
*/
|
||||
enum AVIODataMarkerType current_type;
|
||||
int64_t last_time;
|
||||
} AVIOContext;
|
||||
|
||||
/**
|
||||
* Return the name of the protocol that will handle the passed URL.
|
||||
@@ -404,14 +466,26 @@ int avio_put_str16le(AVIOContext *s, const char *str);
|
||||
int avio_put_str16be(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Passing this as the "whence" parameter to a seek function causes it to
|
||||
* Mark the written bytestream as a specific type.
|
||||
*
|
||||
* Zero-length ranges are omitted from the output.
|
||||
*
|
||||
* @param time the stream time the current bytestream pos corresponds to
|
||||
* (in AV_TIME_BASE units), or AV_NOPTS_VALUE if unknown or not
|
||||
* applicable
|
||||
* @param type the kind of data written starting at the current pos
|
||||
*/
|
||||
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type);
|
||||
|
||||
/**
|
||||
* ORing this as the "whence" parameter to a seek function causes it to
|
||||
* return the filesize without seeking anywhere. Supporting this is optional.
|
||||
* If it is not supported then the seek function will return <0.
|
||||
*/
|
||||
#define AVSEEK_SIZE 0x10000
|
||||
|
||||
/**
|
||||
* Oring this flag as into the "whence" parameter to a seek function causes it to
|
||||
* Passing this flag as the "whence" parameter to a seek function causes it to
|
||||
* seek by any means (like reopening and linear reading) or other normally unreasonable
|
||||
* means that can be extremely slow.
|
||||
* This may be ignored by the seek code.
|
||||
|
||||
+16
-2
@@ -29,9 +29,11 @@
|
||||
|
||||
#include "libavutil/version.h"
|
||||
|
||||
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
|
||||
// Also please add any ticket numbers that you believe might be affected here
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 57
|
||||
#define LIBAVFORMAT_VERSION_MINOR 21
|
||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
||||
#define LIBAVFORMAT_VERSION_MINOR 56
|
||||
#define LIBAVFORMAT_VERSION_MICRO 101
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
@@ -71,6 +73,18 @@
|
||||
#ifndef FF_API_COMPUTE_PKT_FIELDS2
|
||||
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_OPEN_CALLBACKS
|
||||
#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_LAVF_AVCTX
|
||||
#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 58)
|
||||
#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
|
||||
#define FF_API_R_FRAME_RATE 1
|
||||
|
||||
+9
-4
@@ -18,6 +18,12 @@
|
||||
* 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
|
||||
#define AVUTIL_ADLER32_H
|
||||
|
||||
@@ -25,11 +31,10 @@
|
||||
#include "attributes.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Public header for libavutil Adler32 hasher
|
||||
* @defgroup lavu_adler32 Adler-32
|
||||
* @ingroup lavu_hash
|
||||
* Adler-32 hash function implementation.
|
||||
*
|
||||
* @defgroup lavu_adler32 Adler32
|
||||
* @ingroup lavu_crypto
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
+17
@@ -110,6 +110,23 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
|
||||
*/
|
||||
int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples);
|
||||
|
||||
/**
|
||||
* Peek data from an AVAudioFifo.
|
||||
*
|
||||
* @see enum AVSampleFormat
|
||||
* The documentation for AVSampleFormat describes the data layout.
|
||||
*
|
||||
* @param af AVAudioFifo to read from
|
||||
* @param data audio data plane pointers
|
||||
* @param nb_samples number of samples to peek
|
||||
* @param offset offset from current read position
|
||||
* @return number of samples actually peek, or negative AVERROR code
|
||||
* on failure. The number of samples actually peek will not
|
||||
* be greater than nb_samples, and will only be less than
|
||||
* nb_samples if av_audio_fifo_size is less than nb_samples.
|
||||
*/
|
||||
int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offset);
|
||||
|
||||
/**
|
||||
* Read data from an AVAudioFifo.
|
||||
*
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#if FF_API_AUDIOCONVERT
|
||||
#include "channel_layout.h"
|
||||
#endif
|
||||
+10
-1
@@ -45,7 +45,7 @@
|
||||
|
||||
/**
|
||||
* assert() equivalent, that does not lie in speed critical code.
|
||||
* These asserts() thus can be enabled without fearing speedloss.
|
||||
* These asserts() thus can be enabled without fearing speed loss.
|
||||
*/
|
||||
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
|
||||
#define av_assert1(cond) av_assert0(cond)
|
||||
@@ -59,8 +59,17 @@
|
||||
*/
|
||||
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
|
||||
#define av_assert2(cond) av_assert0(cond)
|
||||
#define av_assert2_fpu() av_assert0_fpu()
|
||||
#else
|
||||
#define av_assert2(cond) ((void)0)
|
||||
#define av_assert2_fpu() ((void)0)
|
||||
#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 */
|
||||
|
||||
@@ -3,5 +3,4 @@
|
||||
#define AVUTIL_AVCONFIG_H
|
||||
#define AV_HAVE_BIGENDIAN 0
|
||||
#define AV_HAVE_FAST_UNALIGNED 1
|
||||
#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
|
||||
#endif /* AVUTIL_AVCONFIG_H */
|
||||
|
||||
+6
-1
@@ -156,7 +156,7 @@ static inline size_t av_strnlen(const char *s, size_t len)
|
||||
char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
|
||||
|
||||
/**
|
||||
* Convert a number to a av_malloced string.
|
||||
* Convert a number to an av_malloced string.
|
||||
*/
|
||||
char *av_d2str(double d);
|
||||
|
||||
@@ -284,6 +284,11 @@ const char *av_dirname(char *path);
|
||||
|
||||
/**
|
||||
* Match instances of a name in a comma-separated list of names.
|
||||
* List entries are checked from the start to the end of the names list,
|
||||
* the first match ends further processing. If an entry prefixed with '-'
|
||||
* matches, then 0 is returned. The "ALL" list entry is considered to
|
||||
* match all names.
|
||||
*
|
||||
* @param name Name to look for.
|
||||
* @param names List of names.
|
||||
* @return 1 on match, 0 otherwise.
|
||||
|
||||
+12
-10
@@ -23,7 +23,8 @@
|
||||
|
||||
/**
|
||||
* @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
|
||||
* libavutil contains the code shared across all the other FFmpeg
|
||||
* libraries
|
||||
*
|
||||
* @note In order to use the functions provided by avutil you must include
|
||||
* the specific header.
|
||||
* @note
|
||||
* libavutil is designed to be modular. In most cases, in order to use the
|
||||
* functions provided by one component of libavutil you must explicitly include
|
||||
* the specific header containing that feature. If you are only using
|
||||
* media-related components, you could simply include libavutil/avutil.h, which
|
||||
* brings in most of the "core" components.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
@@ -94,7 +96,7 @@
|
||||
* @{
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_math Maths
|
||||
* @defgroup lavu_math Mathematics
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
@@ -266,7 +268,7 @@ enum AVPictureType {
|
||||
AV_PICTURE_TYPE_I, ///< Intra
|
||||
AV_PICTURE_TYPE_P, ///< Predicted
|
||||
AV_PICTURE_TYPE_B, ///< Bi-dir predicted
|
||||
AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4
|
||||
AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
|
||||
AV_PICTURE_TYPE_SI, ///< Switching Intra
|
||||
AV_PICTURE_TYPE_SP, ///< Switching Predicted
|
||||
AV_PICTURE_TYPE_BI, ///< BI type
|
||||
|
||||
+7
-2
@@ -29,19 +29,24 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Decode a base64-encoded string.
|
||||
*
|
||||
* @param out buffer for decoded data
|
||||
* @param in null-terminated input string
|
||||
* @param out_size size in bytes of the out buffer, must be at
|
||||
* least 3/4 of the length of in
|
||||
* least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
|
||||
* @return number of bytes written, or a negative value in case of
|
||||
* invalid input
|
||||
*/
|
||||
int av_base64_decode(uint8_t *out, const char *in, int out_size);
|
||||
|
||||
/**
|
||||
* Calculate the output size in bytes needed to decode a base64 string
|
||||
* with length x to a data buffer.
|
||||
*/
|
||||
#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
|
||||
|
||||
/**
|
||||
* Encode data to base64 and null-terminate.
|
||||
*
|
||||
|
||||
+17
-1
@@ -248,6 +248,23 @@ typedef struct AVBufferPool AVBufferPool;
|
||||
*/
|
||||
AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
|
||||
|
||||
/**
|
||||
* Allocate and initialize a buffer pool with a more complex allocator.
|
||||
*
|
||||
* @param size size of each buffer in this pool
|
||||
* @param opaque arbitrary user data used by the allocator
|
||||
* @param alloc a function that will be used to allocate new buffers when the
|
||||
* pool is empty.
|
||||
* @param pool_free a function that will be called immediately before the pool
|
||||
* is freed. I.e. after av_buffer_pool_can_uninit() is called
|
||||
* by the pool and all the frames are returned to the pool and
|
||||
* freed. It is intended to uninitialize the user opaque data.
|
||||
* @return newly created buffer pool on success, NULL on error.
|
||||
*/
|
||||
AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
|
||||
AVBufferRef* (*alloc)(void *opaque, int size),
|
||||
void (*pool_free)(void *opaque));
|
||||
|
||||
/**
|
||||
* Mark the pool as being available for freeing. It will actually be freed only
|
||||
* once all the allocated buffers associated with the pool are released. Thus it
|
||||
@@ -255,7 +272,6 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
|
||||
* in use.
|
||||
*
|
||||
* @param pool pointer to the pool to be freed. It will be set to NULL.
|
||||
* @see av_buffer_pool_can_uninit()
|
||||
*/
|
||||
void av_buffer_pool_uninit(AVBufferPool **pool);
|
||||
|
||||
|
||||
+16
-5
@@ -54,9 +54,12 @@
|
||||
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
|
||||
/* assume b>0 */
|
||||
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
|
||||
/* assume a>0 and b>0 */
|
||||
#define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
|
||||
/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
|
||||
#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
|
||||
: ((a) + (1<<(b)) - 1) >> (b))
|
||||
/* Backwards compat. */
|
||||
#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
|
||||
|
||||
#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
|
||||
#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
|
||||
|
||||
@@ -211,7 +214,7 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
|
||||
*/
|
||||
static av_always_inline av_const int av_clip_intp2_c(int a, int p)
|
||||
{
|
||||
if ((a + (1 << p)) & ~((2 << p) - 1))
|
||||
if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
|
||||
return (a >> 31) ^ ((1 << p) - 1);
|
||||
else
|
||||
return a;
|
||||
@@ -331,6 +334,11 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
|
||||
return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
|
||||
}
|
||||
|
||||
static av_always_inline av_const int av_parity_c(uint32_t v)
|
||||
{
|
||||
return av_popcount(v) & 1;
|
||||
}
|
||||
|
||||
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
|
||||
#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
|
||||
|
||||
@@ -351,13 +359,13 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
|
||||
* to prevent undefined results.
|
||||
*/
|
||||
#define GET_UTF8(val, GET_BYTE, ERROR)\
|
||||
val= GET_BYTE;\
|
||||
val= (GET_BYTE);\
|
||||
{\
|
||||
uint32_t top = (val & 128) >> 1;\
|
||||
if ((val & 0xc0) == 0x80 || val >= 0xFE)\
|
||||
ERROR\
|
||||
while (val & top) {\
|
||||
int tmp= GET_BYTE - 128;\
|
||||
int tmp= (GET_BYTE) - 128;\
|
||||
if(tmp>>6)\
|
||||
ERROR\
|
||||
val= (val<<6) + tmp;\
|
||||
@@ -517,3 +525,6 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
|
||||
#ifndef av_popcount64
|
||||
# define av_popcount64 av_popcount64_c
|
||||
#endif
|
||||
#ifndef av_parity
|
||||
# define av_parity av_parity_c
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@
|
||||
/**
|
||||
* Return the flags which specify extensions supported by the CPU.
|
||||
* The returned value is affected by av_force_cpu_flags() if that was used
|
||||
* before. So av_get_cpu_flags() can easily be used in a application to
|
||||
* before. So av_get_cpu_flags() can easily be used in an application to
|
||||
* detect the enabled cpu flags.
|
||||
*/
|
||||
int av_get_cpu_flags(void);
|
||||
|
||||
+14
-2
@@ -18,6 +18,12 @@
|
||||
* 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
|
||||
#define AVUTIL_CRC_H
|
||||
|
||||
@@ -27,8 +33,14 @@
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_crc32 CRC32
|
||||
* @ingroup lavu_crypto
|
||||
* @defgroup lavu_crc32 CRC
|
||||
* @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.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
+6
-4
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
@@ -65,7 +64,6 @@
|
||||
}
|
||||
av_dict_free(&d);
|
||||
@endcode
|
||||
*
|
||||
*/
|
||||
|
||||
#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
|
||||
@@ -78,6 +76,7 @@
|
||||
#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
|
||||
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
|
||||
delimiter is added, the strings are simply concatenated. */
|
||||
#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
|
||||
|
||||
typedef struct AVDictionaryEntry {
|
||||
char *key;
|
||||
@@ -118,10 +117,13 @@ int av_dict_count(const AVDictionary *m);
|
||||
* Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
|
||||
* these arguments will be freed on error.
|
||||
*
|
||||
* Warning: Adding a new entry to a dictionary invalidates all existing entries
|
||||
* previously returned with av_dict_get.
|
||||
*
|
||||
* @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
|
||||
* a dictionary struct is allocated and put in *pm.
|
||||
* @param key entry key to add to *pm (will be av_strduped depending on flags)
|
||||
* @param value entry value to add to *pm (will be av_strduped depending on flags).
|
||||
* @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
|
||||
* @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
|
||||
* Passing a NULL value will cause an existing entry to be deleted.
|
||||
* @return >= 0 on success otherwise an error code <0
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define AVUTIL_DISPLAY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* The display transformation matrix specifies an affine transformation that
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Automatically generated by version.sh, do not manually edit! */
|
||||
#ifndef AVUTIL_FFVERSION_H
|
||||
#define AVUTIL_FFVERSION_H
|
||||
#define FFMPEG_VERSION "git-2015-12-28-4deafba"
|
||||
#define FFMPEG_VERSION "3.2.4"
|
||||
#endif /* AVUTIL_FFVERSION_H */
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ void av_file_unmap(uint8_t *bufptr, size_t size);
|
||||
* @note On very old libcs it is necessary to set a secure umask before
|
||||
* calling this, av_tempfile() can't call umask itself as it is used in
|
||||
* libraries and could interfere with the calling application.
|
||||
* @deprecated as fd numbers cannot be passed saftely between libs on some platforms
|
||||
*/
|
||||
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
|
||||
|
||||
|
||||
+45
-3
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
@@ -106,12 +105,22 @@ enum AVFrameSideDataType {
|
||||
* @endcode
|
||||
*/
|
||||
AV_FRAME_DATA_SKIP_SAMPLES,
|
||||
|
||||
/**
|
||||
* This side data must be associated with an audio frame and corresponds to
|
||||
* enum AVAudioServiceType defined in avcodec.h.
|
||||
*/
|
||||
AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
|
||||
/**
|
||||
* Mastering display metadata associated with a video frame. The payload is
|
||||
* an AVMasteringDisplayMetadata type and contains information about the
|
||||
* mastering display color volume.
|
||||
*/
|
||||
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
|
||||
/**
|
||||
* The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
|
||||
* This is set on the first frame of a GOP that has a temporal reference of 0.
|
||||
*/
|
||||
AV_FRAME_DATA_GOP_TIMECODE
|
||||
};
|
||||
|
||||
enum AVActiveFormatDescription {
|
||||
@@ -167,6 +176,10 @@ typedef struct AVFrameSideData {
|
||||
* Similarly fields that are marked as to be only accessed by
|
||||
* av_opt_ptr() can be reordered. This allows 2 forks to add fields
|
||||
* without breaking compatibility with each other.
|
||||
*
|
||||
* Fields can be accessed through AVOptions, the name string used, matches the
|
||||
* C structure field name for fields accessible through AVOptions. The AVClass
|
||||
* for AVFrame can be obtained from avcodec_get_frame_class()
|
||||
*/
|
||||
typedef struct AVFrame {
|
||||
#define AV_NUM_DATA_POINTERS 8
|
||||
@@ -178,6 +191,9 @@ typedef struct AVFrame {
|
||||
* see avcodec_align_dimensions2(). Some filters and swscale can read
|
||||
* up to 16 bytes beyond the planes, if these filters are to be used,
|
||||
* then 16 extra bytes must be allocated.
|
||||
*
|
||||
* NOTE: Except for hwaccel formats, pointers not needed by the format
|
||||
* MUST be set to NULL.
|
||||
*/
|
||||
uint8_t *data[AV_NUM_DATA_POINTERS];
|
||||
|
||||
@@ -251,10 +267,14 @@ typedef struct AVFrame {
|
||||
*/
|
||||
int64_t pts;
|
||||
|
||||
#if FF_API_PKT_PTS
|
||||
/**
|
||||
* PTS copied from the AVPacket that was decoded to produce this frame.
|
||||
* @deprecated use the pts field instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
int64_t pkt_pts;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
|
||||
@@ -312,7 +332,7 @@ typedef struct AVFrame {
|
||||
int palette_has_changed;
|
||||
|
||||
/**
|
||||
* reordered opaque 64bit (generally an integer or a double precision float
|
||||
* reordered opaque 64 bits (generally an integer or a double precision float
|
||||
* PTS but can be anything).
|
||||
* The user sets AVCodecContext.reordered_opaque to represent the input at
|
||||
* that time,
|
||||
@@ -369,6 +389,7 @@ typedef struct AVFrame {
|
||||
|
||||
/**
|
||||
* @defgroup lavu_frame_flags AV_FRAME_FLAGS
|
||||
* @ingroup lavu_frame
|
||||
* Flags describing additional frame properties.
|
||||
*
|
||||
* @{
|
||||
@@ -378,6 +399,10 @@ typedef struct AVFrame {
|
||||
* The frame data may be corrupted, e.g. due to decoding errors.
|
||||
*/
|
||||
#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)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -502,6 +527,11 @@ typedef struct AVFrame {
|
||||
*/
|
||||
AVBufferRef *qp_table_buf;
|
||||
#endif
|
||||
/**
|
||||
* For hwaccel-format frames, this should be a reference to the
|
||||
* AVHWFramesContext describing the frame.
|
||||
*/
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
} AVFrame;
|
||||
|
||||
/**
|
||||
@@ -573,6 +603,10 @@ void av_frame_free(AVFrame **frame);
|
||||
* If src is not reference counted, new buffers are allocated and the data is
|
||||
* copied.
|
||||
*
|
||||
* @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
|
||||
* or newly allocated with av_frame_alloc() before calling this
|
||||
* function, or undefined behavior will occur.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error
|
||||
*/
|
||||
int av_frame_ref(AVFrame *dst, const AVFrame *src);
|
||||
@@ -593,6 +627,10 @@ void av_frame_unref(AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Move everything contained in src to dst and reset src.
|
||||
*
|
||||
* @warning: dst is not unreferenced, but directly overwritten without reading
|
||||
* or deallocating its contents. Call av_frame_unref(dst) manually
|
||||
* before calling this function to ensure that no memory is leaked.
|
||||
*/
|
||||
void av_frame_move_ref(AVFrame *dst, AVFrame *src);
|
||||
|
||||
@@ -608,6 +646,10 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
|
||||
* necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
|
||||
* For planar formats, one buffer will be allocated for each plane.
|
||||
*
|
||||
* @warning: if frame already has been allocated, calling this function will
|
||||
* leak memory. In addition, undefined behavior can occur in certain
|
||||
* cases.
|
||||
*
|
||||
* @param frame frame in which to store the new buffers.
|
||||
* @param align required buffer size alignment
|
||||
*
|
||||
|
||||
+171
-20
@@ -18,18 +18,108 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavu_hash_generic
|
||||
* Generic hashing API
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_HASH_H
|
||||
#define AVUTIL_HASH_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;
|
||||
|
||||
/**
|
||||
* Allocate a hash context for the algorithm specified by name.
|
||||
*
|
||||
* @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);
|
||||
|
||||
@@ -38,8 +128,8 @@ int av_hash_alloc(struct AVHashContext **ctx, const char *name);
|
||||
*
|
||||
* This function can be used to enumerate the algorithms.
|
||||
*
|
||||
* @param i index of the hash algorithm, starting from 0
|
||||
* @return a pointer to a static string or NULL if i is out of range
|
||||
* @param[in] i Index of the hash algorithm, starting from 0
|
||||
* @return Pointer to a static string or `NULL` if `i` is out of range
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* and are fine with not supporting hashes newly added to 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
|
||||
* your code to overflow a buffer.
|
||||
* You can use this if you absolutely want or need to use static allocation for
|
||||
* the output buffer and are fine with not supporting hashes newly added to
|
||||
* libavutil without recompilation.
|
||||
*
|
||||
* @warning
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Initialize or reset a hash context.
|
||||
*
|
||||
* @param[in,out] ctx Hash context
|
||||
*/
|
||||
void av_hash_init(struct AVHashContext *ctx);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Finalize a hash context and compute the actual hash value.
|
||||
* If size is smaller than the hash size, the hash is truncated;
|
||||
* if size is larger, the buffer is padded with 0.
|
||||
* Finalize a hash context and store the actual hash value in a buffer.
|
||||
*
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_HASH_H */
|
||||
|
||||
+429
@@ -0,0 +1,429 @@
|
||||
/*
|
||||
* 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_H
|
||||
#define AVUTIL_HWCONTEXT_H
|
||||
|
||||
#include "buffer.h"
|
||||
#include "frame.h"
|
||||
#include "log.h"
|
||||
#include "pixfmt.h"
|
||||
|
||||
enum AVHWDeviceType {
|
||||
AV_HWDEVICE_TYPE_VDPAU,
|
||||
AV_HWDEVICE_TYPE_CUDA,
|
||||
AV_HWDEVICE_TYPE_VAAPI,
|
||||
AV_HWDEVICE_TYPE_DXVA2,
|
||||
AV_HWDEVICE_TYPE_QSV,
|
||||
};
|
||||
|
||||
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
|
||||
|
||||
/**
|
||||
* This struct aggregates all the (hardware/vendor-specific) "high-level" state,
|
||||
* i.e. state that is not tied to a concrete processing configuration.
|
||||
* E.g., in an API that supports hardware-accelerated encoding and decoding,
|
||||
* this struct will (if possible) wrap the state that is common to both encoding
|
||||
* and decoding and from which specific instances of encoders or decoders can be
|
||||
* derived.
|
||||
*
|
||||
* This struct is reference-counted with the AVBuffer mechanism. The
|
||||
* av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
|
||||
* points to the actual AVHWDeviceContext. Further objects derived from
|
||||
* AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
|
||||
* specific properties) will hold an internal reference to it. After all the
|
||||
* references are released, the AVHWDeviceContext itself will be freed,
|
||||
* optionally invoking a user-specified callback for uninitializing the hardware
|
||||
* state.
|
||||
*/
|
||||
typedef struct AVHWDeviceContext {
|
||||
/**
|
||||
* A class for logging. Set by av_hwdevice_ctx_alloc().
|
||||
*/
|
||||
const AVClass *av_class;
|
||||
|
||||
/**
|
||||
* Private data used internally by libavutil. Must not be accessed in any
|
||||
* way by the caller.
|
||||
*/
|
||||
AVHWDeviceInternal *internal;
|
||||
|
||||
/**
|
||||
* This field identifies the underlying API used for hardware access.
|
||||
*
|
||||
* This field is set when this struct is allocated and never changed
|
||||
* afterwards.
|
||||
*/
|
||||
enum AVHWDeviceType type;
|
||||
|
||||
/**
|
||||
* The format-specific data, allocated and freed by libavutil along with
|
||||
* this context.
|
||||
*
|
||||
* Should be cast by the user to the format-specific context defined in the
|
||||
* corresponding header (hwcontext_*.h) and filled as described in the
|
||||
* documentation before calling av_hwdevice_ctx_init().
|
||||
*
|
||||
* After calling av_hwdevice_ctx_init() this struct should not be modified
|
||||
* by the caller.
|
||||
*/
|
||||
void *hwctx;
|
||||
|
||||
/**
|
||||
* This field may be set by the caller before calling av_hwdevice_ctx_init().
|
||||
*
|
||||
* If non-NULL, this callback will be called when the last reference to
|
||||
* this context is unreferenced, immediately before it is freed.
|
||||
*
|
||||
* @note when other objects (e.g an AVHWFramesContext) are derived from this
|
||||
* struct, this callback will be invoked after all such child objects
|
||||
* are fully uninitialized and their respective destructors invoked.
|
||||
*/
|
||||
void (*free)(struct AVHWDeviceContext *ctx);
|
||||
|
||||
/**
|
||||
* Arbitrary user data, to be used e.g. by the free() callback.
|
||||
*/
|
||||
void *user_opaque;
|
||||
} AVHWDeviceContext;
|
||||
|
||||
typedef struct AVHWFramesInternal AVHWFramesInternal;
|
||||
|
||||
/**
|
||||
* This struct describes a set or pool of "hardware" frames (i.e. those with
|
||||
* data not located in normal system memory). All the frames in the pool are
|
||||
* assumed to be allocated in the same way and interchangeable.
|
||||
*
|
||||
* This struct is reference-counted with the AVBuffer mechanism and tied to a
|
||||
* given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
|
||||
* yields a reference, whose data field points to the actual AVHWFramesContext
|
||||
* struct.
|
||||
*/
|
||||
typedef struct AVHWFramesContext {
|
||||
/**
|
||||
* A class for logging.
|
||||
*/
|
||||
const AVClass *av_class;
|
||||
|
||||
/**
|
||||
* Private data used internally by libavutil. Must not be accessed in any
|
||||
* way by the caller.
|
||||
*/
|
||||
AVHWFramesInternal *internal;
|
||||
|
||||
/**
|
||||
* A reference to the parent AVHWDeviceContext. This reference is owned and
|
||||
* managed by the enclosing AVHWFramesContext, but the caller may derive
|
||||
* additional references from it.
|
||||
*/
|
||||
AVBufferRef *device_ref;
|
||||
|
||||
/**
|
||||
* The parent AVHWDeviceContext. This is simply a pointer to
|
||||
* device_ref->data provided for convenience.
|
||||
*
|
||||
* Set by libavutil in av_hwframe_ctx_init().
|
||||
*/
|
||||
AVHWDeviceContext *device_ctx;
|
||||
|
||||
/**
|
||||
* The format-specific data, allocated and freed automatically along with
|
||||
* this context.
|
||||
*
|
||||
* Should be cast by the user to the format-specific context defined in the
|
||||
* corresponding header (hwframe_*.h) and filled as described in the
|
||||
* documentation before calling av_hwframe_ctx_init().
|
||||
*
|
||||
* After any frames using this context are created, the contents of this
|
||||
* struct should not be modified by the caller.
|
||||
*/
|
||||
void *hwctx;
|
||||
|
||||
/**
|
||||
* This field may be set by the caller before calling av_hwframe_ctx_init().
|
||||
*
|
||||
* If non-NULL, this callback will be called when the last reference to
|
||||
* this context is unreferenced, immediately before it is freed.
|
||||
*/
|
||||
void (*free)(struct AVHWFramesContext *ctx);
|
||||
|
||||
/**
|
||||
* Arbitrary user data, to be used e.g. by the free() callback.
|
||||
*/
|
||||
void *user_opaque;
|
||||
|
||||
/**
|
||||
* A pool from which the frames are allocated by av_hwframe_get_buffer().
|
||||
* This field may be set by the caller before calling av_hwframe_ctx_init().
|
||||
* The buffers returned by calling av_buffer_pool_get() on this pool must
|
||||
* have the properties described in the documentation in the corresponding hw
|
||||
* type's header (hwcontext_*.h). The pool will be freed strictly before
|
||||
* this struct's free() callback is invoked.
|
||||
*
|
||||
* This field may be NULL, then libavutil will attempt to allocate a pool
|
||||
* internally. Note that certain device types enforce pools allocated at
|
||||
* fixed size (frame count), which cannot be extended dynamically. In such a
|
||||
* case, initial_pool_size must be set appropriately.
|
||||
*/
|
||||
AVBufferPool *pool;
|
||||
|
||||
/**
|
||||
* Initial size of the frame pool. If a device type does not support
|
||||
* dynamically resizing the pool, then this is also the maximum pool size.
|
||||
*
|
||||
* May be set by the caller before calling av_hwframe_ctx_init(). Must be
|
||||
* set if pool is NULL and the device type does not support dynamic pools.
|
||||
*/
|
||||
int initial_pool_size;
|
||||
|
||||
/**
|
||||
* The pixel format identifying the underlying HW surface type.
|
||||
*
|
||||
* Must be a hwaccel format, i.e. the corresponding descriptor must have the
|
||||
* AV_PIX_FMT_FLAG_HWACCEL flag set.
|
||||
*
|
||||
* Must be set by the user before calling av_hwframe_ctx_init().
|
||||
*/
|
||||
enum AVPixelFormat format;
|
||||
|
||||
/**
|
||||
* The pixel format identifying the actual data layout of the hardware
|
||||
* frames.
|
||||
*
|
||||
* Must be set by the caller before calling av_hwframe_ctx_init().
|
||||
*
|
||||
* @note when the underlying API does not provide the exact data layout, but
|
||||
* only the colorspace/bit depth, this field should be set to the fully
|
||||
* planar version of that format (e.g. for 8-bit 420 YUV it should be
|
||||
* AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
|
||||
*/
|
||||
enum AVPixelFormat sw_format;
|
||||
|
||||
/**
|
||||
* The allocated dimensions of the frames in this pool.
|
||||
*
|
||||
* Must be set by the user before calling av_hwframe_ctx_init().
|
||||
*/
|
||||
int width, height;
|
||||
} AVHWFramesContext;
|
||||
|
||||
/**
|
||||
* Allocate an AVHWDeviceContext for a given pixel format.
|
||||
*
|
||||
* @param format a hwaccel pixel format (AV_PIX_FMT_FLAG_HWACCEL must be set
|
||||
* on the corresponding format descriptor)
|
||||
* @return a reference to the newly created AVHWDeviceContext on success or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
|
||||
|
||||
/**
|
||||
* Finalize the device context before use. This function must be called after
|
||||
* the context is filled with all the required information and before it is
|
||||
* used in any way.
|
||||
*
|
||||
* @param ref a reference to the AVHWDeviceContext
|
||||
* @return 0 on success, a negative AVERROR code on failure
|
||||
*/
|
||||
int av_hwdevice_ctx_init(AVBufferRef *ref);
|
||||
|
||||
/**
|
||||
* Open a device of the specified type and create an AVHWDeviceContext for it.
|
||||
*
|
||||
* This is a convenience function intended to cover the simple cases. Callers
|
||||
* who need to fine-tune device creation/management should open the device
|
||||
* manually and then wrap it in an AVHWDeviceContext using
|
||||
* av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
|
||||
*
|
||||
* The returned context is already initialized and ready for use, the caller
|
||||
* should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
|
||||
* the created AVHWDeviceContext are set by this function and should not be
|
||||
* touched by the caller.
|
||||
*
|
||||
* @param device_ctx On success, a reference to the newly-created device context
|
||||
* will be written here. The reference is owned by the caller
|
||||
* and must be released with av_buffer_unref() when no longer
|
||||
* needed. On failure, NULL will be written to this pointer.
|
||||
* @param type The type of the device to create.
|
||||
* @param device A type-specific string identifying the device to open.
|
||||
* @param opts A dictionary of additional (type-specific) options to use in
|
||||
* opening the device. The dictionary remains owned by the caller.
|
||||
* @param flags currently unused
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR code on failure.
|
||||
*/
|
||||
int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
|
||||
const char *device, AVDictionary *opts, int flags);
|
||||
|
||||
/**
|
||||
* Allocate an AVHWFramesContext tied to a given device context.
|
||||
*
|
||||
* @param device_ctx a reference to a AVHWDeviceContext. This function will make
|
||||
* a new reference for internal use, the one passed to the
|
||||
* function remains owned by the caller.
|
||||
* @return a reference to the newly created AVHWFramesContext on success or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
|
||||
|
||||
/**
|
||||
* Finalize the context before use. This function must be called after the
|
||||
* context is filled with all the required information and before it is attached
|
||||
* to any frames.
|
||||
*
|
||||
* @param ref a reference to the AVHWFramesContext
|
||||
* @return 0 on success, a negative AVERROR code on failure
|
||||
*/
|
||||
int av_hwframe_ctx_init(AVBufferRef *ref);
|
||||
|
||||
/**
|
||||
* Allocate a new frame attached to the given AVHWFramesContext.
|
||||
*
|
||||
* @param hwframe_ctx a reference to an AVHWFramesContext
|
||||
* @param frame an empty (freshly allocated or unreffed) frame to be filled with
|
||||
* newly allocated buffers.
|
||||
* @param flags currently unused, should be set to zero
|
||||
* @return 0 on success, a negative AVERROR code on failure
|
||||
*/
|
||||
int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
|
||||
|
||||
/**
|
||||
* Copy data to or from a hw surface. At least one of dst/src must have an
|
||||
* AVHWFramesContext attached.
|
||||
*
|
||||
* If src has an AVHWFramesContext attached, then the format of dst (if set)
|
||||
* must use one of the formats returned by av_hwframe_transfer_get_formats(src,
|
||||
* AV_HWFRAME_TRANSFER_DIRECTION_FROM).
|
||||
* If dst has an AVHWFramesContext attached, then the format of src must use one
|
||||
* of the formats returned by av_hwframe_transfer_get_formats(dst,
|
||||
* AV_HWFRAME_TRANSFER_DIRECTION_TO)
|
||||
*
|
||||
* dst may be "clean" (i.e. with data/buf pointers unset), in which case the
|
||||
* data buffers will be allocated by this function using av_frame_get_buffer().
|
||||
* If dst->format is set, then this format will be used, otherwise (when
|
||||
* dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
|
||||
*
|
||||
* @param dst the destination frame. dst is not touched on failure.
|
||||
* @param src the source frame.
|
||||
* @param flags currently unused, should be set to zero
|
||||
* @return 0 on success, a negative AVERROR error code on failure.
|
||||
*/
|
||||
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
|
||||
|
||||
enum AVHWFrameTransferDirection {
|
||||
/**
|
||||
* Transfer the data from the queried hw frame.
|
||||
*/
|
||||
AV_HWFRAME_TRANSFER_DIRECTION_FROM,
|
||||
|
||||
/**
|
||||
* Transfer the data to the queried hw frame.
|
||||
*/
|
||||
AV_HWFRAME_TRANSFER_DIRECTION_TO,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a list of possible source or target formats usable in
|
||||
* av_hwframe_transfer_data().
|
||||
*
|
||||
* @param hwframe_ctx the frame context to obtain the information for
|
||||
* @param dir the direction of the transfer
|
||||
* @param formats the pointer to the output format list will be written here.
|
||||
* The list is terminated with AV_PIX_FMT_NONE and must be freed
|
||||
* by the caller when no longer needed using av_free().
|
||||
* If this function returns successfully, the format list will
|
||||
* have at least one item (not counting the terminator).
|
||||
* On failure, the contents of this pointer are unspecified.
|
||||
* @param flags currently unused, should be set to zero
|
||||
* @return 0 on success, a negative AVERROR code on failure.
|
||||
*/
|
||||
int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
|
||||
enum AVHWFrameTransferDirection dir,
|
||||
enum AVPixelFormat **formats, int flags);
|
||||
|
||||
|
||||
/**
|
||||
* This struct describes the constraints on hardware frames attached to
|
||||
* a given device with a hardware-specific configuration. This is returned
|
||||
* by av_hwdevice_get_hwframe_constraints() and must be freed by
|
||||
* av_hwframe_constraints_free() after use.
|
||||
*/
|
||||
typedef struct AVHWFramesConstraints {
|
||||
/**
|
||||
* A list of possible values for format in the hw_frames_ctx,
|
||||
* terminated by AV_PIX_FMT_NONE. This member will always be filled.
|
||||
*/
|
||||
enum AVPixelFormat *valid_hw_formats;
|
||||
|
||||
/**
|
||||
* A list of possible values for sw_format in the hw_frames_ctx,
|
||||
* terminated by AV_PIX_FMT_NONE. Can be NULL if this information is
|
||||
* not known.
|
||||
*/
|
||||
enum AVPixelFormat *valid_sw_formats;
|
||||
|
||||
/**
|
||||
* The minimum size of frames in this hw_frames_ctx.
|
||||
* (Zero if not known.)
|
||||
*/
|
||||
int min_width;
|
||||
int min_height;
|
||||
|
||||
/**
|
||||
* The maximum size of frames in this hw_frames_ctx.
|
||||
* (INT_MAX if not known / no limit.)
|
||||
*/
|
||||
int max_width;
|
||||
int max_height;
|
||||
} AVHWFramesConstraints;
|
||||
|
||||
/**
|
||||
* Allocate a HW-specific configuration structure for a given HW device.
|
||||
* After use, the user must free all members as required by the specific
|
||||
* hardware structure being used, then free the structure itself with
|
||||
* av_free().
|
||||
*
|
||||
* @param device_ctx a reference to the associated AVHWDeviceContext.
|
||||
* @return The newly created HW-specific configuration structure on
|
||||
* success or NULL on failure.
|
||||
*/
|
||||
void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
|
||||
|
||||
/**
|
||||
* Get the constraints on HW frames given a device and the HW-specific
|
||||
* configuration to be used with that device. If no HW-specific
|
||||
* configuration is provided, returns the maximum possible capabilities
|
||||
* of the device.
|
||||
*
|
||||
* @param device_ctx a reference to the associated AVHWDeviceContext.
|
||||
* @param hwconfig a filled HW-specific configuration structure, or NULL
|
||||
* to return the maximum possible capabilities of the device.
|
||||
* @return AVHWFramesConstraints structure describing the constraints
|
||||
* on the device, or NULL if not available.
|
||||
*/
|
||||
AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
|
||||
const void *hwconfig);
|
||||
|
||||
/**
|
||||
* Free an AVHWFrameConstraints structure.
|
||||
*
|
||||
* @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
|
||||
*/
|
||||
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_H */
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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_CUDA_H
|
||||
#define AVUTIL_HWCONTEXT_CUDA_H
|
||||
|
||||
#include <cuda.h>
|
||||
|
||||
#include "pixfmt.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
* An API-specific header for AV_HWDEVICE_TYPE_CUDA.
|
||||
*
|
||||
* This API supports dynamic frame pools. AVHWFramesContext.pool must return
|
||||
* AVBufferRefs whose data pointer is a CUdeviceptr.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This struct is allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
typedef struct AVCUDADeviceContext {
|
||||
CUcontext cuda_ctx;
|
||||
} AVCUDADeviceContext;
|
||||
|
||||
/**
|
||||
* AVHWFramesContext.hwctx is currently not used
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_CUDA_H */
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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_DXVA2_H
|
||||
#define AVUTIL_HWCONTEXT_DXVA2_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
|
||||
*
|
||||
* Only fixed-size pools are supported.
|
||||
*
|
||||
* For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
|
||||
* with the data pointer set to a pointer to IDirect3DSurface9.
|
||||
*/
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <dxva2api.h>
|
||||
|
||||
/**
|
||||
* This struct is allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
typedef struct AVDXVA2DeviceContext {
|
||||
IDirect3DDeviceManager9 *devmgr;
|
||||
} AVDXVA2DeviceContext;
|
||||
|
||||
/**
|
||||
* This struct is allocated as AVHWFramesContext.hwctx
|
||||
*/
|
||||
typedef struct AVDXVA2FramesContext {
|
||||
/**
|
||||
* The surface type (e.g. DXVA2_VideoProcessorRenderTarget or
|
||||
* DXVA2_VideoDecoderRenderTarget). Must be set by the caller.
|
||||
*/
|
||||
DWORD surface_type;
|
||||
|
||||
/**
|
||||
* The surface pool. When an external pool is not provided by the caller,
|
||||
* this will be managed (allocated and filled on init, freed on uninit) by
|
||||
* libavutil.
|
||||
*/
|
||||
IDirect3DSurface9 **surfaces;
|
||||
int nb_surfaces;
|
||||
|
||||
/**
|
||||
* Certain drivers require the decoder to be destroyed before the surfaces.
|
||||
* To allow internally managed pools to work properly in such cases, this
|
||||
* field is provided.
|
||||
*
|
||||
* If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on
|
||||
* it just before the internal surface pool is freed.
|
||||
*/
|
||||
IDirectXVideoDecoder *decoder_to_release;
|
||||
} AVDXVA2FramesContext;
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_DXVA2_H */
|
||||
@@ -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 */
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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_VAAPI_H
|
||||
#define AVUTIL_HWCONTEXT_VAAPI_H
|
||||
|
||||
#include <va/va.h>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* API-specific header for AV_HWDEVICE_TYPE_VAAPI.
|
||||
*
|
||||
* Dynamic frame pools are supported, but note that any pool used as a render
|
||||
* target is required to be of fixed size in order to be be usable as an
|
||||
* argument to vaCreateContext().
|
||||
*
|
||||
* For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
|
||||
* with the data pointer set to a VASurfaceID.
|
||||
*/
|
||||
|
||||
/**
|
||||
* VAAPI connection details.
|
||||
*
|
||||
* Allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
typedef struct AVVAAPIDeviceContext {
|
||||
/**
|
||||
* The VADisplay handle, to be filled by the user.
|
||||
*/
|
||||
VADisplay display;
|
||||
} AVVAAPIDeviceContext;
|
||||
|
||||
/**
|
||||
* VAAPI-specific data associated with a frame pool.
|
||||
*
|
||||
* Allocated as AVHWFramesContext.hwctx.
|
||||
*/
|
||||
typedef struct AVVAAPIFramesContext {
|
||||
/**
|
||||
* Set by the user to apply surface attributes to all surfaces in
|
||||
* the frame pool. If null, default settings are used.
|
||||
*/
|
||||
VASurfaceAttrib *attributes;
|
||||
int nb_attributes;
|
||||
/**
|
||||
* The surfaces IDs of all surfaces in the pool after creation.
|
||||
* Only valid if AVHWFramesContext.initial_pool_size was positive.
|
||||
* These are intended to be used as the render_targets arguments to
|
||||
* vaCreateContext().
|
||||
*/
|
||||
VASurfaceID *surface_ids;
|
||||
int nb_surfaces;
|
||||
} AVVAAPIFramesContext;
|
||||
|
||||
/**
|
||||
* VAAPI hardware pipeline configuration details.
|
||||
*
|
||||
* Allocated with av_hwdevice_hwconfig_alloc().
|
||||
*/
|
||||
typedef struct AVVAAPIHWConfig {
|
||||
/**
|
||||
* ID of a VAAPI pipeline configuration.
|
||||
*/
|
||||
VAConfigID config_id;
|
||||
} AVVAAPIHWConfig;
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_VAAPI_H */
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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_VDPAU_H
|
||||
#define AVUTIL_HWCONTEXT_VDPAU_H
|
||||
|
||||
#include <vdpau/vdpau.h>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* An API-specific header for AV_HWDEVICE_TYPE_VDPAU.
|
||||
*
|
||||
* This API supports dynamic frame pools. AVHWFramesContext.pool must return
|
||||
* AVBufferRefs whose data pointer is a VdpVideoSurface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This struct is allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
typedef struct AVVDPAUDeviceContext {
|
||||
VdpDevice device;
|
||||
VdpGetProcAddress *get_proc_address;
|
||||
} AVVDPAUDeviceContext;
|
||||
|
||||
/**
|
||||
* AVHWFramesContext.hwctx is currently not used
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_VDPAU_H */
|
||||
+14
@@ -191,6 +191,20 @@ int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
|
||||
*/
|
||||
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
|
||||
|
||||
/**
|
||||
* Check if the given dimension of an image is valid, meaning that all
|
||||
* bytes of the image can be addressed with a signed int.
|
||||
*
|
||||
* @param w the width of the picture
|
||||
* @param h the height of the picture
|
||||
* @param max_pixels the maximum number of pixels the user wants to accept
|
||||
* @param pix_fmt the pixel format, can be AV_PIX_FMT_NONE if unknown.
|
||||
* @param log_offset the offset to sum to the log level for logging with log_ctx
|
||||
* @param log_ctx the parent logging context, it may be NULL
|
||||
* @return >= 0 if valid, a negative error code otherwise
|
||||
*/
|
||||
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx);
|
||||
|
||||
/**
|
||||
* Check if the given sample aspect ratio of an image is valid.
|
||||
*
|
||||
|
||||
+18
-1
@@ -44,7 +44,7 @@ typedef enum {
|
||||
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
|
||||
AV_CLASS_CATEGORY_DEVICE_OUTPUT,
|
||||
AV_CLASS_CATEGORY_DEVICE_INPUT,
|
||||
AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
|
||||
AV_CLASS_CATEGORY_NB ///< not part of ABI/API
|
||||
}AVClassCategory;
|
||||
|
||||
#define AV_IS_INPUT_DEVICE(category) \
|
||||
@@ -317,6 +317,23 @@ AVClassCategory av_default_get_category(void *ptr);
|
||||
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
|
||||
char *line, int line_size, int *print_prefix);
|
||||
|
||||
/**
|
||||
* Format a line of log the same way as the default callback.
|
||||
* @param line buffer to receive the formatted line;
|
||||
* may be NULL if line_size is 0
|
||||
* @param line_size size of the buffer; at most line_size-1 characters will
|
||||
* be written to the buffer, plus one null terminator
|
||||
* @param print_prefix used to store whether the prefix must be printed;
|
||||
* must point to a persistent integer initially set to 1
|
||||
* @return Returns a negative value if an error occurred, otherwise returns
|
||||
* the number of characters that would have been written for a
|
||||
* sufficiently large buffer, not including the terminating null
|
||||
* character. If the return value is not less than line_size, it means
|
||||
* that the log message was truncated to fit the buffer.
|
||||
*/
|
||||
int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
|
||||
char *line, int line_size, int *print_prefix);
|
||||
|
||||
#if FF_API_DLOG
|
||||
/**
|
||||
* av_dlog macros
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Copyright (c) 2016 Neil Birkbeck <neil.birkbeck@gmail.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 AVUTIL_MASTERING_DISPLAY_METADATA_H
|
||||
#define AVUTIL_MASTERING_DISPLAY_METADATA_H
|
||||
|
||||
#include "frame.h"
|
||||
#include "rational.h"
|
||||
|
||||
|
||||
/**
|
||||
* Mastering display metadata capable of representing the color volume of
|
||||
* the display used to master the content (SMPTE 2086:2014).
|
||||
*
|
||||
* To be used as payload of a AVFrameSideData or AVPacketSideData with the
|
||||
* appropriate type.
|
||||
*
|
||||
* @note The struct should be allocated with av_mastering_display_metadata_alloc()
|
||||
* and its size is not a part of the public ABI.
|
||||
*/
|
||||
typedef struct AVMasteringDisplayMetadata {
|
||||
/**
|
||||
* CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
|
||||
*/
|
||||
AVRational display_primaries[3][2];
|
||||
|
||||
/**
|
||||
* CIE 1931 xy chromaticity coords of white point.
|
||||
*/
|
||||
AVRational white_point[2];
|
||||
|
||||
/**
|
||||
* Min luminance of mastering display (cd/m^2).
|
||||
*/
|
||||
AVRational min_luminance;
|
||||
|
||||
/**
|
||||
* Max luminance of mastering display (cd/m^2).
|
||||
*/
|
||||
AVRational max_luminance;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the display primaries (and white point) are set.
|
||||
*/
|
||||
int has_primaries;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the luminance (min_ and max_) have been set.
|
||||
*/
|
||||
int has_luminance;
|
||||
|
||||
} AVMasteringDisplayMetadata;
|
||||
|
||||
/**
|
||||
* Allocate an AVMasteringDisplayMetadata structure and set its fields to
|
||||
* default values. The resulting struct can be freed using av_freep().
|
||||
*
|
||||
* @return An AVMasteringDisplayMetadata filled with default values or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
|
||||
|
||||
/**
|
||||
* Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
|
||||
*
|
||||
* @param frame The frame which side data is added to.
|
||||
*
|
||||
* @return The AVMasteringDisplayMetadata structure to be filled by caller.
|
||||
*/
|
||||
AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);
|
||||
|
||||
#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */
|
||||
+110
-33
@@ -18,6 +18,12 @@
|
||||
* 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
|
||||
#define AVUTIL_MATHEMATICS_H
|
||||
|
||||
@@ -63,84 +69,155 @@
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_math
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Rounding methods.
|
||||
*/
|
||||
enum AVRounding {
|
||||
AV_ROUND_ZERO = 0, ///< Round toward zero.
|
||||
AV_ROUND_INF = 1, ///< Round away from zero.
|
||||
AV_ROUND_DOWN = 2, ///< 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_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.
|
||||
*/
|
||||
int64_t av_const av_gcd(int64_t a, int64_t b);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* INT64_MIN or INT64_MAX then a is passed through unchanged.
|
||||
* The operation is mathematically equivalent to `a * b / c`, but writing that
|
||||
* 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.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* INT64_MIN or INT64_MAX then a is passed through unchanged.
|
||||
* The operation is mathematically equivalent to `a * bq / cq`.
|
||||
*
|
||||
* @see av_rescale(), av_rescale_rnd(), av_rescale_q()
|
||||
*/
|
||||
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.
|
||||
* 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 -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
|
||||
* Compare two timestamps each in its own time base.
|
||||
*
|
||||
* @return One of the following values:
|
||||
* - -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);
|
||||
|
||||
/**
|
||||
* Compare 2 integers modulo mod.
|
||||
* That is we compare integers a and b for which only the least
|
||||
* significant log2(mod) bits are known.
|
||||
* Compare the remainders of two integer operands divided by a common divisor.
|
||||
*
|
||||
* @param mod must be a power of 2
|
||||
* @return a negative value if a is smaller than b
|
||||
* a positive value if a is greater than b
|
||||
* 0 if a equals b
|
||||
* In other words, compare the least significant `log2(mod)` bits of integers
|
||||
* `a` and `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);
|
||||
|
||||
/**
|
||||
* Rescale a timestamp while preserving known durations.
|
||||
*
|
||||
* @param in_ts Input timestamp
|
||||
* @param in_tb Input timebase
|
||||
* @param fs_tb Duration and *last timebase
|
||||
* @param duration duration till the next call
|
||||
* @param out_tb Output timebase
|
||||
* This function is designed to be called per audio packet to scale the input
|
||||
* timestamp to a different time base. Compared to a simple av_rescale_q()
|
||||
* call, this function is robust against possible inconsistent frame durations.
|
||||
*
|
||||
* 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);
|
||||
|
||||
@@ -150,15 +227,15 @@ 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
|
||||
* no accumulation of rounding errors occurs.
|
||||
*
|
||||
* @param ts Input timestamp
|
||||
* @param ts_tb Input timestamp timebase
|
||||
* @param inc value to add to ts
|
||||
* @param inc_tb inc timebase
|
||||
* @param[in] ts Input timestamp
|
||||
* @param[in] ts_tb Input timestamp time base
|
||||
* @param[in] inc Value to be added
|
||||
* @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);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
+9
-1
@@ -18,6 +18,12 @@
|
||||
* 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
|
||||
#define AVUTIL_MD5_H
|
||||
|
||||
@@ -28,7 +34,9 @@
|
||||
|
||||
/**
|
||||
* @defgroup lavu_md5 MD5
|
||||
* @ingroup lavu_crypto
|
||||
* @ingroup lavu_hash
|
||||
* MD5 hash function implementation.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
+521
-231
@@ -20,7 +20,8 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* memory handling functions
|
||||
* @ingroup lavu_mem
|
||||
* Memory handling functions
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_MEM_H
|
||||
@@ -35,9 +36,56 @@
|
||||
|
||||
/**
|
||||
* @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)
|
||||
#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
|
||||
#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)
|
||||
#define av_malloc_attrib __attribute__((__malloc__))
|
||||
#else
|
||||
#define av_malloc_attrib
|
||||
#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)
|
||||
#define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
|
||||
#else
|
||||
@@ -73,21 +156,51 @@
|
||||
#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()
|
||||
*/
|
||||
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||
|
||||
/**
|
||||
* Allocate a block of size * nmemb bytes with av_malloc().
|
||||
* @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.
|
||||
* Allocate a memory block 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, 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()
|
||||
*/
|
||||
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.
|
||||
* 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 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.
|
||||
* Allocate a memory block for an array with av_mallocz().
|
||||
*
|
||||
* The allocated memory will have size `size * nmemb` bytes.
|
||||
*
|
||||
* @param nmemb Number of elements
|
||||
* @param size Size of the single element
|
||||
* @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.
|
||||
*/
|
||||
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.
|
||||
* @param size Size of the single element
|
||||
* @return Pointer to the allocated block, or `NULL` if the block cannot
|
||||
* be allocated
|
||||
*
|
||||
* @see av_mallocz()
|
||||
* @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.
|
||||
* @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.
|
||||
* Non-inlined equivalent of av_mallocz_array().
|
||||
*
|
||||
* Created for symmetry with the calloc() C function.
|
||||
*/
|
||||
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.
|
||||
* @param s string to be duplicated
|
||||
* @param len the maximum length of the resulting string (not counting the
|
||||
* terminating byte).
|
||||
* @return Pointer to a newly-allocated string containing a
|
||||
* copy of s or NULL if the string cannot be allocated.
|
||||
* Allocate, reallocate, or free 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`. Otherwise, expand or
|
||||
* shrink that block of memory according to `size`.
|
||||
*
|
||||
* @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.
|
||||
* @param p buffer to be duplicated
|
||||
* @return Pointer to a newly allocated buffer containing a
|
||||
* copy of p or NULL if the buffer cannot be allocated.
|
||||
* Allocate, reallocate, or free a block of memory through a pointer to a
|
||||
* pointer.
|
||||
*
|
||||
* 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
|
||||
* av_realloc() and set the pointer pointing to it to NULL.
|
||||
* @param ptr Pointer to the pointer to the memory block which should
|
||||
* be freed.
|
||||
* @note passing a pointer to a NULL pointer is safe and leads to no action.
|
||||
* Allocate, reallocate, or free a block of memory.
|
||||
*
|
||||
* This function does the same thing as av_realloc(), except:
|
||||
* - It takes two size arguments and allocates `nelem * elsize` bytes,
|
||||
* 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()
|
||||
*/
|
||||
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
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
* In case of failure, the array is freed, *tab_ptr is set to NULL and
|
||||
* *nb_ptr is set to 0.
|
||||
* In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
|
||||
* `*nb_ptr` is set to 0.
|
||||
*
|
||||
* @param tab_ptr pointer to the array to grow
|
||||
* @param nb_ptr pointer to the number of elements in the array
|
||||
* @param elem element to add
|
||||
* @param[in,out] tab_ptr Pointer to the array to grow
|
||||
* @param[in,out] nb_ptr Pointer to the number of elements in the array
|
||||
* @param[in] elem Element to add
|
||||
* @see av_dynarray_add_nofree(), av_dynarray2_add()
|
||||
*/
|
||||
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
|
||||
* instead and leave current buffer untouched.
|
||||
*
|
||||
* @param tab_ptr pointer to the array to grow
|
||||
* @param nb_ptr pointer to the number of elements in the array
|
||||
* @param elem element to add
|
||||
* @return >=0 on success, negative otherwise.
|
||||
* @return >=0 on success, negative otherwise
|
||||
* @see av_dynarray_add(), av_dynarray2_add()
|
||||
*/
|
||||
av_warn_unused_result
|
||||
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.
|
||||
* Therefore, the amortized cost of adding an element is constant.
|
||||
*
|
||||
* 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.
|
||||
* In case of failure, the array is freed, *tab_ptr is set to NULL and
|
||||
* *nb_ptr is set to 0.
|
||||
* In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
|
||||
* `*nb_ptr` is set to 0.
|
||||
*
|
||||
* @param tab_ptr pointer to the array to grow
|
||||
* @param nb_ptr pointer to the number of elements in the array
|
||||
* @param elem_size size in bytes of the elements in the array
|
||||
* @param elem_data pointer to the data of the element to add. If NULL, the space of
|
||||
* the new added element is not filled.
|
||||
* @return pointer to the data of the element to copy in the new allocated space.
|
||||
* If NULL, the new allocated space is left uninitialized."
|
||||
* @param[in,out] tab_ptr Pointer to the array to grow
|
||||
* @param[in,out] nb_ptr Pointer to the number of elements in the array
|
||||
* @param[in] elem_size Size in bytes of an element in the array
|
||||
* @param[in] elem_data Pointer to the data of the element to add. If
|
||||
* `NULL`, the space of the newly added element is
|
||||
* allocated but 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()
|
||||
*/
|
||||
void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
|
||||
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)
|
||||
{
|
||||
size_t t = a * b;
|
||||
/* Hack inspired from glibc: only try the division if nelem and elsize
|
||||
* are both greater than sqrt(SIZE_MAX). */
|
||||
/* Hack inspired from glibc: don't try the division if nelem and elsize
|
||||
* are both less than sqrt(SIZE_MAX). */
|
||||
if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
|
||||
return AVERROR(EINVAL);
|
||||
*r = t;
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
+82
@@ -18,15 +18,97 @@
|
||||
* 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
|
||||
#define AVUTIL_MURMUR3_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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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]);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_MURMUR3_H */
|
||||
|
||||
-177
@@ -1,177 +0,0 @@
|
||||
/*
|
||||
* copyright (c) 2006-2012 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* 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_OLD_PIX_FMTS_H
|
||||
#define AVUTIL_OLD_PIX_FMTS_H
|
||||
|
||||
/*
|
||||
* This header exists to prevent new pixel formats from being accidentally added
|
||||
* to the deprecated list.
|
||||
* Do not include it directly. It will be removed on next major bump
|
||||
*
|
||||
* Do not add new items to this list. Use the AVPixelFormat enum instead.
|
||||
*/
|
||||
PIX_FMT_NONE = AV_PIX_FMT_NONE,
|
||||
PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
|
||||
PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
|
||||
PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
|
||||
PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
|
||||
PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
|
||||
PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
|
||||
PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
|
||||
PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
|
||||
PIX_FMT_GRAY8, ///< Y , 8bpp
|
||||
PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
|
||||
PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
|
||||
PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
|
||||
PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
|
||||
PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
|
||||
PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
|
||||
#if FF_API_XVMC
|
||||
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
|
||||
PIX_FMT_XVMC_MPEG2_IDCT,
|
||||
#endif /* FF_API_XVMC */
|
||||
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
|
||||
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
|
||||
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
|
||||
PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
|
||||
PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
|
||||
PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
|
||||
PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
|
||||
PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
|
||||
PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
|
||||
PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
|
||||
|
||||
PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
|
||||
PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
|
||||
PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
|
||||
PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
|
||||
|
||||
PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
|
||||
PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
|
||||
PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
|
||||
PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
|
||||
PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
|
||||
#if FF_API_VDPAU
|
||||
PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
#endif
|
||||
PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
|
||||
PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
|
||||
|
||||
PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
|
||||
PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
|
||||
PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
|
||||
PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
|
||||
|
||||
PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
|
||||
PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
|
||||
PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
|
||||
PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
|
||||
|
||||
PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
|
||||
PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
|
||||
PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
|
||||
PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
#if FF_API_VDPAU
|
||||
PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
#endif
|
||||
PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
|
||||
|
||||
PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
|
||||
PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
|
||||
PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
|
||||
PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
|
||||
PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha
|
||||
PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
|
||||
PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
|
||||
|
||||
//the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus
|
||||
//If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored separately
|
||||
//is better
|
||||
PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
|
||||
|
||||
#ifdef AV_PIX_FMT_ABI_GIT_MASTER
|
||||
PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
|
||||
PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
|
||||
PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
|
||||
PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
|
||||
#endif
|
||||
PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
|
||||
PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian
|
||||
PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian
|
||||
PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian
|
||||
PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian
|
||||
PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian
|
||||
PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian
|
||||
|
||||
#ifndef AV_PIX_FMT_ABI_GIT_MASTER
|
||||
PIX_FMT_RGBA64BE=0x123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
|
||||
PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
|
||||
PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
|
||||
PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
|
||||
#endif
|
||||
PIX_FMT_0RGB=0x123+4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB...
|
||||
PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0...
|
||||
PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR...
|
||||
PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0...
|
||||
PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
|
||||
PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
|
||||
|
||||
PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big endian
|
||||
PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little endian
|
||||
PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big endian
|
||||
PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little endian
|
||||
|
||||
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
|
||||
#endif /* AVUTIL_OLD_PIX_FMTS_H */
|
||||
+3
-3
@@ -58,7 +58,7 @@
|
||||
* The following example illustrates an AVOptions-enabled struct:
|
||||
* @code
|
||||
* typedef struct test_struct {
|
||||
* AVClass *class;
|
||||
* const AVClass *class;
|
||||
* int int_opt;
|
||||
* char *str_opt;
|
||||
* uint8_t *bin_opt;
|
||||
@@ -96,7 +96,7 @@
|
||||
* @code
|
||||
* test_struct *alloc_test_struct(void)
|
||||
* {
|
||||
* test_struct *ret = av_malloc(sizeof(*ret));
|
||||
* test_struct *ret = av_mallocz(sizeof(*ret));
|
||||
* ret->class = &test_class;
|
||||
* av_opt_set_defaults(ret);
|
||||
* return ret;
|
||||
@@ -281,7 +281,7 @@ typedef struct AVOption {
|
||||
#define AV_OPT_FLAG_VIDEO_PARAM 16
|
||||
#define AV_OPT_FLAG_SUBTITLE_PARAM 32
|
||||
/**
|
||||
* The option is inteded for exporting values to the caller.
|
||||
* The option is intended for exporting values to the caller.
|
||||
*/
|
||||
#define AV_OPT_FLAG_EXPORT 64
|
||||
/**
|
||||
|
||||
+102
-102
@@ -85,16 +85,16 @@ typedef struct AVPixFmtDescriptor {
|
||||
/**
|
||||
* Amount to shift the luma width right to find the chroma width.
|
||||
* For YV12 this is 1 for example.
|
||||
* chroma_width = -((-luma_width) >> log2_chroma_w)
|
||||
* chroma_width = AV_CEIL_RSHIFT(luma_width, log2_chroma_w)
|
||||
* The note above is needed to ensure rounding up.
|
||||
* This value only refers to the chroma components.
|
||||
*/
|
||||
uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w)
|
||||
uint8_t log2_chroma_w;
|
||||
|
||||
/**
|
||||
* Amount to shift the luma height right to find the chroma height.
|
||||
* For YV12 this is 1 for example.
|
||||
* chroma_height= -((-luma_height) >> log2_chroma_h)
|
||||
* chroma_height= AV_CEIL_RSHIFT(luma_height, log2_chroma_h)
|
||||
* The note above is needed to ensure rounding up.
|
||||
* This value only refers to the chroma components.
|
||||
*/
|
||||
@@ -172,78 +172,6 @@ typedef struct AVPixFmtDescriptor {
|
||||
*/
|
||||
#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
|
||||
* described by pixdesc. Note that this is not the same as the number
|
||||
@@ -292,8 +220,8 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc);
|
||||
* you do check the return code!
|
||||
*
|
||||
* @param[in] pix_fmt the pixel format
|
||||
* @param[out] h_shift store log2_chroma_w
|
||||
* @param[out] v_shift store log2_chroma_h
|
||||
* @param[out] h_shift store log2_chroma_w (horizontal/width shift)
|
||||
* @param[out] v_shift store log2_chroma_h (vertical/height shift)
|
||||
*
|
||||
* @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
|
||||
*/
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
@@ -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 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 */
|
||||
|
||||
+47
-26
@@ -24,7 +24,6 @@
|
||||
/**
|
||||
* @file
|
||||
* pixel format definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libavutil/avconfig.h"
|
||||
@@ -54,7 +53,7 @@
|
||||
* to run on the IBM VGA graphics adapter use 6-bit palette components.
|
||||
*
|
||||
* @par
|
||||
* For all the 8bit per pixel formats, an RGB32 palette is in data[1] like
|
||||
* For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
|
||||
* for pal8. This palette is filled in automatically by the function
|
||||
* allocating the picture.
|
||||
*/
|
||||
@@ -71,14 +70,14 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_GRAY8, ///< Y , 8bpp
|
||||
AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
|
||||
AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
|
||||
AV_PIX_FMT_PAL8, ///< 8 bit with AV_PIX_FMT_RGB32 palette
|
||||
AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
|
||||
AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
|
||||
AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
|
||||
AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
|
||||
#if FF_API_XVMC
|
||||
AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
|
||||
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 */
|
||||
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
|
||||
@@ -126,7 +125,7 @@ enum AVPixelFormat {
|
||||
/**@{*/
|
||||
AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
|
||||
/**@}*/
|
||||
AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
|
||||
#else
|
||||
@@ -144,7 +143,7 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
#if FF_API_VDPAU
|
||||
AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG-4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
#endif
|
||||
AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
|
||||
|
||||
@@ -152,7 +151,7 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
|
||||
AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
|
||||
AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
|
||||
AV_PIX_FMT_YA8, ///< 8bit gray, 8bit alpha
|
||||
AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha
|
||||
|
||||
AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
|
||||
AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
|
||||
@@ -179,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_VDA_VLD, ///< hardware decoding through VDA
|
||||
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_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
|
||||
AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
|
||||
@@ -223,8 +223,8 @@ enum AVPixelFormat {
|
||||
|
||||
AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef
|
||||
|
||||
AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian)
|
||||
AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian)
|
||||
AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian)
|
||||
AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian)
|
||||
|
||||
AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
|
||||
AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
|
||||
@@ -242,6 +242,12 @@ enum AVPixelFormat {
|
||||
|
||||
AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
|
||||
|
||||
/**
|
||||
* HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
|
||||
* exactly as for system memory frames.
|
||||
*/
|
||||
AV_PIX_FMT_CUDA,
|
||||
|
||||
AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
|
||||
AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
|
||||
AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
|
||||
@@ -289,11 +295,19 @@ enum AVPixelFormat {
|
||||
|
||||
AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
|
||||
|
||||
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_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
|
||||
AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
|
||||
|
||||
#define AV_PIX_FMT_Y400A AV_PIX_FMT_GRAY8A
|
||||
#define AV_PIX_FMT_GBR24P AV_PIX_FMT_GBRP
|
||||
AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian
|
||||
AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-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_MEDIACODEC, ///< hardware decoding through MediaCodec
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
|
||||
@@ -344,6 +358,8 @@ enum AVPixelFormat {
|
||||
#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
|
||||
#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
|
||||
#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
|
||||
#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
|
||||
#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
|
||||
#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
|
||||
|
||||
#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
|
||||
@@ -365,6 +381,7 @@ enum AVPixelFormat {
|
||||
#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
|
||||
#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
|
||||
#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
|
||||
#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
|
||||
|
||||
/**
|
||||
* Chromaticity coordinates of the source primaries.
|
||||
@@ -381,8 +398,10 @@ enum AVColorPrimaries {
|
||||
AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
|
||||
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
|
||||
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
|
||||
AVCOL_PRI_SMPTEST428_1= 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
||||
AVCOL_PRI_NB, ///< Not part of ABI
|
||||
AVCOL_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
||||
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
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -403,11 +422,12 @@ enum AVColorTransferCharacteristic {
|
||||
AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
|
||||
AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
|
||||
AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
|
||||
AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system
|
||||
AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system
|
||||
AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10, 12, 14 and 16 bit systems
|
||||
AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
|
||||
AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
|
||||
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_NB, ///< Not part of ABI
|
||||
AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
|
||||
AVCOL_TRC_NB ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -420,12 +440,13 @@ enum AVColorSpace {
|
||||
AVCOL_SPC_RESERVED = 3,
|
||||
AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
|
||||
AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
|
||||
AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
|
||||
AVCOL_SPC_SMPTE240M = 7,
|
||||
AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
|
||||
AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
|
||||
AVCOL_SPC_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_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
|
||||
|
||||
@@ -437,7 +458,7 @@ enum AVColorRange {
|
||||
AVCOL_RANGE_UNSPECIFIED = 0,
|
||||
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_NB, ///< Not part of ABI
|
||||
AVCOL_RANGE_NB ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -457,13 +478,13 @@ enum AVColorRange {
|
||||
*/
|
||||
enum AVChromaLocation {
|
||||
AVCHROMA_LOC_UNSPECIFIED = 0,
|
||||
AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4 4:2:0, h264 default for 4:2:0
|
||||
AVCHROMA_LOC_CENTER = 2, ///< mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0
|
||||
AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
|
||||
AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
|
||||
AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
|
||||
AVCHROMA_LOC_TOP = 4,
|
||||
AVCHROMA_LOC_BOTTOMLEFT = 5,
|
||||
AVCHROMA_LOC_BOTTOM = 6,
|
||||
AVCHROMA_LOC_NB, ///< Not part of ABI
|
||||
AVCHROMA_LOC_NB ///< Not part of ABI
|
||||
};
|
||||
|
||||
#endif /* AVUTIL_PIXFMT_H */
|
||||
|
||||
+80
-39
@@ -21,7 +21,8 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* rational numbers
|
||||
* @ingroup lavu_math_rational
|
||||
* Utilties for rational number calculation.
|
||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||
*/
|
||||
|
||||
@@ -33,22 +34,39 @@
|
||||
#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{
|
||||
int num; ///< numerator
|
||||
int den; ///< denominator
|
||||
int num; ///< Numerator
|
||||
int den; ///< Denominator
|
||||
} AVRational;
|
||||
|
||||
/**
|
||||
* Create a rational.
|
||||
* Create an AVRational.
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
@@ -58,10 +76,15 @@ static inline AVRational av_make_q(int num, int den)
|
||||
|
||||
/**
|
||||
* Compare two rationals.
|
||||
* @param a first rational
|
||||
* @param b second rational
|
||||
* @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the
|
||||
* values is of the form 0/0
|
||||
*
|
||||
* @param a First rational
|
||||
* @param b Second rational
|
||||
*
|
||||
* @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){
|
||||
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.
|
||||
* @param a rational to convert
|
||||
* @return (double) a
|
||||
* Convert an AVRational to a `double`.
|
||||
* @param a AVRational to convert
|
||||
* @return `a` in floating-point form
|
||||
* @see av_d2q()
|
||||
*/
|
||||
static inline double av_q2d(AVRational a){
|
||||
return a.num / (double) a.den;
|
||||
@@ -83,44 +107,46 @@ static inline double av_q2d(AVRational a){
|
||||
|
||||
/**
|
||||
* Reduce a fraction.
|
||||
*
|
||||
* This is useful for framerate calculations.
|
||||
* @param dst_num destination numerator
|
||||
* @param dst_den destination denominator
|
||||
* @param num source numerator
|
||||
* @param den source denominator
|
||||
* @param max the maximum allowed for dst_num & dst_den
|
||||
* @return 1 if exact, 0 otherwise
|
||||
*
|
||||
* @param[out] dst_num Destination numerator
|
||||
* @param[out] dst_den Destination denominator
|
||||
* @param[in] num Source numerator
|
||||
* @param[in] den Source denominator
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Multiply two rationals.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @param b First rational
|
||||
* @param c Second rational
|
||||
* @return b*c
|
||||
*/
|
||||
AVRational av_mul_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Divide one rational by another.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @param b First rational
|
||||
* @param c Second rational
|
||||
* @return b/c
|
||||
*/
|
||||
AVRational av_div_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Add two rationals.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @param b First rational
|
||||
* @param c Second rational
|
||||
* @return b+c
|
||||
*/
|
||||
AVRational av_add_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Subtract one rational from another.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @param b First rational
|
||||
* @param c Second rational
|
||||
* @return b-c
|
||||
*/
|
||||
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.
|
||||
* inf is expressed as {1,0} or {-1,0} depending on the sign.
|
||||
*
|
||||
* @param d double to convert
|
||||
* @param max the maximum allowed numerator and denominator
|
||||
* @return (AVRational) d
|
||||
* In case of infinity, the returned value is expressed as `{1, 0}` or
|
||||
* `{-1, 0}` depending on the sign.
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
|
||||
* than q1, 0 if they have the same distance.
|
||||
* Find which of the two rationals is closer to another rational.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Find the nearest value in q_list to q.
|
||||
* @param q_list an array of rationals terminated by {0, 0}
|
||||
* @return the index of the nearest value found in the array
|
||||
* Find the value in a list of rationals nearest a given reference rational.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
|
||||
+9
-1
@@ -19,6 +19,12 @@
|
||||
* 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
|
||||
#define AVUTIL_RIPEMD_H
|
||||
|
||||
@@ -29,7 +35,9 @@
|
||||
|
||||
/**
|
||||
* @defgroup lavu_ripemd RIPEMD
|
||||
* @ingroup lavu_crypto
|
||||
* @ingroup lavu_hash
|
||||
* RIPEMD hash function implementation.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
+2
-1
@@ -32,7 +32,6 @@
|
||||
*
|
||||
* Audio sample format enumeration and related convenience functions.
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -69,6 +68,8 @@ enum AVSampleFormat {
|
||||
AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
|
||||
AV_SAMPLE_FMT_FLTP, ///< float, 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
|
||||
};
|
||||
|
||||
+17
-1
@@ -18,6 +18,12 @@
|
||||
* 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
|
||||
#define AVUTIL_SHA_H
|
||||
|
||||
@@ -28,7 +34,17 @@
|
||||
|
||||
/**
|
||||
* @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
-2
@@ -19,6 +19,12 @@
|
||||
* 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
|
||||
#define AVUTIL_SHA512_H
|
||||
|
||||
@@ -28,8 +34,19 @@
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_sha512 SHA512
|
||||
* @ingroup lavu_crypto
|
||||
* @defgroup lavu_sha512 SHA-512
|
||||
* @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.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
+18
@@ -149,4 +149,22 @@ AVStereo3D *av_stereo3d_alloc(void);
|
||||
*/
|
||||
AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Provide a human-readable name of a given stereo3d type.
|
||||
*
|
||||
* @param type The input stereo3d type value.
|
||||
*
|
||||
* @return The name of the stereo3d value, or "unknown".
|
||||
*/
|
||||
const char *av_stereo3d_type_name(unsigned int type);
|
||||
|
||||
/**
|
||||
* Get the AVStereo3DType form a human-readable name.
|
||||
*
|
||||
* @param type The input string.
|
||||
*
|
||||
* @return The AVStereo3DType value, or -1 if not found.
|
||||
*/
|
||||
int av_stereo3d_from_name(const char *name);
|
||||
|
||||
#endif /* AVUTIL_STEREO3D_H */
|
||||
|
||||
+8
-8
@@ -69,10 +69,10 @@ int av_thread_message_queue_recv(AVThreadMessageQueue *mq,
|
||||
/**
|
||||
* Set the sending error code.
|
||||
*
|
||||
* If the error code is set to non-zero, av_thread_message_queue_recv() will
|
||||
* return it immediately when there are no longer available messages.
|
||||
* Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
|
||||
* to cause the receiving thread to stop or suspend its operation.
|
||||
* If the error code is set to non-zero, av_thread_message_queue_send() will
|
||||
* return it immediately. Conventional values, such as AVERROR_EOF or
|
||||
* AVERROR(EAGAIN), can be used to cause the sending thread to stop or
|
||||
* suspend its operation.
|
||||
*/
|
||||
void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
|
||||
int err);
|
||||
@@ -80,10 +80,10 @@ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
|
||||
/**
|
||||
* Set the receiving error code.
|
||||
*
|
||||
* If the error code is set to non-zero, av_thread_message_queue_send() will
|
||||
* return it immediately. Conventional values, such as AVERROR_EOF or
|
||||
* AVERROR(EAGAIN), can be used to cause the sending thread to stop or
|
||||
* suspend its operation.
|
||||
* If the error code is set to non-zero, av_thread_message_queue_recv() will
|
||||
* return it immediately when there are no longer available messages.
|
||||
* Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
|
||||
* to cause the receiving thread to stop or suspend its operation.
|
||||
*/
|
||||
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
|
||||
int err);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
static inline char *av_ts_make_string(char *buf, int64_t ts)
|
||||
{
|
||||
if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
|
||||
else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts);
|
||||
else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ struct AVTreeNode *av_tree_node_alloc(void);
|
||||
* then the corresponding entry in next is unchanged.
|
||||
* @param cmp compare function used to compare elements in the tree,
|
||||
* 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
|
||||
* user wants, be a different type (like an opaque context).
|
||||
* @return An element with cmp(key, elem) == 0 or NULL if no such element
|
||||
@@ -120,8 +120,8 @@ void av_tree_destroy(struct AVTreeNode *t);
|
||||
/**
|
||||
* Apply enu(opaque, &elem) to all the elements in the tree in a given range.
|
||||
*
|
||||
* @param cmp a comparison function that returns < 0 for a element below the
|
||||
* range, > 0 for a element above the range and == 0 for a
|
||||
* @param cmp a comparison function that returns < 0 for an element below the
|
||||
* range, > 0 for an element above the range and == 0 for an
|
||||
* element inside the range
|
||||
*
|
||||
* @note The cmp function should use the same ordering used to construct the
|
||||
|
||||
+28
-12
@@ -18,6 +18,12 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavu
|
||||
* Libavutil version macros
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_VERSION_H
|
||||
#define AVUTIL_VERSION_H
|
||||
|
||||
@@ -29,6 +35,21 @@
|
||||
* Useful to check and match library version in order to maintain
|
||||
* 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
|
||||
*
|
||||
@@ -64,8 +79,8 @@
|
||||
*/
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 55
|
||||
#define LIBAVUTIL_VERSION_MINOR 12
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
#define LIBAVUTIL_VERSION_MINOR 34
|
||||
#define LIBAVUTIL_VERSION_MICRO 101
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, \
|
||||
@@ -78,9 +93,7 @@
|
||||
#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* @defgroup depr_guards Deprecation guards
|
||||
* @defgroup lavu_depr_guards Deprecation Guards
|
||||
* 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
|
||||
* the public API and may change, break or disappear at any time.
|
||||
@@ -119,11 +132,14 @@
|
||||
#ifndef FF_API_CRC_BIG_TABLE
|
||||
#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_PKT_PTS
|
||||
#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_VERSION_H */
|
||||
|
||||
|
||||
+33
-3
@@ -28,11 +28,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup lswr Libswresample
|
||||
* @defgroup lswr libswresample
|
||||
* @{
|
||||
*
|
||||
* Libswresample (lswr) is a library that handles audio resampling, sample
|
||||
* format conversion and mixing.
|
||||
* Audio resampling, sample format conversion and mixing library.
|
||||
*
|
||||
* Interaction with lswr is done through SwrContext, which is
|
||||
* allocated with swr_alloc() or swr_alloc_set_opts(). It is opaque, so all parameters
|
||||
@@ -121,6 +120,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/frame.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
|
||||
@@ -366,6 +366,36 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
|
||||
*/
|
||||
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
|
||||
|
||||
/**
|
||||
* Generate a channel mixing matrix.
|
||||
*
|
||||
* This function is the one used internally by libswresample for building the
|
||||
* default mixing matrix. It is made public just as a utility function for
|
||||
* building custom matrices.
|
||||
*
|
||||
* @param in_layout input channel layout
|
||||
* @param out_layout output channel layout
|
||||
* @param center_mix_level mix level for the center channel
|
||||
* @param surround_mix_level mix level for the surround channel(s)
|
||||
* @param lfe_mix_level mix level for the low-frequency effects channel
|
||||
* @param rematrix_maxval if 1.0, coefficients will be normalized to prevent
|
||||
* overflow. if INT_MAX, coefficients will not be
|
||||
* normalized.
|
||||
* @param[out] matrix mixing coefficients; matrix[i + stride * o] is
|
||||
* the weight of input channel i in output channel o.
|
||||
* @param stride distance between adjacent input channels in the
|
||||
* matrix array
|
||||
* @param matrix_encoding matrixed stereo downmix mode (e.g. dplii)
|
||||
* @param log_ctx parent logging context, can be NULL
|
||||
* @return 0 on success, negative AVERROR code on failure
|
||||
*/
|
||||
int swr_build_matrix(uint64_t in_layout, uint64_t out_layout,
|
||||
double center_mix_level, double surround_mix_level,
|
||||
double lfe_mix_level, double rematrix_maxval,
|
||||
double rematrix_volume, double *matrix,
|
||||
int stride, enum AVMatrixEncoding matrix_encoding,
|
||||
void *log_ctx);
|
||||
|
||||
/**
|
||||
* Set a customized remix matrix.
|
||||
*
|
||||
|
||||
+5
-5
@@ -18,8 +18,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef SWR_VERSION_H
|
||||
#define SWR_VERSION_H
|
||||
#ifndef SWRESAMPLE_VERSION_H
|
||||
#define SWRESAMPLE_VERSION_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
@@ -29,8 +29,8 @@
|
||||
#include "libavutil/avutil.h"
|
||||
|
||||
#define LIBSWRESAMPLE_VERSION_MAJOR 2
|
||||
#define LIBSWRESAMPLE_VERSION_MINOR 0
|
||||
#define LIBSWRESAMPLE_VERSION_MICRO 101
|
||||
#define LIBSWRESAMPLE_VERSION_MINOR 3
|
||||
#define LIBSWRESAMPLE_VERSION_MICRO 100
|
||||
|
||||
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
|
||||
LIBSWRESAMPLE_VERSION_MINOR, \
|
||||
@@ -42,4 +42,4 @@
|
||||
|
||||
#define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION)
|
||||
|
||||
#endif /* SWR_VERSION_H */
|
||||
#endif /* SWRESAMPLE_VERSION_H */
|
||||
|
||||
+15
-29
@@ -35,7 +35,9 @@
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup libsws Color conversion and scaling
|
||||
* @defgroup libsws libswscale
|
||||
* Color conversion and scaling library.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* Return the LIBSWSCALE_VERSION_INT constant.
|
||||
@@ -73,7 +75,7 @@ const char *swscale_license(void);
|
||||
#define SWS_PRINT_INFO 0x1000
|
||||
|
||||
//the following 3 flags are not completely implemented
|
||||
//internal chrominace subsampling info
|
||||
//internal chrominance subsampling info
|
||||
#define SWS_FULL_CHR_H_INT 0x2000
|
||||
//input subsampling info
|
||||
#define SWS_FULL_CHR_H_INP 0x4000
|
||||
@@ -91,6 +93,7 @@ const char *swscale_license(void);
|
||||
#define SWS_CS_SMPTE170M 5
|
||||
#define SWS_CS_SMPTE240M 7
|
||||
#define SWS_CS_DEFAULT 5
|
||||
#define SWS_CS_BT2020 9
|
||||
|
||||
/**
|
||||
* Return a pointer to yuv<->rgb coefficients for the given colorspace
|
||||
@@ -247,18 +250,6 @@ SwsVector *sws_allocVec(int length);
|
||||
*/
|
||||
SwsVector *sws_getGaussianVec(double variance, double quality);
|
||||
|
||||
/**
|
||||
* Allocate and return a vector with length coefficients, all
|
||||
* with the same value c.
|
||||
*/
|
||||
SwsVector *sws_getConstVec(double c, int length);
|
||||
|
||||
/**
|
||||
* Allocate and return a vector with just one coefficient, with
|
||||
* value 1.0.
|
||||
*/
|
||||
SwsVector *sws_getIdentityVec(void);
|
||||
|
||||
/**
|
||||
* Scale all the coefficients of a by the scalar value.
|
||||
*/
|
||||
@@ -268,22 +259,17 @@ void sws_scaleVec(SwsVector *a, double scalar);
|
||||
* Scale all the coefficients of a so that their sum equals height.
|
||||
*/
|
||||
void sws_normalizeVec(SwsVector *a, double height);
|
||||
void sws_convVec(SwsVector *a, SwsVector *b);
|
||||
void sws_addVec(SwsVector *a, SwsVector *b);
|
||||
void sws_subVec(SwsVector *a, SwsVector *b);
|
||||
void sws_shiftVec(SwsVector *a, int shift);
|
||||
|
||||
/**
|
||||
* Allocate and return a clone of the vector a, that is a vector
|
||||
* with the same coefficients as a.
|
||||
*/
|
||||
SwsVector *sws_cloneVec(SwsVector *a);
|
||||
|
||||
/**
|
||||
* Print with av_log() a textual representation of the vector a
|
||||
* if log_level <= av_log_level.
|
||||
*/
|
||||
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
|
||||
#if FF_API_SWS_VECTOR
|
||||
attribute_deprecated SwsVector *sws_getConstVec(double c, int length);
|
||||
attribute_deprecated SwsVector *sws_getIdentityVec(void);
|
||||
attribute_deprecated void sws_convVec(SwsVector *a, SwsVector *b);
|
||||
attribute_deprecated void sws_addVec(SwsVector *a, SwsVector *b);
|
||||
attribute_deprecated void sws_subVec(SwsVector *a, SwsVector *b);
|
||||
attribute_deprecated void sws_shiftVec(SwsVector *a, int shift);
|
||||
attribute_deprecated SwsVector *sws_cloneVec(SwsVector *a);
|
||||
attribute_deprecated void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
|
||||
#endif
|
||||
|
||||
void sws_freeVec(SwsVector *a);
|
||||
|
||||
|
||||
+5
-1
@@ -27,7 +27,7 @@
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBSWSCALE_VERSION_MAJOR 4
|
||||
#define LIBSWSCALE_VERSION_MINOR 0
|
||||
#define LIBSWSCALE_VERSION_MINOR 2
|
||||
#define LIBSWSCALE_VERSION_MICRO 100
|
||||
|
||||
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
|
||||
@@ -46,4 +46,8 @@
|
||||
* the public API and may change, break or disappear at any time.
|
||||
*/
|
||||
|
||||
#ifndef FF_API_SWS_VECTOR
|
||||
#define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6)
|
||||
#endif
|
||||
|
||||
#endif /* SWSCALE_VERSION_H */
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user