Mercurial > libavcodec.hg
diff imgconvert.c @ 5084:9930b7031cb2 libavcodec
Add support for listing the supported pixel formats using the option
-pix_fmt list
patch by Stefano Sabatini stefano sabatini minus lala chez poste it
original thread: [FFmpeg-devel] [PATCH] List supported pixel formats
date: 05/25/2007 05:46 PM
author | benoit |
---|---|
date | Wed, 30 May 2007 14:20:55 +0000 |
parents | cf6608b00186 |
children | dfa6e7fa2bac |
line wrap: on
line diff
--- a/imgconvert.c Wed May 30 09:32:25 2007 +0000 +++ b/imgconvert.c Wed May 30 14:20:55 2007 +0000 @@ -378,6 +378,27 @@ return i; } +void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt) +{ + PixFmtInfo info= pix_fmt_info[pix_fmt]; + + char is_alpha_char= info.is_alpha ? 'y' : 'n'; + + /* print header */ + if (pix_fmt < 0) + snprintf (buf, buf_size, + "name " " nb_channels" " depth" " is_alpha" + ); + else + snprintf (buf, buf_size, + "%-10s" " %1d " " %2d " " %c ", + info.name, + info.nb_channels, + info.depth, + is_alpha_char + ); +} + int avpicture_fill(AVPicture *picture, uint8_t *ptr, int pix_fmt, int width, int height) {