Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 08/12] fftools/ffmpeg_mux: move OutputStream.sq_idx_mux to private data
Date: Wed, 13 Dec 2023 20:30:03 +0100
Message-ID: <20231213193007.17471-8-anton@khirnov.net> (raw)
In-Reply-To: <20231213193007.17471-1-anton@khirnov.net>

It should not be accessed outside of ffmpeg_mux*
---
 fftools/ffmpeg.h          |  2 --
 fftools/ffmpeg_mux.c      | 12 ++++++------
 fftools/ffmpeg_mux.h      |  2 ++
 fftools/ffmpeg_mux_init.c | 12 ++++++------
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 2963d2d5d4..5c061ef0f4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -586,8 +586,6 @@ typedef struct OutputStream {
     /* packet quality factor */
     atomic_int quality;
 
-    int sq_idx_mux;
-
     EncStats enc_stats_pre;
     EncStats enc_stats_post;
 
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index fdedc550e1..06db55a6d4 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -168,12 +168,12 @@ fail:
     return ret;
 }
 
-static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int *stream_eof)
+static int sync_queue_process(Muxer *mux, MuxStream *ms, AVPacket *pkt, int *stream_eof)
 {
     OutputFile *of = &mux->of;
 
-    if (ost->sq_idx_mux >= 0) {
-        int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
+    if (ms->sq_idx_mux >= 0) {
+        int ret = sq_send(mux->sq_mux, ms->sq_idx_mux, SQPKT(pkt));
         if (ret < 0) {
             if (ret == AVERROR_EOF)
                 *stream_eof = 1;
@@ -198,7 +198,7 @@ static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int
                 return ret;
         }
     } else if (pkt)
-        return write_packet(mux, ost, pkt);
+        return write_packet(mux, &ms->ost, pkt);
 
     return 0;
 }
@@ -268,14 +268,14 @@ static int mux_packet_filter(Muxer *mux, MuxThreadContext *mt,
             if (!bsf_eof)
                 ms->bsf_pkt->time_base = ms->bsf_ctx->time_base_out;
 
-            ret = sync_queue_process(mux, ost, bsf_eof ? NULL : ms->bsf_pkt, stream_eof);
+            ret = sync_queue_process(mux, ms, bsf_eof ? NULL : ms->bsf_pkt, stream_eof);
             if (ret < 0)
                 goto mux_fail;
         }
         *stream_eof = 1;
         return AVERROR_EOF;
     } else {
-        ret = sync_queue_process(mux, ost, pkt, stream_eof);
+        ret = sync_queue_process(mux, ms, pkt, stream_eof);
         if (ret < 0)
             goto mux_fail;
     }
diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h
index 5d7cf3fa76..d0be8a51ea 100644
--- a/fftools/ffmpeg_mux.h
+++ b/fftools/ffmpeg_mux.h
@@ -50,6 +50,8 @@ typedef struct MuxStream {
     int sch_idx_enc;
     int sch_idx_src;
 
+    int sq_idx_mux;
+
     int64_t max_frames;
 
     // timestamp from which the streamcopied streams should start,
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 455876d456..f527a083db 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1923,7 +1923,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u
         MuxStream     *ms = ms_from_ost(ost);
         enum AVMediaType type = ost->type;
 
-        ost->sq_idx_mux    = -1;
+        ms->sq_idx_mux  = -1;
 
         nb_interleaved += IS_INTERLEAVED(type);
         nb_av_enc      += IS_AV_ENC(ost, type);
@@ -1992,13 +1992,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(mux->sq_mux,
-                                            of->shortest || ms->max_frames < INT64_MAX);
-            if (ost->sq_idx_mux < 0)
-                return ost->sq_idx_mux;
+            ms->sq_idx_mux = sq_add_stream(mux->sq_mux,
+                                           of->shortest || ms->max_frames < INT64_MAX);
+            if (ms->sq_idx_mux < 0)
+                return ms->sq_idx_mux;
 
             if (ms->max_frames != INT64_MAX)
-                sq_limit_frames(mux->sq_mux, ost->sq_idx_mux, ms->max_frames);
+                sq_limit_frames(mux->sq_mux, ms->sq_idx_mux, ms->max_frames);
         }
     }
 
-- 
2.42.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-12-13 19:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 19:29 [FFmpeg-devel] [PATCH 01/12] fftools/ffmpeg_filter: move FilterGraph.graph to FilterGraphThread Anton Khirnov
2023-12-13 19:29 ` [FFmpeg-devel] [PATCH 02/12] fftools/ffmpeg: replace InputStream.file_index by a pointer Anton Khirnov
2023-12-13 19:29 ` [FFmpeg-devel] [PATCH 03/12] fftools/ffmpeg: replace OutputStream.file_index " Anton Khirnov
2023-12-14 19:20   ` Michael Niedermayer
2023-12-14 19:34     ` Anton Khirnov
2023-12-14 19:53       ` James Almer
2023-12-13 19:29 ` [FFmpeg-devel] [PATCH 04/12] fftools/ffmpeg: move InputStream.discard to private data Anton Khirnov
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 05/12] fftools/ffmpeg: move InputStream.codec_desc " Anton Khirnov
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 06/12] fftools/ffmpeg: drop unused InputFile.eof_reached Anton Khirnov
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 07/12] fftools/ffmpeg_demux: move InputFile.readrate to private data Anton Khirnov
2023-12-13 19:30 ` Anton Khirnov [this message]
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 09/12] fftools/ffmpeg: drop OutputFile.sq_encode Anton Khirnov
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 10/12] fftools/ffmpeg_sched: move trailing_dts() higher up Anton Khirnov
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 11/12] fftools/ffmpeg: update the reported timestamp at the end Anton Khirnov
2023-12-13 19:30 ` [FFmpeg-devel] [PATCH 12/12] fftools/ffmpeg_sched: track dts+duration as last_dts Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231213193007.17471-8-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git