Browse code

Extend show_pix_fmts(), make it show input/output support for conversion and other information exposed by the pixdesc API.

Originally committed as revision 21751 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2010/02/11 08:36:35
Showing 1 changed files
... ...
@@ -35,6 +35,7 @@
35 35
 #include "libswscale/swscale.h"
36 36
 #include "libpostproc/postprocess.h"
37 37
 #include "libavutil/avstring.h"
38
+#include "libavutil/pixdesc.h"
38 39
 #include "libavcodec/opt.h"
39 40
 #include "cmdutils.h"
40 41
 #include "version.h"
... ...
@@ -627,7 +628,30 @@ void show_filters(void)
627 627
 
628 628
 void show_pix_fmts(void)
629 629
 {
630
-    list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB);
630
+    enum PixelFormat pix_fmt;
631
+
632
+    printf(
633
+        "Pixel formats:\n"
634
+        "I.... = Supported Input  format for conversion\n"
635
+        ".O... = Supported Output format for conversion\n"
636
+        "..H.. = Hardware accelerated format\n"
637
+        "...P. = Paletted format\n"
638
+        "....B = Bitstream format\n"
639
+        "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n"
640
+        "-----\n");
641
+
642
+    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) {
643
+        const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
644
+        printf("%c%c%c%c%c %-16s       %d            %2d\n",
645
+               sws_isSupportedInput (pix_fmt)      ? 'I' : '.',
646
+               sws_isSupportedOutput(pix_fmt)      ? 'O' : '.',
647
+               pix_desc->flags & PIX_FMT_HWACCEL   ? 'H' : '.',
648
+               pix_desc->flags & PIX_FMT_PAL       ? 'P' : '.',
649
+               pix_desc->flags & PIX_FMT_BITSTREAM ? 'B' : '.',
650
+               pix_desc->name,
651
+               pix_desc->nb_components,
652
+               av_get_bits_per_pixel(pix_desc));
653
+    }
631 654
 }
632 655
 
633 656
 int read_yesno(void)