[FFmpeg-cvslog] fftools/ffmpeg: move OutputStream.packets_encoded to Encoder

Anton Khirnov git at videolan.org
Tue May 2 12:31:02 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Apr 27 16:02:30 2023 +0200| [7e3eb2412314760bff6036e6eb2d4b7bbdcde9c4] | committer: Anton Khirnov

fftools/ffmpeg: move OutputStream.packets_encoded to Encoder

It is no longer used outside of ffmpeg_enc.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e3eb2412314760bff6036e6eb2d4b7bbdcde9c4
---

 fftools/ffmpeg.h     | 2 --
 fftools/ffmpeg_enc.c | 9 ++++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index c4b77ab2c8..116087354d 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -665,8 +665,6 @@ typedef struct OutputStream {
     // number of frames/samples sent to the encoder
     uint64_t frames_encoded;
     uint64_t samples_encoded;
-    // number of packets received from the encoder
-    uint64_t packets_encoded;
 
     /* packet quality factor */
     int quality;
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index c368097cd0..5707199ac5 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -59,6 +59,9 @@ struct Encoder {
 
     // combined size of all the packets received from the encoder
     uint64_t data_size;
+
+    // number of packets received from the encoder
+    uint64_t packets_encoded;
 };
 
 static uint64_t dup_warning = 1000;
@@ -619,7 +622,7 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write
         }
     }
 
-    frame_number = ost->packets_encoded;
+    frame_number = e->packets_encoded;
     if (vstats_version <= 1) {
         fprintf(vstats_file, "frame= %5"PRId64" q= %2.1f ", frame_number,
                 ost->quality / (float)FF_QP2LAMBDA);
@@ -708,7 +711,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
             update_video_stats(ost, pkt, !!vstats_filename);
         if (ost->enc_stats_post.io)
             enc_stats_write(ost, &ost->enc_stats_post, NULL, pkt,
-                            ost->packets_encoded);
+                            e->packets_encoded);
 
         if (debug_ts) {
             av_log(ost, AV_LOG_INFO, "encoder -> type:%s "
@@ -742,7 +745,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
 
         e->data_size += pkt->size;
 
-        ost->packets_encoded++;
+        e->packets_encoded++;
 
         of_output_packet(of, pkt, ost, 0);
     }



More information about the ffmpeg-cvslog mailing list