]> git.sesse.net Git - ffmpeg/blobdiff - cmdutils.c
pthreads: reset got_frames on flush.
[ffmpeg] / cmdutils.c
index 0ab98e85b71f5a6501fd66a30c397644e8aec7e3..386db3d48b4e508277c94cce2be79c6a27e05703 100644 (file)
@@ -34,7 +34,9 @@
 #include "libavdevice/avdevice.h"
 #include "libswscale/swscale.h"
 #include "libswresample/swresample.h"
+#if CONFIG_POSTPROC
 #include "libpostproc/postprocess.h"
+#endif
 #include "libavutil/avstring.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/parseutils.h"
@@ -54,7 +56,7 @@
 struct SwsContext *sws_opts;
 AVDictionary *format_opts, *codec_opts;
 
-static const int this_year = 2012;
+const int this_year = 2012;
 
 static FILE *report_file;
 
@@ -607,7 +609,9 @@ static void print_all_libs_info(int flags, int level)
     PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);
     PRINT_LIB_INFO(swscale,  SWSCALE,  flags, level);
     PRINT_LIB_INFO(swresample,SWRESAMPLE,  flags, level);
+#if CONFIG_POSTPROC
     PRINT_LIB_INFO(postproc, POSTPROC, flags, level);
+#endif
 }
 
 static void print_program_info(int flags, int level)
@@ -760,6 +764,18 @@ int opt_formats(const char *opt, const char *arg)
     return 0;
 }
 
+static char get_media_type_char(enum AVMediaType type)
+{
+    static const char map[AVMEDIA_TYPE_NB] = {
+        [AVMEDIA_TYPE_VIDEO]      = 'V',
+        [AVMEDIA_TYPE_AUDIO]      = 'A',
+        [AVMEDIA_TYPE_DATA]       = 'D',
+        [AVMEDIA_TYPE_SUBTITLE]   = 'S',
+        [AVMEDIA_TYPE_ATTACHMENT] = 'T',
+    };
+    return type >= 0 && type < AVMEDIA_TYPE_NB && map[type] ? map[type] : '?';
+}
+
 int opt_codecs(const char *opt, const char *arg)
 {
     AVCodec *p = NULL, *p2;
@@ -779,7 +795,6 @@ int opt_codecs(const char *opt, const char *arg)
         int decode = 0;
         int encode = 0;
         int cap    = 0;
-        const char *type_str;
 
         p2 = NULL;
         while ((p = av_codec_next(p))) {
@@ -800,24 +815,10 @@ int opt_codecs(const char *opt, const char *arg)
             break;
         last_name = p2->name;
 
-        switch (p2->type) {
-        case AVMEDIA_TYPE_VIDEO:
-            type_str = "V";
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            type_str = "A";
-            break;
-        case AVMEDIA_TYPE_SUBTITLE:
-            type_str = "S";
-            break;
-        default:
-            type_str = "?";
-            break;
-        }
-        printf(" %s%s%s%s%s%s %-15s %s",
+        printf(" %s%s%c%s%s%s %-15s %s",
                decode ? "D" : (/* p2->decoder ? "d" : */ " "),
                encode ? "E" : " ",
-               type_str,
+               get_media_type_char(p2->type),
                cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
                cap & CODEC_CAP_DR1 ? "D" : " ",
                cap & CODEC_CAP_TRUNCATED ? "T" : " ",
@@ -871,11 +872,31 @@ int opt_protocols(const char *opt, const char *arg)
 int opt_filters(const char *opt, const char *arg)
 {
     AVFilter av_unused(**filter) = NULL;
+    char descr[64], *descr_cur;
+    int i, j;
+    const AVFilterPad *pad;
 
     printf("Filters:\n");
 #if CONFIG_AVFILTER
-    while ((filter = av_filter_next(filter)) && *filter)
-        printf("%-16s %s\n", (*filter)->name, (*filter)->description);
+    while ((filter = av_filter_next(filter)) && *filter) {
+        descr_cur = descr;
+        for (i = 0; i < 2; i++) {
+            if (i) {
+                *(descr_cur++) = '-';
+                *(descr_cur++) = '>';
+            }
+            pad = i ? (*filter)->outputs : (*filter)->inputs;
+            for (j = 0; pad[j].name; j++) {
+                if (descr_cur >= descr + sizeof(descr) - 4)
+                    break;
+                *(descr_cur++) = get_media_type_char(pad[j].type);
+            }
+            if (!j)
+                *(descr_cur++) = '|';
+        }
+        *descr_cur = 0;
+        printf("%-16s %-10s %s\n", (*filter)->name, descr, (*filter)->description);
+    }
 #endif
     return 0;
 }