[FFmpeg-devel] [PATCH] examples/muxing: zero AVPacket before av_read_frame()

Hendrik Leppkes h.leppkes at gmail.com
Tue Jan 28 16:09:09 CET 2014

On Tue, Jan 28, 2014 at 4:07 PM, Andrey Utkin
<andrey.krieger.utkin at gmail.com> wrote:
> 2014-01-28 Hendrik Leppkes <h.leppkes at gmail.com>:
>> Fact remains that ->data is never read by av_read_frame, only written
>> to. The API does NOT require you to init the AVPacket in any way.
>> If it would, it would be smarter to actually make it clear it itself.
> We don't need `data` now at all, since data is now pointed to by `buf`.
> See below for av_read_frame() description in avformat.h, "If pkt->buf
> is NULL, then...".
> By this i consider that av_read_frame() relies on initial state of AVPacket.buf.

The documentation describes how to handle the data that comes *out* of
that function call, not what goes *in*.
I read the actual code of av_read_frame, trust me, it does not care at
all about the input AVPacket, it just writes to it.

- Hendrik

More information about the ffmpeg-devel mailing list