[FFmpeg-cvslog] avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL

Nathan Caldwell git at videolan.org
Mon Oct 22 14:49:52 CEST 2012


ffmpeg | branch: master | Nathan Caldwell <saintdev at gmail.com> | Thu Oct 18 14:47:38 2012 -0600| [a4aa20fbdbe8a092fa0a2707cd702531865d957f] | committer: Luca Barbato

avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4aa20fbdbe8a092fa0a2707cd702531865d957f
---

 libavcodec/utils.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 836d953..cbe527e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1490,12 +1490,13 @@ av_cold int avcodec_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec *avcodec_find_encoder(enum AVCodecID id)
+static AVCodec *find_encdec(enum AVCodecID id, int encoder)
 {
     AVCodec *p, *experimental = NULL;
     p = first_avcodec;
     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
@@ -1506,6 +1507,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;
@@ -1522,14 +1528,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
 
 AVCodec *avcodec_find_decoder(enum AVCodecID id)
 {
-    AVCodec *p;
-    p = first_avcodec;
-    while (p) {
-        if (av_codec_is_decoder(p) && p->id == id)
-            return p;
-        p = p->next;
-    }
-    return NULL;
+    return find_encdec(id, 0);
 }
 
 AVCodec *avcodec_find_decoder_by_name(const char *name)



More information about the ffmpeg-cvslog mailing list