[FFmpeg-devel] [PATCH 1/2] lavu: add av_bprintf and related.

Michael Niedermayer michaelni at gmx.at
Wed Feb 1 21:57:31 CET 2012


On Wed, Feb 01, 2012 at 09:37:00PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
[...]
>  #undef printf
> diff --git a/libavutil/avstring.h b/libavutil/avstring.h
> index f73d6e7..8917ec8 100644
> --- a/libavutil/avstring.h
> +++ b/libavutil/avstring.h
> @@ -203,6 +203,46 @@ int av_strcasecmp(const char *a, const char *b);
>  int av_strncasecmp(const char *a, const char *b, size_t n);
>  
>  /**
> + * Buffer to print data progressively
> + * The string buffer grows as necessary and is always 0-terminated.
> + * The length of the string can go beyond the allocated size: the buffer is
> + * then truncated, but the functions still keep account of the required
> + * size.
> + * The string buffer can be stolen and/or freed using av_free.
> + * If size == 0, no allocation is made, the system only counts the size.
> + */
> +typedef struct AVBPrint {
> +    char *str;         /** string so far; or NULL if size == 0 */
> +    unsigned len;      /** length so far */
> +    unsigned size;     /** allocated memory */
> +    unsigned size_max; /** maximum allocated memory */
> +} AVBPrint;
> +
> +/**
> + * Init a print buffer
> + * @param buf        buffer to init
> + * @param size_init  initial size (including the final 0)
> + * @param size_max   maximum size
> + * @return  0 or error code (probably AVERROR(ENOMEM))
> + */
> +int av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max);

iam not sure if this is a problem or not but when the struct becomes
larger / is changed this would break ABI as the struct and its size
seem part of the ABI

[...]

-- 
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: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120201/6dac9f83/attachment.asc>


More information about the ffmpeg-devel mailing list