summaryrefslogtreecommitdiff
path: root/libavcodec/libshine.c
diff options
context:
space:
mode:
authorRomain Beauxis <toots@rastageeks.org>2013-07-21 15:40:08 -0500
committerPaul B Mahol <onemda@gmail.com>2013-07-30 21:12:34 +0000
commit38536e59275052b89755c6ee806642ce27055009 (patch)
tree18b5f1f4cccf0c27f454af5edcaaea0cb30c8daf /libavcodec/libshine.c
parentd49252721a18280a2ee8bd58d97942e15cfc219f (diff)
downloadffmpeg-38536e59275052b89755c6ee806642ce27055009.tar.gz
Support for shine 3.0.0
Diffstat (limited to 'libavcodec/libshine.c')
-rw-r--r--libavcodec/libshine.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/libshine.c b/libavcodec/libshine.c
index 521ac17f8b..cf8b1bbc52 100644
--- a/libavcodec/libshine.c
+++ b/libavcodec/libshine.c
@@ -50,17 +50,17 @@ static av_cold int libshine_encode_init(AVCodecContext *avctx)
shine_set_config_mpeg_defaults(&s->config.mpeg);
if (avctx->bit_rate)
s->config.mpeg.bitr = avctx->bit_rate / 1000;
- if (shine_find_bitrate_index(s->config.mpeg.bitr) < 0) {
- av_log(avctx, AV_LOG_ERROR, "invalid bitrate\n");
- return AVERROR(EINVAL);
- }
s->config.mpeg.mode = avctx->channels == 2 ? STEREO : MONO;
s->config.wave.samplerate = avctx->sample_rate;
s->config.wave.channels = avctx->channels == 2 ? PCM_STEREO : PCM_MONO;
+ if (shine_check_config(s->config.wave.samplerate, s->config.mpeg.bitr) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "invalid configuration\n");
+ return AVERROR(EINVAL);
+ }
s->shine = shine_initialise(&s->config);
if (!s->shine)
return AVERROR(ENOMEM);
- avctx->frame_size = samp_per_frame;
+ avctx->frame_size = shine_samples_per_pass(s->shine);
ff_af_queue_init(avctx, &s->afq);
return 0;
}
@@ -75,7 +75,7 @@ static int libshine_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
int ret, len;
if (frame)
- data = shine_encode_frame(s->shine, frame->data[0], &written);
+ data = shine_encode_buffer(s->shine, (int16_t **)frame->data, &written);
else
data = shine_flush(s->shine, &written);
if (written < 0)