]> git.sesse.net Git - ffmpeg/blobdiff - cmdutils.c
Move ff_ac3_critical_band_size_tab in ac3.c for non-hardcoded tables.
[ffmpeg] / cmdutils.c
index b2e6ee0081a26d1806909a8f6146146996baa8b6..58fe85cfda634a926bf8adec44c460d4cd2f8db9 100644 (file)
@@ -55,7 +55,7 @@ AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
 AVFormatContext *avformat_opts;
 struct SwsContext *sws_opts;
 
-const int this_year = 2010;
+static const int this_year = 2011;
 
 void init_opts(void)
 {
@@ -63,7 +63,9 @@ void init_opts(void)
     for (i = 0; i < AVMEDIA_TYPE_NB; i++)
         avcodec_opts[i] = avcodec_alloc_context2(i);
     avformat_opts = avformat_alloc_context();
+#if CONFIG_SWSCALE
     sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL);
+#endif
 }
 
 void uninit_opts(void)
@@ -73,7 +75,9 @@ void uninit_opts(void)
         av_freep(&avcodec_opts[i]);
     av_freep(&avformat_opts->key);
     av_freep(&avformat_opts);
+#if CONFIG_SWSCALE
     av_freep(&sws_opts);
+#endif
 }
 
 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
@@ -194,7 +198,7 @@ unknown_opt:
             } else if (po->flags & OPT_INT64) {
                 *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
             } else if (po->flags & OPT_FLOAT) {
-                *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
+                *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
             } else if (po->flags & OPT_FUNC2) {
                 if (po->u.func2_arg(opt, arg) < 0) {
                     fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
@@ -241,14 +245,22 @@ int opt_default(const char *opt, const char *arg){
     }
     if (!o) {
         AVCodec *p = NULL;
+        AVOutputFormat *oformat = NULL;
         while ((p=av_codec_next(p))){
             AVClass *c= p->priv_class;
             if(c && av_find_opt(&c, opt, NULL, 0, 0))
                 break;
         }
-        if(!p){
-        fprintf(stderr, "Unrecognized option '%s'\n", opt);
-        exit(1);
+        if (!p) {
+            while ((oformat = av_oformat_next(oformat))) {
+                const AVClass *c = oformat->priv_class;
+                if (c && av_find_opt(&c, opt, NULL, 0, 0))
+                    break;
+            }
+        }
+        if(!p && !oformat){
+            fprintf(stderr, "Unrecognized option '%s'\n", opt);
+            exit(1);
         }
     }
 
@@ -322,7 +334,13 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
         if(codec && codec->priv_class && avctx->priv_data){
             priv_ctx= avctx->priv_data;
         }
+    } else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) {
+        AVFormatContext *avctx = ctx;
+        if (avctx->oformat && avctx->oformat->priv_class) {
+            priv_ctx = avctx->priv_data;
+        }
     }
+
     for(i=0; i<opt_name_count; i++){
         char buf[256];
         const AVOption *opt;
@@ -360,7 +378,7 @@ static int warned_cfg = 0;
         const char *indent = flags & INDENT? "  " : "";                 \
         if (flags & SHOW_VERSION) {                                     \
             unsigned int version = libname##_version();                 \
-            fprintf(outstream, "%slib%-10s %2d.%2d.%2d / %2d.%2d.%2d\n", \
+            fprintf(outstream, "%slib%-9s %2d.%3d.%2d / %2d.%3d.%2d\n", \
                     indent, #libname,                                   \
                     LIB##LIBNAME##_VERSION_MAJOR,                       \
                     LIB##LIBNAME##_VERSION_MINOR,                       \