[FFmpeg-cvslog] Set default ffv1 coder to -1.

Carl Eugen Hoyos git at videolan.org
Tue Jul 10 14:33:22 CEST 2012


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Tue Jul 10 14:29:10 2012 +0200| [acf0283925151bdfa135e934cf6e3c351b2adf75] | committer: Carl Eugen Hoyos

Set default ffv1 coder to -1.

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

Fixes ticket #1519.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=acf0283925151bdfa135e934cf6e3c351b2adf75
---

 libavcodec/ffv1.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index a0322df..6d60117 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -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,



More information about the ffmpeg-cvslog mailing list