[FFmpeg-devel] [PATCH] HAM6/HAM8 support for IFF demuxer/decoder
Martin Storsjö
martin
Wed May 5 15:32:31 CEST 2010
On Tue, 4 May 2010, Sebastian Vater wrote:
> --- a/libavformat/iff.c
> +++ b/libavformat/iff.c
> @@ -152,12 +155,18 @@ static int iff_read_header(AVFormatContext *s,
> case ID_CMAP:
> - st->codec->extradata_size = data_size;
> - st->codec->extradata = av_malloc(data_size);
> + st->codec->extradata_size = data_size + sizeof(IffExtraContext);
> + st->codec->extradata = av_malloc(data_size + sizeof(IffExtraContext));
> if (!st->codec->extradata)
> return AVERROR(ENOMEM);
> @@ -195,6 +204,17 @@ static int iff_read_header(AVFormatContext *s,
>
> url_fseek(pb, iff->body_pos, SEEK_SET);
>
> + if (!st->codec->extradata) {
> + st->codec->extradata_size = sizeof(IffExtraContext);
> + st->codec->extradata = av_malloc(sizeof(IffExtraContext));
> + if (!st->codec->extradata)
> + return AVERROR(ENOMEM);
> + }
If being nitpicky, you should pad extradata with
FF_INPUT_BUFFER_PADDING_SIZE, set to zero, see the documentation of the
extradata field in avcodec.h. I guess the current decoder doesn't care
about this, but it's part of the public libavcodec API, that libavformat
should follow.
This issue is present in the current code already, but you can choose
either to fix it while you're modifying that code, or do that as a
separate patch before doing your actual modifications.
// Martin
More information about the ffmpeg-devel
mailing list