From patchwork Tue Sep 24 07:09:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51784 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:ad12:0:b0:48e:c0f8:d0de with SMTP id w18csp171055vqy; Tue, 24 Sep 2024 00:11:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsNjUUXISirEAq1pyC8bIA68cCIXaDIjbKpF05Re2JqRIn7B2fRJNFk0fD1rqC+i7HPBwqAgSVZrqvQlgJbs8U@gmail.com X-Google-Smtp-Source: AGHT+IFGWxZFOdPcj5qe0rA0lJ5CYieh7HeoBRYQdIUDPMz1Lp9dbCd+FU1C1uyWQoBqIhK95cba X-Received: by 2002:a05:6512:234a:b0:530:aa6d:9ea0 with SMTP id 2adb3069b0e04-537a691476emr752616e87.22.1727161888113; Tue, 24 Sep 2024 00:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727161888; cv=none; d=google.com; s=arc-20240605; b=PmjKXE+1YOqRUIuXCsICp7/v1pI3lrQ5h9GrAJIa8EFWNOu2fy2rzRUk7FdshrOt/e RotOpjPeht8DXCSyikH9pwbS1gDoT5em5ntv5MctSHuLO2PX9NDqwv8eMlUIsl4hD1cj vRIMRF2iG9/ia8AR4/XxfvoLJJlIUnDQCbUkojS3rV0YnchdXuWseAlryaiSQwwbZiVD xtrAFhkXzICCpc3eoOpKC2ZpQZyL0Ub4hvur2mEnmjxwX3/GQ0Ujy//MhZthC2km83W2 L2T/LzF7ZGQ929dZ5u/J1n/n8xfnXTvgFD7WwgpIEm2hrEj8E6zya/9+VcwQAmriS5Kk RY0Q== 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=Aqz5KSOUDnmQBy/O+oiX4OgQoeL2vpy2fZFpIopl9WI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=KdPW3Pw7pbWVPWivaDwztiaGXgqMYJbwuNeD8O1h1dRngpUT/NCKKzKYLmTsr0+tme /InilVmLqf09l5yzxwHDdqgkOSEKr5Ux3hffcUjFtm0dR4VvigyPsV1YZ8uPk01Gz0TX CyNQIsZWMRCLCSmYMn7+B+ls9sMjnvTi6MyMnUEVwFImKIZyNtFy9lgFSLBr0aAPZ/eX KDAs0rtPQZImURUgn/WxZ8PDBiZcOJBfawjYU7fYi0WbNlbgm7tIgmrK29R+ePT3q+9d 2K+jnr/QDJfe+fKYstOG2hYQGw7fSdmw5Zcj89P+kxloRATaSi4MWJSOE8uW/dUV+7Bm l7Hw==; 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=Gmpuhx9F; 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-537a863eb17si278167e87.197.2024.09.24.00.11.27; Tue, 24 Sep 2024 00:11:28 -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=Gmpuhx9F; 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 243AE68DB84; Tue, 24 Sep 2024 10:10:30 +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 1628168DA9E for ; Tue, 24 Sep 2024 10:10:23 +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=Gmpuhx9F; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 803D74E08 for ; Tue, 24 Sep 2024 09:10:18 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id DFA3Rw6xwcYe for ; Tue, 24 Sep 2024 09:10:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727161815; bh=5lxSbzwP/7t2K/3cOu2sDcc8ighp0uJxceV1SQaSHjQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gmpuhx9FGrs2daREdxHb/ZcuJ2Csuwt/FPOMYsv8leWJg91g43n7xdhHWwqp1KtW1 6pwBvBmUkWZ9DOcJVkmOIFp+pPmp8REvfcRv6fwt7D5aS18cQYZMTPTe2QacfvEQRY jVh577m8tIFsoyEBHlmMtppOlB6sp5Q9VZoZagIY3G2QQ0x2jc4qAqAYac4nIq65aj A+WrzIIJaDNZFn480SPauAHUQEMjtGDK+mU8ygHLgXruW9kO6HkD6LRSXPPguR9ZQR wdhm8bLrPr1uQB3Wuq3ZKLNztwn7F4MIRafMGZV/CGZMd1v3FMV0VZI87kBFOQ62Ow kS4EBoIgyoMQg== 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 8BA404E13 for ; Tue, 24 Sep 2024 09:10:15 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 6FF753A1B33 for ; Tue, 24 Sep 2024 09:10:10 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Sep 2024 09:09:54 +0200 Message-ID: <20240924071000.11428-13-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924071000.11428-1-anton@khirnov.net> References: <20240924071000.11428-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/13] fftools/ffmpeg_filter: remove remaining OutputStream usage in init_simple_filtergraph() 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: tBO3gpVgfN0s With this, nothing in ffmpeg_filter acesses OutputStream anymore, thus there are no more direct ties between filtering and muxing. Rename init_simple_filtergraph() to fg_create_simple() for consistency. --- fftools/ffmpeg.h | 9 +++++---- fftools/ffmpeg_filter.c | 22 +++++++++++----------- fftools/ffmpeg_mux_init.c | 7 +++++-- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index d20034efb0..b5c95439e5 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -755,10 +755,11 @@ int find_codec(void *logctx, const char *name, int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global); int filtergraph_is_simple(const FilterGraph *fg); -int init_simple_filtergraph(InputStream *ist, OutputStream *ost, - char *graph_desc, - Scheduler *sch, unsigned sch_idx_enc, - const OutputFilterOptions *opts); +int fg_create_simple(FilterGraph **pfg, + InputStream *ist, + char *graph_desc, + Scheduler *sch, unsigned sched_idx_enc, + const OutputFilterOptions *opts); int fg_finalise_bindings(void); /** diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 7faa666d2d..c36a3ad00a 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1180,25 +1180,27 @@ fail: return 0; } -int init_simple_filtergraph(InputStream *ist, OutputStream *ost, - char *graph_desc, - Scheduler *sch, unsigned sched_idx_enc, - const OutputFilterOptions *opts) +int fg_create_simple(FilterGraph **pfg, + InputStream *ist, + char *graph_desc, + Scheduler *sch, unsigned sched_idx_enc, + const OutputFilterOptions *opts) { + const enum AVMediaType type = ist->par->codec_type; FilterGraph *fg; FilterGraphPriv *fgp; int ret; - ret = fg_create(&ost->fg_simple, graph_desc, sch); + ret = fg_create(pfg, graph_desc, sch); if (ret < 0) return ret; - fg = ost->fg_simple; + fg = *pfg; fgp = fgp_from_fg(fg); fgp->is_simple = 1; snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf%s", - av_get_media_type_string(ost->type)[0], opts->name); + av_get_media_type_string(type)[0], opts->name); if (fg->nb_inputs != 1 || fg->nb_outputs != 1) { av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected " @@ -1208,16 +1210,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost, graph_desc, fg->nb_inputs, fg->nb_outputs); return AVERROR(EINVAL); } - if (fg->outputs[0]->type != ost->type) { + if (fg->outputs[0]->type != type) { av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect " "it to %s output stream\n", av_get_media_type_string(fg->outputs[0]->type), - av_get_media_type_string(ost->type)); + av_get_media_type_string(type)); return AVERROR(EINVAL); } - ost->filter = fg->outputs[0]; - ret = ifilter_bind_ist(fg->inputs[0], ist, opts->vs); if (ret < 0) return ret; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 53a17c33a6..ec9f328e90 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1010,8 +1010,11 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, ost->filter = ofilter; ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts); } else { - ret = init_simple_filtergraph(ost->ist, ost, filters, - mux->sch, ms->sch_idx_enc, &opts); + ret = fg_create_simple(&ost->fg_simple, ost->ist, filters, + mux->sch, ms->sch_idx_enc, &opts); + if (ret >= 0) + ost->filter = ost->fg_simple->outputs[0]; + } av_freep(&opts.nb_threads); if (ret < 0)