1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavc: reimplement avcodec_get_type() using codec descriptors

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
wm4 2015-09-26 18:42:50 +02:00 committed by Anton Khirnov
parent b10b6ac7a9
commit a5d58fea68
2 changed files with 6 additions and 14 deletions

View File

@ -2435,3 +2435,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;
}

View File

@ -2320,20 +2320,6 @@ void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
#endif
enum AVMediaType avcodec_get_type(enum AVCodecID codec_id)
{
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;