From 34afd585c72239e32f3f9a90571ea9cfbf38404f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 10 Apr 2024 22:57:12 +0200 Subject: [PATCH] Delete all kinds of stuff --- Common/compat.c | 43 -- ext/at3_standalone/avcodec.h | 832 +---------------------------- ext/at3_standalone/avpacket.c | 60 --- ext/at3_standalone/avutil.h | 1 - ext/at3_standalone/frame.c | 1 - ext/at3_standalone/frame.h | 2 - ext/at3_standalone/get_bits.h | 236 -------- ext/at3_standalone/internal.h | 63 --- ext/at3_standalone/opt.c | 503 ----------------- ext/at3_standalone/opt.h | 46 -- ext/at3_standalone/options.c | 85 --- ext/at3_standalone/util_internal.h | 181 ------- ext/at3_standalone/utils.c | 65 +-- 13 files changed, 11 insertions(+), 2107 deletions(-) diff --git a/Common/compat.c b/Common/compat.c index 2e9410662f..8679906697 100644 --- a/Common/compat.c +++ b/Common/compat.c @@ -4,49 +4,6 @@ #include "ext/at3_standalone/compat.h" #include "ext/at3_standalone/common.h" -/* -void *av_malloc(size_t size) { - return malloc(size); -} - -void *av_mallocz(size_t size) { - return calloc(size, 1); -} - -void av_free(void *p) { - free(p); -} - -void av_freep(void **p) { - void *pp = *p; - free(pp); - *p = 0; -} - -int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc) -{ - void *val; - - memcpy(&val, ptr, sizeof(val)); - if (min_size <= *size) { - av_assert0(val || !min_size); - return 0; - } - min_size = FFMAX(min_size + min_size / 16 + 32, min_size); - av_freep(ptr); - val = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size); - memcpy(ptr, &val, sizeof(val)); - if (!val) - min_size = 0; - *size = min_size; - return 1; -} - -int av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) { - return ff_fast_malloc(ptr, size, min_size, 0); -} -*/ - void av_log(void *avcl, int level, const char *fmt, ...) { } diff --git a/ext/at3_standalone/avcodec.h b/ext/at3_standalone/avcodec.h index 2ce18c3bd5..3b024cbae9 100644 --- a/ext/at3_standalone/avcodec.h +++ b/ext/at3_standalone/avcodec.h @@ -1062,16 +1062,6 @@ typedef struct AVPacket { int64_t duration; int64_t pos; ///< byte position in stream, -1 if unknown - -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated Same as the duration field, but as int64_t. This was required - * for Matroska subtitles, whose duration values could overflow when the - * duration field was still an int. - */ - attribute_deprecated - int64_t convergence_duration; -#endif } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted @@ -1266,13 +1256,6 @@ typedef struct AVCodecContext { */ float b_quant_offset; - /** - * Size of the frame reordering buffer in the decoder. - * For MPEG-2 it is 1 IPB or 0 low delay IP. - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - int has_b_frames; #if FF_API_PRIVATE_OPT /** @deprecated use encoder private options instead */ @@ -1303,159 +1286,6 @@ typedef struct AVCodecContext { */ int *slice_offset; - /** - * motion estimation comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int me_cmp; - /** - * subpixel motion estimation comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int me_sub_cmp; - /** - * macroblock comparison function (not supported yet) - * - encoding: Set by user. - * - decoding: unused - */ - int mb_cmp; - /** - * interlaced DCT comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int ildct_cmp; -#define FF_CMP_SAD 0 -#define FF_CMP_SSE 1 -#define FF_CMP_SATD 2 -#define FF_CMP_DCT 3 -#define FF_CMP_PSNR 4 -#define FF_CMP_BIT 5 -#define FF_CMP_RD 6 -#define FF_CMP_ZERO 7 -#define FF_CMP_VSAD 8 -#define FF_CMP_VSSE 9 -#define FF_CMP_NSSE 10 -#define FF_CMP_W53 11 -#define FF_CMP_W97 12 -#define FF_CMP_DCTMAX 13 -#define FF_CMP_DCT264 14 -#define FF_CMP_CHROMA 256 - - /** - * ME diamond size & shape - * - encoding: Set by user. - * - decoding: unused - */ - int dia_size; - - /** - * amount of previous MV predictors (2a+1 x 2a+1 square) - * - encoding: Set by user. - * - decoding: unused - */ - int last_predictor_count; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int pre_me; -#endif - - /** - * motion estimation prepass comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int me_pre_cmp; - - /** - * ME prepass diamond size & shape - * - encoding: Set by user. - * - decoding: unused - */ - int pre_dia_size; - - /** - * subpel ME quality - * - encoding: Set by user. - * - decoding: unused - */ - int me_subpel_quality; - -#if FF_API_AFD - /** - * DTG active format information (additional aspect ratio - * information only used in DVB MPEG-2 transport streams) - * 0 if not set. - * - * - encoding: unused - * - decoding: Set by decoder. - * @deprecated Deprecated in favor of AVSideData - */ - attribute_deprecated int dtg_active_format; -#define FF_DTG_AFD_SAME 8 -#define FF_DTG_AFD_4_3 9 -#define FF_DTG_AFD_16_9 10 -#define FF_DTG_AFD_14_9 11 -#define FF_DTG_AFD_4_3_SP_14_9 13 -#define FF_DTG_AFD_16_9_SP_14_9 14 -#define FF_DTG_AFD_SP_4_3 15 -#endif /* FF_API_AFD */ - - /** - * maximum motion estimation search range in subpel units - * If 0 then no limit. - * - * - encoding: Set by user. - * - decoding: unused - */ - int me_range; - -#if FF_API_QUANT_BIAS - /** - * @deprecated use encoder private option instead - */ - attribute_deprecated int intra_quant_bias; -#define FF_DEFAULT_QUANT_BIAS 999999 - - /** - * @deprecated use encoder private option instead - */ - attribute_deprecated int inter_quant_bias; -#endif - - /** - * slice flags - * - encoding: unused - * - decoding: Set by user. - */ - int slice_flags; -#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display -#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) -#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) - -#if FF_API_XVMC - /** - * XVideo Motion Acceleration - * - encoding: forbidden - * - decoding: set by decoder - * @deprecated XvMC doesn't need it anymore. - */ - attribute_deprecated int xvmc_acceleration; -#endif /* FF_API_XVMC */ - - /** - * macroblock decision mode - * - encoding: Set by user. - * - decoding: unused - */ - int mb_decision; -#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp -#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits -#define FF_MB_DECISION_RD 2 ///< rate distortion /** * custom intra quantization matrix @@ -1471,81 +1301,6 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int scenechange_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int noise_reduction; -#endif - -#if FF_API_MPV_OPT - /** - * @deprecated this field is unused - */ - attribute_deprecated - int me_threshold; - - /** - * @deprecated this field is unused - */ - attribute_deprecated - int mb_threshold; -#endif - - /** - * precision of the intra DC coefficient - 8 - * - encoding: Set by user. - * - decoding: Set by libavcodec - */ - int intra_dc_precision; - - /** - * Number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: Set by user. - */ - int skip_top; - - /** - * Number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: Set by user. - */ - int skip_bottom; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - float border_masking; -#endif - - /** - * minimum MB lagrange multipler - * - encoding: Set by user. - * - decoding: unused - */ - int mb_lmin; - - /** - * maximum MB lagrange multipler - * - encoding: Set by user. - * - decoding: unused - */ - int mb_lmax; - -#if FF_API_PRIVATE_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int me_penalty_compensation; -#endif - /** * * - encoding: Set by user. @@ -1573,70 +1328,6 @@ typedef struct AVCodecContext { */ int refs; -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int chromaoffset; -#endif - -#if FF_API_UNUSED_MEMBERS - /** - * Multiplied by qscale for each frame and added to scene_change_score. - * - encoding: Set by user. - * - decoding: unused - */ - attribute_deprecated int scenechange_factor; -#endif - - /** - * - * Note: Value depends upon the compare function used for fullpel ME. - * - encoding: Set by user. - * - decoding: unused - */ - int mv0_threshold; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_sensitivity; -#endif - - /** - * Chromaticity coordinates of the source primaries. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorPrimaries color_primaries; - - /** - * Color Transfer Characteristic. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorTransferCharacteristic color_trc; - - /** - * YUV colorspace type. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorSpace colorspace; - - /** - * MPEG vs JPEG YUV range. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorRange color_range; - - /** - * This defines the location of chroma samples. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVChromaLocation chroma_sample_location; - /** * Number of slices. * Indicates number of picture subdivisions. Used for parallelized @@ -1823,44 +1514,6 @@ typedef struct AVCodecContext { */ int refcounted_frames; - /* - encoding parameters */ - float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - float qblur; ///< amount of qscale smoothing over time (0.0-1.0) - - /** - * minimum quantizer - * - encoding: Set by user. - * - decoding: unused - */ - int qmin; - - /** - * maximum quantizer - * - encoding: Set by user. - * - decoding: unused - */ - int qmax; - - /** - * maximum quantizer difference between frames - * - encoding: Set by user. - * - decoding: unused - */ - int max_qdiff; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - float rc_qsquish; - - attribute_deprecated - float rc_qmod_amp; - attribute_deprecated - int rc_qmod_freq; -#endif - /** * decoder bitstream buffer size * - encoding: Set by user. @@ -1876,244 +1529,6 @@ typedef struct AVCodecContext { int rc_override_count; RcOverride *rc_override; -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - const char *rc_eq; -#endif - - /** - * maximum bitrate - * - encoding: Set by user. - * - decoding: Set by user, may be overwritten by libavcodec. - */ - int64_t rc_max_rate; - - /** - * minimum bitrate - * - encoding: Set by user. - * - decoding: unused - */ - int64_t rc_min_rate; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - float rc_buffer_aggressivity; - - attribute_deprecated - float rc_initial_cplx; -#endif - - /** - * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. - * - encoding: Set by user. - * - decoding: unused. - */ - float rc_max_available_vbv_use; - - /** - * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. - * - encoding: Set by user. - * - decoding: unused. - */ - float rc_min_vbv_overflow_use; - - /** - * Number of bits which should be loaded into the rc buffer before decoding starts. - * - encoding: Set by user. - * - decoding: unused - */ - int rc_initial_buffer_occupancy; - -#if FF_API_CODER_TYPE -#define FF_CODER_TYPE_VLC 0 -#define FF_CODER_TYPE_AC 1 -#define FF_CODER_TYPE_RAW 2 -#define FF_CODER_TYPE_RLE 3 -#if FF_API_UNUSED_MEMBERS -#define FF_CODER_TYPE_DEFLATE 4 -#endif /* FF_API_UNUSED_MEMBERS */ - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int coder_type; -#endif /* FF_API_CODER_TYPE */ - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int context_model; -#endif - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int lmin; - - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int lmax; -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_factor; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_exp; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_cmp; -#endif /* FF_API_PRIVATE_OPT */ - - /** - * trellis RD quantization - * - encoding: Set by user. - * - decoding: unused - */ - int trellis; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int min_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int max_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int64_t timecode_frame_start; -#endif - -#if FF_API_RTP_CALLBACK - /** - * @deprecated unused - */ - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send. */ - /* It depends on the encoder if the data starts */ - /* with a Start Code (it should). H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload. */ - attribute_deprecated - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do its best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263. */ - /* This doesn't take account of any particular */ - /* headers inside the transmitted RTP payload. */ -#endif - -#if FF_API_STAT_BITS - /* statistics, used for 2-pass encoding */ - attribute_deprecated - int mv_bits; - attribute_deprecated - int header_bits; - attribute_deprecated - int i_tex_bits; - attribute_deprecated - int p_tex_bits; - attribute_deprecated - int i_count; - attribute_deprecated - int p_count; - attribute_deprecated - int skip_count; - attribute_deprecated - int misc_bits; - - /** @deprecated this field is unused */ - attribute_deprecated - int frame_bits; -#endif - - /** - * pass1 encoding statistics output buffer - * - encoding: Set by libavcodec. - * - decoding: unused - */ - char *stats_out; - - /** - * pass2 encoding statistics input buffer - * Concatenated stuff from stats_out of pass1 should be placed here. - * - encoding: Allocated/set/freed by user. - * - decoding: unused - */ - char *stats_in; - - /** - * Work around bugs in encoders which sometimes cannot be detected automatically. - * - encoding: Set by user - * - decoding: Set by user - */ - int workaround_bugs; -#define FF_BUG_AUTODETECT 1 ///< autodetection -#if FF_API_OLD_MSMPEG4 -#define FF_BUG_OLD_MSMPEG4 2 -#endif -#define FF_BUG_XVID_ILACE 4 -#define FF_BUG_UMP4 8 -#define FF_BUG_NO_PADDING 16 -#define FF_BUG_AMV 32 -#if FF_API_AC_VLC -#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. -#endif -#define FF_BUG_QPEL_CHROMA 64 -#define FF_BUG_STD_QPEL 128 -#define FF_BUG_QPEL_CHROMA2 256 -#define FF_BUG_DIRECT_BLOCKSIZE 512 -#define FF_BUG_EDGE 1024 -#define FF_BUG_HPEL_CHROMA 2048 -#define FF_BUG_DC_CLIP 4096 -#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. -#define FF_BUG_TRUNCATED 16384 - - /** - * strictly follow the standard (MPEG4, ...). - * - encoding: Set by user. - * - decoding: Set by user. - * Setting this to STRICT or higher means the encoder and decoder will - * generally do stupid things, whereas setting it to unofficial or lower - * will mean the encoder might produce output that is not supported by all - * spec-compliant decoders. Decoders don't differentiate between normal, - * unofficial and experimental (that is, they always try to decode things - * when they can) unless they are explicitly asked to behave stupidly - * (=strictly conform to the specs) - */ - int strict_std_compliance; -#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. -#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. -#define FF_COMPLIANCE_NORMAL 0 -#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions -#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. - /** * error concealment flags * - encoding: unused @@ -2124,54 +1539,6 @@ typedef struct AVCodecContext { #define FF_EC_DEBLOCK 2 #define FF_EC_FAVOR_INTER 256 - /** - * debug - * - encoding: Set by user. - * - decoding: Set by user. - */ - int debug; -#define FF_DEBUG_PICT_INFO 1 -#define FF_DEBUG_RC 2 -#define FF_DEBUG_BITSTREAM 4 -#define FF_DEBUG_MB_TYPE 8 -#define FF_DEBUG_QP 16 -#if FF_API_DEBUG_MV -/** - * @deprecated this option does nothing - */ -#define FF_DEBUG_MV 32 -#endif -#define FF_DEBUG_DCT_COEFF 0x00000040 -#define FF_DEBUG_SKIP 0x00000080 -#define FF_DEBUG_STARTCODE 0x00000100 -#if FF_API_UNUSED_MEMBERS -#define FF_DEBUG_PTS 0x00000200 -#endif /* FF_API_UNUSED_MEMBERS */ -#define FF_DEBUG_ER 0x00000400 -#define FF_DEBUG_MMCO 0x00000800 -#define FF_DEBUG_BUGS 0x00001000 -#if FF_API_DEBUG_MV -#define FF_DEBUG_VIS_QP 0x00002000 ///< only access through AVOptions from outside libavcodec -#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec -#endif -#define FF_DEBUG_BUFFERS 0x00008000 -#define FF_DEBUG_THREADS 0x00010000 -#define FF_DEBUG_GREEN_MD 0x00800000 -#define FF_DEBUG_NOMC 0x01000000 - -#if FF_API_DEBUG_MV - /** - * debug - * Code outside libavcodec should access this field using AVOptions - * - encoding: Set by user. - * - decoding: Set by user. - */ - int debug_mv; -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames -#endif - /** * Error recognition; may misdetect some more or less valid parts as errors. * - encoding: unused @@ -2202,19 +1569,6 @@ typedef struct AVCodecContext { */ uint64_t error[AV_NUM_DATA_POINTERS]; - /** - * DCT algorithm, see FF_DCT_* below - * - encoding: Set by user. - * - decoding: unused - */ - int dct_algo; -#define FF_DCT_AUTO 0 -#define FF_DCT_FASTINT 1 -#define FF_DCT_INT 2 -#define FF_DCT_MMX 3 -#define FF_DCT_ALTIVEC 5 -#define FF_DCT_FAAN 6 - /** * IDCT algorithm, see FF_IDCT_* below. * - encoding: Set by user. @@ -2285,75 +1639,6 @@ typedef struct AVCodecContext { */ attribute_deprecated AVFrame *coded_frame; #endif - - /** - * thread count - * is used to decide how many independent tasks should be passed to execute() - * - encoding: Set by user. - * - decoding: Set by user. - */ - int thread_count; - - /** - * Which multithreading methods to use. - * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, - * so clients which cannot provide future frames should not use it. - * - * - encoding: Set by user, otherwise the default is used. - * - decoding: Set by user, otherwise the default is used. - */ - int thread_type; -#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once -#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once - - /** - * Which multithreading methods are in use by the codec. - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - int active_thread_type; - - /** - * Set by the client if its custom get_buffer() callback can be called - * synchronously from another thread, which allows faster multithreaded decoding. - * draw_horiz_band() will be called from other threads regardless of this setting. - * Ignored if the default get_buffer() is used. - * - encoding: Set by user. - * - decoding: Set by user. - */ - int thread_safe_callbacks; - - /** - * The codec may call this to execute several independent things. - * It will return only after finishing all tasks. - * The user may replace this with some multithreaded implementation, - * the default implementation will execute the parts serially. - * @param count the number of things to execute - * - encoding: Set by libavcodec, user can override. - * - decoding: Set by libavcodec, user can override. - */ - int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); - - /** - * The codec may call this to execute several independent things. - * It will return only after finishing all tasks. - * The user may replace this with some multithreaded implementation, - * the default implementation will execute the parts serially. - * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. - * @param c context passed also to func - * @param count the number of things to execute - * @param arg2 argument passed unchanged to func - * @param ret return values of executed functions, must have space for "count" values. May be NULL. - * @param func function that will be called count times, with jobnr from 0 to count-1. - * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no - * two instances of func executing at the same time will have the same threadnr. - * @return always 0 currently, but code should handle a future improvement where when any call to func - * returns < 0 no further calls to func may be done and < 0 is returned. - * - encoding: Set by libavcodec, user can override. - * - decoding: Set by libavcodec, user can override. - */ - int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); - /** * noise vs. sse weight for the nsse comparison function * - encoding: Set by user. @@ -2361,87 +1646,6 @@ typedef struct AVCodecContext { */ int nsse_weight; - /** - * profile - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int profile; -#define FF_PROFILE_UNKNOWN -99 -#define FF_PROFILE_RESERVED -100 - -#define FF_PROFILE_AAC_MAIN 0 -#define FF_PROFILE_AAC_LOW 1 -#define FF_PROFILE_AAC_SSR 2 -#define FF_PROFILE_AAC_LTP 3 -#define FF_PROFILE_AAC_HE 4 -#define FF_PROFILE_AAC_HE_V2 28 -#define FF_PROFILE_AAC_LD 22 -#define FF_PROFILE_AAC_ELD 38 -#define FF_PROFILE_MPEG2_AAC_LOW 128 -#define FF_PROFILE_MPEG2_AAC_HE 131 - -#define FF_PROFILE_DTS 20 -#define FF_PROFILE_DTS_ES 30 -#define FF_PROFILE_DTS_96_24 40 -#define FF_PROFILE_DTS_HD_HRA 50 -#define FF_PROFILE_DTS_HD_MA 60 -#define FF_PROFILE_DTS_EXPRESS 70 - -#define FF_PROFILE_MPEG2_422 0 -#define FF_PROFILE_MPEG2_HIGH 1 -#define FF_PROFILE_MPEG2_SS 2 -#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 -#define FF_PROFILE_MPEG2_MAIN 4 -#define FF_PROFILE_MPEG2_SIMPLE 5 - -#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag -#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag - -#define FF_PROFILE_H264_BASELINE 66 -#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) -#define FF_PROFILE_H264_MAIN 77 -#define FF_PROFILE_H264_EXTENDED 88 -#define FF_PROFILE_H264_HIGH 100 -#define FF_PROFILE_H264_HIGH_10 110 -#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_HIGH_422 122 -#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_HIGH_444 144 -#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 -#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_CAVLC_444 44 - -#define FF_PROFILE_VC1_SIMPLE 0 -#define FF_PROFILE_VC1_MAIN 1 -#define FF_PROFILE_VC1_COMPLEX 2 -#define FF_PROFILE_VC1_ADVANCED 3 - -#define FF_PROFILE_MPEG4_SIMPLE 0 -#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 -#define FF_PROFILE_MPEG4_CORE 2 -#define FF_PROFILE_MPEG4_MAIN 3 -#define FF_PROFILE_MPEG4_N_BIT 4 -#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 -#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 -#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 -#define FF_PROFILE_MPEG4_HYBRID 8 -#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 -#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 -#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 -#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 -#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 -#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 -#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 - - /** - * level - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int level; -#define FF_LEVEL_UNKNOWN -99 - /** * Skip IDCT/dequantization for selected frames. * - encoding: unused @@ -3063,7 +2267,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), * av_dict_set(), av_opt_find(). */ -int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, void *options); /** * Close a given AVCodecContext and free all the data associated with it @@ -3076,13 +2280,6 @@ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **op */ int avcodec_close(AVCodecContext *avctx); -/** - * Free all allocated data in the given subtitle struct. - * - * @param sub AVSubtitle to free. - */ -void avsubtitle_free(AVSubtitle *sub); - /** * @} */ @@ -3177,13 +2374,6 @@ int av_dup_packet(AVPacket *pkt); */ int av_copy_packet(AVPacket *dst, const AVPacket *src); -/** - * Copy packet side data - * - * @return 0 on success, negative AVERROR on fail - */ -int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); - /** * Free a packet. * @@ -3195,24 +2385,6 @@ attribute_deprecated void av_free_packet(AVPacket *pkt); #endif -/** - * Pack a dictionary for use in side_data. - * - * @param dict The dictionary to pack. - * @param size pointer to store the size of the returned data - * @return pointer to data if successful, NULL otherwise - */ -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); -/** - * Unpack a dictionary from side_data. - * - * @param data data from side_data - * @param size size of the data - * @param dict the metadata storage dictionary - * @return 0 on success, < 0 on failure - */ -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); - /** * Setup a new reference to the data described by a given packet * @@ -4126,8 +3298,6 @@ size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_ta void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); -int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); -int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef /** diff --git a/ext/at3_standalone/avpacket.c b/ext/at3_standalone/avpacket.c index c254150f29..a067ef3f7b 100644 --- a/ext/at3_standalone/avpacket.c +++ b/ext/at3_standalone/avpacket.c @@ -196,66 +196,6 @@ FF_ENABLE_DEPRECATION_WARNINGS #define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size) -{ - AVDictionaryEntry *t = NULL; - uint8_t *data = NULL; - *size = 0; - - if (!dict) - return NULL; - - while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) { - const size_t keylen = strlen(t->key); - const size_t valuelen = strlen(t->value); - const size_t new_size = *size + keylen + 1 + valuelen + 1; - uint8_t *const new_data = av_realloc(data, new_size); - - if (!new_data) - goto fail; - data = new_data; - if (new_size > INT_MAX) - goto fail; - - memcpy(data + *size, t->key, keylen + 1); - memcpy(data + *size + keylen + 1, t->value, valuelen + 1); - - *size = new_size; - } - - return data; - -fail: - av_freep(&data); - *size = 0; - return NULL; -} - -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict) -{ - const uint8_t *end = data + size; - int ret = 0; - - if (!dict || !data || !size) - return ret; - if (size && end[-1]) - return AVERROR_INVALIDDATA; - while (data < end) { - const uint8_t *key = data; - const uint8_t *val = data + strlen(key) + 1; - - if (val >= end) - return AVERROR_INVALIDDATA; - - ret = av_dict_set(dict, key, val, 0); - if (ret < 0) - break; - data = val + strlen(val) + 1; - } - - return ret; -} - int av_packet_copy_props(AVPacket *dst, const AVPacket *src) { int i; diff --git a/ext/at3_standalone/avutil.h b/ext/at3_standalone/avutil.h index 29f73d3f77..072c827371 100644 --- a/ext/at3_standalone/avutil.h +++ b/ext/at3_standalone/avutil.h @@ -190,7 +190,6 @@ const char *avutil_license(void); enum AVMediaType { AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA - AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous AVMEDIA_TYPE_SUBTITLE, diff --git a/ext/at3_standalone/frame.c b/ext/at3_standalone/frame.c index 61ecfef609..3cb10cb6c7 100644 --- a/ext/at3_standalone/frame.c +++ b/ext/at3_standalone/frame.c @@ -20,7 +20,6 @@ #include "channel_layout.h" #include "buffer.h" #include "common.h" -#include "dict.h" #include "frame.h" #include "util_internal.h" #include "mem.h" diff --git a/ext/at3_standalone/frame.h b/ext/at3_standalone/frame.h index bced2e9404..e812441e52 100644 --- a/ext/at3_standalone/frame.h +++ b/ext/at3_standalone/frame.h @@ -30,7 +30,6 @@ #include "avutil.h" #include "buffer.h" -#include "dict.h" #include "rational.h" #include "samplefmt.h" #include "version.h" @@ -367,7 +366,6 @@ int av_frame_get_decode_error_flags (const AVFrame *frame); void av_frame_set_decode_error_flags (AVFrame *frame, int val); int av_frame_get_pkt_size(const AVFrame *frame); void av_frame_set_pkt_size(AVFrame *frame, int val); -AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); /** * Get the name of a colorspace. diff --git a/ext/at3_standalone/get_bits.h b/ext/at3_standalone/get_bits.h index 5bc786f3b8..a4905f41f5 100644 --- a/ext/at3_standalone/get_bits.h +++ b/ext/at3_standalone/get_bits.h @@ -217,34 +217,6 @@ static inline int get_bits_count(const GetBitContext *s) return s->index; } -static inline void skip_bits_long(GetBitContext *s, int n) -{ -#if UNCHECKED_BITSTREAM_READER - s->index += n; -#else - s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index); -#endif -} - -/** - * read mpeg1 dc style vlc (sign bit + mantissa with no MSB). - * if MSB not set it is negative - * @param n length in bits - */ -static inline int get_xbits(GetBitContext *s, int n) -{ - register int sign; - register int32_t cache; - OPEN_READER(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE(re, s); - cache = GET_CACHE(re, s); - sign = ~cache >> 31; - LAST_SKIP_BITS(re, s, n); - CLOSE_READER(re, s); - return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; -} - static inline int get_sbits(GetBitContext *s, int n) { register int tmp; @@ -292,19 +264,6 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n) return tmp; } -/** - * Show 1-25 bits. - */ -static inline unsigned int show_bits(GetBitContext *s, int n) -{ - register int tmp; - OPEN_READER_NOSIZE(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE(re, s); - tmp = SHOW_UBITS(re, s, n); - return tmp; -} - static inline void skip_bits(GetBitContext *s, int n) { OPEN_READER(re, s); @@ -332,84 +291,6 @@ static inline unsigned int get_bits1(GetBitContext *s) return result; } -static inline unsigned int show_bits1(GetBitContext *s) -{ - return show_bits(s, 1); -} - -static inline void skip_bits1(GetBitContext *s) -{ - skip_bits(s, 1); -} - -/** - * Read 0-32 bits. - */ -static inline unsigned int get_bits_long(GetBitContext *s, int n) -{ - if (!n) { - return 0; - } else if (n <= MIN_CACHE_BITS) { - return get_bits(s, n); - } else { -#ifdef BITSTREAM_READER_LE - unsigned ret = get_bits(s, 16); - return ret | (get_bits(s, n - 16) << 16); -#else - unsigned ret = get_bits(s, 16) << (n - 16); - return ret | get_bits(s, n - 16); -#endif - } -} - -/** - * Read 0-64 bits. - */ -static inline uint64_t get_bits64(GetBitContext *s, int n) -{ - if (n <= 32) { - return get_bits_long(s, n); - } else { -#ifdef BITSTREAM_READER_LE - uint64_t ret = get_bits_long(s, 32); - return ret | (uint64_t) get_bits_long(s, n - 32) << 32; -#else - uint64_t ret = (uint64_t) get_bits_long(s, n - 32) << 32; - return ret | get_bits_long(s, 32); -#endif - } -} - -/** - * Read 0-32 bits as a signed integer. - */ -static inline int get_sbits_long(GetBitContext *s, int n) -{ - return sign_extend(get_bits_long(s, n), n); -} - -/** - * Show 0-32 bits. - */ -static inline unsigned int show_bits_long(GetBitContext *s, int n) -{ - if (n <= MIN_CACHE_BITS) { - return show_bits(s, n); - } else { - GetBitContext gb = *s; - return get_bits_long(&gb, n); - } -} - -static inline int check_marker(GetBitContext *s, const char *msg) -{ - int bit = get_bits1(s); - if (!bit) - av_log(NULL, AV_LOG_INFO, "Marker bit missing at %d of %d %s\n", get_bits_count(s) - 1, s->size_in_bits, msg); - - return bit; -} - /** * Initialize GetBitContext. * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes @@ -589,126 +470,9 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], return code; } -static inline int decode012(GetBitContext *gb) -{ - int n; - n = get_bits1(gb); - if (n == 0) - return 0; - else - return get_bits1(gb) + 1; -} - -static inline int decode210(GetBitContext *gb) -{ - if (get_bits1(gb)) - return 0; - else - return 2 - get_bits1(gb); -} - static inline int get_bits_left(GetBitContext *gb) { return gb->size_in_bits - get_bits_count(gb); } -static inline int skip_1stop_8data_bits(GetBitContext *gb) -{ - if (get_bits_left(gb) <= 0) - return AVERROR_INVALIDDATA; - - while (get_bits1(gb)) { - skip_bits(gb, 8); - if (get_bits_left(gb) <= 0) - return AVERROR_INVALIDDATA; - } - - return 0; -} - -//#define TRACE - -#ifdef TRACE -static inline void print_bin(int bits, int n) -{ - int i; - - for (i = n - 1; i >= 0; i--) - av_log(NULL, AV_LOG_DEBUG, "%d", (bits >> i) & 1); - for (i = n; i < 24; i++) - av_log(NULL, AV_LOG_DEBUG, " "); -} - -static inline int get_bits_trace(GetBitContext *s, int n, const char *file, - const char *func, int line) -{ - int r = get_bits(s, n); - - print_bin(r, n); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", - r, n, r, get_bits_count(s) - n, file, func, line); - - return r; -} - -static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], - int bits, int max_depth, const char *file, - const char *func, int line) -{ - int show = show_bits(s, 24); - int pos = get_bits_count(s); - int r = get_vlc2(s, table, bits, max_depth); - int len = get_bits_count(s) - pos; - int bits2 = show >> (24 - len); - - print_bin(bits2, len); - - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", - bits2, len, r, pos, file, func, line); - - return r; -} - -#define GET_RL_VLC(level, run, name, gb, table, bits, \ - max_depth, need_update) \ - do { \ - int show = SHOW_UBITS(name, gb, 24); \ - int len; \ - int pos = name ## _index; \ - \ - GET_RL_VLC_INTERNAL(level, run, name, gb, table, bits,max_depth, need_update); \ - \ - len = name ## _index - pos + 1; \ - show = show >> (24 - len); \ - \ - print_bin(show, len); \ - \ - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d/%-3d rlv @%5d in %s %s:%d\n",\ - show, len, run-1, level, pos, __FILE__, __PRETTY_FUNCTION__, __LINE__);\ - } while (0) \ - - -static inline int get_xbits_trace(GetBitContext *s, int n, const char *file, - const char *func, int line) -{ - int show = show_bits(s, n); - int r = get_xbits(s, n); - - print_bin(show, n); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", - show, n, r, get_bits_count(s) - n, file, func, line); - - return r; -} - -#define get_bits(s, n) get_bits_trace(s , n, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__) - -#define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#else //TRACE -#define GET_RL_VLC GET_RL_VLC_INTERNAL -#endif - #endif /* AVCODEC_GET_BITS_H */ diff --git a/ext/at3_standalone/internal.h b/ext/at3_standalone/internal.h index e3e2c1017e..7b0c7a1447 100644 --- a/ext/at3_standalone/internal.h +++ b/ext/at3_standalone/internal.h @@ -261,67 +261,4 @@ static av_always_inline float ff_exp2fi(int x) { */ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags); -/** - * Identical in function to av_frame_make_writable(), except it uses - * ff_get_buffer() to allocate the buffer when needed. - */ -int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame); - -int ff_thread_can_start_frame(AVCodecContext *avctx); - -int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx); - -/** - * Call avcodec_open2 recursively by decrementing counter, unlocking mutex, - * calling the function and then restoring again. Assumes the mutex is - * already locked - */ -int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); - -/** - * Finalize buf into extradata and set its size appropriately. - */ -int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf); - -const uint8_t *avpriv_find_start_code(const uint8_t *p, - const uint8_t *end, - uint32_t *state); - -/** - * Check that the provided frame dimensions are valid and set them on the codec - * context. - */ -int ff_set_dimensions(AVCodecContext *s, int width, int height); - -/** - * Check that the provided sample aspect ratio is valid and set it on the codec - * context. - */ -int ff_set_sar(AVCodecContext *avctx, AVRational sar); - -/** - * Add or update AV_FRAME_DATA_MATRIXENCODING side data. - */ -int ff_side_data_update_matrix_encoding(AVFrame *frame, - enum AVMatrixEncoding matrix_encoding); - -/** - * Select the (possibly hardware accelerated) pixel format. - * This is a wrapper around AVCodecContext.get_format() and should be used - * instead of calling get_format() directly. - */ -int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt); - -/** - * Set various frame properties from the codec context / packet data. - */ -int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame); - -/** - * Add a CPB properties side data to an encoding context. - */ -AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx); - -int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type); - #endif /* AVCODEC_INTERNAL_H */ diff --git a/ext/at3_standalone/opt.c b/ext/at3_standalone/opt.c index 173310df38..f5ceafe391 100644 --- a/ext/at3_standalone/opt.c +++ b/ext/at3_standalone/opt.c @@ -243,24 +243,6 @@ static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t return 0; } -int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags) -{ - void *target_obj; - AVDictionary **dst; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->flags & AV_OPT_FLAG_READONLY) - return AVERROR(EINVAL); - - dst = (AVDictionary **)(((uint8_t *)target_obj) + o->offset); - av_dict_free(dst); - av_dict_copy(dst, val, 0); - - return 0; -} - static void format_duration(char *buf, size_t size, int64_t d) { char *e; @@ -449,11 +431,6 @@ static int get_format(void *obj, const char *name, int search_flags, int *out_fm return 0; } -int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt) -{ - return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_PIXEL_FMT, "pixel"); -} - int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt) { return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample"); @@ -573,199 +550,6 @@ static char *get_opt_flags_string(void *obj, const char *unit, int64_t value) return NULL; } -static void opt_list(void *obj, void *av_log_obj, const char *unit, - int req_flags, int rej_flags) -{ - const AVOption *opt=NULL; - AVOptionRanges *r; - int i; - - while ((opt = av_opt_next(obj, opt))) { - if (!(opt->flags & req_flags) || (opt->flags & rej_flags)) - continue; - - /* Don't print CONST's on level one. - * Don't print anything but CONST's on level two. - * Only print items from the requested unit. - */ - if (!unit && opt->type==AV_OPT_TYPE_CONST) - continue; - else if (unit && opt->type!=AV_OPT_TYPE_CONST) - continue; - else if (unit && opt->type==AV_OPT_TYPE_CONST && strcmp(unit, opt->unit)) - continue; - else if (unit && opt->type == AV_OPT_TYPE_CONST) - av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); - else - av_log(av_log_obj, AV_LOG_INFO, " %s%-17s ", - (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? "" : "-", - opt->name); - - switch (opt->type) { - case AV_OPT_TYPE_FLAGS: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_INT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_INT64: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_DOUBLE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_FLOAT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_STRING: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_RATIONAL: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_BINARY: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_IMAGE_SIZE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_VIDEO_RATE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_PIXEL_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_SAMPLE_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_DURATION: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_COLOR: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_CHANNEL_LAYOUT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_BOOL: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_CONST: - default: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - } - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_FILTERING_PARAM)? 'F' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_EXPORT) ? 'X' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_READONLY) ? 'R' : '.'); - - if (opt->help) - av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); - - if (av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) { - switch (opt->type) { - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_FLOAT: - case AV_OPT_TYPE_RATIONAL: - for (i = 0; i < r->nb_ranges; i++) { - av_log(av_log_obj, AV_LOG_INFO, " (from "); - log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_min); - av_log(av_log_obj, AV_LOG_INFO, " to "); - log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_max); - av_log(av_log_obj, AV_LOG_INFO, ")"); - } - break; - } - av_opt_freep_ranges(&r); - } - - if (opt->type != AV_OPT_TYPE_CONST && - opt->type != AV_OPT_TYPE_BINARY && - !((opt->type == AV_OPT_TYPE_COLOR || - opt->type == AV_OPT_TYPE_IMAGE_SIZE || - opt->type == AV_OPT_TYPE_STRING || - opt->type == AV_OPT_TYPE_VIDEO_RATE) && - !opt->default_val.str)) { - av_log(av_log_obj, AV_LOG_INFO, " (default "); - switch (opt->type) { - case AV_OPT_TYPE_BOOL: - av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(get_bool_name(opt->default_val.i64), "invalid")); - break; - case AV_OPT_TYPE_FLAGS: { - char *def_flags = get_opt_flags_string(obj, opt->unit, opt->default_val.i64); - if (def_flags) { - av_log(av_log_obj, AV_LOG_INFO, "%s", def_flags); - av_freep(&def_flags); - } else { - av_log(av_log_obj, AV_LOG_INFO, "%"PRIX64, opt->default_val.i64); - } - break; - } - case AV_OPT_TYPE_DURATION: { - char buf[25]; - format_duration(buf, sizeof(buf), opt->default_val.i64); - av_log(av_log_obj, AV_LOG_INFO, "%s", buf); - break; - } - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: { - const char *def_const = get_opt_const_name(obj, opt->unit, opt->default_val.i64); - if (def_const) - av_log(av_log_obj, AV_LOG_INFO, "%s", def_const); - else - log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64); - break; - } - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_FLOAT: - log_value(av_log_obj, AV_LOG_INFO, opt->default_val.dbl); - break; - case AV_OPT_TYPE_RATIONAL: { - AVRational q = av_d2q(opt->default_val.dbl, INT_MAX); - av_log(av_log_obj, AV_LOG_INFO, "%d/%d", q.num, q.den); } - break; - case AV_OPT_TYPE_SAMPLE_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_sample_fmt_name(opt->default_val.i64), "none")); - break; - case AV_OPT_TYPE_COLOR: - case AV_OPT_TYPE_IMAGE_SIZE: - case AV_OPT_TYPE_STRING: - case AV_OPT_TYPE_VIDEO_RATE: - av_log(av_log_obj, AV_LOG_INFO, "\"%s\"", opt->default_val.str); - break; - case AV_OPT_TYPE_CHANNEL_LAYOUT: - av_log(av_log_obj, AV_LOG_INFO, "0x%"PRIx64, opt->default_val.i64); - break; - } - av_log(av_log_obj, AV_LOG_INFO, ")"); - } - - av_log(av_log_obj, AV_LOG_INFO, "\n"); - if (opt->unit && opt->type != AV_OPT_TYPE_CONST) { - opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags); - } - } -} - -int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags) -{ - if (!obj) - return -1; - - av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); - - opt_list(obj, av_log_obj, NULL, req_flags, rej_flags); - - return 0; -} - void av_opt_set_defaults(void *s) { av_opt_set_defaults2(s, 0, 0); @@ -1302,290 +1086,3 @@ int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_fla return AVERROR_OPTION_NOT_FOUND; return av_opt_is_set_to_default(target, o); } - -#ifdef TEST - -typedef struct TestContext -{ - const AVClass *class; - int num; - int toggle; - char *string; - int flags; - AVRational rational; - AVRational video_rate; - int w, h; - enum AVPixelFormat pix_fmt; - enum AVSampleFormat sample_fmt; - int64_t duration; - uint8_t color[4]; - int64_t channel_layout; - void *binary; - int binary_size; - void *binary1; - int binary_size1; - void *binary2; - int binary_size2; - int64_t num64; - float flt; - double dbl; - char *escape; - int bool1; - int bool2; - int bool3; -} TestContext; - -#define OFFSET(x) offsetof(TestContext, x) - -#define TEST_FLAG_COOL 01 -#define TEST_FLAG_LAME 02 -#define TEST_FLAG_MU 04 - -static const AVOption test_options[]= { -{"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, 1 }, -{"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, 1 }, -{"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, 10, 1 }, -{"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, {.str = "default"}, CHAR_MIN, CHAR_MAX, 1 }, -{"escape", "set escape str", OFFSET(escape), AV_OPT_TYPE_STRING, {.str = "\\=,"}, CHAR_MIN, CHAR_MAX, 1 }, -{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 1}, 0, INT_MAX, 1, "flags" }, -{"cool", "set cool flag", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_COOL}, INT_MIN, INT_MAX, 1, "flags" }, -{"lame", "set lame flag", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_LAME}, INT_MIN, INT_MAX, 1, "flags" }, -{"mu", "set mu flag", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_MU}, INT_MIN, INT_MAX, 1, "flags" }, -{"size", "set size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE,{.str="200x300"}, 0, 0, 1}, -{"pix_fmt", "set pixfmt", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_0BGR}, -1, INT_MAX, 1}, -{"sample_fmt", "set samplefmt", OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, {.i64 = AV_SAMPLE_FMT_S16}, -1, INT_MAX, 1}, -{"video_rate", "set videorate", OFFSET(video_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0 , 1}, -{"duration", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 1000}, 0, INT64_MAX, 1}, -{"color", "set color", OFFSET(color), AV_OPT_TYPE_COLOR, {.str = "pink"}, 0, 0, 1}, -{"cl", "set channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = AV_CH_LAYOUT_HEXAGONAL}, 0, INT64_MAX, 1}, -{"bin", "set binary value", OFFSET(binary), AV_OPT_TYPE_BINARY, {.str="62696e00"}, 0, 0, 1 }, -{"bin1", "set binary value", OFFSET(binary1), AV_OPT_TYPE_BINARY, {.str=NULL}, 0, 0, 1 }, -{"bin2", "set binary value", OFFSET(binary2), AV_OPT_TYPE_BINARY, {.str=""}, 0, 0, 1 }, -{"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, {.i64 = 1}, 0, 100, 1 }, -{"flt", "set float", OFFSET(flt), AV_OPT_TYPE_FLOAT, {.dbl = 1.0/3}, 0, 100, 1}, -{"dbl", "set double", OFFSET(dbl), AV_OPT_TYPE_DOUBLE, {.dbl = 1.0/3}, 0, 100, 1 }, -{"bool1", "set boolean value", OFFSET(bool1), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, 1 }, -{"bool2", "set boolean value", OFFSET(bool2), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, 1 }, -{"bool3", "set boolean value", OFFSET(bool3), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 1 }, -{NULL}, -}; - -static const char *test_get_name(void *ctx) -{ - return "test"; -} - -static const AVClass test_class = { - "TestContext", - test_get_name, - test_options -}; - -static void log_callback_help(void *ptr, int level, const char *fmt, va_list vl) -{ - vfprintf(stdout, fmt, vl); -} - -int main(void) -{ - int i; - - av_log_set_level(AV_LOG_DEBUG); - av_log_set_callback(log_callback_help); - - printf("Testing default values\n"); - { - TestContext test_ctx = { 0 }; - test_ctx.class = &test_class; - av_opt_set_defaults(&test_ctx); - - printf("num=%d\n", test_ctx.num); - printf("toggle=%d\n", test_ctx.toggle); - printf("string=%s\n", test_ctx.string); - printf("escape=%s\n", test_ctx.escape); - printf("flags=%d\n", test_ctx.flags); - printf("rational=%d/%d\n", test_ctx.rational.num, test_ctx.rational.den); - printf("video_rate=%d/%d\n", test_ctx.video_rate.num, test_ctx.video_rate.den); - printf("width=%d height=%d\n", test_ctx.w, test_ctx.h); - printf("sample_fmt=%s\n", av_get_sample_fmt_name(test_ctx.sample_fmt)); - printf("duration=%"PRId64"\n", test_ctx.duration); - printf("color=%d %d %d %d\n", test_ctx.color[0], test_ctx.color[1], test_ctx.color[2], test_ctx.color[3]); - printf("channel_layout=%"PRId64"=%"PRId64"\n", test_ctx.channel_layout, (int64_t)AV_CH_LAYOUT_HEXAGONAL); - if (test_ctx.binary) - printf("binary=%x %x %x %x\n", ((uint8_t*)test_ctx.binary)[0], ((uint8_t*)test_ctx.binary)[1], ((uint8_t*)test_ctx.binary)[2], ((uint8_t*)test_ctx.binary)[3]); - printf("binary_size=%d\n", test_ctx.binary_size); - printf("num64=%"PRId64"\n", test_ctx.num64); - printf("flt=%.6f\n", test_ctx.flt); - printf("dbl=%.6f\n", test_ctx.dbl); - - av_opt_show2(&test_ctx, NULL, -1, 0); - - av_opt_free(&test_ctx); - } - - printf("\nTesting av_opt_is_set_to_default()\n"); - { - int ret; - TestContext test_ctx = { 0 }; - const AVOption *o = NULL; - test_ctx.class = &test_class; - - av_log_set_level(AV_LOG_QUIET); - - while (o = av_opt_next(&test_ctx, o)) { - ret = av_opt_is_set_to_default_by_name(&test_ctx, o->name, 0); - printf("name:%10s default:%d error:%s\n", o->name, !!ret, ret < 0 ? av_err2str(ret) : ""); - } - av_opt_set_defaults(&test_ctx); - while (o = av_opt_next(&test_ctx, o)) { - ret = av_opt_is_set_to_default_by_name(&test_ctx, o->name, 0); - printf("name:%10s default:%d error:%s\n", o->name, !!ret, ret < 0 ? av_err2str(ret) : ""); - } - av_opt_free(&test_ctx); - } - - printf("\nTest av_opt_serialize()\n"); - { - TestContext test_ctx = { 0 }; - char *buf; - test_ctx.class = &test_class; - - av_log_set_level(AV_LOG_QUIET); - - av_opt_set_defaults(&test_ctx); - if (av_opt_serialize(&test_ctx, 0, 0, &buf, '=', ',') >= 0) { - printf("%s\n", buf); - av_opt_free(&test_ctx); - memset(&test_ctx, 0, sizeof(test_ctx)); - test_ctx.class = &test_class; - av_set_options_string(&test_ctx, buf, "=", ","); - av_free(buf); - if (av_opt_serialize(&test_ctx, 0, 0, &buf, '=', ',') >= 0) { - printf("%s\n", buf); - av_free(buf); - } - } - av_opt_free(&test_ctx); - } - - printf("\nTesting av_set_options_string()\n"); - { - TestContext test_ctx = { 0 }; - static const char * const options[] = { - "", - ":", - "=", - "foo=:", - ":=foo", - "=foo", - "foo=", - "foo", - "foo=val", - "foo==val", - "toggle=:", - "string=:", - "toggle=1 : foo", - "toggle=100", - "toggle==1", - "flags=+mu-lame : num=42: toggle=0", - "num=42 : string=blahblah", - "rational=0 : rational=1/2 : rational=1/-1", - "rational=-1/0", - "size=1024x768", - "size=pal", - "size=bogus", - "pix_fmt=yuv420p", - "pix_fmt=2", - "pix_fmt=bogus", - "sample_fmt=s16", - "sample_fmt=2", - "sample_fmt=bogus", - "video_rate=pal", - "video_rate=25", - "video_rate=30000/1001", - "video_rate=30/1.001", - "video_rate=bogus", - "duration=bogus", - "duration=123.45", - "duration=1\\:23\\:45.67", - "color=blue", - "color=0x223300", - "color=0x42FF07AA", - "cl=stereo+downmix", - "cl=foo", - "bin=boguss", - "bin=111", - "bin=ffff", - "num64=bogus", - "num64=44", - "num64=44.4", - "num64=-1", - "num64=101", - "flt=bogus", - "flt=2", - "flt=2.2", - "flt=-1", - "flt=101", - "dbl=bogus", - "dbl=2", - "dbl=2.2", - "dbl=-1", - "dbl=101", - "bool1=true", - "bool2=auto", - }; - - test_ctx.class = &test_class; - av_opt_set_defaults(&test_ctx); - - av_log_set_level(AV_LOG_QUIET); - - for (i=0; i < FF_ARRAY_ELEMS(options); i++) { - int silence_log = !strcmp(options[i], "rational=-1/0"); // inf formating differs between platforms - av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]); - if (silence_log) - av_log_set_callback(NULL); - if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0) - printf("Error '%s'\n", options[i]); - else - printf("OK '%s'\n", options[i]); - av_log_set_callback(log_callback_help); - } - av_opt_free(&test_ctx); - } - - printf("\nTesting av_opt_set_from_string()\n"); - { - TestContext test_ctx = { 0 }; - static const char * const options[] = { - "", - "5", - "5:hello", - "5:hello:size=pal", - "5:size=pal:hello", - ":", - "=", - " 5 : hello : size = pal ", - "a_very_long_option_name_that_will_need_to_be_ellipsized_around_here=42" - }; - static const char * const shorthand[] = { "num", "string", NULL }; - - test_ctx.class = &test_class; - av_opt_set_defaults(&test_ctx); - - av_log_set_level(AV_LOG_QUIET); - - for (i=0; i < FF_ARRAY_ELEMS(options); i++) { - av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]); - if (av_opt_set_from_string(&test_ctx, options[i], shorthand, "=", ":") < 0) - printf("Error '%s'\n", options[i]); - else - printf("OK '%s'\n", options[i]); - } - av_opt_free(&test_ctx); - } - - return 0; -} - -#endif diff --git a/ext/at3_standalone/opt.h b/ext/at3_standalone/opt.h index 9e15aaa131..bba9b0ec35 100644 --- a/ext/at3_standalone/opt.h +++ b/ext/at3_standalone/opt.h @@ -277,8 +277,6 @@ typedef struct AVOption { #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... #endif #define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 /** * The option is inteded for exporting values to the caller. */ @@ -651,48 +649,6 @@ void *av_opt_child_next(void *obj, void *prev); */ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); -/** - * @defgroup opt_set_funcs Option setting functions - * @{ - * Those functions set the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. In case of av_opt_set() if the field is not - * of a string type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN - * is passed here, then the option may be set on a child of obj. - * - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR_OPTION_NOT_FOUND if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid - */ -int av_opt_set (void *obj, const char *name, const char *val, int search_flags); -int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); -int av_opt_set_double (void *obj, const char *name, double val, int search_flags); -int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); -int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); -int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags); -int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags); -int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags); -int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags); -int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags); -/** - * @note Any old dictionary present is discarded and replaced with a copy of the new one. The - * caller still owns val is and responsible for freeing it. - */ -int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags); - /** * Set a binary option to an integer list. * @@ -736,10 +692,8 @@ int av_opt_get (void *obj, const char *name, int search_flags, uint8_t int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val); int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); -int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out); int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt); int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt); -int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val); int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout); /** * @param[out] out_val The returned dictionary is a copy of the actual value and must diff --git a/ext/at3_standalone/options.c b/ext/at3_standalone/options.c index 24786fa29e..8781555826 100644 --- a/ext/at3_standalone/options.c +++ b/ext/at3_standalone/options.c @@ -90,17 +90,11 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec) if(s->codec_type == AVMEDIA_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; - else if(s->codec_type == AVMEDIA_TYPE_VIDEO) - flags= AV_OPT_FLAG_VIDEO_PARAM; - else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE) - flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); s->time_base = (AVRational){0,1}; s->pkt_timebase = (AVRational){ 0, 1 }; s->get_buffer2 = avcodec_default_get_buffer2; - s->execute = avcodec_default_execute; - s->execute2 = avcodec_default_execute2; s->sample_fmt = AV_SAMPLE_FMT_NONE; if(codec && codec->priv_data_size){ @@ -151,85 +145,6 @@ void avcodec_free_context(AVCodecContext **pavctx) av_freep(pavctx); } -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) -{ - const AVCodec *orig_codec = dest->codec; - uint8_t *orig_priv_data = dest->priv_data; - - if (avcodec_is_open(dest)) { // check that the dest context is uninitialized - av_log(dest, AV_LOG_ERROR, - "Tried to copy AVCodecContext %p into already-initialized %p\n", - src, dest); - return AVERROR(EINVAL); - } - - av_opt_free(dest); - av_freep(&dest->rc_override); - av_freep(&dest->intra_matrix); - av_freep(&dest->inter_matrix); - av_freep(&dest->extradata); - av_freep(&dest->subtitle_header); - - memcpy(dest, src, sizeof(*dest)); - av_opt_copy(dest, src); - - dest->priv_data = orig_priv_data; - dest->codec = orig_codec; - - if (orig_priv_data && src->codec && src->codec->priv_class && - dest->codec && dest->codec->priv_class) - av_opt_copy(orig_priv_data, src->priv_data); - - - /* set values specific to opened codecs back to their default state */ - dest->slice_offset = NULL; - dest->internal = NULL; -#if FF_API_CODED_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - dest->coded_frame = NULL; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - /* reallocate values that should be allocated separately */ - dest->extradata = NULL; - dest->intra_matrix = NULL; - dest->inter_matrix = NULL; - dest->rc_override = NULL; - dest->subtitle_header = NULL; - -#define alloc_and_copy_or_fail(obj, size, pad) \ - if (src->obj && size > 0) { \ - dest->obj = av_malloc(size + pad); \ - if (!dest->obj) \ - goto fail; \ - memcpy(dest->obj, src->obj, size); \ - if (pad) \ - memset(((uint8_t *) dest->obj) + size, 0, pad); \ - } - alloc_and_copy_or_fail(extradata, src->extradata_size, - AV_INPUT_BUFFER_PADDING_SIZE); - dest->extradata_size = src->extradata_size; - alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0); - alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0); - alloc_and_copy_or_fail(rc_override, src->rc_override_count * sizeof(*src->rc_override), 0); - alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 1); - av_assert0(dest->subtitle_header_size == src->subtitle_header_size); -#undef alloc_and_copy_or_fail - - return 0; - -fail: - av_freep(&dest->rc_override); - av_freep(&dest->intra_matrix); - av_freep(&dest->inter_matrix); - av_freep(&dest->extradata); - av_freep(&dest->subtitle_header); - dest->subtitle_header_size = 0; - dest->extradata_size = 0; - av_opt_free(dest); - return AVERROR(ENOMEM); -} - const AVClass *avcodec_get_class(void) { return &av_codec_context_class; diff --git a/ext/at3_standalone/util_internal.h b/ext/at3_standalone/util_internal.h index 5fe851381e..6c9cba0870 100644 --- a/ext/at3_standalone/util_internal.h +++ b/ext/at3_standalone/util_internal.h @@ -36,25 +36,10 @@ #include #include "config.h" #include "attributes.h" -#include "dict.h" #include "macros.h" #include "version.h" -#if ARCH_X86 -# include "x86/emms.h" -#endif - -#ifndef emms_c -# define emms_c() while(0) -#endif - -#ifndef attribute_align_arg -#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) -# define attribute_align_arg __attribute__((force_align_arg_pointer)) -#else # define attribute_align_arg -#endif -#endif #if defined(_MSC_VER) && CONFIG_SHARED # define av_export __declspec(dllimport) @@ -62,23 +47,6 @@ # define av_export #endif -#if HAVE_PRAGMA_DEPRECATED -# if defined(__ICL) || defined (__INTEL_COMPILER) -# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478)) -# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop)) -# elif defined(_MSC_VER) -# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996)) -# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop)) -# else -# define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -# define FF_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"") -# endif -#else -# define FF_DISABLE_DEPRECATION_WARNINGS -# define FF_ENABLE_DEPRECATION_WARNINGS -#endif - - #define FF_MEMORY_POISON 0x2a #define MAKE_ACCESSORS(str, name, type, field) \ @@ -89,13 +57,6 @@ // to be forced to tokenize __VA_ARGS__ #define E1(x) x -/* Check if the hard coded offset of a struct member still matches reality. - * Induce a compilation failure if not. - */ -#define AV_CHECK_OFFSET(s, m, o) struct check_##o { \ - int x_##o[offsetof(s, m) == o? 1: -1]; \ - } - #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \ uint8_t la_##v[sizeof(t s o) + (a)]; \ t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a) @@ -124,42 +85,6 @@ # define LOCAL_ALIGNED_32(t, v, ...) LOCAL_ALIGNED(32, t, v, __VA_ARGS__) #endif -#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ -{\ - p = av_malloc(size);\ - if (!(p) && (size) != 0) {\ - av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto label;\ - }\ -} - -#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ -{\ - p = av_mallocz(size);\ - if (!(p) && (size) != 0) {\ - av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto label;\ - }\ -} - -#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\ -{\ - p = av_malloc_array(nelem, elsize);\ - if (!p) {\ - av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto label;\ - }\ -} - -#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\ -{\ - p = av_mallocz_array(nelem, elsize);\ - if (!p) {\ - av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto label;\ - }\ -} - #include "libm.h" /** @@ -212,17 +137,6 @@ # define ONLY_IF_THREADS_ENABLED(x) NULL #endif -/** - * Log a generic warning message about a missing feature. - * Additionally request that a sample showcasing the feature be uploaded. - * - * @param[in] avc a pointer to an arbitrary struct of which the first field is - * a pointer to an AVClass struct - * @param[in] msg string containing the name of the missing feature - */ -void avpriv_request_sample(void *avc, - const char *msg, ...); - #if HAVE_LIBC_MSVCRT #include #if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 @@ -244,101 +158,6 @@ void avpriv_request_sample(void *avc, # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif -/** - * Clip and convert a double value into the long long amin-amax range. - * This function is needed because conversion of floating point to integers when - * it does not fit in the integer's representation does not necessarily saturate - * correctly (usually converted to a cvttsd2si on x86) which saturates numbers - * > INT64_MAX to INT64_MIN. The standard marks such conversions as undefined - * behavior, allowing this sort of mathematically bogus conversions. This provides - * a safe alternative that is slower obviously but assures safety and better - * mathematical behavior. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static av_always_inline av_const int64_t ff_rint64_clip(double a, int64_t amin, int64_t amax) -{ - int64_t res; -#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - // INT64_MAX+1,INT64_MIN are exactly representable as IEEE doubles - // do range checks first - if (a >= 9223372036854775808.0) - return amax; - if (a <= -9223372036854775808.0) - return amin; - - // safe to call llrint and clip accordingly - res = llrint(a); - if (res > amax) - return amax; - if (res < amin) - return amin; - return res; -} - -/** - * Compute 10^x for floating point values. Note: this function is by no means - * "correctly rounded", and is meant as a fast, reasonably accurate approximation. - * For instance, maximum relative error for the double precision variant is - * ~ 1e-13 for very small and very large values. - * This is ~2x faster than GNU libm's approach, which is still off by 2ulp on - * some inputs. - * @param x exponent - * @return 10^x - */ -static av_always_inline double ff_exp10(double x) -{ - return exp2(M_LOG2_10 * x); -} - -static av_always_inline float ff_exp10f(float x) -{ - return exp2f(M_LOG2_10 * x); -} - -/** - * Compute x^y for floating point x, y. Note: this function is faster than the - * libm variant due to mainly 2 reasons: - * 1. It does not handle any edge cases. In particular, this is only guaranteed - * to work correctly for x > 0. - * 2. It is not as accurate as a standard nearly "correctly rounded" libm variant. - * @param x base - * @param y exponent - * @return x^y - */ -static av_always_inline float ff_fast_powf(float x, float y) -{ - return expf(logf(x) * y); -} - - -/** - * A wrapper for open() setting O_CLOEXEC. - */ -av_warn_unused_result -int avpriv_open(const char *filename, int flags, ...); - -int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); - -static av_always_inline av_const int avpriv_mirror(int x, int w) -{ - if (!w) - return 0; - - while ((unsigned)x > (unsigned)w) { - x = -x; - if (x < 0) - x += 2 * w; - } - return x; -} - -void ff_check_pixfmt_descriptors(void); - extern const uint8_t ff_reverse[256]; #endif /* AVUTIL_INTERNAL_H */ diff --git a/ext/at3_standalone/utils.c b/ext/at3_standalone/utils.c index 8189d35a64..0190b7916c 100644 --- a/ext/at3_standalone/utils.c +++ b/ext/at3_standalone/utils.c @@ -35,7 +35,6 @@ #include "mathematics.h" #include "avstring.h" #include "samplefmt.h" -#include "dict.h" #include "avcodec.h" #include "opt.h" #include "internal.h" @@ -233,9 +232,6 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data; } - if (avctx->debug & FF_DEBUG_BUFFERS) - av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p", frame); - return 0; fail: av_frame_unref(frame); @@ -250,8 +246,6 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags return ret; switch (avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - return -1; case AVMEDIA_TYPE_AUDIO: return audio_get_buffer(avctx, frame); default: @@ -262,8 +256,6 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) { AVPacket *pkt = avctx->internal->pkt; - int i; - if (pkt) { av_frame_set_pkt_pos (frame, pkt->pos); av_frame_set_pkt_duration(frame, pkt->duration); @@ -275,8 +267,6 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) } switch (avctx->codec->type) { - case AVMEDIA_TYPE_VIDEO: - break; case AVMEDIA_TYPE_AUDIO: if (!frame->sample_rate) frame->sample_rate = avctx->sample_rate; @@ -306,29 +296,17 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) return 0; } -int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) -{ - return ff_init_buffer_info(avctx, frame); -} - -static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) -{ - int override_dimensions = 1; - int ret; - - ret = ff_decode_frame_props(avctx, frame); - if (ret < 0) - return ret; - - ret = avctx->get_buffer2(avctx, frame, flags); - -end: - return ret; -} - int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) { - return get_buffer_internal(avctx, frame, flags); + int override_dimensions = 1; + int ret; + + ret = ff_init_buffer_info(avctx, frame); + if (ret < 0) + return ret; + + ret = avctx->get_buffer2(avctx, frame, flags); + return ret; } int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size) @@ -369,7 +347,6 @@ static int64_t get_bit_rate(AVCodecContext *ctx) int bits_per_sample; switch (ctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_ATTACHMENT: @@ -478,31 +455,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code } avctx->frame_number = 0; - if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) && - avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { - const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; - AVCodec *codec2; - av_log(avctx, AV_LOG_ERROR, - "The %s '%s' is experimental but experimental codecs are not enabled, " - "add '-strict %d' if you want to use it.\n", - codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); - codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); - if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL)) - av_log(avctx, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", - codec_string, codec2->name); - ret = AVERROR_EXPERIMENTAL; - goto free_and_end; - } - if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; } - if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS)) - avctx->thread_count = 1; - #if FF_API_VISMV if (avctx->debug_mv) av_log(avctx, AV_LOG_WARNING, "The 'vismv' option is deprecated, " @@ -515,8 +473,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; - if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME) - || avctx->internal->frame_thread_encoder)) { + if (avctx->codec->init) { ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; @@ -670,8 +627,6 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif } avctx->codec = NULL; - avctx->active_thread_type = 0; - return 0; }