History

avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL

Nathan Caldwell committed 14 years ago

Commit a4aa20f1 parent 620345f1 file · +9 −10Browse files

Unified · Split

libavcodec/utils.c+9−10
@@ -1490,12 +1490,13 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 1489 unmodified lines
14901490 return 0;
14911491 }
14921492
1493−AVCodec *avcodec_find_encoder(enum AVCodecID id)
1493+static AVCodec *find_encdec(enum AVCodecID id, int encoder)
14941494 {
14951495 AVCodec *p, *experimental = NULL;
14961496 p = first_avcodec;
14971497 while (p) {
1498− if (av_codec_is_encoder(p) && p->id == id) {
1498+ if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) &&
1499+ p->id == id) {
14991500 if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
15001501 experimental = p;
15011502 } else
@@ -1506,6 +1507,11 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id) · 4 unmodified lines
15061507 return experimental;
15071508 }
15081509
1510+AVCodec *avcodec_find_encoder(enum AVCodecID id)
1511+{
1512+ return find_encdec(id, 1);
1513+}
1514+
15091515 AVCodec *avcodec_find_encoder_by_name(const char *name)
15101516 {
15111517 AVCodec *p;
@@ -1522,14 +1528,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name) · 10 unmodified lines
15221528
15231529 AVCodec *avcodec_find_decoder(enum AVCodecID id)
15241530 {
1525− AVCodec *p;
1526− p = first_avcodec;
1527− while (p) {
1528− if (av_codec_is_decoder(p) && p->id == id)
1529− return p;
1530− p = p->next;
1531− }
1532− return NULL;
1531+ return find_encdec(id, 0);
15331532 }
15341533
15351534 AVCodec *avcodec_find_decoder_by_name(const char *name)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t