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:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-22 07:57:44 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-27 07:05:46 +0300
commitaeee5e3967a0024615cea1bb2736ed120c566048 (patch)
treed8536feeef38a1bad507b72b011fbcbf1de4e48c /libavformat/chromaprint.c
parentdd1975b0bbcfdd7d02808b3deac43f8f4073731d (diff)
avformat/chromaprint: Improve returned error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/chromaprint.c')
-rw-r--r--libavformat/chromaprint.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c
index b7a943e126..e4882c8e61 100644
--- a/libavformat/chromaprint.c
+++ b/libavformat/chromaprint.c
@@ -69,47 +69,45 @@ static int write_header(AVFormatContext *s)
if (!cpr->ctx) {
av_log(s, AV_LOG_ERROR, "Failed to create chromaprint context.\n");
- return AVERROR(ENOMEM);
+ return AVERROR_EXTERNAL;
}
if (cpr->silence_threshold != -1) {
#if CPR_VERSION_INT >= AV_VERSION_INT(0, 7, 0)
if (!chromaprint_set_option(cpr->ctx, "silence_threshold", cpr->silence_threshold)) {
av_log(s, AV_LOG_ERROR, "Failed to set silence threshold. Setting silence_threshold requires -algorithm 3 option.\n");
- goto fail;
+ return AVERROR_EXTERNAL;
}
#else
av_log(s, AV_LOG_ERROR, "Setting the silence threshold requires Chromaprint "
"version 0.7.0 or later.\n");
- goto fail;
+ return AVERROR(ENOSYS);
#endif
}
if (s->nb_streams != 1) {
av_log(s, AV_LOG_ERROR, "Only one stream is supported\n");
- goto fail;
+ return AVERROR(EINVAL);
}
st = s->streams[0];
if (st->codecpar->channels > 2) {
av_log(s, AV_LOG_ERROR, "Only up to 2 channels are supported\n");
- goto fail;
+ return AVERROR(EINVAL);
}
if (st->codecpar->sample_rate < 1000) {
av_log(s, AV_LOG_ERROR, "Sampling rate must be at least 1000\n");
- goto fail;
+ return AVERROR(EINVAL);
}
if (!chromaprint_start(cpr->ctx, st->codecpar->sample_rate, st->codecpar->channels)) {
av_log(s, AV_LOG_ERROR, "Failed to start chromaprint\n");
- goto fail;
+ return AVERROR_EXTERNAL;
}
return 0;
-fail:
- return AVERROR(EINVAL);
}
static int write_packet(AVFormatContext *s, AVPacket *pkt)
@@ -124,7 +122,7 @@ static int write_trailer(AVFormatContext *s)
AVIOContext *pb = s->pb;
void *fp = NULL;
char *enc_fp = NULL;
- int size, enc_size, ret = AVERROR(EINVAL);
+ int size, enc_size, ret = AVERROR_EXTERNAL;
if (!chromaprint_finish(cpr->ctx)) {
av_log(s, AV_LOG_ERROR, "Failed to generate fingerprint\n");