[FFmpeg-devel] [PATCH 1/3] avformat/avio: add resizeable field to AVIOContext
Michael Niedermayer
michaelni at gmx.at
Tue Apr 21 14:52:32 CEST 2015
On Tue, Apr 21, 2015 at 02:03:43PM +0200, Nicolas George wrote:
> 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,
the API requires av_malloc(), this is documented in the
avio_alloc_context() doxy
> aviobuf.c uses av_realloc(); buffers created with av_malloc() can not
> officially be used with av_realloc().
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150421/15679dae/attachment.asc>
More information about the ffmpeg-devel
mailing list