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;