From 7080cbe2c828271fd75f9281b8b62020778db79a Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Mon, 9 Jun 2008 00:36:27 +0000 Subject: [PATCH] pass extradata through ffm Originally committed as revision 13721 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/ffmdec.c | 8 +++++++- libavformat/ffmenc.c | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 9c0ea89eb4..dd9fa9789b 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -320,7 +320,13 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) default: goto fail; } - + if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { + codec->extradata_size = get_be32(pb); + codec->extradata = av_malloc(codec->extradata_size); + if (!codec->extradata) + return AVERROR(ENOMEM); + get_buffer(pb, codec->extradata, codec->extradata_size); + } } /* get until end of block reached */ diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index 906152f978..738d3101da 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -168,6 +168,10 @@ static int ffm_write_header(AVFormatContext *s) default: return -1; } + if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { + put_be32(pb, codec->extradata_size); + put_buffer(pb, codec->extradata, codec->extradata_size); + } } /* flush until end of block reached */