summaryrefslogtreecommitdiff
path: root/libavcodec/tta.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-04 12:37:42 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:45 -0300
commit1191ffd50a756fc621b34eb8f84a583c35f3573a (patch)
tree90d5869dd156d3182693c3a2958fa5de35ce672b /libavcodec/tta.c
parent0045c6dd5cc50adbcb0039924b0ac5b55da0fdeb (diff)
downloadffmpeg-1191ffd50a756fc621b34eb8f84a583c35f3573a.tar.gz
tta: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/tta.c')
-rw-r--r--libavcodec/tta.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index ef5a2b42ac..0291017eeb 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -113,7 +113,7 @@ static int allocate_buffers(AVCodecContext *avctx)
return AVERROR(ENOMEM);
} else
s->decode_buffer = NULL;
- s->ch_ctx = av_malloc_array(avctx->channels, sizeof(*s->ch_ctx));
+ s->ch_ctx = av_malloc_array(avctx->ch_layout.nb_channels, sizeof(*s->ch_ctx));
if (!s->ch_ctx)
return AVERROR(ENOMEM);
@@ -154,9 +154,17 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
}
AV_WL64(s->crc_pass, tta_check_crc64(s->pass));
}
- avctx->channels = s->channels = get_bits(&gb, 16);
- if (s->channels > 1 && s->channels < 9)
- avctx->channel_layout = tta_channel_layouts[s->channels-2];
+
+ s->channels = get_bits(&gb, 16);
+
+ av_channel_layout_uninit(&avctx->ch_layout);
+ if (s->channels > 1 && s->channels < 9) {
+ av_channel_layout_from_mask(&avctx->ch_layout, tta_channel_layouts[s->channels-2]);
+ } else {
+ avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ avctx->ch_layout.nb_channels = s->channels;
+ }
+
avctx->bits_per_raw_sample = get_bits(&gb, 16);
s->bps = (avctx->bits_per_raw_sample + 7) / 8;
avctx->sample_rate = get_bits_long(&gb, 32);
@@ -197,7 +205,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
(s->last_frame_length ? 1 : 0);
av_log(avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n",
- s->format, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,
+ s->format, avctx->ch_layout.nb_channels, avctx->bits_per_coded_sample, avctx->sample_rate,
avctx->block_align);
av_log(avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
s->data_length, s->frame_length, s->last_frame_length, total_frames);