]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/options.c
ac3enc: restructure coupling coordinate reuse calculation
[ffmpeg] / libavcodec / options.c
index 545887a7c17af9022692c5bbba60316043c80d7b..1ee02c04174944d5246c10f6c33f20ac6530bb69 100644 (file)
@@ -25,6 +25,8 @@
  */
 
 #include "avcodec.h"
+#include "internal.h"
+#include "libavutil/avassert.h"
 #include "libavutil/opt.h"
 #include <float.h>              /* FLT_MIN, FLT_MAX */
 
@@ -69,7 +71,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i
 
 static const AVOption options[]={
 {"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, V|E},
-{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = 64*1000 }, INT_MIN, INT_MAX, A|E},
+{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, A|E},
 {"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E},
 {"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, UINT_MAX, V|A|E|D, "flags"},
 {"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"},
@@ -181,7 +183,10 @@ static const AVOption options[]={
 {"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, V|D, "er"},
 {"compliant", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_COMPLIANT }, INT_MIN, INT_MAX, V|D, "er"},
 {"aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"},
+#if FF_API_VERY_AGGRESSIVE
 {"very_aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"},
+#endif /* FF_API_VERY_AGGRESSIVE */
+{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"},
 {"has_b_frames", NULL, OFFSET(has_b_frames), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
 {"block_align", NULL, OFFSET(block_align), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
 {"parse_only", NULL, OFFSET(parse_only), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
@@ -524,6 +529,15 @@ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
             av_opt_set_defaults(s->priv_data);
         }
     }
+    if (codec && codec->defaults) {
+        int ret;
+        AVCodecDefault *d = codec->defaults;
+        while (d->key) {
+            ret = av_set_string3(s, d->key, d->value, 0, NULL);
+            av_assert0(ret >= 0);
+            d++;
+        }
+    }
     return 0;
 }
 
@@ -540,6 +554,7 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
     return avctx;
 }
 
+#if FF_API_ALLOC_CONTEXT
 AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
 
@@ -549,14 +564,17 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
 
     return avctx;
 }
+#endif
 
 void avcodec_get_context_defaults(AVCodecContext *s){
     avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
 }
 
+#if FF_API_ALLOC_CONTEXT
 AVCodecContext *avcodec_alloc_context(void){
     return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
 }
+#endif
 
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 {