From patchwork Tue Apr 25 07:26:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Tong1" X-Patchwork-Id: 41322 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a17:907:3203:b0:94c:9d7a:e065 with SMTP id xg3csp3293934ejb; Tue, 25 Apr 2023 00:30:52 -0700 (PDT) X-Google-Smtp-Source: AKy350Zdpm/rAn+hGP09oTjPdgauKy6uFg+3zDLHBqHcLwkT4EWFLCPV2g01suQg2ANUoPrGn8uP X-Received: by 2002:a17:906:69ca:b0:94a:5925:56e2 with SMTP id g10-20020a17090669ca00b0094a592556e2mr11833382ejs.22.1682407852463; Tue, 25 Apr 2023 00:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682407852; cv=none; d=google.com; s=arc-20160816; b=L/+XBpo7pIjo0R6swL05aTXeMJuOrb1mabBfUYtOzaVRp/l4qfhs5Qq22e/FvIjVTP o2J5OKEPLdRWp81rxvVUGYXXo4hAELVjDNHxlk3PGCx6OVaXN84WFxGz+61e5DonPmB3 RlH6r9tPu07n5twVhfTawgijGz+4NqT1u8galdiLM56KwFIKpqAfWnUpQgtxv/R+yJGn knGIJW9Z96gzzsVL8qrG1dFU4cwN0a3JnBYO61/p2RLInnLIfh+28r8QM39LMyXukQMy JEs/zl3i3OmU2FvAxmUQpZn0glL7/yrcejlr1eJkq2CmqR/lyUTxShhWvdqfT+LFrxk+ AZEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=wO3lW1np3l2fm7dFxx8x09PII2FZDEiFruTfUpxo1jI=; b=vaF2enZH385V2jJnoJ0kRaFNbnOm697isvZ2q9qaBDDwuXKQHfFQ6HzyOzHN/x7hIZ cA3uz6gTSglr8i5ODc/9l/4q8kj72Emh1o98KFfUkMtVtcPIlXWP040CEbdGul5zNGPU ktZlmLtJOdoVKxWJ8HA0SDCZZ5Vj/5cJ7wbC/wBbE5iZbe2LNcv4Yh1UOao1PAfyVf4G Qwi0sV/n/Ht/Mh8wFY/uMOMNNA0sMvhx85Q90KD87vh3Sk/RgDCiEGfBwdnMVM5B5CXd bbrY0zbMapt95WIpNUOS77VLitifJZBnCUWt1DQxskOiYmMTJg9lULAZIZW6D5vGGFTY ydSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=bFc5Yxlu; 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 jx10-20020a170906ca4a00b0094f9a88ec2esi8835518ejb.277.2023.04.25.00.30.52; Tue, 25 Apr 2023 00:30:52 -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=@intel.com header.s=Intel header.b=bFc5Yxlu; 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 12EE668BF7D; Tue, 25 Apr 2023 10:30:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D2DF68BF07 for ; Tue, 25 Apr 2023 10:30:28 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682407829; x=1713943829; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AZy4jkY+WfupfPCSlOr0VoLFP0k/jtizfH4iDdZ6fds=; b=bFc5YxluuNXJ1jJwEo/Kr1UZXGmCEKU/l472x2YrzCDifVLfSDw8QeUC OVulpS4kUCq2A4yXNGmMKDDoV8j6uONiLy0oU/+e9PBScQatTjkmoEvAH dfAsTgI7FBeCW9q3SLom0ST3ipFK2GWmz6lyNVPeY3RPUpVBpl7Qb4GtI OqTm07Ki24aAqVElewbk8KJA3e94M9WcYAU6KcIT3Wi0RIlziBvyOoQU+ DG5JEexagKWFEvKMXxJrF0F37u8QGz18dauzfJxuXm9kvtF1E4DftejxJ Du2oQ5h4uFiSRFZKsaylkKg1+y2FtvUi8aMqOKEripHl7nrKbtJe/qHA3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="374630999" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="374630999" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2023 00:30:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="867798378" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="867798378" Received: from desktop-qn7n0nf.sh.intel.com (HELO localhost.localdomain) ([10.239.160.59]) by orsmga005.jf.intel.com with ESMTP; 25 Apr 2023 00:30:01 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Apr 2023 15:26:20 +0800 Message-Id: <20230425072620.512-5-tong1.wu@intel.com> X-Mailer: git-send-email 2.39.1.windows.1 In-Reply-To: <20230425072620.512-1-tong1.wu@intel.com> References: <20230425072620.512-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 5/5] lavfi/format: add a hwmap auto conversion filter 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 Cc: Tong Wu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: g/+4xIW8MWZE When two formats lists cannot be merged, a scale filter is auto-inserted. However, when it comes to hardware map, we have to manually add a hwmap filter to do the conversion. This patch introduces an auto hwmap filter to do the hwmap conversion automatically. Signed-off-by: Tong Wu --- libavfilter/avfiltergraph.c | 3 ++- libavfilter/formats.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 8af0467bc5..b2b627ad6a 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -402,7 +402,8 @@ static int insert_auto_filter(AVFilterContext **convert, AVFilterGraph *graph, AVFilterContext *ctx; AVFilterLink *inlink, *outlink; char inst_name[30]; - const char *opts = FF_FIELD_AT(char *, neg->conversion_filters[conv_step].conversion_opts_offset, *graph); + const char *opts = neg->conversion_filters[conv_step].conversion_opts_offset == 0 ? NULL : + FF_FIELD_AT(char *, neg->conversion_filters[conv_step].conversion_opts_offset, *graph); const char *name = neg->conversion_filters[conv_step].conversion_filter; if (!(filter = avfilter_get_by_name(name))) { diff --git a/libavfilter/formats.c b/libavfilter/formats.c index c8e20e5b20..fee10fa0ee 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -331,6 +331,10 @@ static const AVFilterFormatsFilter filters_video[] = { .conversion_filter = "scale", .conversion_opts_offset = offsetof(AVFilterGraph, scale_sws_opts), }, + { + .conversion_filter = "hwmap", + .conversion_opts_offset = 0, + } }; static const AVFilterFormatsFilter filters_audio[] = {