[FFmpeg-devel] [PATCH] Implement a cmdutils functions for listing available elements
Michael Niedermayer
michaelni
Sun Oct 25 20:35:24 CET 2009
On Sun, Oct 25, 2009 at 06:53:52PM +0100, Stefano Sabatini wrote:
> On date Saturday 2009-10-24 00:52:14 +0200, Stefano Sabatini encoded:
> > Hi all,
> >
> > this is meant as a replacement for the -formats option.
> >
> > It provides more control on what to list, this simplify for example
> > grepping operations and also programs which generate completions for
> > the ff* tools.
>
> Updated patch, with support to sample_fmts and minor cosmetical fixes.
>
> Regards.
> --
> FFmpeg = Fast and Friendly Mystic Portentous Evanescent Governor
> cmdutils.c | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> cmdutils.h | 6 ++
> 2 files changed, 140 insertions(+)
> d379730d5fdcaac6847481cedabbc8e528ec0c68 implement-opt-list.patch
> Index: cmdutils.h
> ===================================================================
> --- cmdutils.h (revision 20371)
> +++ cmdutils.h (working copy)
> @@ -56,6 +56,12 @@
> int opt_loglevel(const char *opt, const char *arg);
>
> /**
> + * Lists available formats, codecs, protocols and other elements
> + * integrated into the current build.
> + */
> +int opt_list(const char *opt, const char *arg);
this doxy is not enough to use this function, one has to read the code
thats not ideal
> +
> +/**
> * Parses a string and returns its corresponding value as a double.
> * Exits from the application if the string cannot be correctly
> * parsed or the corresponding value is invalid.
> Index: cmdutils.c
> ===================================================================
> --- cmdutils.c (revision 20371)
> +++ cmdutils.c (working copy)
> @@ -35,6 +35,7 @@
> #include "libswscale/swscale.h"
> #include "libpostproc/postprocess.h"
> #include "libavutil/avstring.h"
> +#include "libavcodec/audioconvert.h"
> #include "libavcodec/opt.h"
> #include "cmdutils.h"
> #include "version.h"
> @@ -256,6 +257,139 @@
> return 0;
> }
>
> +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);
> + }
> +}
> +
> +int opt_list(const char *opt, const char *arg)
opt is unused and isnt documented either ...
> +{
> + if (!strcmp(arg, "formats")) {
> + AVInputFormat *ifmt = NULL;
> + AVOutputFormat *ofmt = NULL;
> + const char *last_name = "000";
> +
> + fprintf(stderr,
> + "D. = Demuxing supported\n"
> + ".E = Muxing supported\n"
> + "--\n");
i wonder if av_log() would be better, i cant think of any real advantage
for ff* but maybe one day this function could be used by an application
for which fprintf(stderr) is inconvenient
[...]
> + printf(
iam sure mixing stderr & stdout like that is not a good idea
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091025/c2ff7dd8/attachment.pgp>
More information about the ffmpeg-devel
mailing list