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:
authorNathan Caldwell <saintdev@gmail.com>2012-10-19 08:58:25 +0400
committerLuca Barbato <lu_zero@gentoo.org>2012-10-22 01:03:26 +0400
commitc854102da773fa898cc6dbc8ca474b1088ce5f12 (patch)
treebabd340426cf4f8e658da03b18189088bd76d10d /avconv.c
parenta893655bdaa726a82424367b6456d195be12ebbc (diff)
avcodec: handle AVERROR_EXPERIMENTAL
Error out on init if a codec with CODEC_CAP_EXPERIMENTAL is requested and strict_std_compliance is not FF_COMPLIANCE_EXPERIMENTAL. Move the check from avconv to avcodec_open2() and return AVERROR_EXPERIMENTAL accordingly. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/avconv.c b/avconv.c
index 4d9c7c0b7f..759e1c0ce8 100644
--- a/avconv.c
+++ b/avconv.c
@@ -229,21 +229,18 @@ void assert_avoptions(AVDictionary *m)
}
}
-static void assert_codec_experimental(AVCodecContext *c, int encoder)
+static void abort_codec_experimental(AVCodec *c, int encoder)
{
const char *codec_string = encoder ? "encoder" : "decoder";
AVCodec *codec;
- if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&
- c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
- av_log(NULL, AV_LOG_FATAL, "%s '%s' is experimental and might produce bad "
- "results.\nAdd '-strict experimental' if you want to use it.\n",
- codec_string, c->codec->name);
- codec = encoder ? avcodec_find_encoder(c->codec->id) : avcodec_find_decoder(c->codec->id);
- if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
- av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n",
- codec_string, codec->name);
- exit(1);
- }
+ av_log(NULL, AV_LOG_FATAL, "%s '%s' is experimental and might produce bad "
+ "results.\nAdd '-strict experimental' if you want to use it.\n",
+ codec_string, c->name);
+ codec = encoder ? avcodec_find_encoder(c->id) : avcodec_find_decoder(c->id);
+ if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
+ av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n",
+ codec_string, codec->name);
+ exit(1);
}
/*
@@ -1442,7 +1439,7 @@ static void print_sdp(void)
static int init_input_stream(int ist_index, char *error, int error_len)
{
- int i;
+ int i, ret;
InputStream *ist = input_streams[ist_index];
if (ist->decoding_needed) {
AVCodec *codec = ist->dec;
@@ -1470,12 +1467,13 @@ static int init_input_stream(int ist_index, char *error, int error_len)
if (!av_dict_get(ist->opts, "threads", NULL, 0))
av_dict_set(&ist->opts, "threads", "auto", 0);
- if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) {
+ if ((ret = avcodec_open2(ist->st->codec, codec, &ist->opts)) < 0) {
+ if (ret == AVERROR_EXPERIMENTAL)
+ abort_codec_experimental(codec, 0);
snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d",
ist->file_index, ist->st->index);
- return AVERROR(EINVAL);
+ return ret;
}
- assert_codec_experimental(ist->st->codec, 0);
assert_avoptions(ist->opts);
}
@@ -1808,13 +1806,13 @@ static int transcode_init(void)
}
if (!av_dict_get(ost->opts, "threads", NULL, 0))
av_dict_set(&ost->opts, "threads", "auto", 0);
- if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) {
+ if ((ret = avcodec_open2(ost->st->codec, codec, &ost->opts)) < 0) {
+ if (ret == AVERROR_EXPERIMENTAL)
+ abort_codec_experimental(codec, 1);
snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
ost->file_index, ost->index);
- ret = AVERROR(EINVAL);
goto dump_format;
}
- assert_codec_experimental(ost->st->codec, 1);
assert_avoptions(ost->opts);
if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000)
av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."