avcodec: Add utils test
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 28 Feb 2016 11:35:33 +0000 (12:35 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 29 Feb 2016 20:44:06 +0000 (21:44 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/Makefile
libavcodec/utils.c

index 5389725..667e257 100644 (file)
@@ -952,6 +952,7 @@ TESTPROGS = imgconvert                                                  \
             jpeg2000dwt                                                 \
             mathops                                                    \
             options                                                     \
+            utils                                                       \
             avfft                                                       \
 
 TESTPROGS-$(CONFIG_CABAC)                 += cabac
index b1ba51e..f435588 100644 (file)
@@ -3679,3 +3679,23 @@ AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx)
 
     return props;
 }
+
+#ifdef TEST
+int main(void){
+    avcodec_register_all();
+    AVCodec *codec = NULL;
+    int ret = 0;
+
+    while (codec = av_codec_next(codec)) {
+        if (av_codec_is_encoder(codec)) {
+            if (codec->type == AVMEDIA_TYPE_AUDIO) {
+                if (!codec->sample_fmts) {
+                    av_log(NULL, AV_LOG_FATAL, "Encoder %s is missing the sample_fmts field\n", codec->name);
+                    ret = 1;
+                }
+            }
+        }
+    }
+    return ret;
+}
+#endif /* TEST */