[FFmpeg-devel] [PATCH 1/3] avformat/avio: add resizeable field to AVIOContext

Nicolas George george at nsup.org
Tue Apr 21 14:03:43 CEST 2015


Le duodi 2 floréal, an CCXXIII, Michael Niedermayer a écrit :
> This indicates that its safe to use av_free/av_malloc on the IO context
> 
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/avio.h    |    7 +++++++
>  libavformat/aviobuf.c |    1 +
>  libavformat/segment.c |    1 +
>  libavformat/wtvdec.c  |    3 ++-
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avio.h b/libavformat/avio.h
> index 51913e3..73d1645 100644
> --- a/libavformat/avio.h
> +++ b/libavformat/avio.h
> @@ -196,6 +196,13 @@ typedef struct AVIOContext {
>       * This field is internal to libavformat and access from outside is not allowed.
>       */
>      int orig_buffer_size;
> +
> +    /**
> +     * The io buffer can be resized or freed with av_free / av_malloc.
> +     * The user application does not keep a private copy of the buffer pointer
> +     * which would become stale on such reallocation.
> +     */
> +    int resizeable;

I suspect you should replace av_malloc() with av_realloc(). For example,
aviobuf.c uses av_realloc(); buffers created with av_malloc() can not
officially be used with av_realloc().

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150421/0c9d7fc3/attachment.asc>


More information about the ffmpeg-devel mailing list