[1/2] avcodec: Set flags2 default value depending on availability

Message ID 1320322758-46659-1-git-send-email-martin@martin.st
State Committed
Commit adc85ce20bc18c7f2074e1e88d0eeaffde810ea4
Headers show

Commit Message

Martin Storsjö Nov. 3, 2011, 12:19 p.m.
This makes the code compile when FF_API_X264_GLOBAL_OPTS or
FF_API_LAME_GLOBAL_OPTS is 0.
---
 libavcodec/options.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

Comments

Anton Khirnov Nov. 4, 2011, 10:44 a.m. | #1
On Thu,  3 Nov 2011 14:19:17 +0200, Martin Storsjö <martin@martin.st> wrote:
> This makes the code compile when FF_API_X264_GLOBAL_OPTS or
> FF_API_LAME_GLOBAL_OPTS is 0.
> ---

Ok.

Patch

diff --git a/libavcodec/options.c b/libavcodec/options.c
index a08ed98..ef7a39a 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -351,7 +351,17 @@  static const AVOption options[]={
 {"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"inter_threshold", NULL, OFFSET(inter_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.dbl = CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE }, 0, UINT_MAX, V|A|E|D, "flags2"},
+#if FF_API_X264_GLOBAL_OPTS
+#define X264_DEFAULTS CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE
+#else
+#define X264_DEFAULTS 0
+#endif
+#if FF_API_LAME_GLOBAL_OPTS
+#define LAME_DEFAULTS CODEC_FLAG2_BIT_RESERVOIR
+#else
+#define LAME_DEFAULTS 0
+#endif
+{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.dbl = X264_DEFAULTS|LAME_DEFAULTS }, 0, UINT_MAX, V|A|E|D, "flags2"},
 {"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 #if FF_API_ANTIALIAS_ALGO
 {"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D, "aa"},