[FFmpeg-cvslog] fftools/ffmpeg_mux: move sq_mux from OutputFile to Muxer

Anton Khirnov git at videolan.org
Tue Oct 18 15:23:34 EEST 2022


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Oct 13 15:29:29 2022 +0200| [ee0a900e5817148c8343f8f95e7b811b069704f4] | committer: Anton Khirnov

fftools/ffmpeg_mux: move sq_mux from OutputFile to Muxer

It is internal to ffmpeg_mux* and does not need to be visible to other
code.

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

 fftools/ffmpeg.h          | 1 -
 fftools/ffmpeg_mux.c      | 8 ++++----
 fftools/ffmpeg_mux.h      | 1 +
 fftools/ffmpeg_mux_init.c | 8 ++++----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 9ccd158e4b..20eb6e2aa9 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -620,7 +620,6 @@ typedef struct OutputFile {
     const char           *url;
 
     SyncQueue *sq_encode;
-    SyncQueue *sq_mux;
 
     int nb_streams;
     int ost_index;       /* index of the first stream in output_streams */
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index f830e5854b..652628185e 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -159,12 +159,12 @@ static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt)
     OutputFile *of = &mux->of;
 
     if (ost->sq_idx_mux >= 0) {
-        int ret = sq_send(of->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
+        int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
         if (ret < 0)
             return ret;
 
         while (1) {
-            ret = sq_receive(of->sq_mux, -1, SQPKT(mux->sq_pkt));
+            ret = sq_receive(mux->sq_mux, -1, SQPKT(mux->sq_pkt));
             if (ret < 0)
                 return (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) ? 0 : ret;
 
@@ -540,7 +540,7 @@ int of_stream_init(OutputFile *of, OutputStream *ost)
 {
     Muxer *mux = mux_from_of(of);
     if (ost->sq_idx_mux >= 0)
-        sq_set_tb(of->sq_mux, ost->sq_idx_mux, ost->mux_timebase);
+        sq_set_tb(mux->sq_mux, ost->sq_idx_mux, ost->mux_timebase);
 
     ost->initialized = 1;
 
@@ -611,7 +611,7 @@ void of_close(OutputFile **pof)
     thread_stop(mux);
 
     sq_free(&of->sq_encode);
-    sq_free(&of->sq_mux);
+    sq_free(&mux->sq_mux);
 
     for (int i = 0; i < mux->of.nb_streams; i++) {
         MuxStream *ms = &mux->streams[i];
diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h
index d9c4dce750..7cb1337b49 100644
--- a/fftools/ffmpeg_mux.h
+++ b/fftools/ffmpeg_mux.h
@@ -68,6 +68,7 @@ typedef struct Muxer {
     atomic_int_least64_t last_filesize;
     int header_written;
 
+    SyncQueue *sq_mux;
     AVPacket *sq_pkt;
 } Muxer;
 
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index be7286c26d..3945bbed3a 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1100,8 +1100,8 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u
     /* if there are any additional interleaved streams, then ALL the streams
      * are also synchronized before sending them to the muxer */
     if (nb_interleaved > nb_av_enc) {
-        of->sq_mux = sq_alloc(SYNC_QUEUE_PACKETS, buf_size_us);
-        if (!of->sq_mux)
+        mux->sq_mux = sq_alloc(SYNC_QUEUE_PACKETS, buf_size_us);
+        if (!mux->sq_mux)
             return AVERROR(ENOMEM);
 
         mux->sq_pkt = av_packet_alloc();
@@ -1115,13 +1115,13 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u
             if (!IS_INTERLEAVED(type))
                 continue;
 
-            ost->sq_idx_mux = sq_add_stream(of->sq_mux,
+            ost->sq_idx_mux = sq_add_stream(mux->sq_mux,
                                             of->shortest || ost->max_frames < INT64_MAX);
             if (ost->sq_idx_mux < 0)
                 return ost->sq_idx_mux;
 
             if (ost->max_frames != INT64_MAX)
-                sq_limit_frames(of->sq_mux, ost->sq_idx_mux, ost->max_frames);
+                sq_limit_frames(mux->sq_mux, ost->sq_idx_mux, ost->max_frames);
         }
     }
 



More information about the ffmpeg-cvslog mailing list