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/25] fftools/ffmpeg: remove OutputStream.encoding_needed
Date: Wed,  3 Aug 2022 15:58:27 +0200
Message-ID: <20220803135844.16662-8-anton@khirnov.net> (raw)
In-Reply-To: <20220803135844.16662-1-anton@khirnov.net>

It is unnecessary, as it is always exactly equivalent to !!ost->enc_ctx
---
 fftools/ffmpeg.c     | 10 +++++-----
 fftools/ffmpeg.h     |  1 -
 fftools/ffmpeg_opt.c |  8 ++------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0a1dc5bb3b..6124197580 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1536,7 +1536,7 @@ static void print_final_stats(int64_t total_size)
 
             av_log(NULL, AV_LOG_VERBOSE, "  Output stream #%d:%d (%s): ",
                    i, j, av_get_media_type_string(type));
-            if (ost->encoding_needed) {
+            if (ost->enc_ctx) {
                 av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded",
                        ost->frames_encoded);
                 if (type == AVMEDIA_TYPE_AUDIO)
@@ -1788,7 +1788,7 @@ static void flush_encoders(void)
         AVCodecContext *enc = ost->enc_ctx;
         OutputFile      *of = output_files[ost->file_index];
 
-        if (!ost->encoding_needed)
+        if (!enc)
             continue;
 
         // Try to enable encoding with no input frames.
@@ -2359,7 +2359,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
 
-        if (!check_output_constraints(ist, ost) || !ost->encoding_needed
+        if (!check_output_constraints(ist, ost) || !ost->enc_ctx
             || ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
             continue;
 
@@ -2568,7 +2568,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
 
-        if (!check_output_constraints(ist, ost) || ost->encoding_needed ||
+        if (!check_output_constraints(ist, ost) || ost->enc_ctx ||
             (!pkt && no_eof))
             continue;
 
@@ -3137,7 +3137,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
     OutputFile *of = output_files[ost->file_index];
     int ret = 0;
 
-    if (ost->encoding_needed) {
+    if (ost->enc_ctx) {
         const AVCodec *codec = ost->enc;
         AVCodecContext *dec = NULL;
         InputStream *ist;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 713de42e2b..69e4758a2d 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -464,7 +464,6 @@ typedef struct OutputStream {
     int index;               /* stream index in the output file */
     int source_index;        /* InputStream index */
     AVStream *st;            /* stream in the output file */
-    int encoding_needed;     /* true if encoding needed for this stream */
     /* number of frames emitted by the video-encoding sync code */
     int64_t vsync_frame_number;
     /* input pts and corresponding output pts
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 784209e770..ffa320da87 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1559,10 +1559,6 @@ static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *o
             ost->enc = find_codec_or_die(codec_name, ost->st->codecpar->codec_type, 1);
             ost->st->codecpar->codec_id = ost->enc->id;
         }
-        ost->encoding_needed = !!ost->enc;
-    } else {
-        /* no encoding supported for other media types */
-        ost->encoding_needed = 0;
     }
 
     return 0;
@@ -2433,7 +2429,7 @@ static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_si
     int limit_frames = 0, limit_frames_av_enc = 0;
 
 #define IS_AV_ENC(ost, type)  \
-    (ost->encoding_needed && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
+    (ost->enc_ctx && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
 #define IS_INTERLEAVED(type) (type != AVMEDIA_TYPE_ATTACHMENT)
 
     for (int i = 0; i < oc->nb_streams; i++) {
@@ -3043,7 +3039,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
     for (i = of->ost_index; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
 
-        if (ost->encoding_needed && ost->source_index >= 0) {
+        if (ost->enc_ctx && ost->source_index >= 0) {
             InputStream *ist = input_streams[ost->source_index];
             ist->decoding_needed |= DECODING_FOR_OST;
             ist->processing_needed = 1;
-- 
2.34.1

_______________________________________________
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:[~2022-08-03 14:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 13:58 [FFmpeg-devel] [PATCH 01/25] fftools/ffmpeg_opt: move adding attachments out of open_output_file() Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 02/25] fftools/ffmpeg_opt: move adding programs " Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 03/25] fftools/ffmpeg_opt: move adding metadata " Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 04/25] fftools/ffmpeg_hw: stop logging to the decoder context Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 05/25] fftools/ffmpeg: stop accessing the decoder context unnecessarily Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 06/25] fftools/ffmpeg_opt: drop redundant decoder selection Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 07/25] fftools/ffmpeg: remove OutputStream.stream_copy Anton Khirnov
2022-08-04 12:40   ` Michael Niedermayer
2022-08-04 12:54     ` Andreas Rheinhardt
2022-08-04 14:37     ` Anton Khirnov
2022-08-04 14:51       ` Andreas Rheinhardt
2022-08-06  4:26     ` [FFmpeg-devel] [PATCH] " Anton Khirnov
2022-08-03 13:58 ` Anton Khirnov [this message]
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 09/25] fftools/ffmpeg: remove OutputStream.sync_ist Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 10/25] fftools/ffmpeg: deprecate specifying a sync stream with -map Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 11/25] doc/ffmpeg: update -map documentation Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 12/25] fftools/ffmpeg: drop a superfluous stack variable Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 13/25] fftools/ffmpeg: store the input file index in InputFile Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 14/25] fftools/ffmpeg: always read input in a thread Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 15/25] fftools/ffmpeg: drop a write-only variable Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 16/25] fftools/ffmpeg: move the input thread into its own file Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 17/25] fftools/ffmpeg: drop the 'h' key handling Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 18/25] fftools/ffmpeg: handle dumping input packets in input_thread() Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 19/25] fftools/ffmpeg: report new streams from the input thread Anton Khirnov
2022-08-03 18:47   ` Andreas Rheinhardt
2022-08-04  8:20   ` Anton Khirnov
2022-08-04  8:23     ` Nicolas George
2022-08-04  8:25       ` Andreas Rheinhardt
2022-08-04  8:29         ` Nicolas George
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 20/25] fftools/ffmpeg: move get_input_packet() to ffmpeg_demux.c Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 21/25] fftools/ffmpeg: move seek_to_start() " Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 22/25] fftools/ffmpeg: move -stream_loop handling to the demuxer thread Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 23/25] fftools/ffmpeg_demux: factorize signalling end of demuxing Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 24/25] fftools/ffmpeg_demux: do not store demux packet in the context Anton Khirnov
2022-08-03 13:58 ` [FFmpeg-devel] [PATCH 25/25] fftools/ffmpeg: move handling corrupt packets to the input thread 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=20220803135844.16662-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