diff options
author | Daniel Verkamp <daniel@drv.nu> | 2009-10-22 20:43:55 +0000 |
---|---|---|
committer | Daniel Verkamp <daniel@drv.nu> | 2009-10-22 20:43:55 +0000 |
commit | b74d42ee330212dbfec8024e9490a5a7372497cc (patch) | |
tree | 9fcbc6e0e25a1bb48db0cdec0a832760694be566 /libavcodec | |
parent | df84d7d9bdf6b8e6896c711880f130b72738c828 (diff) | |
download | ffmpeg-b74d42ee330212dbfec8024e9490a5a7372497cc.tar.gz |
Build extradata in adpcm_ms encoder.
This fixes issue #1244.
Originally committed as revision 20349 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/adpcm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index ebf37dbcf9..6abe18495c 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -154,6 +154,8 @@ typedef struct ADPCMContext { #if CONFIG_ENCODERS static av_cold int adpcm_encode_init(AVCodecContext *avctx) { + uint8_t *extradata; + int i; if (avctx->channels > 2) return -1; /* only stereo or mono =) */ @@ -177,6 +179,16 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; /* each 16 bits sample gives one nibble */ /* and we have 7 bytes per channel overhead */ avctx->block_align = BLKSIZE; + avctx->extradata_size = 32; + extradata = avctx->extradata = av_malloc(avctx->extradata_size); + if (!extradata) + return AVERROR(ENOMEM); + bytestream_put_le16(&extradata, avctx->frame_size); + bytestream_put_le16(&extradata, 7); /* wNumCoef */ + for (i = 0; i < 7; i++) { + bytestream_put_le16(&extradata, AdaptCoeff1[i] * 4); + bytestream_put_le16(&extradata, AdaptCoeff2[i] * 4); + } break; case CODEC_ID_ADPCM_YAMAHA: avctx->frame_size = BLKSIZE * avctx->channels; |