[FFmpeg-devel] [PATCH 3/5] avcodec/tests/codec_desc: Test for every AVCodec to have a descriptor

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Sep 22 01:18:14 EEST 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/tests/codec_desc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tests/codec_desc.c b/libavcodec/tests/codec_desc.c
index c9b3497343..378e4c637f 100644
--- a/libavcodec/tests/codec_desc.c
+++ b/libavcodec/tests/codec_desc.c
@@ -16,11 +16,14 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcodec/avcodec.h"
+#include "libavcodec/codec.h"
+#include "libavcodec/codec_desc.h"
 
 int main(int argc, char **argv)
 {
     const AVCodecDescriptor *old_desc = NULL, *desc;
+    const AVCodec *codec;
+    void *iter = NULL;
 
     while (desc = avcodec_descriptor_next(old_desc)) {
         if (old_desc && old_desc->id >= desc->id) {
@@ -40,6 +43,13 @@ int main(int argc, char **argv)
 
         old_desc = desc;
     }
+    while (codec = av_codec_iterate(&iter)) {
+        if (!avcodec_descriptor_get(codec->id)) {
+            av_log(NULL, AV_LOG_FATAL, "Codec %s lacks a corresponding descriptor\n",
+                   codec->name);
+            return 1;
+        }
+    }
 
     return 0;
 }
-- 
2.30.2



More information about the ffmpeg-devel mailing list