From 98f3b098f9e3582ffaee736816ffa6b5f7859d87 Mon Sep 17 00:00:00 2001 From: Arpi Date: Sun, 23 Dec 2001 22:25:18 +0000 Subject: [PATCH] avcodec_find_encoder_by_name() patch by Alex Originally committed as revision 237 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 1 + libavcodec/utils.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 10d19a9c31..9b027091e2 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -230,6 +230,7 @@ void avcodec_init(void); void register_avcodec(AVCodec *format); AVCodec *avcodec_find_encoder(enum CodecID id); +AVCodec *avcodec_find_encoder_by_name(const char *name); AVCodec *avcodec_find_decoder(enum CodecID id); AVCodec *avcodec_find_decoder_by_name(const char *name); void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 01c1c13c65..0e6ba29d7a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -155,6 +155,18 @@ AVCodec *avcodec_find_encoder(enum CodecID id) return NULL; } +AVCodec *avcodec_find_encoder_by_name(const char *name) +{ + AVCodec *p; + p = first_avcodec; + while (p) { + if (p->encode != NULL && strcmp(name,p->name) == 0) + return p; + p = p->next; + } + return NULL; +} + AVCodec *avcodec_find_decoder(enum CodecID id) { AVCodec *p;