[FFmpeg-devel] [PATCH] Add a priv_data pointer to AVFormatParameters

Andy Parkins andyparkins
Wed Oct 3 14:50:38 CEST 2007

Here's the problem: you have a customised AVInputFormat, set up to call
your own functions - not ffmpeg's.  You register it and make a call to
av_open_input_file() with the appropriate parameter pointing at your custom

You want your custom read_header() handler to be passed some parameters
that are specific to your input format.  You can't use
AVFormatContext::priv_data because av_open_input_file() zeroes and
reallocates that before calling any of the AVInputFormat members.
AVFormatParameters _is_ preserved through to the AVInputFormat::read_header()
call, but doesn't have any members that match the parameters you want to

The solution is this patch; we add a priv_data pointer to
AVFormatParameters.  AVFormatParameters is created filled with NUL bytes
by default so if the user chooses not to supply priv_data, the custom
read_header() will receive a NULL priv_data pointer.

If the user _does_ want to pass some custom options to their custom
read_header() they can make a AVFormatParameters structure and pass
whatever they want through by setting priv_data.
 libavformat/avformat.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03b43dfcb25cc0fa88169951cd02b65bd039f76a.diff
Type: text/x-patch
Size: 429 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071003/2124ae2f/attachment.bin>

More information about the ffmpeg-devel mailing list