Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>tags/n3.0
| @@ -1532,11 +1532,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: Set by user, may be overwritten by libavcodec | |||
| * if this info is available in the stream | |||
| */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int bit_rate; | |||
| #else | |||
| int64_t bit_rate; | |||
| #endif | |||
| /** | |||
| * number of bits the bitstream is allowed to diverge from the reference. | |||
| @@ -2467,22 +2463,14 @@ typedef struct AVCodecContext { | |||
| * - encoding: Set by user. | |||
| * - decoding: Set by user, may be overwritten by libavcodec. | |||
| */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int rc_max_rate; | |||
| #else | |||
| int64_t rc_max_rate; | |||
| #endif | |||
| /** | |||
| * minimum bitrate | |||
| * - encoding: Set by user. | |||
| * - decoding: unused | |||
| */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int rc_min_rate; | |||
| #else | |||
| int64_t rc_min_rate; | |||
| #endif | |||
| #if FF_API_MPV_OPT | |||
| /** | |||
| @@ -42,13 +42,8 @@ | |||
| #define AV_CODEC_DEFAULT_BITRATE 200*1000 | |||
| static const AVOption avcodec_options[] = { | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| {"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, INT_MAX, A|V|E}, | |||
| {"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = 128*1000 }, 0, INT_MAX, A|E}, | |||
| #else | |||
| {"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, INT_MAX, A|V|E}, | |||
| {"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = 128*1000 }, 0, INT_MAX, A|E}, | |||
| #endif | |||
| {"bt", "Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far " | |||
| "ratecontrol is willing to deviate from the target average bitrate value. This is not related " | |||
| "to minimum/maximum bitrate. Lowering tolerance too much has an adverse effect on quality.", | |||
| @@ -191,15 +186,9 @@ static const AVOption avcodec_options[] = { | |||
| #if FF_API_MPV_OPT | |||
| {"rc_eq", "deprecated, use encoder private options instead", OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E}, | |||
| #endif | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| {"maxrate", "maximum bitrate (in bits/s). Used for VBV together with bufsize.", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|A|E}, | |||
| {"minrate", "minimum bitrate (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise.", | |||
| OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, | |||
| #else | |||
| {"maxrate", "maximum bitrate (in bits/s). Used for VBV together with bufsize.", OFFSET(rc_max_rate), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT_MAX, V|A|E}, | |||
| {"minrate", "minimum bitrate (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise.", | |||
| OFFSET(rc_min_rate), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, | |||
| #endif | |||
| {"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|V|E}, | |||
| #if FF_API_MPV_OPT | |||
| {"rc_buf_aggressivity", "deprecated, use encoder private options instead", OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E}, | |||
| @@ -1358,11 +1358,7 @@ typedef struct AVFormatContext { | |||
| * available. Never set it directly if the file_size and the | |||
| * duration are known as FFmpeg can compute it automatically. | |||
| */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int bit_rate; | |||
| #else | |||
| int64_t bit_rate; | |||
| #endif | |||
| unsigned int packet_size; | |||
| int max_delay; | |||
| @@ -1395,18 +1391,20 @@ typedef struct AVFormatContext { | |||
| #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 | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| /** | |||
| * @deprecated deprecated in favor of probesize2 | |||
| * Maximum size of the data read from input for determining | |||
| * the input container format. | |||
| * Demuxing only, set by the caller before avformat_open_input(). | |||
| */ | |||
| unsigned int probesize; | |||
| int64_t probesize; | |||
| /** | |||
| * @deprecated deprecated in favor of max_analyze_duration2 | |||
| * Maximum duration (in AV_TIME_BASE units) of the data read | |||
| * from input in avformat_find_stream_info(). | |||
| * Demuxing only, set by the caller before avformat_find_stream_info(). | |||
| * Can be set to 0 to let avformat choose using a heuristic. | |||
| */ | |||
| attribute_deprecated | |||
| int max_analyze_duration; | |||
| #endif | |||
| int64_t max_analyze_duration; | |||
| const uint8_t *key; | |||
| int keylen; | |||
| @@ -1752,31 +1750,6 @@ typedef struct AVFormatContext { | |||
| */ | |||
| int64_t output_ts_offset; | |||
| /** | |||
| * Maximum duration (in AV_TIME_BASE units) of the data read | |||
| * from input in avformat_find_stream_info(). | |||
| * Demuxing only, set by the caller before avformat_find_stream_info() | |||
| * via AVOptions (NO direct access). | |||
| * Can be set to 0 to let avformat choose using a heuristic. | |||
| */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int64_t max_analyze_duration2; | |||
| #else | |||
| int64_t max_analyze_duration; | |||
| #endif | |||
| /** | |||
| * Maximum size of the data read from input for determining | |||
| * the input container format. | |||
| * Demuxing only, set by the caller before avformat_open_input() | |||
| * via AVOptions (NO direct access). | |||
| */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int64_t probesize2; | |||
| #else | |||
| int64_t probesize; | |||
| #endif | |||
| /** | |||
| * dump format separator. | |||
| * can be ", " or "\n " or anything else | |||
| @@ -2512,12 +2512,7 @@ static int mpegts_read_header(AVFormatContext *s) | |||
| AVIOContext *pb = s->pb; | |||
| uint8_t buf[8 * 1024] = {0}; | |||
| int len; | |||
| int64_t pos, probesize = | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| s->probesize ? s->probesize : s->probesize2; | |||
| #else | |||
| s->probesize; | |||
| #endif | |||
| int64_t pos, probesize = s->probesize; | |||
| if (ffio_ensure_seekback(pb, probesize) < 0) | |||
| av_log(s, AV_LOG_WARNING, "Failed to allocate buffers for seekback\n"); | |||
| @@ -36,11 +36,7 @@ | |||
| static const AVOption avformat_options[] = { | |||
| {"avioflags", NULL, OFFSET(avio_flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "avioflags"}, | |||
| {"direct", "reduce buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVIO_FLAG_DIRECT }, INT_MIN, INT_MAX, D|E, "avioflags"}, | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| {"probesize", "set probing size", OFFSET(probesize2), AV_OPT_TYPE_INT64, {.i64 = 5000000 }, 32, INT64_MAX, D}, | |||
| #else | |||
| {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 = 5000000 }, 32, INT64_MAX, D}, | |||
| #endif | |||
| {"formatprobesize", "number of bytes to probe file format", OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, INT_MAX-1, D}, | |||
| {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E}, | |||
| {"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"}, | |||
| @@ -58,11 +54,7 @@ static const AVOption avformat_options[] = { | |||
| {"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"}, | |||
| {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D}, | |||
| {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" }, | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| {"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration2), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D}, | |||
| #else | |||
| {"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D}, | |||
| #endif | |||
| {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, | |||
| {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D}, | |||
| {"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.i64 = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */ | |||
| @@ -448,11 +448,7 @@ real_parse_asm_rule(AVStream *st, const char *p, const char *end) | |||
| { | |||
| do { | |||
| /* can be either averagebandwidth= or AverageBandwidth= */ | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| if (sscanf(p, " %*1[Aa]verage%*1[Bb]andwidth=%d", &st->codec->bit_rate) == 1) | |||
| #else | |||
| if (sscanf(p, " %*1[Aa]verage%*1[Bb]andwidth=%"SCNd64, &st->codec->bit_rate) == 1) | |||
| #endif | |||
| break; | |||
| if (!(p = strchr(p, ',')) || p > end) | |||
| p = end; | |||
| @@ -2369,7 +2369,7 @@ static void update_stream_timings(AVFormatContext *ic) | |||
| /* compute the bitrate */ | |||
| double bitrate = (double) filesize * 8.0 * AV_TIME_BASE / | |||
| (double) ic->duration; | |||
| if (bitrate >= 0 && (!AV_HAVE_INCOMPATIBLE_LIBAV_ABI || bitrate <= INT_MAX)) | |||
| if (bitrate >= 0 && bitrate <= INT64_MAX) | |||
| ic->bit_rate = bitrate; | |||
| } | |||
| } | |||
| @@ -3085,18 +3085,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) | |||
| // new streams might appear, no options for those | |||
| int orig_nb_streams = ic->nb_streams; | |||
| int flush_codecs; | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int64_t max_analyze_duration = ic->max_analyze_duration2; | |||
| #else | |||
| int64_t max_analyze_duration = ic->max_analyze_duration; | |||
| #endif | |||
| int64_t max_stream_analyze_duration; | |||
| int64_t max_subtitle_analyze_duration; | |||
| #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI | |||
| int64_t probesize = ic->probesize2; | |||
| #else | |||
| int64_t probesize = ic->probesize; | |||
| #endif | |||
| if (!max_analyze_duration) | |||
| max_analyze_duration = ic->max_analyze_duration; | |||