aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-14 14:03:20 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-14 14:11:03 +0100
commit9f32048dd1967d7aa5421c490349a1056849cd78 (patch)
tree7147e237551224b8f7477096d2cf7e1f000d31ef /libavcodec
parentdbfa4317f3f8df13d889732d62f8d6abef2ac620 (diff)
parentaa241229891173b0357eee04e6ca78f806cc9c0c (diff)
downloadffmpeg-9f32048dd1967d7aa5421c490349a1056849cd78.tar.gz
Merge commit 'aa241229891173b0357eee04e6ca78f806cc9c0c'
* commit 'aa241229891173b0357eee04e6ca78f806cc9c0c': lavc: deprecate FF_MAX_B_FRAMES Conflicts: libavcodec/options_table.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h5
-rw-r--r--libavcodec/mpegvideo.h2
-rw-r--r--libavcodec/mpegvideo_enc.c6
-rw-r--r--libavcodec/options_table.h2
-rw-r--r--libavcodec/version.h3
5 files changed, 16 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 084f2ae1b4..18a41256d8 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -691,7 +691,12 @@ typedef struct RcOverride{
float quality_factor;
} RcOverride;
+#if FF_API_MAX_BFRAMES
+/**
+ * @deprecated there is no libavcodec-wide limit on the number of B-frames
+ */
#define FF_MAX_B_FRAMES 16
+#endif
/* encoding support
These flags can be passed in AVCodecContext.flags before initialization.
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 79b391ca1c..cffda4b4da 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -66,6 +66,8 @@ enum OutputFormat {
#define MAX_THREADS 32
#define MAX_PICTURE_COUNT 36
+#define MAX_B_FRAMES 16
+
#define ME_MAP_SIZE 64
#define ME_MAP_SHIFT 3
#define ME_MAP_MV_BITS 11
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 7842e0b359..fe83669e18 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -316,6 +316,10 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
+ if (avctx->max_b_frames > MAX_B_FRAMES) {
+ av_log(avctx, AV_LOG_ERROR, "Too many B-frames requested, maximum "
+ "is %d.\n", MAX_B_FRAMES);
+ }
s->max_b_frames = avctx->max_b_frames;
s->codec_id = avctx->codec->id;
s->strict_std_compliance = avctx->strict_std_compliance;
@@ -1146,7 +1150,7 @@ static int estimate_best_b_count(MpegEncContext *s)
{
AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id);
AVCodecContext *c = avcodec_alloc_context3(NULL);
- AVFrame input[FF_MAX_B_FRAMES + 2];
+ AVFrame input[MAX_B_FRAMES + 2];
const int scale = s->avctx->brd_scale;
int i, j, out_size, p_lambda, b_lambda, lambda2;
int64_t best_rd = INT64_MAX;
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index f330913815..427a4a2205 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -106,7 +106,7 @@ static const AVOption avcodec_options[] = {
{"qmin", "minimum video quantizer scale (VBR)", OFFSET(qmin), AV_OPT_TYPE_INT, {.i64 = 2 }, -1, 69, V|E},
{"qmax", "maximum video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.i64 = 31 }, -1, 1024, V|E},
{"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E},
-{"bf", "set maximum number of B frames between non-B-frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, FF_MAX_B_FRAMES, V|E},
+{"bf", "set maximum number of B frames between non-B-frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, INT_MAX, V|E},
{"b_qfactor", "QP factor between P- and B-frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},
{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 75beb45358..6f2d5da07e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -129,5 +129,8 @@
#ifndef FF_API_MB_TYPE
#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
+#ifndef FF_API_MAX_BFRAMES
+#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
#endif /* AVCODEC_VERSION_H */