diff mbox series

[FFmpeg-devel,v3,1/1] fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'

Message ID MN2PR04MB5981EA21F4920A6BDB7FB11ABAB79@MN2PR04MB5981.namprd04.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,v3,1/1] fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Soft Works Oct. 13, 2021, 12:08 p.m. UTC
New output looks like this:

Pixel formats:
I.... = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
....B = Bitstream format
FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS
-----
IO... yuv420p                3             12      8-8-8
IO... yuyv422                3             16      8-8-8
IO... rgb24                  3             24      8-8-8
IO... bgr24                  3             24      8-8-8
IO... yuv422p                3             16      8-8-8
IO... yuv444p                3             24      8-8-8

[..]

Signed-off-by: softworkz <softworkz@hotmail.com>
---
v3: add context prefix to commit message
v2: print depth values of all components

 fftools/cmdutils.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 2c8e98982f..426ba6c99f 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1754,7 +1754,7 @@  int show_pix_fmts(void *optctx, const char *opt, const char *arg)
            "..H.. = Hardware accelerated format\n"
            "...P. = Paletted format\n"
            "....B = Bitstream format\n"
-           "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n"
+           "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS\n"
            "-----\n");
 
 #if !CONFIG_SWSCALE
@@ -1764,7 +1764,7 @@  int show_pix_fmts(void *optctx, const char *opt, const char *arg)
 
     while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
         enum AVPixelFormat av_unused pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
-        printf("%c%c%c%c%c %-16s       %d            %2d\n",
+        printf("%c%c%c%c%c %-16s       %d            %3d      %d",
                sws_isSupportedInput (pix_fmt)              ? 'I' : '.',
                sws_isSupportedOutput(pix_fmt)              ? 'O' : '.',
                pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL   ? 'H' : '.',
@@ -1772,7 +1772,12 @@  int show_pix_fmts(void *optctx, const char *opt, const char *arg)
                pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
                pix_desc->name,
                pix_desc->nb_components,
-               av_get_bits_per_pixel(pix_desc));
+               av_get_bits_per_pixel(pix_desc),
+               pix_desc->comp[0].depth);
+
+        for (unsigned i = 1; i < pix_desc->nb_components; i++)
+            printf("-%d", pix_desc->comp[i].depth);
+        printf("\n");
     }
     return 0;
 }