aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adpcmenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-24 22:37:24 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-24 22:39:52 +0200
commiteae3cf06a5410cf6d06235de4ceea28e33e53be3 (patch)
tree126512350cc96249cd1d157969a87a0018f6ab53 /libavcodec/adpcmenc.c
parent0f2297a9b958b8598b17f139e7ec2d7e593a0a7c (diff)
parent2b4e49d4281690db67073ba644ad2ffc17767cdf (diff)
downloadandroid_external_ffmpeg-eae3cf06a5410cf6d06235de4ceea28e33e53be3.tar.gz
android_external_ffmpeg-eae3cf06a5410cf6d06235de4ceea28e33e53be3.tar.bz2
android_external_ffmpeg-eae3cf06a5410cf6d06235de4ceea28e33e53be3.zip
Merge remote-tracking branch 'qatar/master'
* qatar/master: flvdec: Fix invalid pointer deferences when parsing index configure: disable hardware capabilities ELF section with suncc on Solaris x86 Use explicit struct initializers for AVCodec declarations. Use explicit struct initializers for AVOutputFormat/AVInputFormat declarations. adpcmenc: Set bits_per_coded_sample adpcmenc: fix QT IMA ADPCM encoder adpcmdec: Fix QT IMA ADPCM decoder permit decoding of multichannel ADPCM_EA_XAS Fix input buffer size check in adpcm_ea decoder. fft: avoid a signed overflow mpegps: Handle buffer exhaustion when reading packets. Conflicts: libavcodec/adpcm.c libavcodec/adpcmenc.c libavdevice/alsa-audio-enc.c libavformat/flvdec.c libavformat/mpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/adpcmenc.c')
-rw-r--r--libavcodec/adpcmenc.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index c39bab8edb..14978f0218 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -86,6 +86,8 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error);
}
+ avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
+
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_WAV:
avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* each 16 bits sample gives one nibble */
@@ -670,18 +672,17 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
-#define ADPCM_ENCODER(id,name,long_name_) \
-AVCodec ff_ ## name ## _encoder = { \
- #name, \
- AVMEDIA_TYPE_AUDIO, \
- id, \
- sizeof(ADPCMEncodeContext), \
- adpcm_encode_init, \
- adpcm_encode_frame, \
- adpcm_encode_close, \
- NULL, \
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
- .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+#define ADPCM_ENCODER(id_, name_, long_name_) \
+AVCodec ff_ ## name_ ## _encoder = { \
+ .name = #name_, \
+ .type = AVMEDIA_TYPE_AUDIO, \
+ .id = id_, \
+ .priv_data_size = sizeof(ADPCMEncodeContext), \
+ .init = adpcm_encode_init, \
+ .encode = adpcm_encode_frame, \
+ .close = adpcm_encode_close, \
+ .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
+ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");