]> git.sesse.net Git - ffmpeg/blobdiff - cmdutils.c
Reindent
[ffmpeg] / cmdutils.c
index e8de2f36ab0b89c701632cbd848348740e459406..600dcaf51f407c8129b4d87da0812de20e628bab 100644 (file)
@@ -50,7 +50,7 @@ AVCodecContext *avcodec_opts[CODEC_TYPE_NB];
 AVFormatContext *avformat_opts;
 struct SwsContext *sws_opts;
 
-const int this_year = 2009;
+const int this_year = 2010;
 
 double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
 {
@@ -125,11 +125,20 @@ void parse_options(int argc, char **argv, const OptionDef *options,
         opt = argv[optindex++];
 
         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
+            int bool_val = 1;
             if (opt[1] == '-' && opt[2] == '\0') {
                 handleoptions = 0;
                 continue;
             }
-            po= find_option(options, opt + 1);
+            opt++;
+            po= find_option(options, opt);
+            if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
+                /* handle 'no' bool option */
+                po = find_option(options, opt + 2);
+                if (!(po->name && (po->flags & OPT_BOOL)))
+                    goto unknown_opt;
+                bool_val = 0;
+            }
             if (!po->name)
                 po= find_option(options, "default");
             if (!po->name) {
@@ -150,15 +159,15 @@ unknown_opt:
                 str = av_strdup(arg);
                 *po->u.str_arg = str;
             } else if (po->flags & OPT_BOOL) {
-                *po->u.int_arg = 1;
+                *po->u.int_arg = bool_val;
             } else if (po->flags & OPT_INT) {
-                *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
+                *po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
             } else if (po->flags & OPT_INT64) {
-                *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
+                *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+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
+                *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
             } else if (po->flags & OPT_FUNC2) {
-                if(po->u.func2_arg(opt+1, arg)<0)
+                if(po->u.func2_arg(opt, arg)<0)
                     goto unknown_opt;
             } else {
                 po->u.func_arg(arg);
@@ -325,14 +334,10 @@ void show_banner(void)
 {
     fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d Fabrice Bellard, et al.\n",
             program_name, program_birth_year, this_year);
+    fprintf(stderr, "  built on %s %s with %s %s\n",
+            __DATE__, __TIME__, CC_TYPE, CC_VERSION);
     fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
     print_all_lib_versions(stderr, 1);
-    fprintf(stderr, "  built on " __DATE__ " " __TIME__);
-#ifdef __GNUC__
-    fprintf(stderr, ", gcc: " __VERSION__ "\n");
-#else
-    fprintf(stderr, ", using a non-gcc compiler\n");
-#endif
 }
 
 void show_version(void) {
@@ -409,16 +414,27 @@ void show_license(void)
     );
 }
 
+void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
+{
+    int i;
+    char fmt_str[128];
+    for (i=-1; i < nb_fmts; i++) {
+        get_fmt_string (fmt_str, sizeof(fmt_str), i);
+        fprintf(stdout, "%s\n", fmt_str);
+    }
+}
+
 void show_formats(void)
 {
     AVInputFormat *ifmt=NULL;
     AVOutputFormat *ofmt=NULL;
-    URLProtocol *up=NULL;
-    AVCodec *p=NULL, *p2;
-    AVBitStreamFilter *bsf=NULL;
     const char *last_name;
 
-    printf("File formats:\n");
+    printf(
+        "File formats:\n"
+        " D. = Demuxing supported\n"
+        " .E = Muxing supported\n"
+        " --\n");
     last_name= "000";
     for(;;){
         int decode=0;
@@ -455,9 +471,23 @@ void show_formats(void)
             name,
             long_name ? long_name:" ");
     }
-    printf("\n");
+}
 
-    printf("Codecs:\n");
+void show_codecs(void)
+{
+    AVCodec *p=NULL, *p2;
+    const char *last_name;
+    printf(
+        "Codecs:\n"
+        " D..... = Decoding supported\n"
+        " .E.... = Encoding supported\n"
+        " ..V... = Video codec\n"
+        " ..A... = Audio codec\n"
+        " ..S... = Subtitle codec\n"
+        " ...S.. = Supports draw_horiz_band\n"
+        " ....D. = Supports direct rendering method 1\n"
+        " .....T = Supports weird frame truncation\n"
+        " ------\n");
     last_name= "000";
     for(;;){
         int decode=0;
@@ -511,25 +541,50 @@ void show_formats(void)
         printf("\n");
     }
     printf("\n");
+    printf(
+"Note, the names of encoders and decoders do not always match, so there are\n"
+"several cases where the above table shows encoder only or decoder only entries\n"
+"even though both encoding and decoding are supported. For example, the h263\n"
+"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
+"worse.\n");
+}
+
+void show_bsfs(void)
+{
+    AVBitStreamFilter *bsf=NULL;
 
     printf("Bitstream filters:\n");
     while((bsf = av_bitstream_filter_next(bsf)))
-        printf(" %s", bsf->name);
+        printf("%s\n", bsf->name);
     printf("\n");
+}
+
+void show_protocols(void)
+{
+    URLProtocol *up=NULL;
 
     printf("Supported file protocols:\n");
     while((up = av_protocol_next(up)))
-        printf(" %s:", up->name);
+        printf("%s\n", up->name);
     printf("\n");
 
     printf("Frame size, frame rate abbreviations:\n ntsc pal qntsc qpal sntsc spal film ntsc-film sqcif qcif cif 4cif\n");
-    printf("\n");
-    printf(
-"Note, the names of encoders and decoders do not always match, so there are\n"
-"several cases where the above table shows encoder only or decoder only entries\n"
-"even though both encoding and decoding are supported. For example, the h263\n"
-"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
-"worse.\n");
+}
+
+void show_filters(void)
+{
+    AVFilter av_unused(**filter) = NULL;
+
+    printf("Filters:\n");
+#if CONFIG_AVFILTER
+    while ((filter = av_filter_next(filter)) && *filter)
+        printf("%-16s %s\n", (*filter)->name, (*filter)->description);
+#endif
+}
+
+void show_pix_fmts(void)
+{
+    list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB);
 }
 
 int read_yesno(void)