aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2011-08-17 13:54:49 +0200
committerNicolas George <nicolas.george@normalesup.org>2011-08-22 10:54:44 +0200
commitb3be9f4a88787d2d6692ffced187db677afdc726 (patch)
tree5bfbc8a747d6613676add5e3f91fb9bdcdfaceac /libavcodec/utils.c
parent8b52b46c97f2badf6095275f6c5a91ad4c2a9d51 (diff)
downloadffmpeg-b3be9f4a88787d2d6692ffced187db677afdc726.tar.gz
lavc: add a table of all codecs names.
The table is automatically generated from the definition of enum CodecID in avcodec.h and contains the name of all known codecs, even those for which no encoder nor decoder exists or is enabled. The table is queried using the avcodec_get_name function. If CONFIG_SMALL is true, the table is not compiled in; the avcodec_get_name looks for names in the list of available decoders and encoders.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ce8c0993a9..1d5ec44d36 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -984,6 +984,25 @@ static int get_bit_rate(AVCodecContext *ctx)
return bit_rate;
}
+const char *avcodec_get_name(enum CodecID id)
+{
+ AVCodec *codec;
+
+#if !CONFIG_SMALL
+ switch (id) {
+#include "libavcodec/codec_names.h"
+ }
+ av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id);
+#endif
+ codec = avcodec_find_decoder(id);
+ if (codec)
+ return codec->name;
+ codec = avcodec_find_encoder(id);
+ if (codec)
+ return codec->name;
+ return "unknown_codec";
+}
+
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
{
int i, len, ret = 0;