aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-11 17:45:50 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-16 20:24:20 +0200
commitbca06e77e1b07f1dab04c3b9fef6fdcb62b4a401 (patch)
treeda3177e2674159e2c25d061448c05c55328ea33a /libavcodec/utils.c
parent7f5bf4fbaf1f2142547321a16358f9871fabdcc6 (diff)
downloadffmpeg-bca06e77e1b07f1dab04c3b9fef6fdcb62b4a401.tar.gz
lavc: add avcodec_get_type() for mapping codec_id -> type.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0abab9a83d..166fbec607 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1301,3 +1301,17 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count)
return ff_thread_init(s);
}
#endif
+
+enum AVMediaType avcodec_get_type(enum CodecID codec_id)
+{
+ if (codec_id <= CODEC_ID_NONE)
+ return AVMEDIA_TYPE_UNKNOWN;
+ else if (codec_id < CODEC_ID_FIRST_AUDIO)
+ return AVMEDIA_TYPE_VIDEO;
+ else if (codec_id < CODEC_ID_FIRST_SUBTITLE)
+ return AVMEDIA_TYPE_AUDIO;
+ else if (codec_id < CODEC_ID_FIRST_UNKNOWN)
+ return AVMEDIA_TYPE_SUBTITLE;
+
+ return AVMEDIA_TYPE_UNKNOWN;
+}