[FFmpeg-devel] [PATCH] Implement -pix_fmts for listing all the supported pixel formats
Stefano Sabatini
stefano.sabatini-lala
Sat Dec 12 14:13:05 CET 2009
On date Friday 2009-11-20 00:34:48 +0100, Stefano Sabatini encoded:
> Hi, requires two steps, moving list_fmts to cmdutils.c and implement
> the function.
>
> My plan is to remove the -pix_fmt list feature, which I never liked and
> which would be at this point just redundant.
>
> Same could be done for -sample_fmts.
>
> At this point I believe there would be no point into leaving its
> list_fmts() interface in cmdutils.h, so I my plan to remove it (this
> is why I didn't docuemnted it).
>
> Regards.
> --
> FFmpeg = Fundamental & Faboulous Multimedia Peaceful Elected Game
> Index: ffmpeg/cmdutils.c
> ===================================================================
> --- ffmpeg.orig/cmdutils.c 2009-11-20 00:19:34.000000000 +0100
> +++ ffmpeg/cmdutils.c 2009-11-20 00:29:56.000000000 +0100
> @@ -413,6 +413,16 @@
> );
> }
>
> +void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
> +{
> + int i;
> + char fmt_str[128];
> + for (i=-1; i < nb_fmts; i++) {
> + get_fmt_string (fmt_str, sizeof(fmt_str), i);
> + fprintf(stdout, "%s\n", fmt_str);
> + }
> +}
> +
> void show_formats(void)
> {
> AVInputFormat *ifmt=NULL;
> Index: ffmpeg/cmdutils.h
> ===================================================================
> --- ffmpeg.orig/cmdutils.h 2009-11-20 00:19:34.000000000 +0100
> +++ ffmpeg/cmdutils.h 2009-11-20 00:29:56.000000000 +0100
> @@ -131,6 +131,8 @@
>
> void print_error(const char *filename, int err);
>
> +void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
> +
> /**
> * Prints the program banner to stderr. The banner contents depend on the
> * current version of the repository and of the libav* libraries used by
> Index: ffmpeg/ffmpeg.c
> ===================================================================
> --- ffmpeg.orig/ffmpeg.c 2009-11-20 00:19:34.000000000 +0100
> +++ ffmpeg/ffmpeg.c 2009-11-20 00:29:56.000000000 +0100
> @@ -2545,16 +2545,6 @@
> }
> }
>
> -static void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
> -{
> - int i;
> - char fmt_str[128];
> - for (i=-1; i < nb_fmts; i++) {
> - get_fmt_string (fmt_str, sizeof(fmt_str), i);
> - fprintf(stdout, "%s\n", fmt_str);
> - }
> -}
> -
> static void opt_frame_pix_fmt(const char *arg)
> {
> if (strcmp(arg, "list")) {
> Index: ffmpeg/cmdutils.c
> ===================================================================
> --- ffmpeg.orig/cmdutils.c 2009-11-20 00:29:56.000000000 +0100
> +++ ffmpeg/cmdutils.c 2009-11-20 00:33:36.000000000 +0100
> @@ -423,6 +423,12 @@
> }
> }
>
> +void show_pix_fmts(void)
> +{
> + list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB);
> + printf("\n");
> +}
> +
> void show_formats(void)
> {
> AVInputFormat *ifmt=NULL;
> Index: ffmpeg/cmdutils.h
> ===================================================================
> --- ffmpeg.orig/cmdutils.h 2009-11-20 00:29:56.000000000 +0100
> +++ ffmpeg/cmdutils.h 2009-11-20 00:31:13.000000000 +0100
> @@ -178,6 +178,12 @@
> void show_protocols(void);
>
> /**
> + * Prints a listing containing all the pixel formats supported by the
> + * program.
> + */
> +void show_pix_fmts(void);
> +
> +/**
> * Returns a positive value if reads from standard input a line
> * starting with [yY], otherwise returns 0.
> */
> Index: ffmpeg/ffmpeg.c
> ===================================================================
> --- ffmpeg.orig/ffmpeg.c 2009-11-20 00:29:56.000000000 +0100
> +++ ffmpeg/ffmpeg.c 2009-11-20 00:31:13.000000000 +0100
> @@ -3822,6 +3822,7 @@
> { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" },
> { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" },
> { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
> + { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
> { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
> { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
> { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
> Index: ffmpeg/ffplay.c
> ===================================================================
> --- ffmpeg.orig/ffplay.c 2009-11-20 00:29:56.000000000 +0100
> +++ ffmpeg/ffplay.c 2009-11-20 00:31:13.000000000 +0100
> @@ -2460,6 +2460,7 @@
> { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" },
> { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" },
> { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
> + { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
> { "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" },
> { "y", HAS_ARG | OPT_FUNC2, {(void*)opt_height}, "force displayed height", "height" },
> { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
> Index: ffmpeg/ffserver.c
> ===================================================================
> --- ffmpeg.orig/ffserver.c 2009-11-20 00:29:56.000000000 +0100
> +++ ffmpeg/ffserver.c 2009-11-20 00:31:13.000000000 +0100
> @@ -4479,6 +4479,7 @@
> { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" },
> { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" },
> { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
> + { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
> { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
> { "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" },
> { "d", 0, {(void*)opt_debug}, "enable debug mode" },
Ping.
--
FFmpeg = Faithful and Fierce Murdering Picky Evil Game
More information about the ffmpeg-devel
mailing list