[FFmpeg-devel] [PATCH 15/29] fftools/ffmpeg_mux: make data_size_mux private to ffmpeg_mux

Anton Khirnov anton at khirnov.net
Sun Apr 9 17:08:39 EEST 2023


It is no longer used outside of this file.
---
 fftools/ffmpeg.h     | 2 --
 fftools/ffmpeg_mux.c | 5 +++--
 fftools/ffmpeg_mux.h | 3 +++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index ddfeeabf75..bbcbf1aa80 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -649,8 +649,6 @@ typedef struct OutputStream {
     int keep_pix_fmt;
 
     /* stats */
-    // combined size of all the packets sent to the muxer
-    uint64_t data_size_mux;
     // combined size of all the packets received from the encoder
     uint64_t data_size_enc;
     // number of packets send to the muxer
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 01a11117a9..b316925115 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -128,7 +128,7 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
     }
     ms->last_mux_dts = pkt->dts;
 
-    ost->data_size_mux += pkt->size;
+    ms->data_size_mux += pkt->size;
     frame_num = atomic_fetch_add(&ost->packets_written, 1);
 
     pkt->stream_index = ost->index;
@@ -652,9 +652,10 @@ static void mux_final_stats(Muxer *mux)
 
     for (int j = 0; j < of->nb_streams; j++) {
         OutputStream *ost = of->streams[j];
+        MuxStream     *ms = ms_from_ost(ost);
         const AVCodecParameters *par = ost->st->codecpar;
         const  enum AVMediaType type = par->codec_type;
-        const uint64_t s = ost->data_size_mux;
+        const uint64_t s = ms->data_size_mux;
 
         switch (type) {
         case AVMEDIA_TYPE_VIDEO:    video_size    += s; break;
diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h
index c76dc2e524..3fab74b2ed 100644
--- a/fftools/ffmpeg_mux.h
+++ b/fftools/ffmpeg_mux.h
@@ -63,6 +63,9 @@ typedef struct MuxStream {
     /* dts of the last packet sent to the muxer, in the stream timebase
      * used for making up missing dts values */
     int64_t last_mux_dts;
+
+    // combined size of all the packets sent to the muxer
+    uint64_t data_size_mux;
 } MuxStream;
 
 typedef struct Muxer {
-- 
2.39.1



More information about the ffmpeg-devel mailing list