libaacplus: return meaningful error codes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
6d53034483
commit
abf1e59ef2
@ -43,19 +43,19 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
|
|||||||
/* number of channels */
|
/* number of channels */
|
||||||
if (avctx->channels < 1 || avctx->channels > 2) {
|
if (avctx->channels < 1 || avctx->channels > 2) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
|
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
|
||||||
return -1;
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
|
if (avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
|
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
|
||||||
return -1;
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
|
s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
|
||||||
&s->samples_input, &s->max_output_bytes);
|
&s->samples_input, &s->max_output_bytes);
|
||||||
if (!s->aacplus_handle) {
|
if (!s->aacplus_handle) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
|
av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
|
||||||
return -1;
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check aacplus version */
|
/* check aacplus version */
|
||||||
@ -67,7 +67,7 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
|
|||||||
aacplus_cfg->inputFormat = avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? AACPLUS_INPUT_FLOAT : AACPLUS_INPUT_16BIT;
|
aacplus_cfg->inputFormat = avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? AACPLUS_INPUT_FLOAT : AACPLUS_INPUT_16BIT;
|
||||||
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
|
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
|
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
|
||||||
return -1;
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->frame_size = s->samples_input / avctx->channels;
|
avctx->frame_size = s->samples_input / avctx->channels;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user