[SCM] libav/experimental: avconv: split printing the final statistics into a separate function

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Aug 10 16:02:23 UTC 2014


The following commit has been merged in the experimental branch:
commit a220b07b0f971f88213aef012aea51af2800be62
Author: Anton Khirnov <anton at khirnov.net>
Date:   Mon Mar 17 10:09:09 2014 +0100

    avconv: split printing the final statistics into a separate function

diff --git a/avconv.c b/avconv.c
index d393ce1..df9bbb9 100644
--- a/avconv.c
+++ b/avconv.c
@@ -736,6 +736,40 @@ static int poll_filters(void)
     return ret;
 }
 
+static void print_final_stats(int64_t total_size)
+{
+    uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
+    uint64_t data_size = 0;
+    float percent = -1.0;
+    int i;
+
+    for (i = 0; i < nb_output_streams; i++) {
+        OutputStream *ost = output_streams[i];
+        switch (ost->st->codec->codec_type) {
+            case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break;
+            case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break;
+            default:                 other_size += ost->data_size; break;
+        }
+        extra_size += ost->st->codec->extradata_size;
+        data_size  += ost->data_size;
+    }
+
+    if (data_size && total_size >= data_size)
+        percent = 100.0 * (total_size - data_size) / data_size;
+
+    av_log(NULL, AV_LOG_INFO, "\n");
+    av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
+           video_size / 1024.0,
+           audio_size / 1024.0,
+           other_size / 1024.0,
+           extra_size / 1024.0);
+    if (percent >= 0.0)
+        av_log(NULL, AV_LOG_INFO, "%f%%", percent);
+    else
+        av_log(NULL, AV_LOG_INFO, "unknown");
+    av_log(NULL, AV_LOG_INFO, "\n");
+}
+
 static void print_report(int is_last_report, int64_t timer_start)
 {
     char buf[1024];
@@ -852,37 +886,9 @@ static void print_report(int is_last_report, int64_t timer_start)
 
     fflush(stderr);
 
-    if (is_last_report) {
-        uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
-        uint64_t data_size = 0;
-        float percent = -1.0;
+    if (is_last_report)
+        print_final_stats(total_size);
 
-        for (i = 0; i < nb_output_streams; i++) {
-            OutputStream *ost = output_streams[i];
-            switch (ost->st->codec->codec_type) {
-            case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break;
-            case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break;
-            default:                 other_size += ost->data_size; break;
-            }
-            extra_size += ost->st->codec->extradata_size;
-            data_size  += ost->data_size;
-        }
-
-        if (data_size && total_size >= data_size)
-            percent = 100.0 * (total_size - data_size) / data_size;
-
-        av_log(NULL, AV_LOG_INFO, "\n");
-        av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
-               video_size / 1024.0,
-               audio_size / 1024.0,
-               other_size / 1024.0,
-               extra_size / 1024.0);
-        if (percent >= 0.0)
-            av_log(NULL, AV_LOG_INFO, "%f%%", percent);
-        else
-            av_log(NULL, AV_LOG_INFO, "unknown");
-        av_log(NULL, AV_LOG_INFO, "\n");
-    }
 }
 
 static void flush_encoders(void)

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list