aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-10-12 08:51:47 +0000
committerPaul B Mahol <onemda@gmail.com>2012-10-12 09:07:31 +0000
commit56519d7d14ac73580dd2b99e2789e33c19674f28 (patch)
treebb384e1b6986e47757a21dd4c837762469cbc3d3
parent62722ae2d4b2e5f632c725e150dde0f7d0fbfe8d (diff)
downloadffmpeg-56519d7d14ac73580dd2b99e2789e33c19674f28.tar.gz
takdec: s/bits_per_coded_sample/bits_per_raw_sample
bits_per_coded_sample should be set from demuxer and not from decoder. Prior to this change value set from demuxer would get overwritten in decoder. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/takdec.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 0877b64554..d55f51a26d 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -146,9 +146,9 @@ static const struct CParam {
{ 0x1A, 0x1800000, 0x1800000, 0x6800000, 0xC000000 },
};
-static void tak_set_bps(AVCodecContext *avctx)
+static void tak_set_bps(AVCodecContext *avctx, int bps)
{
- switch (avctx->bits_per_coded_sample) {
+ switch (bps) {
case 8:
avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
break;
@@ -196,7 +196,7 @@ static av_cold int tak_decode_init(AVCodecContext *avctx)
s->uval = get_scale(avctx->sample_rate, get_shift(avctx->sample_rate));
s->subframe_scale = get_scale(avctx->sample_rate, 1);
- tak_set_bps(avctx);
+ tak_set_bps(avctx, avctx->bits_per_coded_sample);
return 0;
}
@@ -564,10 +564,10 @@ static int decode_channel(TAKDecContext *s, int chan)
int left = s->nb_samples - 1;
s->sample_shift[chan] = get_b(gb);
- if (s->sample_shift[chan] >= avctx->bits_per_coded_sample)
+ if (s->sample_shift[chan] >= avctx->bits_per_raw_sample)
return AVERROR_INVALIDDATA;
- *dst++ = get_code(gb, avctx->bits_per_coded_sample - s->sample_shift[chan]);
+ *dst++ = get_code(gb, avctx->bits_per_raw_sample - s->sample_shift[chan]);
s->lpc_mode[chan] = get_bits(gb, 2);
s->nb_subframes = get_bits(gb, 3) + 1;
@@ -773,9 +773,9 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- if (s->ti.bps != avctx->bits_per_coded_sample) {
- avctx->bits_per_coded_sample = s->ti.bps;
- tak_set_bps(avctx);
+ if (s->ti.bps != avctx->bits_per_raw_sample) {
+ avctx->bits_per_raw_sample = s->ti.bps;
+ tak_set_bps(avctx, avctx->bits_per_raw_sample);
}
if (s->ti.sample_rate != avctx->sample_rate) {
avctx->sample_rate = s->ti.sample_rate;
@@ -793,7 +793,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0)
return ret;
- if (avctx->bits_per_coded_sample <= 16) {
+ if (avctx->bits_per_raw_sample <= 16) {
av_fast_malloc(&s->decode_buffer, &s->decode_buffer_size,
sizeof(*s->decode_buffer) * FFALIGN(s->nb_samples, 8) *
avctx->channels + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -811,7 +811,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
for (chan = 0; chan < avctx->channels; chan++) {
p = s->decoded[chan];
for (i = 0; i < s->nb_samples; i++)
- *p++ = get_code(gb, avctx->bits_per_coded_sample);
+ *p++ = get_code(gb, avctx->bits_per_raw_sample);
}
} else {
if (s->ti.codec == 2) {
@@ -918,7 +918,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
}
// convert to output buffer
- switch (avctx->bits_per_coded_sample) {
+ switch (avctx->bits_per_raw_sample) {
case 8:
for (chan = 0; chan < avctx->channels; chan++) {
uint8_t *samples = (uint8_t *)s->frame.data[chan];