[PATCH] Implement -pix_fmts for listing all the supported pixel formats
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
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
On Fri, Nov 20, 2009 at 12:34:48AM +0100, Stefano Sabatini wrote:
Hi, requires two steps, moving list_fmts to cmdutils.c and implement the function.
ok also list_fmts() should be used by all the other similar functions [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch
On date Saturday 2009-12-12 18:22:33 +0100, Michael Niedermayer encoded:
On Fri, Nov 20, 2009 at 12:34:48AM +0100, Stefano Sabatini wrote:
Hi, requires two steps, moving list_fmts to cmdutils.c and implement the function.
ok
Applied the first step, I'm waiting for the common opts texi factorization patch to be reviewed before to apply the second, and another patch to remove -pix_fmt list. Is OK to the same to -sample_fmts (I mean with no patches)? Regards. -- FFmpeg = Faithful Funny Merciful Philosophical ExchanGer
On Sat, Dec 12, 2009 at 07:07:06PM +0100, Stefano Sabatini wrote:
On date Saturday 2009-12-12 18:22:33 +0100, Michael Niedermayer encoded:
On Fri, Nov 20, 2009 at 12:34:48AM +0100, Stefano Sabatini wrote:
Hi, requires two steps, moving list_fmts to cmdutils.c and implement the function.
ok
Applied the first step, I'm waiting for the common opts texi factorization patch
not my area ...
to be reviewed before to apply the second, and another patch to remove -pix_fmt list.
-pix_fmt list removial is rejected, its one of the most obviosu ways one would try to get a list -pix_fmt help would be the second. also i would approve if you added -f list / -bsf list / -vcodec list [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle
On date Saturday 2009-12-12 19:19:48 +0100, Michael Niedermayer encoded:
On Sat, Dec 12, 2009 at 07:07:06PM +0100, Stefano Sabatini wrote:
On date Saturday 2009-12-12 18:22:33 +0100, Michael Niedermayer encoded:
On Fri, Nov 20, 2009 at 12:34:48AM +0100, Stefano Sabatini wrote:
Hi, requires two steps, moving list_fmts to cmdutils.c and implement the function.
ok
Applied the first step, I'm waiting for the common opts texi factorization patch
not my area ...
to be reviewed before to apply the second, and another patch to remove -pix_fmt list.
-pix_fmt list removial is rejected, its one of the most obviosu ways one would try to get a list -pix_fmt help would be the second.
Another idea would be to have: -codec/-pix_fmt/-sample_fmt etc. list just a plain list of the values which can be used for completion (that is no header and just one column with the name of the possible values), *and* keep the listing options. This should help more shell completion writers (BTW if there is interest I could provide fish completions for inclusion in the repo).
also i would approve if you added -f list / -bsf list / -vcodec list
Regards. -- FFmpeg = Freak and Fanciful Mega Picky Efficient Generator
On Tue, Feb 16, 2010 at 01:21:35AM +0100, Stefano Sabatini wrote:
On date Saturday 2009-12-12 19:19:48 +0100, Michael Niedermayer encoded:
On Sat, Dec 12, 2009 at 07:07:06PM +0100, Stefano Sabatini wrote:
On date Saturday 2009-12-12 18:22:33 +0100, Michael Niedermayer encoded:
On Fri, Nov 20, 2009 at 12:34:48AM +0100, Stefano Sabatini wrote:
Hi, requires two steps, moving list_fmts to cmdutils.c and implement the function.
ok
Applied the first step, I'm waiting for the common opts texi factorization patch
not my area ...
to be reviewed before to apply the second, and another patch to remove -pix_fmt list.
-pix_fmt list removial is rejected, its one of the most obviosu ways one would try to get a list -pix_fmt help would be the second.
Another idea would be to have: -codec/-pix_fmt/-sample_fmt etc.
list just a plain list of the values which can be used for completion (that is no header and just one column with the name of the possible values), *and* keep the listing options.
This would be the most obfuscated user interface ive seen recently its like -h -? giving different help texts this would confuse everyone [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire
On date Saturday 2009-12-12 18:22:33 +0100, Michael Niedermayer encoded:
On Fri, Nov 20, 2009 at 12:34:48AM +0100, Stefano Sabatini wrote:
Hi, requires two steps, moving list_fmts to cmdutils.c and implement the function.
ok
Applied. -- FFmpeg = Forgiving & Free Majestic Peaceless Exxagerate Gangster
participants (2)
-
michaelni@gmx.at -
stefano.sabatini-lala@poste.it