Revision fcee0164

View differences:

ffmpeg.c
2744 2744
            } else {
2745 2745
                char *p;
2746 2746
                int i;
2747
                AVCodec *codec;
2747 2748
            
2748 2749
                codec_id = file_oformat->video_codec;
2749 2750
                if (video_codec_id != CODEC_ID_NONE)
......
2759 2760
                video_enc->width = frame_width + frame_padright + frame_padleft;
2760 2761
                video_enc->height = frame_height + frame_padtop + frame_padbottom;
2761 2762
		video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
2762
		video_enc->pix_fmt = frame_pix_fmt;
2763
                video_enc->pix_fmt = frame_pix_fmt;
2764

  
2765
                codec = avcodec_find_encoder(codec_id);
2766
                if(codec && codec->pix_fmts){
2767
                    const enum PixelFormat *p= codec->pix_fmts;
2768
                    for(; *p!=-1; p++){
2769
                        if(*p == video_enc->pix_fmt)
2770
                            break;
2771
                    }
2772
                    if(*p == -1)
2773
                        video_enc->pix_fmt = codec->pix_fmts[0];
2774
                }
2763 2775

  
2764 2776
                if (!intra_only)
2765 2777
                    video_enc->gop_size = gop_size;
libavcodec/avcodec.h
1658 1658
    struct AVCodec *next;
1659 1659
    void (*flush)(AVCodecContext *);
1660 1660
    const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0}
1661
    const enum PixelFormat *pix_fmts;       ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1
1661 1662
} AVCodec;
1662 1663

  
1663 1664
/**
libavcodec/svq1.c
1933 1933
    svq1_decode_frame,
1934 1934
    CODEC_CAP_DR1,
1935 1935
    .flush= ff_mpeg_flush,
1936
    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, -1},
1936 1937
};
1937 1938

  
1938 1939
#ifdef CONFIG_ENCODERS
......
1945 1946
    svq1_encode_init,
1946 1947
    svq1_encode_frame,
1947 1948
    svq1_encode_end,
1949
    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, -1},
1948 1950
};
1949 1951

  
1950 1952
#endif //CONFIG_ENCODERS

Also available in: Unified diff