Revision 562b2163

View differences:

ffserver.c
3628 3628

  
3629 3629
static int opt_audio_codec(const char *arg)
3630 3630
{
3631
    AVCodec *p;
3631
    AVCodec *p= avcodec_find_encoder_by_name(arg);
3632 3632

  
3633
    p = first_avcodec;
3634
    while (p) {
3635
        if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_AUDIO)
3636
            break;
3637
        p = p->next;
3638
    }
3639
    if (p == NULL)
3633
    if (p == NULL || p->type != CODEC_TYPE_AUDIO)
3640 3634
        return CODEC_ID_NONE;
3641 3635

  
3642 3636
    return p->id;
......
3644 3638

  
3645 3639
static int opt_video_codec(const char *arg)
3646 3640
{
3647
    AVCodec *p;
3641
    AVCodec *p= avcodec_find_encoder_by_name(arg);
3648 3642

  
3649
    p = first_avcodec;
3650
    while (p) {
3651
        if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_VIDEO)
3652
            break;
3653
        p = p->next;
3654
    }
3655
    if (p == NULL)
3643
    if (p == NULL || p->type != CODEC_TYPE_VIDEO)
3656 3644
        return CODEC_ID_NONE;
3657 3645

  
3658 3646
    return p->id;

Also available in: Unified diff