From patchwork Sat Sep 28 09:53:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51900 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d8ca:0:b0:48e:c0f8:d0de with SMTP id dy10csp895547vqb; Sat, 28 Sep 2024 02:54:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV1Ecwss1d1Mur+vecEtRDBK5eb2FOqedNAm+nbhcUb17pSbJASh2wbQSa8ToUJa67JiWGL+7IMScKRedguf+BM@gmail.com X-Google-Smtp-Source: AGHT+IHlQ8uuv0jcaNOJvOQgm3l6NvmhSomfR3MZfrNsjbA7LnKFpJOzU69Scct6basAC1szObAE X-Received: by 2002:a05:6512:258b:b0:52f:cdb0:11c0 with SMTP id 2adb3069b0e04-5389fc3afb1mr3801750e87.21.1727517258728; Sat, 28 Sep 2024 02:54:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727517258; cv=none; d=google.com; s=arc-20240605; b=l3Sz1jlQM5yAtVn0O8LpecJ5K+2hLz/WUArNwKY5TdSUbpKiXPlWjwEt15vu0SW8jp w02HdpQrD7uZpjx3ZjDsrdPzAF+UOrhBtxjlSvTd+dlg0ALChC+0iwlHW3T924qo5hho 4NJvpXZog0jIZ8yFO9rzxO8DKh2JHX/lnPQtJh65ef+0enfPeDZ+Ob7RWIrhr6Ik12KZ rNXhYTsbV8SukfjAiz/V2hVeFu8ERKaDrJD/9Z0bfvVyBqo5QEbKeA6ttL1IJC5Gbne1 TXeT2Xf4hWqancZqOYeZdJmQNm5Wxq98s9zQ25VrAzgnJ5ZyT6AImx6/8MO65NW2i40t Gmlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=J2lZABtT7Hd5sLRhEtcJ4vxF58ERgjfPYSgxrguwvzI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=JDrzHcIindTDDOcU9TH58PAaFngrTGCiOdQmdtOucKBT6kNfC6FaLi0udJVMYVbVT6 FkcADWJ8PpluV3Wvtbo5OTPLDvl/u0C+Ajj8Unyw6ghygCWKFs5oaWqdZvNyshRm127K 5fQJETDiu9L1E1MKSL++yXWQxieKWjtoB15u6ocyZlJwnWK9zkKPtcm1NhCk7cTuEN7K MNt0a4vJAQlDMk3vNEu1/TQoJOr+6+YUTQgxp5ERJ4jUi+DQd3FCCxJEggonsyWqac4a dGxlIJGnoby065UOfbarW4hBhuAqZfEaxNnnng4MBKI+6FTZvluVT6fHBbh3eJJPoCSj sbPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="gc/t/ov7"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-538a04623bfsi1304289e87.645.2024.09.28.02.54.18; Sat, 28 Sep 2024 02:54:18 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="gc/t/ov7"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D2B168DB90; Sat, 28 Sep 2024 12:54:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CCF4068DA94 for ; Sat, 28 Sep 2024 12:53:56 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=gc/t/ov7; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 546A64D9D for ; Sat, 28 Sep 2024 11:53:56 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id hWG7hEV0DXO0 for ; Sat, 28 Sep 2024 11:53:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727517234; bh=83QGSTOUdo1x3t0b+2zV8kokdVYmsbi5+DNDGxS8BsA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gc/t/ov7xoNsxioTpQFmhliHQxu8HpyVPml95mMn6Jkjdydh0m5EyhBIfJO8Rze9+ My9dxze+lVvp5bxElmv2RC5KqIglILEaWvsCfeWZuvElIGqSAm3vLncZhxkBtE0bB0 79Gq6kpMk/KaNLxcMO4YvHZAGZnD2uEtkyvc5yUcWwhR+a93nVVV44uJvWJpdBfbch vTeXxGVeSbVg9ZWVpaG0D9FaQ4Oa4ktLGwMKRgGbIIHOep/GzGiQAWLF73wgxHoaQ+ Wqvjly7B1KSuubjPmrGJb8VJL4RKhg8ksDw7ud0OWlwKpOXuiQhThZ6PPy2geYedCv msEp/Nj/o8A/Q== 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 mail1.khirnov.net (Postfix) with ESMTPS id B7D544DE2 for ; Sat, 28 Sep 2024 11:53:54 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5FCFB3A086F for ; Sat, 28 Sep 2024 11:53:48 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 28 Sep 2024 11:53:34 +0200 Message-ID: <20240928095341.15552-2-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240928095341.15552-1-anton@khirnov.net> References: <20240928095341.15552-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/9] fftools/ffmpeg_demux: drop ist_output_add() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: FLwLO/j59rRO It is now a trivial wrapper over ist_use(), so export that directly. --- fftools/ffmpeg.h | 3 ++- fftools/ffmpeg_demux.c | 17 ++--------------- fftools/ffmpeg_mux_init.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 13e0fd14cd..d12b0e0d88 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -870,7 +870,8 @@ int64_t of_filesize(OutputFile *of); int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch); void ifile_close(InputFile **f); -int ist_output_add(InputStream *ist, OutputStream *ost); +int ist_use(InputStream *ist, int decoding_needed, + const ViewSpecifier *vs, SchedulerNode *src); int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, const ViewSpecifier *vs, InputFilterOptions *opts, SchedulerNode *src); diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 9a3ae67e3a..364f148f60 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -873,8 +873,8 @@ void ifile_close(InputFile **pf) av_freep(pf); } -static int ist_use(InputStream *ist, int decoding_needed, - const ViewSpecifier *vs, SchedulerNode *src) +int ist_use(InputStream *ist, int decoding_needed, + const ViewSpecifier *vs, SchedulerNode *src) { Demuxer *d = demuxer_from_ifile(ist->file); DemuxStream *ds = ds_from_ist(ist); @@ -974,19 +974,6 @@ static int ist_use(InputStream *ist, int decoding_needed, return 0; } -int ist_output_add(InputStream *ist, OutputStream *ost) -{ - DemuxStream *ds = ds_from_ist(ist); - SchedulerNode src; - int ret; - - ret = ist_use(ist, ost->enc ? DECODING_FOR_OST : 0, NULL, &src); - if (ret < 0) - return ret; - - return ost->enc ? ds->sch_idx_dec : ds->sch_idx_stream; -} - int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, const ViewSpecifier *vs, InputFilterOptions *opts, SchedulerNode *src) diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index ec9f328e90..2541be59da 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1537,18 +1537,19 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, if (ret < 0) goto fail; } else if (ost->ist) { - int sched_idx = ist_output_add(ost->ist, ost); - if (sched_idx < 0) { + SchedulerNode src; + + ret = ist_use(ost->ist, !!ost->enc, NULL, &src); + if (ret < 0) { av_log(ost, AV_LOG_ERROR, "Error binding an input stream\n"); - ret = sched_idx; goto fail; } - ms->sch_idx_src = sched_idx; + ms->sch_idx_src = src.idx; if (ost->enc) { - ret = sch_connect(mux->sch, SCH_DEC_OUT(sched_idx, 0), - SCH_ENC(ms->sch_idx_enc)); + ret = sch_connect(mux->sch, + src, SCH_ENC(ms->sch_idx_enc)); if (ret < 0) goto fail; @@ -1557,8 +1558,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, if (ret < 0) goto fail; } else { - ret = sch_connect(mux->sch, SCH_DSTREAM(ost->ist->file->index, sched_idx), - SCH_MSTREAM(ost->file->index, ms->sch_idx)); + ret = sch_connect(mux->sch, + src, SCH_MSTREAM(ost->file->index, ms->sch_idx)); if (ret < 0) goto fail; }