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>2019-06-03 18:54:20 +0300
committerJames Almer <jamrial@gmail.com>2022-03-15 15:42:43 +0300
commit97d9a3293854eda84f05c22e2eaefae7406ac969 (patch)
tree976b6989986eb6e7a8aea5f809bfacbc83d503f4 /libavcodec/libspeexdec.c
parentffdf7269a5c07c9e5910dc14eb3fd2e171944f79 (diff)
libspeex: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libspeexdec.c')
-rw-r--r--libavcodec/libspeexdec.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index 6f032907fc..8029786b1f 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -42,7 +42,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
LibSpeexContext *s = avctx->priv_data;
const SpeexMode *mode;
SpeexHeader *header = NULL;
- int spx_mode;
+ int spx_mode, channels;
if (avctx->extradata && avctx->extradata_size >= 80) {
header = speex_packet_to_header(avctx->extradata,
@@ -68,7 +68,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
spx_mode = 0;
} else if (header) {
avctx->sample_rate = header->rate;
- avctx->channels = header->nb_channels;
+ channels = header->nb_channels;
spx_mode = header->mode;
speex_header_free(header);
} else {
@@ -94,14 +94,15 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
if (!avctx->sample_rate)
avctx->sample_rate = 8000 << spx_mode;
- if (avctx->channels < 1 || avctx->channels > 2) {
+ if (channels < 1 || channels > 2) {
/* libspeex can handle mono or stereo if initialized as stereo */
av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d.\n"
- "Decoding as stereo.\n", avctx->channels);
- avctx->channels = 2;
+ "Decoding as stereo.\n", channels);
+ channels = 2;
}
- avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO :
- AV_CH_LAYOUT_MONO;
+ av_channel_layout_uninit(&avctx->ch_layout);
+ avctx->ch_layout = channels == 2 ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO :
+ (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
speex_bits_init(&s->bits);
s->dec_state = speex_decoder_init(mode);
@@ -110,7 +111,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
return -1;
}
- if (avctx->channels == 2) {
+ if (channels == 2) {
SpeexCallback callback;
callback.callback_id = SPEEX_INBAND_STEREO;
callback.func = speex_std_stereo_request_handler;
@@ -163,7 +164,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "Error decoding Speex frame.\n");
return AVERROR_INVALIDDATA;
}
- if (avctx->channels == 2)
+ if (avctx->ch_layout.nb_channels == 2)
speex_decode_stereo_int(output, s->frame_size, &s->stereo);
*got_frame_ptr = 1;