Skip to content
Snippets Groups Projects
Commit a4aa20fb authored by Nathan Caldwell's avatar Nathan Caldwell Committed by Luca Barbato
Browse files

avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL


Signed-off-by: default avatarLuca Barbato <lu_zero@gentoo.org>
parent 620345f9
No related branches found
No related tags found
No related merge requests found
...@@ -1490,12 +1490,13 @@ av_cold int avcodec_close(AVCodecContext *avctx) ...@@ -1490,12 +1490,13 @@ av_cold int avcodec_close(AVCodecContext *avctx)
return 0; return 0;
} }
AVCodec *avcodec_find_encoder(enum AVCodecID id) static AVCodec *find_encdec(enum AVCodecID id, int encoder)
{ {
AVCodec *p, *experimental = NULL; AVCodec *p, *experimental = NULL;
p = first_avcodec; p = first_avcodec;
while (p) { 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) { if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
experimental = p; experimental = p;
} else } else
...@@ -1506,6 +1507,11 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id) ...@@ -1506,6 +1507,11 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id)
return experimental; return experimental;
} }
AVCodec *avcodec_find_encoder(enum AVCodecID id)
{
return find_encdec(id, 1);
}
AVCodec *avcodec_find_encoder_by_name(const char *name) AVCodec *avcodec_find_encoder_by_name(const char *name)
{ {
AVCodec *p; AVCodec *p;
...@@ -1522,14 +1528,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name) ...@@ -1522,14 +1528,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
AVCodec *avcodec_find_decoder(enum AVCodecID id) AVCodec *avcodec_find_decoder(enum AVCodecID id)
{ {
AVCodec *p; return find_encdec(id, 0);
p = first_avcodec;
while (p) {
if (av_codec_is_decoder(p) && p->id == id)
return p;
p = p->next;
}
return NULL;
} }
AVCodec *avcodec_find_decoder_by_name(const char *name) AVCodec *avcodec_find_decoder_by_name(const char *name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment