diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-15 18:01:32 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-09-15 18:02:43 +0200 |
commit | 7404f3bdb90e6a5dcb59bc0a091e2c5c038e557d (patch) | |
tree | 08d1d4010e20cd696e358bf03f9e2565f3256e0c /libavcodec | |
parent | 28e023377cfe42c5406441eeff32842c1bb1f09f (diff) | |
download | ffmpeg-7404f3bdb90e6a5dcb59bc0a091e2c5c038e557d.tar.gz |
lavc: Switch bitrate to 64bit unless compatibility with avconv was requested.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 12 | ||||
-rw-r--r-- | libavcodec/cook.c | 2 | ||||
-rw-r--r-- | libavcodec/dcaenc.c | 2 | ||||
-rw-r--r-- | libavcodec/libfdk-aacenc.c | 4 | ||||
-rw-r--r-- | libavcodec/libgsmenc.c | 4 | ||||
-rw-r--r-- | libavcodec/libopusenc.c | 6 | ||||
-rw-r--r-- | libavcodec/libspeexenc.c | 4 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 2 | ||||
-rw-r--r-- | libavcodec/options_table.h | 11 | ||||
-rw-r--r-- | libavcodec/pcm-bluray.c | 4 | ||||
-rw-r--r-- | libavcodec/pcm-dvd.c | 4 | ||||
-rw-r--r-- | libavcodec/sipr.c | 4 | ||||
-rw-r--r-- | libavcodec/utils.c | 4 | ||||
-rw-r--r-- | libavcodec/version.h | 2 | ||||
-rw-r--r-- | libavcodec/wma.c | 4 | ||||
-rw-r--r-- | libavcodec/wmaenc.c | 4 |
16 files changed, 48 insertions, 25 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 6e3edaaed7..aac51985f0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1532,7 +1532,11 @@ 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. @@ -2463,14 +2467,22 @@ 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 /** diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 673896d6cd..d8fb736828 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1028,7 +1028,7 @@ static void dump_cook_context(COOKContext *q) } ff_dlog(q->avctx, "COOKContext\n"); PRINT("nb_channels", q->avctx->channels); - PRINT("bit_rate", q->avctx->bit_rate); + PRINT("bit_rate", (int)q->avctx->bit_rate); PRINT("sample_rate", q->avctx->sample_rate); PRINT("samples_per_channel", q->subpacket[0].samples_per_channel); PRINT("subbands", q->subpacket[0].subbands); diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index 23587a7bd7..79da8f4289 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -145,7 +145,7 @@ static int encode_init(AVCodecContext *avctx) c->samplerate_index = i; if (avctx->bit_rate < 32000 || avctx->bit_rate > 3840000) { - av_log(avctx, AV_LOG_ERROR, "Bit rate %i not supported.", avctx->bit_rate); + av_log(avctx, AV_LOG_ERROR, "Bit rate %"PRId64" not supported.", (int64_t)avctx->bit_rate); return AVERROR(EINVAL); } for (i = 0; ff_dca_bit_rates[i] < avctx->bit_rate; i++) diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index 5df0c90947..98a817b537 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -215,8 +215,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) } if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATE, avctx->bit_rate)) != AACENC_OK) { - av_log(avctx, AV_LOG_ERROR, "Unable to set the bitrate %d: %s\n", - avctx->bit_rate, aac_get_error(err)); + av_log(avctx, AV_LOG_ERROR, "Unable to set the bitrate %"PRId64": %s\n", + (int64_t)avctx->bit_rate, aac_get_error(err)); goto error; } } diff --git a/libavcodec/libgsmenc.c b/libavcodec/libgsmenc.c index 45fdb8edd6..69ce439ec1 100644 --- a/libavcodec/libgsmenc.c +++ b/libavcodec/libgsmenc.c @@ -62,8 +62,8 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) { if (avctx->bit_rate != 13000 /* Official */ && avctx->bit_rate != 13200 /* Very common */ && avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) { - av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n", - avctx->bit_rate); + av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %"PRId64"bps\n", + (int64_t)avctx->bit_rate); if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index a170b711c6..8ac02f9520 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -180,12 +180,12 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx) avctx->bit_rate = 64000 * opus->stream_count + 32000 * coupled_stream_count; av_log(avctx, AV_LOG_WARNING, - "No bit rate set. Defaulting to %d bps.\n", avctx->bit_rate); + "No bit rate set. Defaulting to %"PRId64" bps.\n", (int64_t)avctx->bit_rate); } if (avctx->bit_rate < 500 || avctx->bit_rate > 256000 * avctx->channels) { - av_log(avctx, AV_LOG_ERROR, "The bit rate %d bps is unsupported. " - "Please choose a value between 500 and %d.\n", avctx->bit_rate, + av_log(avctx, AV_LOG_ERROR, "The bit rate %"PRId64" bps is unsupported. " + "Please choose a value between 500 and %d.\n", (int64_t)avctx->bit_rate, 256000 * avctx->channels); return AVERROR(EINVAL); } diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c index fbc17388a1..65a84dc56d 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -125,10 +125,10 @@ static av_cold void print_enc_params(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, " quality: %f\n", s->vbr_quality); } else if (s->abr) { av_log(avctx, AV_LOG_DEBUG, "rate control: ABR\n"); - av_log(avctx, AV_LOG_DEBUG, " bitrate: %d bps\n", avctx->bit_rate); + av_log(avctx, AV_LOG_DEBUG, " bitrate: %"PRId64" bps\n", (int64_t)avctx->bit_rate); } else { av_log(avctx, AV_LOG_DEBUG, "rate control: CBR\n"); - av_log(avctx, AV_LOG_DEBUG, " bitrate: %d bps\n", avctx->bit_rate); + av_log(avctx, AV_LOG_DEBUG, " bitrate: %"PRId64" bps\n", (int64_t)avctx->bit_rate); } av_log(avctx, AV_LOG_DEBUG, "complexity: %d\n", avctx->compression_level); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index b04fa39bc7..b84eba1602 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -486,7 +486,7 @@ FF_ENABLE_DEPRECATION_WARNINGS avctx->bit_rate * av_q2d(avctx->time_base) > avctx->bit_rate_tolerance) { av_log(avctx, AV_LOG_WARNING, - "bitrate tolerance %d too small for bitrate %d, overriding\n", avctx->bit_rate_tolerance, avctx->bit_rate); + "bitrate tolerance %d too small for bitrate %"PRId64", overriding\n", avctx->bit_rate_tolerance, (int64_t)avctx->bit_rate); avctx->bit_rate_tolerance = 5 * avctx->bit_rate * av_q2d(avctx->time_base); } diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d6a5c69ac4..1150841953 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -42,8 +42,13 @@ #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.", @@ -186,9 +191,15 @@ 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}, diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c index e7f9ee44a1..22c1c08bcf 100644 --- a/libavcodec/pcm-bluray.c +++ b/libavcodec/pcm-bluray.c @@ -117,9 +117,9 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, if (avctx->debug & FF_DEBUG_PICT_INFO) ff_dlog(avctx, - "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n", + "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %"PRId64" bit/s\n", avctx->channels, avctx->bits_per_coded_sample, - avctx->sample_rate, avctx->bit_rate); + avctx->sample_rate, (int64_t)avctx->bit_rate); return 0; } diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c index 985a19bdb1..a78c05dbe2 100644 --- a/libavcodec/pcm-dvd.c +++ b/libavcodec/pcm-dvd.c @@ -140,9 +140,9 @@ static int pcm_dvd_parse_header(AVCodecContext *avctx, const uint8_t *header) if (avctx->debug & FF_DEBUG_PICT_INFO) ff_dlog(avctx, - "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n", + "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %"PRId64" bit/s\n", avctx->channels, avctx->bits_per_coded_sample, - avctx->sample_rate, avctx->bit_rate); + avctx->sample_rate, (int64_t)avctx->bit_rate); s->last_header = header_int; diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index eb8b471263..4602a42484 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -493,8 +493,8 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx) else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5; else ctx->mode = MODE_5k0; av_log(avctx, AV_LOG_WARNING, - "Invalid block_align: %d. Mode %s guessed based on bitrate: %d\n", - avctx->block_align, modes[ctx->mode].mode_name, avctx->bit_rate); + "Invalid block_align: %d. Mode %s guessed based on bitrate: %"PRId64"\n", + avctx->block_align, modes[ctx->mode].mode_name, (int64_t)avctx->bit_rate); } av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3e4cea531a..ababdf3cfe 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1450,7 +1450,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) && avctx->bit_rate>0 && avctx->bit_rate<1000) { - av_log(avctx, AV_LOG_WARNING, "Bitrate %d is extremely low, maybe you mean %dk\n", avctx->bit_rate, avctx->bit_rate); + av_log(avctx, AV_LOG_WARNING, "Bitrate %"PRId64" is extremely low, maybe you mean %"PRId64"k\n", (int64_t)avctx->bit_rate, (int64_t)avctx->bit_rate); } if (!avctx->rc_initial_buffer_occupancy) @@ -2828,7 +2828,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ", %d kb/s", bitrate / 1000); } else if (enc->rc_max_rate > 0) { snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", max. %d kb/s", enc->rc_max_rate / 1000); + ", max. %"PRId64" kb/s", (int64_t)enc->rc_max_rate / 1000); } } diff --git a/libavcodec/version.h b/libavcodec/version.h index d233c712cf..07a9070d01 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 1 +#define LIBAVCODEC_VERSION_MINOR 2 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavcodec/wma.c b/libavcodec/wma.c index 006d8d55e4..6d1c7e5c2f 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -185,8 +185,8 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2) high_freq = high_freq * 0.5; } ff_dlog(s->avctx, "flags2=0x%x\n", flags2); - ff_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", - s->version, avctx->channels, avctx->sample_rate, avctx->bit_rate, + ff_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%"PRId64" block_align=%d\n", + s->version, avctx->channels, avctx->sample_rate, (int64_t)avctx->bit_rate, avctx->block_align); ff_dlog(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", bps, bps1, high_freq, s->byte_offset_bits); diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index fc23d4e33d..faf0cb518d 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -50,8 +50,8 @@ static av_cold int encode_init(AVCodecContext *avctx) if (avctx->bit_rate < 24 * 1000) { av_log(avctx, AV_LOG_ERROR, - "bitrate too low: got %i, need 24000 or higher\n", - avctx->bit_rate); + "bitrate too low: got %"PRId64", need 24000 or higher\n", + (int64_t)avctx->bit_rate); return AVERROR(EINVAL); } |