diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-08-11 17:45:50 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-08-16 20:24:20 +0200 |
commit | bca06e77e1b07f1dab04c3b9fef6fdcb62b4a401 (patch) | |
tree | da3177e2674159e2c25d061448c05c55328ea33a /libavcodec/utils.c | |
parent | 7f5bf4fbaf1f2142547321a16358f9871fabdcc6 (diff) | |
download | ffmpeg-bca06e77e1b07f1dab04c3b9fef6fdcb62b4a401.tar.gz |
lavc: add avcodec_get_type() for mapping codec_id -> type.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 14 |
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; +} |