From 0ae0faa7c03688a46441f31d2d6eacaeb3fde6aa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 28 Oct 2010 12:15:44 +0000 Subject: Keep track of how many slices*gops where encoded in ffv1 2 pass. Originally committed as revision 25593 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ffv1.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libavcodec/ffv1.c') diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index b183dddfc4..6c5408d6bf 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -251,6 +251,7 @@ typedef struct FFV1Context{ int run_index; int colorspace; int_fast16_t *sample_buffer; + int gob_count; int quant_table_count; @@ -960,6 +961,7 @@ static av_cold int encode_init(AVCodecContext *avctx) } if(avctx->stats_in){ char *p= avctx->stats_in; + int gob_count=0; char *next; av_assert0(s->version>=2); @@ -989,6 +991,12 @@ static av_cold int encode_init(AVCodecContext *avctx) } } } + gob_count= strtol(p, &next, 0); + if(next==p || gob_count <0){ + av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n"); + return -1; + } + p=next; while(*p=='\n' || *p==' ') p++; if(p[0]==0) break; } @@ -1113,6 +1121,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){ put_rac(c, &keystate, 1); p->key_frame= 1; + f->gob_count++; write_header(f); clear_state(f); }else{ @@ -1208,7 +1217,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, } } } - snprintf(p, end-p, "\n"); + snprintf(p, end-p, "%d\n", f->gob_count); } else if(avctx->flags&CODEC_FLAG_PASS1) avctx->stats_out[0] = '\0'; -- cgit v1.2.3