Originally committed as revision 25593 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -251,6 +251,7 @@ typedef struct FFV1Context{
|
| 251 | 251 |
int run_index; |
| 252 | 252 |
int colorspace; |
| 253 | 253 |
int_fast16_t *sample_buffer; |
| 254 |
+ int gob_count; |
|
| 254 | 255 |
|
| 255 | 256 |
int quant_table_count; |
| 256 | 257 |
|
| ... | ... |
@@ -960,6 +961,7 @@ static av_cold int encode_init(AVCodecContext *avctx) |
| 960 | 960 |
} |
| 961 | 961 |
if(avctx->stats_in){
|
| 962 | 962 |
char *p= avctx->stats_in; |
| 963 |
+ int gob_count=0; |
|
| 963 | 964 |
char *next; |
| 964 | 965 |
|
| 965 | 966 |
av_assert0(s->version>=2); |
| ... | ... |
@@ -989,6 +991,12 @@ static av_cold int encode_init(AVCodecContext *avctx) |
| 989 | 989 |
} |
| 990 | 990 |
} |
| 991 | 991 |
} |
| 992 |
+ gob_count= strtol(p, &next, 0); |
|
| 993 |
+ if(next==p || gob_count <0){
|
|
| 994 |
+ av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n"); |
|
| 995 |
+ return -1; |
|
| 996 |
+ } |
|
| 997 |
+ p=next; |
|
| 992 | 998 |
while(*p=='\n' || *p==' ') p++; |
| 993 | 999 |
if(p[0]==0) break; |
| 994 | 1000 |
} |
| ... | ... |
@@ -1113,6 +1121,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, |
| 1113 | 1113 |
if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){
|
| 1114 | 1114 |
put_rac(c, &keystate, 1); |
| 1115 | 1115 |
p->key_frame= 1; |
| 1116 |
+ f->gob_count++; |
|
| 1116 | 1117 |
write_header(f); |
| 1117 | 1118 |
clear_state(f); |
| 1118 | 1119 |
}else{
|
| ... | ... |
@@ -1208,7 +1217,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, |
| 1208 | 1208 |
} |
| 1209 | 1209 |
} |
| 1210 | 1210 |
} |
| 1211 |
- snprintf(p, end-p, "\n"); |
|
| 1211 |
+ snprintf(p, end-p, "%d\n", f->gob_count); |
|
| 1212 | 1212 |
} else if(avctx->flags&CODEC_FLAG_PASS1) |
| 1213 | 1213 |
avctx->stats_out[0] = '\0'; |
| 1214 | 1214 |
|