summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-10-28 12:15:44 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-10-28 12:15:44 +0000
commit0ae0faa7c03688a46441f31d2d6eacaeb3fde6aa (patch)
tree3afc2902ca03d3f267942a2b8debeb0a4d9a7e7b /libavcodec/ffv1.c
parent3f0671a2d34f96ed686ca182806db1b8183cbe7d (diff)
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
Diffstat (limited to 'libavcodec/ffv1.c')
-rw-r--r--libavcodec/ffv1.c11
1 files changed, 10 insertions, 1 deletions
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';