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>
This commit is contained in:
Michael Niedermayer
2012-10-22 14:39:12 +02:00
8 changed files with 45 additions and 47 deletions

View File

@@ -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)