aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vmdav.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-02-23 13:11:12 -0500
committerMichael Niedermayer <michaelni@gmx.at>2011-02-26 03:16:04 +0100
commitf3618b014b89aa757f9206507b86056c342f6da3 (patch)
tree7beb6a0d1d1aa567419877d390e317e505454e06 /libavcodec/vmdav.c
parent5e7c422dda9bf2212f112881f402f3f1810cd82e (diff)
downloadffmpeg-f3618b014b89aa757f9206507b86056c342f6da3.tar.gz
vmdaudio: remove unnecessary fields from VmdAudioContext and use the corresponding AVCodecContext fields instead.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com> (cherry picked from commit 2ec7862db8b782020cc220dae827c3438d108b3a)
Diffstat (limited to 'libavcodec/vmdav.c')
-rw-r--r--libavcodec/vmdav.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index bd71ae46c7..88f674a9fd 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -421,9 +421,6 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
typedef struct VmdAudioContext {
AVCodecContext *avctx;
int out_bps;
- int channels;
- int bits;
- int block_align;
int predictors[2];
} VmdAudioContext;
@@ -448,14 +445,13 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
VmdAudioContext *s = avctx->priv_data;
s->avctx = avctx;
- s->channels = avctx->channels;
- s->bits = avctx->bits_per_coded_sample;
- s->block_align = avctx->block_align;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3;
- av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n",
- s->channels, s->bits, s->block_align, avctx->sample_rate);
+ av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
+ "block align = %d, sample rate = %d\n",
+ avctx->channels, avctx->bits_per_coded_sample, avctx->block_align,
+ avctx->sample_rate);
return 0;
}
@@ -482,14 +478,14 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
const uint8_t *buf, int silent_chunks, int data_size)
{
int i;
- int silent_size = s->block_align * silent_chunks * s->out_bps;
+ int silent_size = s->avctx->block_align * silent_chunks * s->out_bps;
if (silent_chunks) {
memset(data, 0, silent_size);
data += silent_size;
}
- if (s->bits == 16)
- vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2);
+ if (s->avctx->bits_per_coded_sample == 16)
+ vmdaudio_decode_audio(s, data, buf, data_size, s->avctx->channels == 2);
else {
/* copy the data but convert it to signed */
for (i = 0; i < data_size; i++){
@@ -537,7 +533,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
}
/* ensure output buffer is large enough */
- if (*data_size < (s->block_align*silent_chunks + buf_size) * s->out_bps)
+ if (*data_size < (avctx->block_align*silent_chunks + buf_size) * s->out_bps)
return -1;
*data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size);