Patch by Janne Grunau, janne-ffmpeg jannau net Originally committed as revision 23334 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -645,6 +645,11 @@ typedef struct RcOverride{ · 644 unmodified lines | ||
| 645 | 645 | * as a last resort. |
| 646 | 646 | */ |
| 647 | 647 | #define CODEC_CAP_SUBFRAMES 0x0100 |
| 648 | +/** | |
| 649 | + * Codec is experimental and is thus avoided in favor of non experimental | |
| 650 | + * encoders | |
| 651 | + */ | |
| 652 | +#define CODEC_CAP_EXPERIMENTAL 0x0200 | |
| 648 | 653 | |
| 649 | 654 | //The following defines may change, don't expect compatibility if you use them. |
| 650 | 655 | #define MB_TYPE_INTRA4x4 0x0001 |
| @@ -725,14 +725,18 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 724 unmodified lines | ||
| 725 | 725 | |
| 726 | 726 | AVCodec *avcodec_find_encoder(enum CodecID id) |
| 727 | 727 | { |
| 728 | − AVCodec *p; | |
| 728 | + AVCodec *p, *experimental=NULL; | |
| 729 | 729 | p = first_avcodec; |
| 730 | 730 | while (p) { |
| 731 | − if (p->encode != NULL && p->id == id) | |
| 732 | − return p; | |
| 731 | + if (p->encode != NULL && p->id == id) { | |
| 732 | + if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) { | |
| 733 | + experimental = p; | |
| 734 | + } else | |
| 735 | + return p; | |
| 736 | + } | |
| 733 | 737 | p = p->next; |
| 734 | 738 | } |
| 735 | − return NULL; | |
| 739 | + return experimental; | |
| 736 | 740 | } |
| 737 | 741 | |
| 738 | 742 | AVCodec *avcodec_find_encoder_by_name(const char *name) |