[FFmpeg-devel] [PATCH] lavu/opt: add av_opt_bprint()

Stefano Sabatini stefasab at gmail.com
Tue Nov 6 12:50:10 CET 2012


On date Tuesday 2012-11-06 12:42:48 +0100, Stefano Sabatini encoded:
> ---
>  libavutil/opt.c |   25 ++++++++++++++++++++++++-
>  libavutil/opt.h |    6 ++++++
>  2 files changed, 30 insertions(+), 1 deletions(-)
[...]
> diff --git a/libavutil/opt.h b/libavutil/opt.h
> index 4a3b7f5..e97beaf 100644
> --- a/libavutil/opt.h
> +++ b/libavutil/opt.h
> @@ -663,6 +663,12 @@ int av_opt_get_q     (void *obj, const char *name, int search_flags, AVRational
>   *          or written to.
>   */
>  void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
> +
> +struct AVBPrint;
> +/**
> + * Append a compact description of a context to a bprint buffer.
> + */
> +void av_opt_bprint(struct AVBPrint *bp, void *obj);

Consider this more like an RFC.

Now it shows something like:

num=42 : toggle=0 : rational=1/2 : string=blahblah : flags=0x00000004 : size=720x576 : pix_fmt=rgb24 : sample_fmt=s32

A possible extension:

av_opt_bprint(struct AVBPrint *bp, void *obj, const char *delim, const char *key_val_sep);

(and at this point we will also need to implement an escaping function
in the lib, like the one in tools/ffescape).

The function would be useful to inspect a context "configuration"
without to rely on programming/debugging. Also the generated string
may be used to literally copy a configuration, and set it elsewhere
(e.g. with av_opt_set_from_string()).
-- 
FFmpeg = Freak & Faithful Maxi Political Egregious Gadget


More information about the ffmpeg-devel mailing list