aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-12-12 18:47:58 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-12-12 18:47:58 +0000
commit562b216307ab1e7a62fe85ef9dcf3c485bc647f7 (patch)
treeab4b4376ac955144497c207b3a6e0cb81997a1f3
parent55b9e69a31658df3c8e41bdcdbc5a8221a74e733 (diff)
downloadffmpeg-562b216307ab1e7a62fe85ef9dcf3c485bc647f7.tar.gz
avoid using first_avcodec
Originally committed as revision 11205 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffserver.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/ffserver.c b/ffserver.c
index 07d44b3488..029b0958a8 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3628,15 +3628,9 @@ static void add_codec(FFStream *stream, AVCodecContext *av)
static int opt_audio_codec(const char *arg)
{
- AVCodec *p;
+ AVCodec *p= avcodec_find_encoder_by_name(arg);
- p = first_avcodec;
- while (p) {
- if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_AUDIO)
- break;
- p = p->next;
- }
- if (p == NULL)
+ if (p == NULL || p->type != CODEC_TYPE_AUDIO)
return CODEC_ID_NONE;
return p->id;
@@ -3644,15 +3638,9 @@ static int opt_audio_codec(const char *arg)
static int opt_video_codec(const char *arg)
{
- AVCodec *p;
+ AVCodec *p= avcodec_find_encoder_by_name(arg);
- p = first_avcodec;
- while (p) {
- if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_VIDEO)
- break;
- p = p->next;
- }
- if (p == NULL)
+ if (p == NULL || p->type != CODEC_TYPE_VIDEO)
return CODEC_ID_NONE;
return p->id;