mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
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 Originally committed as revision 9162 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
808d83fd33
commit
c3b95b1d3d
@ -415,7 +415,8 @@ Add a new video stream to the current output stream.
|
|||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
@item -pix_fmt format
|
@item -pix_fmt format
|
||||||
Set pixel format.
|
Set pixel format. Use 'list' as parameter to show all the supported
|
||||||
|
pixel formats.
|
||||||
@item -sws_flags flags
|
@item -sws_flags flags
|
||||||
Set SwScaler flags (only available when compiled with SwScaler support).
|
Set SwScaler flags (only available when compiled with SwScaler support).
|
||||||
@item -g gop_size
|
@item -g gop_size
|
||||||
|
16
ffmpeg.c
16
ffmpeg.c
@ -2243,10 +2243,24 @@ static void opt_frame_pad_right(const char *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void list_pix_fmts(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char pix_fmt_str[128];
|
||||||
|
for (i=-1; i < PIX_FMT_NB; i++) {
|
||||||
|
avcodec_pix_fmt_string (pix_fmt_str, sizeof(pix_fmt_str), i);
|
||||||
|
fprintf(stdout, "%s\n", pix_fmt_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void opt_frame_pix_fmt(const char *arg)
|
static void opt_frame_pix_fmt(const char *arg)
|
||||||
{
|
{
|
||||||
|
if (strcmp(arg, "list"))
|
||||||
frame_pix_fmt = avcodec_get_pix_fmt(arg);
|
frame_pix_fmt = avcodec_get_pix_fmt(arg);
|
||||||
|
else {
|
||||||
|
list_pix_fmts();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void opt_frame_aspect_ratio(const char *arg)
|
static void opt_frame_aspect_ratio(const char *arg)
|
||||||
@ -3596,7 +3610,7 @@ const OptionDef options[] = {
|
|||||||
{ "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
|
{ "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
|
||||||
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
|
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
|
||||||
{ "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
|
{ "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
|
||||||
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
|
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
|
||||||
{ "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "set top crop band size (in pixels)", "size" },
|
{ "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "set top crop band size (in pixels)", "size" },
|
||||||
{ "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "set bottom crop band size (in pixels)", "size" },
|
{ "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "set bottom crop band size (in pixels)", "size" },
|
||||||
{ "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "set left crop band size (in pixels)", "size" },
|
{ "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "set left crop band size (in pixels)", "size" },
|
||||||
|
@ -2615,6 +2615,19 @@ int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
|
|||||||
int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
|
int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
|
||||||
int has_alpha, int *loss_ptr);
|
int has_alpha, int *loss_ptr);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print in buf the string corresponding to the pixel format with
|
||||||
|
* number pix_fmt, or an header if pix_fmt is negative.
|
||||||
|
*
|
||||||
|
* @param buf[in] the buffer where to write the string
|
||||||
|
* @param buf_size[in] the size of buf
|
||||||
|
* @param pix_fmt[in] the number of the pixel format to print the corresponding info string, or
|
||||||
|
* a negative value to print the corresponding header.
|
||||||
|
* Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1.
|
||||||
|
*/
|
||||||
|
void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt);
|
||||||
|
|
||||||
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
|
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
|
||||||
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
|
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
|
||||||
|
|
||||||
|
@ -378,6 +378,27 @@ enum PixelFormat avcodec_get_pix_fmt(const char* name)
|
|||||||
return i;
|
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 avpicture_fill(AVPicture *picture, uint8_t *ptr,
|
||||||
int pix_fmt, int width, int height)
|
int pix_fmt, int width, int height)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user