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 7633D45829 for ; Tue, 25 Apr 2023 07:30:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF8F968BECE; Tue, 25 Apr 2023 10:30:30 +0300 (EEST) 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 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: 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[] = { -- 2.39.1.windows.1 _______________________________________________ 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".