From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0B76548663 for ; Wed, 14 Feb 2024 18:25:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A2EB768D22B; Wed, 14 Feb 2024 20:24:52 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4737A68D1B1 for ; Wed, 14 Feb 2024 20:24:42 +0200 (EET) 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=HAfx06Uc; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id EAE954482 for ; Wed, 14 Feb 2024 19:24:41 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id ucrphqo_8NrI for ; Wed, 14 Feb 2024 19:24:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1707935078; bh=vEF2yxoaTO7q5mnc7F0ld6x9SFBq4s2QfHqLtHb73qk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HAfx06Uc+A21oJCV5DFLxds/0eMCGBFIqY7+GvSQ92vNLXlBuI2+sSqXbm+pJ9cGk fpvTRotb8aREUmjgk/U8CLsCura6BRd94PTGNwlNr2kmUpVcHChXpOaaojvtmMiJFX /6TS2Q7h/9ytYsoCKZKPXO4yd7bgmw2BG4pApOccmSnHhA7hZyCNA51fnDtWqqz7uY 7cSfMUI2hH7YpsxRG94aYwCpkW0jEw65QfGidw1SePtuGCmGuzXxgDjJ5W90t9A2BG 7OAYqfjaknJFfGolWyWvjTi9CeHBjcrsqVR7TjiHu9G/ZKPD0uF/aOKg8uSgyZnHQb vBJrqg7NHv0QA== 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 9611F4496 for ; Wed, 14 Feb 2024 19:24:38 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 803063A22BD for ; Wed, 14 Feb 2024 19:24:38 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Feb 2024 19:24:30 +0100 Message-ID: <20240214182435.31380-5-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240214182435.31380-1-anton@khirnov.net> References: <20240214182435.31380-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/10] fftools/ffmpeg_filter: pass autorotate/reinit flags through InputFilterOptions 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Rather than read them directly from InputStream. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers. --- fftools/ffmpeg.h | 10 ++++++++-- fftools/ffmpeg_demux.c | 8 ++++++-- fftools/ffmpeg_filter.c | 5 +++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 6db7b8a9c4..9942342f03 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -250,6 +250,11 @@ typedef struct OptionsContext { SpecifierOptList mux_stats_fmt; } OptionsContext; +enum IFilterFlags { + IFILTER_FLAG_AUTOROTATE = (1 << 0), + IFILTER_FLAG_REINIT = (1 << 1), +}; + typedef struct InputFilterOptions { int64_t trim_start_us; int64_t trim_end_us; @@ -258,6 +263,9 @@ typedef struct InputFilterOptions { int sub2video_width; int sub2video_height; + + // a combination of IFILTER_FLAG_* + unsigned flags; } InputFilterOptions; typedef struct InputFilter { @@ -381,8 +389,6 @@ typedef struct InputStream { */ struct OutputStream **outputs; int nb_outputs; - - int reinit_filters; } InputStream; typedef struct InputFile { diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 87ed8225c2..317e27e294 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -63,6 +63,7 @@ typedef struct DemuxStream { int streamcopy_needed; int have_sub2video; + int reinit_filters; int wrap_correction_done; int saw_first_ts; @@ -1033,6 +1034,9 @@ int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, if (!opts->name) return AVERROR(ENOMEM); + opts->flags |= IFILTER_FLAG_AUTOROTATE * !!(ist->autorotate) | + IFILTER_FLAG_REINIT * !!(ds->reinit_filters); + return ds->sch_idx_dec; } @@ -1309,8 +1313,8 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) if (ret < 0) return ret; - ist->reinit_filters = -1; - MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st); + ds->reinit_filters = -1; + MATCH_PER_STREAM_OPT(reinit_filters, i, ds->reinit_filters, ic, st); ist->user_set_discard = AVDISCARD_NONE; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index d182f3ab2e..56aa3edd78 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1534,7 +1534,8 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph, av_assert0(desc); // TODO: insert hwaccel enabled filters like transpose_vaapi into the graph - if (ist->autorotate && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { + if ((ifp->opts.flags & IFILTER_FLAG_AUTOROTATE) && + !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { int32_t *displaymatrix = ifp->displaymatrix; double theta; @@ -2614,7 +2615,7 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt, } else if (ifp->displaymatrix_present) need_reinit |= MATRIX_CHANGED; - if (!ifp->ist->reinit_filters && fgt->graph) + if (!(ifp->opts.flags & IFILTER_FLAG_REINIT) && fgt->graph) need_reinit = 0; if (!!ifp->hw_frames_ctx != !!frame->hw_frames_ctx || -- 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".