diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-22 14:39:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-22 14:39:12 +0200 |
commit | e3a91c51f7136c1bfd96f71b177b693e08427880 (patch) | |
tree | a9ceea95293f4622d5934672ac0004f43972833c /libavcodec/utils.c | |
parent | c3778df2d4c05e76d28d77a2d740e435393046c9 (diff) | |
parent | c3e15f7b39aac2012f09ee4ca86d2bc674ffdbd4 (diff) | |
download | ffmpeg-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 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f7367143c3..bed15bc7d8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -886,15 +886,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; - if (codec->capabilities & CODEC_CAP_EXPERIMENTAL) - if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { - av_log(avctx, AV_LOG_ERROR, - "Codec %s is experimental but experimental codecs are not enabled, try -strict %d\n", - codec->name, FF_COMPLIANCE_EXPERIMENTAL); - ret = -1; - goto free_and_end; - } - //We only call avcodec_set_dimensions() for non h264 codecs so as not to overwrite previously setup dimensions if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){ @@ -937,6 +928,15 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->frame_number = 0; avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); + if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL && + avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { + av_log(avctx, AV_LOG_ERROR, + "Codec %s is experimental but experimental codecs are not enabled, try -strict %d\n", + codec->name, FF_COMPLIANCE_EXPERIMENTAL); + ret = AVERROR_EXPERIMENTAL; + goto free_and_end; + } + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; @@ -1961,13 +1961,14 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) } } -AVCodec *avcodec_find_encoder(enum AVCodecID id) +static AVCodec *find_encdec(enum AVCodecID id, int encoder) { AVCodec *p, *experimental = NULL; p = first_avcodec; id= remap_deprecated_codec_id(id); while (p) { - if (av_codec_is_encoder(p) && p->id == id) { + if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) && + p->id == id) { if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) { experimental = p; } else @@ -1978,6 +1979,11 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id) return experimental; } +AVCodec *avcodec_find_encoder(enum AVCodecID id) +{ + return find_encdec(id, 1); +} + AVCodec *avcodec_find_encoder_by_name(const char *name) { AVCodec *p; @@ -1994,19 +2000,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name) AVCodec *avcodec_find_decoder(enum AVCodecID id) { - AVCodec *p, *experimental=NULL; - p = first_avcodec; - id= remap_deprecated_codec_id(id); - while (p) { - if (av_codec_is_decoder(p) && p->id == id) { - if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) { - experimental = p; - } else - return p; - } - p = p->next; - } - return experimental; + return find_encdec(id, 0); } AVCodec *avcodec_find_decoder_by_name(const char *name) |