]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/codec_desc.c
avcodec/imgconvert: fix possible null pointer dereference
[ffmpeg] / libavcodec / codec_desc.c
index 1e5d715416494a474a355926fcbc340fc3be9b35..79552a910d647ec4e50332ffa1074bec933d7a3c 100644 (file)
 
 #include <string.h>
 
-#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
-#include "libavutil/thread.h"
 #include "avcodec.h"
 #include "profiles.h"
 #include "version.h"
@@ -1604,6 +1602,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .name      = "av1",
         .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
         .props     = AV_CODEC_PROP_LOSSY,
+        .profiles  = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
     },
     {
         .id        = AV_CODEC_ID_BITPACKED,
@@ -2735,6 +2734,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .long_name = NULL_IF_CONFIG_SMALL("Digital Speech Standard - Standard Play mode (DSS SP)"),
         .props     = AV_CODEC_PROP_LOSSY,
     },
+    {
+        .id        = AV_CODEC_ID_CODEC2,
+        .type      = AVMEDIA_TYPE_AUDIO,
+        .name      = "codec2",
+        .long_name = NULL_IF_CONFIG_SMALL("codec2 (very low bitrate speech codec)"),
+        .props     = AV_CODEC_PROP_LOSSY,
+    },
     {
         .id        = AV_CODEC_ID_FFWAVESYNTH,
         .type      = AVMEDIA_TYPE_AUDIO,
@@ -2858,6 +2864,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .long_name = NULL_IF_CONFIG_SMALL("aptX (Audio Processing Technology for Bluetooth)"),
         .props     = AV_CODEC_PROP_LOSSY,
     },
+    {
+        .id        = AV_CODEC_ID_APTX_HD,
+        .type      = AVMEDIA_TYPE_AUDIO,
+        .name      = "aptx_hd",
+        .long_name = NULL_IF_CONFIG_SMALL("aptX HD (Audio Processing Technology for Bluetooth)"),
+        .props     = AV_CODEC_PROP_LOSSY,
+    },
+    {
+        .id        = AV_CODEC_ID_SBC,
+        .type      = AVMEDIA_TYPE_AUDIO,
+        .name      = "sbc",
+        .long_name = NULL_IF_CONFIG_SMALL("SBC (low-complexity subband codec)"),
+        .props     = AV_CODEC_PROP_LOSSY,
+    },
 
     /* subtitle codecs */
     {
@@ -3104,26 +3124,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
     },
 };
 
-#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
-static void check_validity(void)
-{
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(codec_descriptors) - 1; i++) {
-        if (codec_descriptors[i].id >= codec_descriptors[i+1].id) {
-            av_log(NULL, AV_LOG_FATAL, "unsorted codec_id '%s' and '%s'.\n",
-                   codec_descriptors[i].name, codec_descriptors[i+1].name);
-            av_assert0(0);
-        }
-    }
-}
-
-static AVOnce check_validity_once = AV_ONCE_INIT;
-#define CHECK_VALIDITY() ff_thread_once(&check_validity_once, check_validity);
-#else
-#define CHECK_VALIDITY() ((void)0)
-#endif
-
 static int descriptor_compare(const void *key, const void *member)
 {
     enum AVCodecID id = *(const enum AVCodecID *) key;
@@ -3134,8 +3134,6 @@ static int descriptor_compare(const void *key, const void *member)
 
 const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id)
 {
-    CHECK_VALIDITY();
-
     return bsearch(&id, codec_descriptors, FF_ARRAY_ELEMS(codec_descriptors),
                    sizeof(codec_descriptors[0]), descriptor_compare);
 }