From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTP id 1BCCA45B33
	for <ffmpegdev@gitmailbox.com>; Wed, 17 May 2023 10:24:57 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 826C068C141;
	Wed, 17 May 2023 13:21:20 +0300 (EEST)
Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18CF468C140
 for <ffmpeg-devel@ffmpeg.org>; Wed, 17 May 2023 13:20:59 +0300 (EEST)
Received: from localhost (localhost [IPv6:::1])
 by mail0.khirnov.net (Postfix) with ESMTP id CAB45240177
 for <ffmpeg-devel@ffmpeg.org>; Wed, 17 May 2023 12:20:58 +0200 (CEST)
Received: from mail0.khirnov.net ([IPv6:::1])
 by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024)
 with ESMTP id mRsiQ2kaKuiD for <ffmpeg-devel@ffmpeg.org>;
 Wed, 17 May 2023 12:20:58 +0200 (CEST)
Received: from libav.khirnov.net (libav.khirnov.net
 [IPv6:2a00:c500:561:201::7])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "libav.khirnov.net",
 Issuer "smtp.khirnov.net SMTP CA" (verified OK))
 by mail0.khirnov.net (Postfix) with ESMTPS id 65C17240D27
 for <ffmpeg-devel@ffmpeg.org>; Wed, 17 May 2023 12:20:46 +0200 (CEST)
Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1])
 by libav.khirnov.net (Postfix) with ESMTP id 6CD983A1EFC
 for <ffmpeg-devel@ffmpeg.org>; Wed, 17 May 2023 12:20:40 +0200 (CEST)
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Date: Wed, 17 May 2023 12:20:16 +0200
Message-Id: <20230517102029.541-23-anton@khirnov.net>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20230517102029.541-1-anton@khirnov.net>
References: <20230517102029.541-1-anton@khirnov.net>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH 23/36] fftools/ffmpeg: eliminate
 InputStream.got_output
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20230517102029.541-23-anton@khirnov.net/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

It tracks whether the decoder for this stream ever produced any frames
and its only use is for checking whether a filter input ever received a
frame - those that did not are prioritized by the scheduler.

This is awkward and unnecessarily complicated - checking whether the
filtergraph input format is valid works just as well and does not
require maintaining an extra variable.
---
 fftools/ffmpeg.c        | 3 ---
 fftools/ffmpeg.h        | 2 --
 fftools/ffmpeg_filter.c | 2 +-
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 49313edebc..62620bacce 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1412,9 +1412,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
             break;
         }
 
-        if (got_output)
-            ist->got_output = 1;
-
         if (!got_output)
             break;
 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 04c41a5311..3a332768df 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -413,8 +413,6 @@ typedef struct InputStream {
     // number of frames/samples retrieved from the decoder
     uint64_t frames_decoded;
     uint64_t samples_decoded;
-
-    int got_output;
 } InputStream;
 
 typedef struct LastFrameDuration {
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 6f842f6b46..640ecec067 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1700,7 +1700,7 @@ int fg_transcode_step(FilterGraph *graph, InputStream **best_ist)
         for (int i = 0; i < graph->nb_inputs; i++) {
             InputFilter *ifilter = graph->inputs[i];
             InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
-            if (!ifp->ist->got_output && !ifp->eof) {
+            if (ifp->format < 0 && !ifp->eof) {
                 *best_ist = ifp->ist;
                 return 0;
             }
-- 
2.39.2

_______________________________________________
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".