@@ -1512,7 +1512,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
{
AVBPrint buf, buf_script;
OutputStream *ost;
- int64_t total_size = -1;
+ int64_t total_size = of_bytes_written(output_files[0]);
AVCodecContext *enc;
int frame_number, vid, i;
double bitrate;
@@ -1541,10 +1541,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
t = (cur_time-timer_start) / 1000000.0;
-
- if (output_files[0]->ctx->pb)
- total_size = output_files[0]->ctx->pb->bytes_written;
-
vid = 0;
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC);
@@ -694,5 +694,6 @@ void of_close(OutputFile **pof);
void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost,
int unqueue);
int of_finished(OutputFile *of);
+int64_t of_bytes_written(OutputFile *of);
#endif /* FFTOOLS_FFMPEG_H */
@@ -371,3 +371,9 @@ int of_finished(OutputFile *of)
return 1;
return 0;
}
+
+int64_t of_bytes_written(OutputFile *of)
+{
+ AVIOContext *pb = of->ctx->pb;
+ return pb ? pb->bytes_written : -1;
+}