summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-22 14:39:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-22 14:39:12 +0200
commite3a91c51f7136c1bfd96f71b177b693e08427880 (patch)
treea9ceea95293f4622d5934672ac0004f43972833c /ffmpeg.c
parentc3778df2d4c05e76d28d77a2d740e435393046c9 (diff)
parentc3e15f7b39aac2012f09ee4ca86d2bc674ffdbd4 (diff)
downloadffmpeg-e3a91c51f7136c1bfd96f71b177b693e08427880.tar.gz
Merge commit 'c3e15f7b39aac2012f09ee4ca86d2bc674ffdbd4'
* commit 'c3e15f7b39aac2012f09ee4ca86d2bc674ffdbd4': rtpdec: Don't pass a non-AVClass pointer as log context rtsp: Update a comment to the current filename scheme avcodec: handle AVERROR_EXPERIMENTAL avutil: Add AVERROR_EXPERIMENTAL avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL Conflicts: doc/APIchanges ffmpeg.c libavcodec/utils.c libavformat/rtpdec.c libavutil/error.c libavutil/error.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index e69eb89311..1612469fda 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -467,21 +467,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);
}
static void update_benchmark(const char *fmt, ...)
@@ -1859,6 +1856,7 @@ static void print_sdp(void)
static int init_input_stream(int ist_index, char *error, int error_len)
{
+ int ret;
InputStream *ist = input_streams[ist_index];
if (ist->decoding_needed) {
@@ -1878,12 +1876,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);
}
@@ -2267,17 +2266,17 @@ 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;
}
if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
!(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
av_buffersink_set_frame_size(ost->filter->filter,
ost->st->codec->frame_size);
- 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."