Set default ffv1 coder to -1.

Autoselect coder 1 instead of default coder if bits_per_raw_sample > 8.

Fixes ticket #1519.
This commit is contained in:
Carl Eugen Hoyos 2012-07-10 14:29:10 +02:00
parent 4c4e125695
commit acf0283925
1 changed files with 11 additions and 1 deletions

View File

@ -916,7 +916,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
s->ac= avctx->coder_type ? 2:0;
s->ac= avctx->coder_type > 0 ? 2 : 0;
s->plane_count=3;
switch(avctx->pix_fmt){
@ -944,6 +944,10 @@ static av_cold int encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample invalid\n");
return AVERROR_INVALIDDATA;
}
if(!s->ac && avctx->coder_type == -1) {
av_log(avctx, AV_LOG_INFO, "bits_per_raw_sample > 8, forcing coder 1\n");
s->ac = 2;
}
if(!s->ac){
av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample of more than 8 needs -coder 1 currently\n");
return AVERROR_INVALIDDATA;
@ -2058,6 +2062,11 @@ static const AVClass class = {
.version = LIBAVUTIL_VERSION_INT,
};
static const AVCodecDefault ffv1_defaults[] = {
{ "coder", "-1" },
{ NULL },
};
AVCodec ff_ffv1_encoder = {
.name = "ffv1",
.type = AVMEDIA_TYPE_VIDEO,
@ -2067,6 +2076,7 @@ AVCodec ff_ffv1_encoder = {
.encode2 = encode_frame,
.close = common_end,
.capabilities = CODEC_CAP_SLICE_THREADS,
.defaults = ffv1_defaults,
.pix_fmts = (const enum PixelFormat[]){
PIX_FMT_YUV420P, PIX_FMT_YUVA420P, PIX_FMT_YUVA422P, PIX_FMT_YUV444P,
PIX_FMT_YUVA444P, PIX_FMT_YUV440P, PIX_FMT_YUV422P, PIX_FMT_YUV411P,