diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-29 13:45:19 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-29 13:45:19 +0200 |
commit | 2f63e83c26f15f5754c87bfbb9f101cd9a2a4b98 (patch) | |
tree | a4d52100c23e2575b1cabe222b2ea3732b901a58 | |
parent | b123d82c4182fc3842376ac1e078ec63bcd2e20c (diff) | |
parent | a5d58fea68b9212e0065a71939e921505504a9bb (diff) | |
download | ffmpeg-2f63e83c26f15f5754c87bfbb9f101cd9a2a4b98.tar.gz |
Merge commit 'a5d58fea68b9212e0065a71939e921505504a9bb'
* commit 'a5d58fea68b9212e0065a71939e921505504a9bb':
lavc: reimplement avcodec_get_type() using codec descriptors
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r-- | libavcodec/codec_desc.c | 6 | ||||
-rw-r--r-- | libavcodec/utils.c | 20 |
2 files changed, 6 insertions, 20 deletions
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index e2f5176a03..b9c2f64688 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2843,3 +2843,9 @@ const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name) return desc; return NULL; } + +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id) +{ + const AVCodecDescriptor *desc = avcodec_descriptor_get(codec_id); + return desc ? desc->type : AVMEDIA_TYPE_UNKNOWN; +} diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 19548e25a7..c2ded454e2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3403,26 +3403,6 @@ void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, in #endif -enum AVMediaType avcodec_get_type(enum AVCodecID codec_id) -{ - AVCodec *c= avcodec_find_decoder(codec_id); - if(!c) - c= avcodec_find_encoder(codec_id); - if(c) - return c->type; - - if (codec_id <= AV_CODEC_ID_NONE) - return AVMEDIA_TYPE_UNKNOWN; - else if (codec_id < AV_CODEC_ID_FIRST_AUDIO) - return AVMEDIA_TYPE_VIDEO; - else if (codec_id < AV_CODEC_ID_FIRST_SUBTITLE) - return AVMEDIA_TYPE_AUDIO; - else if (codec_id < AV_CODEC_ID_FIRST_UNKNOWN) - return AVMEDIA_TYPE_SUBTITLE; - - return AVMEDIA_TYPE_UNKNOWN; -} - int avcodec_is_open(AVCodecContext *s) { return !!s->internal; |