diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-08-11 15:32:27 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-08-18 08:48:30 +0200 |
commit | 91e59fea30f57af7abd1ad6a68a8f6663805ee44 (patch) | |
tree | 70b46a72c2356052cc7c41be3fa497c156386875 /libavcodec/codec_desc.c | |
parent | 0a0f19b577d54ff2e72cc9a0fe027952db83f332 (diff) | |
download | ffmpeg-91e59fea30f57af7abd1ad6a68a8f6663805ee44.tar.gz |
lavc: add avcodec_descriptor_get_by_name().
Diffstat (limited to 'libavcodec/codec_desc.c')
-rw-r--r-- | libavcodec/codec_desc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 2ace53b4d0..30a4e4a778 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <string.h> + #include "avcodec.h" #include "libavutil/common.h" @@ -1939,3 +1941,14 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev) return prev + 1; return NULL; } + +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name) +{ + const AVCodecDescriptor *desc = NULL; + + while ((desc = avcodec_descriptor_next(desc))) { + if (!strcmp(desc->name, name)) + return desc; + } + return NULL; +} |