Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-05-07 09:20:32 +0400
committerJames Almer <jamrial@gmail.com>2022-03-15 15:42:39 +0300
commit2350a50bed6bd71c67947604f117a4dff73ebe35 (patch)
treed6c599ebcc1c07a051bde4deed3d32bc8600a819 /libavcodec/8svx.c
parent548aeb93834b8425c86d1ce60fddc1d41805724d (diff)
8svx: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/8svx.c')
-rw-r--r--libavcodec/8svx.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index 6ef8cd73fe..6ef7921274 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -88,38 +88,39 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
{
EightSvxContext *esc = avctx->priv_data;
AVFrame *frame = data;
+ int channels = avctx->ch_layout.nb_channels;
int buf_size;
int ch, ret;
int hdr_size = 2;
/* decode and interleave the first packet */
if (!esc->data[0] && avpkt) {
- int chan_size = avpkt->size / avctx->channels - hdr_size;
+ int chan_size = avpkt->size / channels - hdr_size;
- if (avpkt->size % avctx->channels) {
+ if (avpkt->size % channels) {
av_log(avctx, AV_LOG_WARNING, "Packet with odd size, ignoring last byte\n");
}
- if (avpkt->size < (hdr_size + 1) * avctx->channels) {
+ if (avpkt->size < (hdr_size + 1) * channels) {
av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
return AVERROR_INVALIDDATA;
}
esc->fib_acc[0] = avpkt->data[1] + 128;
- if (avctx->channels == 2)
+ if (channels == 2)
esc->fib_acc[1] = avpkt->data[2+chan_size+1] + 128;
esc->data_idx = 0;
esc->data_size = chan_size;
if (!(esc->data[0] = av_malloc(chan_size)))
return AVERROR(ENOMEM);
- if (avctx->channels == 2) {
+ if (channels == 2) {
if (!(esc->data[1] = av_malloc(chan_size))) {
av_freep(&esc->data[0]);
return AVERROR(ENOMEM);
}
}
memcpy(esc->data[0], &avpkt->data[hdr_size], chan_size);
- if (avctx->channels == 2)
+ if (channels == 2)
memcpy(esc->data[1], &avpkt->data[2*hdr_size+chan_size], chan_size);
}
if (!esc->data[0]) {
@@ -139,7 +140,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- for (ch = 0; ch < avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
delta_decode(frame->data[ch], &esc->data[ch][esc->data_idx],
buf_size, &esc->fib_acc[ch], esc->table);
}
@@ -148,14 +149,14 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
- return ((avctx->frame_number == 0)*hdr_size + buf_size)*avctx->channels;
+ return ((avctx->frame_number == 0) * hdr_size + buf_size) * channels;
}
static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
{
EightSvxContext *esc = avctx->priv_data;
- if (avctx->channels < 1 || avctx->channels > 2) {
+ if (avctx->ch_layout.nb_channels < 1 || avctx->ch_layout.nb_channels > 2) {
av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");
return AVERROR_INVALIDDATA;
}