From patchwork Thu Oct 3 19:31:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52014 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:938f:0:b0:48e:c0f8:d0de with SMTP id z15csp105vqg; Thu, 3 Oct 2024 13:09:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4msHW0KMOTXFm7HHcvo9FSx6ZQHH6A6At9xNwi1FWpY+eT10TsjncziKTjQMpcvp/2N8WEJNizLWGCNy6uAW2@gmail.com X-Google-Smtp-Source: AGHT+IEPDxWTgKrRqasATtgzi8zMSEiwJRQObxsG5EdoCFU4gvCM00W1XSjLqSVend8rPTTAoqs0 X-Received: by 2002:a17:907:d599:b0:a8d:5472:b56c with SMTP id a640c23a62f3a-a991bd0ca74mr46997866b.22.1727986149158; Thu, 03 Oct 2024 13:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727986149; cv=none; d=google.com; s=arc-20240605; b=MBFxihO3d9lw7V2NDd375uRlcDChsW7jBI5PBtKQC5/uWgaphOvI56hF8+BjmEpXJ3 1ToqqIPrtBp+hNQxR793XEESi6ztZZ/ZPjXMGtnSHuWnpZ0DgFzXjOLrwh1aE9SISrfh dsipogJHbkL9bFtd3FRFWTf2qqOzPPXZODALG1aNsgPIA9x6PKz4PEhD4LGZCXukPDKv I6l6fKmhCSadtILJLEjukD4Unq9qI0wnc0VGn1ZhRPQ+BjzawYkLWcvLbmKfWbeEiDgD GA3EMs7/PnsrICcA92hrNI7Z8NT8PiN6evRQSPcry1TCmjH8n1TfS4cc2AP93l52t4C1 ivbQ== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=+uTr6eJ0Q6f1yy9gIwh/w9D0aTFOSBy5iadfIW+djbU=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=AT8aqMflWBkCXQzExF3zRqGQP2ZwQV/KghW/S3S0uvkjlaTh359RbQatTa4iWs+p+u hLdMUJVeE5VkZsYYkiI4XB/63H/DoDNF/EB+KAZGFH6lDZ9p+W2PhVf2h+6FZQ8pFwLU FavodMXgk9ViCyIsxBnaz94sAseZMLx4K0/xEkcu00T9ywNHT0ofRDlasdwK39sAGu5e 6sl87bzDbcHyiGcSg+ylzxERSK6us5/44dc3BMfuCkVzP1BMrF1F9AzLcCmxz4cYXCDo /eu9sKNbX5srdAH+hlSHuNz3zt0jmOqYb4g86YgwBhj1ypYRZbJ3lyfFPCOtnkWZT7k1 tT/Q==; 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=DGKYkpIP; 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 a640c23a62f3a-a9910dce9a0si121154866b.97.2024.10.03.13.09.01; Thu, 03 Oct 2024 13:09:09 -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=DGKYkpIP; 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 F33B268DAD5; Thu, 3 Oct 2024 22:32:33 +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 6796568DA73 for ; Thu, 3 Oct 2024 22:32:24 +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=DGKYkpIP; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 0F21C4E14 for ; Thu, 3 Oct 2024 21:32:24 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id LhlV5_zf3BD7 for ; Thu, 3 Oct 2024 21:32:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=UKxU+k7SZQAKwRA7pUA+/WAv73fCuwWU8fvYRGQyDZE=; h=From:To:Subject:Date:From; b=DGKYkpIP0HiwgU0vbit/Tvik2JXCj/j71h7QCnPLhqOz7y8g+pEDC1VFSPnwaSWr+ Jp68bwjIBYrwocSlwcSNEZufnk3hqNNUmtR/7otxt1CPDJNFMSOG9SCz2GPNYCawI6 aw6qrci0LimjsJbkBPD+oO2cUrxEOrnENLRbNVLFuwSHFS13lMWdk2W1RTtTHOpgBd I+SsYPKRJfz26m5kyJulSjP0OjTKCqC3FtKQ1sFAtzi9zgcvxQo16Iqy2azvq5Hjl6 F5bSVtJGqeh2pJc/bWzw995T8J6DFjhEHPtMkRlOYla8CzkYmIjtGQOi8uebi8eEgo fItAthXw3GCdg== 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 0F3124E13 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 9E3463A02F7 for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:21 +0200 Message-ID: <20241003193127.15818-1-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/7] lavfi/avfilter: move AVFilterContext.ready to FFFilterContext 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: d4ZpoIfVol2e This field is private to the generic filtering code. --- libavfilter/avfilter.c | 9 ++++++--- libavfilter/avfilter.h | 7 ++++--- libavfilter/avfilter_internal.h | 7 +++++++ libavfilter/avfiltergraph.c | 18 +++++++++++------- libavfilter/version_major.h | 1 + 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index dc06ebab4d..1a0e94b21d 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -237,7 +237,8 @@ static void update_link_current_pts(FilterLinkInternal *li, int64_t pts) void ff_filter_set_ready(AVFilterContext *filter, unsigned priority) { - filter->ready = FFMAX(filter->ready, priority); + FFFilterContext *ctxi = fffilterctx(filter); + ctxi->ready = FFMAX(ctxi->ready, priority); } /** @@ -473,6 +474,7 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end) int ff_request_frame(AVFilterLink *link) { FilterLinkInternal * const li = ff_link_internal(link); + FFFilterContext * const ctxi_dst = fffilterctx(link->dst); FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1); @@ -482,7 +484,7 @@ int ff_request_frame(AVFilterLink *link) if (li->status_in) { if (ff_framequeue_queued_frames(&li->fifo)) { av_assert1(!li->frame_wanted_out); - av_assert1(link->dst->ready >= 300); + av_assert1(ctxi_dst->ready >= 300); return 0; } else { /* Acknowledge status change. Filters using ff_request_frame() will @@ -1384,12 +1386,13 @@ static int ff_filter_activate_default(AVFilterContext *filter) int ff_filter_activate(AVFilterContext *filter) { + FFFilterContext *ctxi = fffilterctx(filter); int ret; /* Generic timeline support is not yet implemented but should be easy */ av_assert1(!(filter->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC && filter->filter->activate)); - filter->ready = 0; + ctxi->ready = 0; ret = filter->filter->activate ? filter->filter->activate(filter) : ff_filter_activate_default(filter); if (ret == FFERROR_NOT_READY) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index f2c4a64004..1748dd3023 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -518,12 +518,13 @@ struct AVFilterContext { */ AVBufferRef *hw_device_ctx; +#if FF_API_CONTEXT_PUBLIC /** - * Ready status of the filter. - * A non-0 value means that the filter needs activating; - * a higher value suggests a more urgent activation. + * @deprecated this field should never have been accessed by callers */ + attribute_deprecated unsigned ready; +#endif /** * Sets the number of extra hardware frames which the filter will diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index 9ba890a70c..7041d787b0 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -102,6 +102,13 @@ typedef struct FFFilterContext { // AV_CLASS_STATE_FLAG_* unsigned state_flags; + + /** + * Ready status of the filter. + * A non-0 value means that the filter needs activating; + * a higher value suggests a more urgent activation. + */ + unsigned ready; } FFFilterContext; static inline FFFilterContext *fffilterctx(AVFilterContext *ctx) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 38077ff701..7bc7700743 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1470,15 +1470,19 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) int ff_filter_graph_run_once(AVFilterGraph *graph) { - AVFilterContext *filter; + FFFilterContext *ctxi; unsigned i; av_assert0(graph->nb_filters); - filter = graph->filters[0]; - for (i = 1; i < graph->nb_filters; i++) - if (graph->filters[i]->ready > filter->ready) - filter = graph->filters[i]; - if (!filter->ready) + ctxi = fffilterctx(graph->filters[0]); + for (i = 1; i < graph->nb_filters; i++) { + FFFilterContext *ctxi_other = fffilterctx(graph->filters[i]); + + if (ctxi_other->ready > ctxi->ready) + ctxi = ctxi_other; + } + + if (!ctxi->ready) return AVERROR(EAGAIN); - return ff_filter_activate(filter); + return ff_filter_activate(&ctxi->p); } diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h index b2c761370f..41374fbbe5 100644 --- a/libavfilter/version_major.h +++ b/libavfilter/version_major.h @@ -37,5 +37,6 @@ #define FF_API_LINK_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 11) #define FF_API_BUFFERSINK_OPTS (LIBAVFILTER_VERSION_MAJOR < 11) +#define FF_API_CONTEXT_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 11) #endif /* AVFILTER_VERSION_MAJOR_H */ From patchwork Thu Oct 3 19:31:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52009 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b18c:0:b0:48e:c0f8:d0de with SMTP id q12csp584586vqn; Thu, 3 Oct 2024 12:33:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWuFAeK4t5pR6R5IkUqDG91/zcElVHXd9eEk6sKIBNfnhoxFnhpqaNPVdTDcUSyoY9G5CvN/rcweHjz9iRxd2aX@gmail.com X-Google-Smtp-Source: AGHT+IEdQOebtuksVsi0phSRVJREaLwBi8lZEuFRFXPhmrV7VqwH8kkbJ3UTewM+kn7KM6kI25NR X-Received: by 2002:a17:907:26c8:b0:a86:c252:aaa2 with SMTP id a640c23a62f3a-a991c0314d9mr32508866b.51.1727983998719; Thu, 03 Oct 2024 12:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727983998; cv=none; d=google.com; s=arc-20240605; b=ZDd+58pgHjwNNcY/dmCr4cHaEuw7cfId+lFmvI85VP20BG7pHQdjDGDMayjx2Mxl8W igOT64VY23YfOxS/2oveCfMNVe1/VMcHrtsDkCmslBhnOY83MUDKJE13NjKP/3y0RSh4 sYTx+0GAmIlyL04eDnmK9tbv801oyfHuHo/iyDVPpFXgMg87m+N8Zxx7wZeXdfWq9P+l NJigBDIb8qxQgejVlFwYBEK8xXBFzagL/rUc9YSJdITTT437IcvYUqQC8ecqj+KeWyoy 3FBxGNrkc8m0KFhdc/D8u8OhOkgh5C+1b6sVS7P4e0gvEZJUCHvg5N/hA15iOHhoRMkB IVAQ== 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=EaYznPSpCQIJolJKXxlXQD3OCK3+TXwbGU1osMdJlfE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Vfihw/BMuojlQ3tNvRQ1nLJWArArR8Fpif1eZUlnG5NIwT14JHf6kO+NeUdVshocSq WkF57VPdmvpQUkakzL3CDSxhyP+SGQ3zjlzvm3mNWO0ptySPw4FEPaKxabUhoH6oaCRW LZJMMyCIwakkR2sZjWtW/1HaAywJWDYofWxpMMKCevza6F4GOqXnzFlTOIZ9U26sudcV pYtMkkxgS/EJUaYboXcr8oYPzKBdAUOu/gts6FBugza5Mz5LB+beHGjstx79yYdESIdL 8OvINeYWdKKF5LOmTTTgf6N0uDaW0B8MWJ0cooboWd6upJOSMBl3zMT8aqa6YFFqsFxe d5Mg==; 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=B1oh6co4; 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 a640c23a62f3a-a9911105b6esi110266566b.1030.2024.10.03.12.33.18; Thu, 03 Oct 2024 12:33: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=B1oh6co4; 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 EBD1768DAF2; Thu, 3 Oct 2024 22:32:35 +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 8EA6F68CB9B for ; Thu, 3 Oct 2024 22:32:24 +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=B1oh6co4; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 348FA4E16 for ; Thu, 3 Oct 2024 21:32:24 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id fR56L4ekKfo2 for ; Thu, 3 Oct 2024 21:32:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=ND7E+M2hH9e1x58TCh2B9Pypw/HpPIiD4VKSrRX+pIQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=B1oh6co4nl3quskFAePhc0JUFZzH+vHn3wiqRU8XVwpioS2bJreRpGPnb42rUuzdP WKu13hE1zhLhqDQGQcavbfvGvK0B/UtMGdeLFgp5QhFI+TxbZ7fooPNmENuEA/6cOP J/HVUFdkkZUP40YkW62Es1iqMPNdyaEZnpkYVLWj1tq4YIcT3hNk+1GAtPRwrBDhNa 7tWUqATdfalo7RMcBipIl63/eSCn8YSqpcmVkFGVTT/BtgLWOg9t3aoL7MzkWfuVrJ qT/R4uu49OiNz1Q7CYkoFjADvYC9IQwyZyyqWXUavdyuj1tbdJx+lV8rZRAfEDfHYL 9ktHO2//Ln0jA== 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 0DF074E12 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id ABAEC3A0F02 for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:22 +0200 Message-ID: <20241003193127.15818-2-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003193127.15818-1-anton@khirnov.net> References: <20241003193127.15818-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/7] lavfi/avfilter: move AVFilterContext.{enable, var_values} to FFFilterContext 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: Q7Gh3KXoVSJd They are private to generic filtering code. --- libavfilter/avfilter.c | 38 ++++++++++++++++++--------------- libavfilter/avfilter.h | 9 ++++++-- libavfilter/avfilter_internal.h | 5 +++++ 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 1a0e94b21d..dfb30002b1 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -564,11 +564,12 @@ enum { VAR_VARS_NB }; -static int set_enable_expr(AVFilterContext *ctx, const char *expr) +static int set_enable_expr(FFFilterContext *ctxi, const char *expr) { + AVFilterContext *ctx = &ctxi->p; int ret; char *expr_dup; - AVExpr *old = ctx->enable; + AVExpr *old = ctxi->enable; if (!(ctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE)) { av_log(ctx, AV_LOG_ERROR, "Timeline ('enable' option) not supported " @@ -580,15 +581,15 @@ static int set_enable_expr(AVFilterContext *ctx, const char *expr) if (!expr_dup) return AVERROR(ENOMEM); - if (!ctx->var_values) { - ctx->var_values = av_calloc(VAR_VARS_NB, sizeof(*ctx->var_values)); - if (!ctx->var_values) { + if (!ctxi->var_values) { + ctxi->var_values = av_calloc(VAR_VARS_NB, sizeof(*ctxi->var_values)); + if (!ctxi->var_values) { av_free(expr_dup); return AVERROR(ENOMEM); } } - ret = av_expr_parse((AVExpr**)&ctx->enable, expr_dup, var_names, + ret = av_expr_parse(&ctxi->enable, expr_dup, var_names, NULL, NULL, NULL, NULL, 0, ctx->priv); if (ret < 0) { av_log(ctx->priv, AV_LOG_ERROR, @@ -618,7 +619,7 @@ int avfilter_process_command(AVFilterContext *filter, const char *cmd, const cha av_log(filter, AV_LOG_INFO, "%s", res); return 0; }else if(!strcmp(cmd, "enable")) { - return set_enable_expr(filter, arg); + return set_enable_expr(fffilterctx(filter), arg); }else if(filter->filter->process_command) { return filter->filter->process_command(filter, cmd, arg, res, res_len, flags); } @@ -792,10 +793,12 @@ static void free_link(AVFilterLink *link) void avfilter_free(AVFilterContext *filter) { + FFFilterContext *ctxi; int i; if (!filter) return; + ctxi = fffilterctx(filter); if (filter->graph) ff_filter_graph_remove_filter(filter->graph, filter); @@ -829,9 +832,9 @@ void avfilter_free(AVFilterContext *filter) command_queue_pop(filter); } av_opt_free(filter); - av_expr_free(filter->enable); - filter->enable = NULL; - av_freep(&filter->var_values); + av_expr_free(ctxi->enable); + ctxi->enable = NULL; + av_freep(&ctxi->var_values); av_free(filter); } @@ -939,7 +942,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) return ret; if (ctx->enable_str) { - ret = set_enable_expr(ctx, ctx->enable_str); + ret = set_enable_expr(ctxi, ctx->enable_str); if (ret < 0) return ret; } @@ -1559,6 +1562,7 @@ int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *fram { FilterLink *l = ff_filter_link(link); AVFilterContext *dstctx = link->dst; + FFFilterContext *dsti = fffilterctx(dstctx); int64_t pts = frame->pts; #if FF_API_FRAME_PKT FF_DISABLE_DEPRECATION_WARNINGS @@ -1569,15 +1573,15 @@ FF_ENABLE_DEPRECATION_WARNINGS if (!dstctx->enable_str) return 1; - dstctx->var_values[VAR_N] = l->frame_count_out; - dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); - dstctx->var_values[VAR_W] = link->w; - dstctx->var_values[VAR_H] = link->h; + dsti->var_values[VAR_N] = l->frame_count_out; + dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); + dsti->var_values[VAR_W] = link->w; + dsti->var_values[VAR_H] = link->h; #if FF_API_FRAME_PKT - dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos; + dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos; #endif - return fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) >= 0.5; + return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5; } void ff_inlink_request_frame(AVFilterLink *link) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 1748dd3023..22dccf9118 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -501,8 +501,13 @@ struct AVFilterContext { struct AVFilterCommand *command_queue; char *enable_str; ///< enable expression string - void *enable; ///< parsed expression (AVExpr*) - double *var_values; ///< variable values for the enable expression +#if FF_API_CONTEXT_PUBLIC + ///< @deprecated unused + attribute_deprecated + void *enable; + ///< @deprecated unused + double *var_values; +#endif int is_disabled; ///< the enabled state from the last expression evaluation /** diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index 7041d787b0..38c7c5b53e 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -109,6 +109,11 @@ typedef struct FFFilterContext { * a higher value suggests a more urgent activation. */ unsigned ready; + + ///< parsed expression + struct AVExpr *enable; + ///< variable values for the enable expression + double *var_values; } FFFilterContext; static inline FFFilterContext *fffilterctx(AVFilterContext *ctx) From patchwork Thu Oct 3 19:31:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52011 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b18c:0:b0:48e:c0f8:d0de with SMTP id q12csp584773vqn; Thu, 3 Oct 2024 12:33:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURbyPSfbHpjFVW7YiUT2/aEs3YnjFAPD9EsXS0ftZcw8/fQUez3N4paOc3QTmW096xsBjekYHTPFEosJDGjqsU@gmail.com X-Google-Smtp-Source: AGHT+IH5IKLBpdqwKiJno05Sjco3yJjjLnpJpgz/bN5lFRGHe57+0v/Wc/CGr+/JQ1YoOJBbnTmn X-Received: by 2002:a17:907:3201:b0:a86:a4cf:a197 with SMTP id a640c23a62f3a-a991bd62a5bmr19157666b.5.1727984019188; Thu, 03 Oct 2024 12:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727984019; cv=none; d=google.com; s=arc-20240605; b=gqJLExUh1PLRBbPsSKuUyT3jlbWn+HsTQT+rycdfE0mOlH2Y+2WavWSjEe3b3g9LUB 4qGbg5dZwQuD0oYyucBQR/gtV67kOpmw742eNjVYRgeu1z9lFBQZSMeZq7K5T0MyB4aO 2aSfJb3Ayx1dGoXjP1Ebh5Osq6a0HIoI5BHVpyuhyWtnRG6qA9ik4d5coKaNNA9PxTTN I3+L+hzkYFhWnWBlUnowqk7UARkJV0jZhzeqcmZ05YfY6FVYmJSnmdjJD4dZhAivy9es 8P6H5J5Ug3HJOnvDgJJ4Y5A33BDozeTL5wtpfOALf5FGi5u7u4ZNjBwivBTMi3lXlsvp k+hQ== 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=dEBP9dS9MikgofXmcOu/uUzfIMbkBZylYVtBvovWZNU=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=LRJLpvh4MVm0ItVoDrswAfnIC/79fErIZ0g0PaWuIxRYNThPdAoUacFz2WDs6IvKPS KU9ei3vUKsn3E3I5bmXlTklvzAD7E5l8oLKb62J9Cwjbwuye80iozDKa0J7e6mCfXPkS PrRimuqr5+uvViISQCjKxasn+k/sJ79I3L4yw92wW7acdre8otsH85V8kVwyuBIDdA5m iWr2uRzW+py7xEFS4GZLJkXQEyHAGWBNGNhyqciZhXbWicJwykY6dKdNPLmWVgf6C6PK YL8mEPHhcmmzrw4hBu9JnzyY34tsTrYy/KasCAwwrtnpf8XDbAEyzkyGHK1chTok2NGU NvNQ==; 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=MwhEM0xH; 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 a640c23a62f3a-a99110e22b8si108283366b.781.2024.10.03.12.33.38; Thu, 03 Oct 2024 12:33:39 -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=MwhEM0xH; 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 0AD0168DB1A; Thu, 3 Oct 2024 22:32:38 +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 BF94668CB9B for ; Thu, 3 Oct 2024 22:32:29 +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=MwhEM0xH; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 636164E13 for ; Thu, 3 Oct 2024 21:32:24 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id f4qELd2oqjxw for ; Thu, 3 Oct 2024 21:32:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=i2jACmSYNXl29TYsp+6d3u+tDyVcsQr/1GCPFytbv/w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MwhEM0xHT9rY1bVUXS22ztOzmTjZIPLDt3W5RP70D36gXzRIHCSQHX9PdsgZGEQSY 6eeM+NsWglOYjFyPhh+T6+BZYNocCibmSzncpdyWj2019L59LPJ+h9c1HUyVSrzQ0k uuRxispdt1PmEXsQEbH+ulm8EInTEhLsWQ35JDywDziOxbWIyH97H5QWf8/wrLjzPc 1D6MIIdb9SExgbTld3hoCnxOKlbI/wcnhe1Cl+6WW6kAbu9IaUqcKcIlWKIC5t7+dh kiRiVpBHuV3lY4UdB01b+ly1rC6z3Wt04BedBbB/7bK6y+c7nBC6+KVASiTU5wTTX5 Q7LkI2PnDxtQg== 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 0B1114DF1 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id B6E5C3A0F41 for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:23 +0200 Message-ID: <20241003193127.15818-3-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003193127.15818-1-anton@khirnov.net> References: <20241003193127.15818-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] lavfi/avfilter: move AVFilterContext.command_queue to FFFilterContext 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: HSKc5H1lFWPN It is private to generic filtering code. --- libavfilter/avfilter.c | 13 +++++++------ libavfilter/avfilter.h | 4 ++++ libavfilter/avfilter_internal.h | 2 ++ libavfilter/avfiltergraph.c | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index dfb30002b1..86bf7773e1 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -80,10 +80,11 @@ static void tlog_ref(void *ctx, AVFrame *ref, int end) static void command_queue_pop(AVFilterContext *filter) { - AVFilterCommand *c= filter->command_queue; + FFFilterContext *ctxi = fffilterctx(filter); + AVFilterCommand *c = ctxi->command_queue; av_freep(&c->arg); av_freep(&c->command); - filter->command_queue= c->next; + ctxi->command_queue = c->next; av_free(c); } @@ -828,9 +829,8 @@ void avfilter_free(AVFilterContext *filter) av_freep(&filter->inputs); av_freep(&filter->outputs); av_freep(&filter->priv); - while(filter->command_queue){ + while (ctxi->command_queue) command_queue_pop(filter); - } av_opt_free(filter); av_expr_free(ctxi->enable); ctxi->enable = NULL; @@ -1545,7 +1545,8 @@ int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe) int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame) { - AVFilterCommand *cmd = link->dst->command_queue; + FFFilterContext *ctxi = fffilterctx(link->dst); + AVFilterCommand *cmd = ctxi->command_queue; while(cmd && cmd->time <= frame->pts * av_q2d(link->time_base)){ av_log(link->dst, AV_LOG_DEBUG, @@ -1553,7 +1554,7 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame) cmd->time, cmd->command, cmd->arg); avfilter_process_command(link->dst, cmd->command, cmd->arg, 0, 0, cmd->flags); command_queue_pop(link->dst); - cmd= link->dst->command_queue; + cmd = ctxi->command_queue; } return 0; } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 22dccf9118..a255d71700 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -498,7 +498,11 @@ struct AVFilterContext { */ int nb_threads; +#if FF_API_CONTEXT_PUBLIC + ///< @deprecated unused + attribute_deprecated struct AVFilterCommand *command_queue; +#endif char *enable_str; ///< enable expression string #if FF_API_CONTEXT_PUBLIC diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index 38c7c5b53e..c2a2378d61 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -114,6 +114,8 @@ typedef struct FFFilterContext { struct AVExpr *enable; ///< variable values for the enable expression double *var_values; + + struct AVFilterCommand *command_queue; } FFFilterContext; static inline FFFilterContext *fffilterctx(AVFilterContext *ctx) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 7bc7700743..c6472876bf 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1348,8 +1348,9 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const for (i = 0; i < graph->nb_filters; i++) { AVFilterContext *filter = graph->filters[i]; + FFFilterContext *ctxi = fffilterctx(filter); if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ - AVFilterCommand **queue = &filter->command_queue, *next; + AVFilterCommand **queue = &ctxi->command_queue, *next; while (*queue && (*queue)->time <= ts) queue = &(*queue)->next; next = *queue; From patchwork Thu Oct 3 19:31:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52008 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b18c:0:b0:48e:c0f8:d0de with SMTP id q12csp584511vqn; Thu, 3 Oct 2024 12:33:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV02zIu9eatCCAJ+p+yQKEV7yTse5N/p6WT3rWgHFu2KWvAG322Lfq6UPbbWK6akvEfvy8t6znPP9hgdfw73c5W@gmail.com X-Google-Smtp-Source: AGHT+IHhretjAFJBT6tepB77O2rfFCn98iCXGw413FzNfUnzRccLS7v4QA3pqgNNHg2xv06A81WZ X-Received: by 2002:a17:907:d2d5:b0:a80:f358:5d55 with SMTP id a640c23a62f3a-a991bd45c2emr37582966b.33.1727983990035; Thu, 03 Oct 2024 12:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727983990; cv=none; d=google.com; s=arc-20240605; b=ixTNrdi8S8j/jCHfYoXWCuMMznGx9AknE4yhZTevhRERvDsIuBn2tr3YSd/PnmyoBa BFbh1/kTw+oEEegY0h1HtupTUrVcSxMpkB1zFFgVm49VrFe0guXJeDeLP16Jgu96TTYQ UOgNt3VSLxSMGXUnysq2FlwYkDd+w0jWwsA7daSEucPz3zTrj8Ds8jBUcK0ZyetkmzhC +2HniBoelMzoQp2I6zcPJ1Cp7CkGpKqaX8SKMQpWm3MUsydVbeSYSJQP1e6432aOTkvV Slk5wWceeKr5OUoAFoufj1fKTpCl+sG2XX2GPEWuOYrBP/1IJD+KTTYrNHta2/z4gMvw wmOQ== 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=wyTICMj9ialTpJ8suQVeDRZt7C8FpzxHT69v9oCzsb0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Bl1Q1DRmtyLLHGpXo0ggEDyZe/G5cisLw58nS+/BxHOTUFIwNww+FgozrWY20xtWyN ILVWQjJ/qX0ZnjrlZGYmyOmvQnOxyaxKXuCtYQd+YdBfIQ2GHc4zyxp+buE0ey3UTtf5 X8cBE0tAcyNa1Z32vfOB6zvYvb+811xhtKVnHdEDvQ73HURIF6NrAi/GUGpoMJKf9K3D 3ilbiIgvjWCEeCJLc7k6gCqs418KrNeX1Jj5MvGqmmreTZmp5WAqSFqAow+4Ugy7l/5M 1S4wqx0QtS17vWuxiHP37GlFoaNc1PGRmKjY32KN8KpmHkAFEH6+XqtUgR/YJxR6q/sg 2tIw==; 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=T5a0cUk8; 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 a640c23a62f3a-a9910dcf00fsi111328366b.101.2024.10.03.12.33.08; Thu, 03 Oct 2024 12:33:10 -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=T5a0cUk8; 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 05C8968DAE4; Thu, 3 Oct 2024 22:32:35 +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 456D068DA4D for ; Thu, 3 Oct 2024 22:32:24 +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=T5a0cUk8; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 54D0B4E19 for ; Thu, 3 Oct 2024 21:32:23 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 8Yf7s-d-CLDb for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=kWoqzb00vkMsjG4XHVvwUoBFdQ3O8Ds87N8CxrmRndk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T5a0cUk8/jFzV135ENgPGOLSGFcrQ2Q5+L7FsmlofKt8rvov75dcOgJE9MERRlmwu xazMR3fKqXhmXTTMiwXfb1et0/bBb2dBjJrkQHDGTcZrR1m3axpayFsl0j9NKC8EQC /wZr1XzdCz0pTO3p1rIcvHR2HJcfQHfgKTysOx/ukNcPPGJ2dPb5qZKB2s4qQGNtsh HyGyYA09xZbleKaykdcCqzPf2pmajCM24UHA6y/KFBAH5D4IY3xmVG5wYulASnWwp/ w2KWmZCI0Fk9WTwTv1Rtrj+rvrSajnEXKBEovQikQD7Cf3wbl6yTZGp4SRSo8vt5j6 HQbtGOJu1JE5A== 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 0CA474E11 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C1E473A1A1B for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:24 +0200 Message-ID: <20241003193127.15818-4-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003193127.15818-1-anton@khirnov.net> References: <20241003193127.15818-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/7] lavfi/avfilter: document AVFilterContext.is_disabled as private 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: 9Elnz++6cK5Z Ideally there should be three parts to the filter context - public, private to the filter, and private to generic code, but only the first and the last of these exist currently. Until the second is implemented, this is better than nothing. --- libavfilter/avfilter.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index a255d71700..d13a2df732 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -512,7 +512,12 @@ struct AVFilterContext { ///< @deprecated unused double *var_values; #endif - int is_disabled; ///< the enabled state from the last expression evaluation + /** + * MUST NOT be accessed from outside avfilter. + * + * the enabled state from the last expression evaluation + */ + int is_disabled; /** * For filters which will create hardware frames, sets the device the From patchwork Thu Oct 3 19:31:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52012 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b18c:0:b0:48e:c0f8:d0de with SMTP id q12csp587622vqn; Thu, 3 Oct 2024 12:39:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVw2D4wevgqje78FvvxK64YvcmgSE56CQErR/TYzDsNtOJ0DjBdIIqsqhNKkXawI2qOm1ajgte8u72gNwL5PrAY@gmail.com X-Google-Smtp-Source: AGHT+IGd+z5EZRKfMi6H3+TPFvVTGmdMuXi81ETimCrM3hP0MpAKWRNXptBxEy+/YTt9aulpUSQt X-Received: by 2002:a2e:be03:0:b0:2f0:23f7:8e6d with SMTP id 38308e7fff4ca-2faf3d6bedfmr223191fa.8.1727984348504; Thu, 03 Oct 2024 12:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727984348; cv=none; d=google.com; s=arc-20240605; b=BfryfD0/nxWt1grEPbbOIquYt+nHi1s/R9tUKRwNqgYBrfKwhR/5wkv9AX2ZFsip8p mck7h3r3jZL+G+zG8RczOXcYnHxIKHySpF6rE3hUv48VHKrRUQNuStKprSBFu3/B5lQS u4P9+eGkWmXivszhbB+1XinbMcV5Z2zaZgK5yei6IyPxpT0C7wUErtO81O3Wr4dpCZ8l f5w+P6xcfpV91L11IqhXqaMNmJJmTo9oO/xIGoI7dPtISFrspEpmTiS5IhRZ0TLlWe28 y2ub9EAlxRx5nmpAsQulJaN3STcV4AsAWGzjeZBsTmgZ8nkpQFlf9PvdsbF+nWvLAhLD DuBw== 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=lvY/jnDr7POnjehTiE8rliyiMKce8+L+uXDJZ05pacU=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=FFnMKNQOO+j+TQBvu3LFirldPJHyfPxSh7lWpk+plTfyMD2eMDE4w87Ce/VX9rPf7T fyLPE40PQcuWr2TTde9KRoIV9HC07vIqHw3Nz1hDp9Pw0BT3cr/l2NZs54cBLGq47ymd HauB+dFpl1SH5PkxGKUgwQNOCBz+U/rqCEh30Gi8byUVbC/kvPyZLj6Iz102NHVmn3Bc QT18pPpnJb4J0VDknDAqn7U8VZTPgFP9gza7HQ7A4NiN3iVw+OGz7S6nG7qkZHFNfPUK WdrYH32YmKZJ7Go/KXpZNsKEpuW0zCPQ0QNdtBYWboZ9SOdjUUBVtVKUfkOcg47t5fcz BpOg==; 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=k8ZjEKlU; 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 38308e7fff4ca-2faeccbbfddsi6527341fa.646.2024.10.03.12.39.07; Thu, 03 Oct 2024 12:39:08 -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=k8ZjEKlU; 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 9272968C7E5; Thu, 3 Oct 2024 22:32:31 +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 424F568CB9B for ; Thu, 3 Oct 2024 22:32:24 +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=k8ZjEKlU; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 587FD4E1E for ; Thu, 3 Oct 2024 21:32:23 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 9KWtRQJoJVnR for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=S/LxgDygJpv4xw4tppi8s9cQ2l5xOxggXwR8EJM8OP0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=k8ZjEKlUojstz5n4ADBZ5y5qtUsoA1sTE5gem1UBDD1hhYeRHRknEjBMiciuF6vfW Obm3FVGFjfD4sYd34/6rRSnNEt3NmO+gMJmjlNGx3TOKh1nJ8IgY6Y1g9sZe6T5zLF oLWa7x9KuyRyXDKru6GpBC4uVf/iMBtEv1UfrxxJ22mq+7iPyXzgiQE4ZGAr3rLAvK gV8si45NMrEoxNkrCUYBhbcBV0kV2b7OWtBoVuqknNwlmryU7oZGqxgnxr7JXjGnNj pEkr/+8uCTkQKmv8dODBLEen/nSEec5FddAY+KgDEm+dwfvBM7irF7shhuQkXGHJl0 DZRsOisLgABJQ== 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 11C8C4E14 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id CDE703A1A81 for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:25 +0200 Message-ID: <20241003193127.15818-5-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003193127.15818-1-anton@khirnov.net> References: <20241003193127.15818-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] lavfi/avfilter: make ff_inlink_evaluate_timeline_at_frame() static 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: QQn3Nt8pUHqG It is not used outside of avfilter.c --- libavfilter/avfilter.c | 62 ++++++++++++++++++--------------- libavfilter/avfilter_internal.h | 8 ----- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 86bf7773e1..3295ffb18c 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -995,6 +995,38 @@ static int default_filter_frame(AVFilterLink *link, AVFrame *frame) return ff_filter_frame(link->dst->outputs[0], frame); } +/** + * Evaluate the timeline expression of the link for the time and properties + * of the frame. + * @return >0 if enabled, 0 if disabled + * @note It does not update link->dst->is_disabled. + */ +static int evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame) +{ + FilterLink *l = ff_filter_link(link); + AVFilterContext *dstctx = link->dst; + FFFilterContext *dsti = fffilterctx(dstctx); + int64_t pts = frame->pts; +#if FF_API_FRAME_PKT +FF_DISABLE_DEPRECATION_WARNINGS + int64_t pos = frame->pkt_pos; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + + if (!dstctx->enable_str) + return 1; + + dsti->var_values[VAR_N] = l->frame_count_out; + dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); + dsti->var_values[VAR_W] = link->w; + dsti->var_values[VAR_H] = link->h; +#if FF_API_FRAME_PKT + dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos; +#endif + + return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5; +} + static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) { FilterLink *l = ff_filter_link(link); @@ -1013,7 +1045,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) } ff_inlink_process_commands(link, frame); - dstctx->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); + dstctx->is_disabled = !evaluate_timeline_at_frame(link, frame); if (dstctx->is_disabled && (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC)) @@ -1451,7 +1483,7 @@ static void consume_update(FilterLinkInternal *li, const AVFrame *frame) update_link_current_pts(li, frame->pts); ff_inlink_process_commands(link, frame); if (link == link->dst->inputs[0]) - link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); + link->dst->is_disabled = !evaluate_timeline_at_frame(link, frame); li->l.frame_count_out++; li->l.sample_count_out += frame->nb_samples; } @@ -1559,32 +1591,6 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame) return 0; } -int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame) -{ - FilterLink *l = ff_filter_link(link); - AVFilterContext *dstctx = link->dst; - FFFilterContext *dsti = fffilterctx(dstctx); - int64_t pts = frame->pts; -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - int64_t pos = frame->pkt_pos; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - if (!dstctx->enable_str) - return 1; - - dsti->var_values[VAR_N] = l->frame_count_out; - dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); - dsti->var_values[VAR_W] = link->w; - dsti->var_values[VAR_H] = link->h; -#if FF_API_FRAME_PKT - dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos; -#endif - - return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5; -} - void ff_inlink_request_frame(AVFilterLink *link) { av_unused FilterLinkInternal *li = ff_link_internal(link); diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h index c2a2378d61..e0aee20a32 100644 --- a/libavfilter/avfilter_internal.h +++ b/libavfilter/avfilter_internal.h @@ -222,12 +222,4 @@ int ff_filter_graph_run_once(AVFilterGraph *graph); */ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame); -/** - * Evaluate the timeline expression of the link for the time and properties - * of the frame. - * @return >0 if enabled, 0 if disabled - * @note It does not update link->dst->is_disabled. - */ -int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame); - #endif /* AVFILTER_AVFILTER_INTERNAL_H */ From patchwork Thu Oct 3 19:31:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52013 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b18c:0:b0:48e:c0f8:d0de with SMTP id q12csp587685vqn; Thu, 3 Oct 2024 12:39:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVF5KN39xA4rmko1Qxc3Uhr0AwrGBC5m6zRxpdF+nBOVvkq9CPQSskM9/NNuNpHl+UZTjQO/K1NMQwlwg+yXg7K@gmail.com X-Google-Smtp-Source: AGHT+IGljBRH05o7PzfCYhBTe1xZPnTEHHo52h/U36Cep++gtQ+aVk9v+GT8qO49niRzhvZQZZGk X-Received: by 2002:a05:6512:281a:b0:535:3ca5:daa with SMTP id 2adb3069b0e04-539ab862484mr296485e87.7.1727984354170; Thu, 03 Oct 2024 12:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727984354; cv=none; d=google.com; s=arc-20240605; b=b+QAg8GI3L5visjkM0l0swll2w8dLyLnPZpn4QhqnIs/wYooyEx3RB9HPprG9/K7rd 4WJcYjvudvRqk5LFqEDLHyNiOG7XnppKJnYRvZGtkswQr80/NaztO1s/DcRePqK0f2ME +nOkt2gk4hNc+nTSKVCxbg0lJRL7hUIySY68CKQ58xreg+wdAlvuMQQB3UokyrRMwPs/ G7wBJSbmbzL4nWkWBO0qHLMX3yk+SFNQrcnnqz5GJ0yHP75MpkrpnltXw9AgLAdcSMxr 5mQqq/ZsH37K3sDtIf0UD8V7xWqmniTThNo9wzg8rA7Q/YtofLm95TCJUG5h711TE046 R3lw== 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=JSDcNJF5ZMFl3mLEhwpMPJKecbcKX1MctwpIo3Wlapo=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=GgvEf0Cujrj7+7cCDHwJ/bC5kFJwAC7mJ0mtyWBHxEw6bT8cl6gV5hl4iJQgnqjcqB 1KH2M5mU7NmKX1FkOSTgLOtiber/iumtVl9Y8B9tV1qn+adyM+3lovC8U8+M2eBIYySl ySfryXCWXHxCHO9Xjj2dfMEL2dtvVJL7cbKUYZJyWrJztdDoVtpTHPl/+PDYd3pd8ei2 DT0da8b4vaxqS0Ub5nMTprGYEOrLzh14hiQZoNMvoYk/RSNzzHOCGmWBKlk7Ae6I4pmP BpFxIWyWH8qayFFrBi4u/BobyVamYwVVU30mBKbhjE9QXn8Uaab1ky3DeirC34LfxwhA nLFw==; 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=CGidR6Vr; 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-539a824e860si675736e87.83.2024.10.03.12.39.13; Thu, 03 Oct 2024 12:39:14 -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=CGidR6Vr; 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 BC43468DA9B; Thu, 3 Oct 2024 22:32:32 +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 4867E68DA68 for ; Thu, 3 Oct 2024 22:32:24 +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=CGidR6Vr; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C6CAB4E11 for ; Thu, 3 Oct 2024 21:32:23 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id YKC0B0liaCQ3 for ; Thu, 3 Oct 2024 21:32:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=28yQ4+4/qH42Stmnhu0dkHpEqxu97pGc4OocMHkrj+k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CGidR6Vr1P8Je38/K/qth0kNg7c3tF57kKLhtjCx8/bXyvMTkzLClk3/1OaIzrO4Y lzebgt/2GkdxBHk6bE/8pLn49oJgG3iAhkT72AT9nMN028yHUWrIGopEt0TzevMfBO ZFMdLAnqV2sSRnooZFarajdDjP9D9n2mvR/y+h3UIAuy+Jrhd5VokgzHmajvu+V2Dr xGTEBUG1f08E5ZnIxuyizWmsYYfgriwZI42y4LAHtYHM9XewiPlkCAn8iEbpZV2pyX wBCJfVGOTQFlJBnnC4QA7T0tyampsGClO7FD+dBcXM6EhvQ9DFiEitiCsffIF5A5Q3 HkkyHnnymfBUw== 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 3506D4E16 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id D96A23A1DFD for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:26 +0200 Message-ID: <20241003193127.15818-6-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003193127.15818-1-anton@khirnov.net> References: <20241003193127.15818-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/7] lavfi/avfilter: drop ff_ prefixes from static functions 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: qWdXpmqTbhTF --- libavfilter/avfilter.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 3295ffb18c..f7ab908599 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -522,7 +522,7 @@ static int64_t guess_status_pts(AVFilterContext *ctx, int status, AVRational lin return AV_NOPTS_VALUE; } -static int ff_request_frame_to_filter(AVFilterLink *link) +static int request_frame_to_filter(AVFilterLink *link) { FilterLinkInternal * const li = ff_link_internal(link); int ret = -1; @@ -1027,7 +1027,7 @@ FF_ENABLE_DEPRECATION_WARNINGS return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5; } -static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) +static int filter_frame_framed(AVFilterLink *link, AVFrame *frame) { FilterLink *l = ff_filter_link(link); int (*filter_frame)(AVFilterLink *, AVFrame *); @@ -1181,7 +1181,7 @@ static int take_samples(FilterLinkInternal *li, unsigned min, unsigned max, return 0; } -static int ff_filter_frame_to_filter(AVFilterLink *link) +static int filter_frame_to_filter(AVFilterLink *link) { FilterLinkInternal * const li = ff_link_internal(link); AVFrame *frame = NULL; @@ -1201,9 +1201,9 @@ static int ff_filter_frame_to_filter(AVFilterLink *link) produce one or more: unblock its outputs. */ filter_unblock(dst); /* AVFilterPad.filter_frame() expect frame_count_out to have the value - before the frame; ff_filter_frame_framed() will re-increment it. */ + before the frame; filter_frame_framed() will re-increment it. */ li->l.frame_count_out--; - ret = ff_filter_frame_framed(link, frame); + ret = filter_frame_framed(link, frame); if (ret < 0 && ret != li->status_out) { link_set_out_status(link, ret, AV_NOPTS_VALUE); } else { @@ -1230,7 +1230,7 @@ static int forward_status_change(AVFilterContext *filter, FilterLinkInternal *li if (!li_out->status_in) { progress++; - ret = ff_request_frame_to_filter(filter->outputs[out]); + ret = request_frame_to_filter(filter->outputs[out]); if (ret < 0) return ret; } @@ -1249,7 +1249,7 @@ static int forward_status_change(AVFilterContext *filter, FilterLinkInternal *li return 0; } -static int ff_filter_activate_default(AVFilterContext *filter) +static int filter_activate_default(AVFilterContext *filter) { unsigned i; @@ -1267,7 +1267,7 @@ static int ff_filter_activate_default(AVFilterContext *filter) for (i = 0; i < filter->nb_inputs; i++) { FilterLinkInternal *li = ff_link_internal(filter->inputs[i]); if (samples_ready(li, li->l.min_samples)) { - return ff_filter_frame_to_filter(filter->inputs[i]); + return filter_frame_to_filter(filter->inputs[i]); } } for (i = 0; i < filter->nb_inputs; i++) { @@ -1281,7 +1281,7 @@ static int ff_filter_activate_default(AVFilterContext *filter) FilterLinkInternal * const li = ff_link_internal(filter->outputs[i]); if (li->frame_wanted_out && !li->frame_blocked_in) { - return ff_request_frame_to_filter(filter->outputs[i]); + return request_frame_to_filter(filter->outputs[i]); } } return FFERROR_NOT_READY; @@ -1429,7 +1429,7 @@ int ff_filter_activate(AVFilterContext *filter) filter->filter->activate)); ctxi->ready = 0; ret = filter->filter->activate ? filter->filter->activate(filter) : - ff_filter_activate_default(filter); + filter_activate_default(filter); if (ret == FFERROR_NOT_READY) ret = 0; return ret; From patchwork Thu Oct 3 19:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 52010 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b18c:0:b0:48e:c0f8:d0de with SMTP id q12csp584724vqn; Thu, 3 Oct 2024 12:33:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUol/Z0+yTh6gPKMorKyQ6g5vXm90hDDO5CygwJtQUXac2xUEAQYVWyc3pk1lKgVtQFg8uWjtqobUNmXOR8VvzT@gmail.com X-Google-Smtp-Source: AGHT+IF9m7V6Bfr9JcWzOuPEJCp7R7njW+w2MEQSw/mhPwKQyHx8g2Z1Gn2fTihBuFbSXDTx6oEe X-Received: by 2002:a05:6512:280e:b0:539:9720:99d4 with SMTP id 2adb3069b0e04-539ab87da94mr241919e87.28.1727984013742; Thu, 03 Oct 2024 12:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727984013; cv=none; d=google.com; s=arc-20240605; b=B9iw68wyeZZlANW3LshYrLqc1hq0/kS6nePm5J14qfS/e7JrUjHY+N8uGANTOt7y8u 52dQwNTc0THpOtKAR9iTKeC+SYBX0ZSUarHQGZzVFD7xB1io7L/upj/HpmIL3PliPgUi Zr2XRHelSA5oAy74pzdp6zEw+wes+csBzgs4smHz+NANv8ILYRuHFSW4qMWExO92uM71 amXiNWEgk4HDuxkfppLL7U2jFfel3CZ64QImGbA1ABHQg3Al9GPLOcWqGJcdzBQNU9OO sSkJqDe7rycHGV5HptN+bf2g8ZyRisS5dso/eIxVyaWb14COhhs3/oeGzAWJHjlolvpw Sk/g== 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=iDWChD5t2vV3vJeQCYbpdIUjpNxBMm0gx9741ocACfg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=RAYfbJ8u3hnHOjsbjIVqz84SAbGiKI/2PiV3GwZJDUbZWZSfiPTxEVpSAMmqsmLlf5 Ur3fmr4xFfzZaM46LkMyjDt8Fb6NHCkRLVLi1//dJWkXOULLm+6aIuwQyzD7kh/BXedb CDoi2Om+ubjt2pE6p8v8oSoRIjnDTLSfQiWK0Cx8tnRNotBjvA5zfV0Y+lrYrXiPbV2D oM81k2sA0Pr8sEnvg5gmVTLmFG7dCUqmw7+RfB3VJ0JqSQGSmEsYnkYv54Sb44NLoo2p +a8Iebt/3hLpHIDaKPFznTLo3cMl3IN6//veYgqg3pi5z/8RLdKK+eK21FMVY8s0aml9 bfig==; 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=n6JgLBbk; 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-539a829fd41si672730e87.396.2024.10.03.12.33.31; Thu, 03 Oct 2024 12:33:33 -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=n6JgLBbk; 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 D4E1168DB0E; Thu, 3 Oct 2024 22:32:36 +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 BFAB768DA91 for ; Thu, 3 Oct 2024 22:32:29 +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=n6JgLBbk; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 7D6C34DF1 for ; Thu, 3 Oct 2024 21:32:24 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id nsoPLZ9oiOl5 for ; Thu, 3 Oct 2024 21:32:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727983942; bh=tqR/J459TQy1sw2br4mgEgRgPBa39Enf2pbjagQ5b1s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n6JgLBbkUj0eXMAUFznBzjxvpDCpRiAqqj0d9x17nACQEmhSOww8tGdHNTuXaIgYt Z6DNcsk1N0tEO8RcNRuYL8mKgl8V42YsQmSVhgJLYxdvFpAJpVj/AxFQ5bODFaizrs wGFczNeaIqUCBtfmZ3S+MaSFsUxVC/B7+sCJCRVZ/9ZZXuk9r0gFL0DYZiNoSN/wO7 92ORE00WxhpeIjqk8W/RYweNT+01L3K+SnGKkjA7WU8Ao1OCbI062U1RshP3+Ig7RC T+py37XSyXuwFUX8+yqTAsmjLUjLOw4SsNFh9hrFcM3JaW5nNevJ/8wk0/hlooAsNL twLLwCztWbjuQ== 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 35CED4E18 for ; Thu, 3 Oct 2024 21:32:22 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E519B3A1E08 for ; Thu, 03 Oct 2024 21:32:15 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2024 21:31:27 +0200 Message-ID: <20241003193127.15818-7-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003193127.15818-1-anton@khirnov.net> References: <20241003193127.15818-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/7] fftools/ffmpeg_filter: stop setting a no-op option 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: UISRZ2B0tztI --- fftools/ffmpeg_filter.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 2ff7c4c4f4..28c5223c5d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1586,15 +1586,9 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, int ret; snprintf(name, sizeof(name), "out_%s", ofp->name); - ofp->filter = avfilter_graph_alloc_filter(graph, - avfilter_get_by_name("abuffersink"), - name); - if (!ofp->filter) - return AVERROR(ENOMEM); - if ((ret = av_opt_set_int(ofp->filter, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0) - return ret; - - ret = avfilter_init_dict(ofp->filter, NULL); + ret = avfilter_graph_create_filter(&ofp->filter, + avfilter_get_by_name("abuffersink"), + name, NULL, NULL, graph); if (ret < 0) return ret;