From patchwork Fri Mar 31 16:21:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 40954 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp851820pzb; Fri, 31 Mar 2023 09:23:10 -0700 (PDT) X-Google-Smtp-Source: AKy350bcWWnPsim21qWopwX1vX8R5PlC1QrB53R+UNiJVlIrA6xnFjUrzZfa4rs8i9sfT2dTQPnY X-Received: by 2002:a17:906:b2d2:b0:93e:fa12:aa1a with SMTP id cf18-20020a170906b2d200b0093efa12aa1amr28104282ejb.1.1680279790677; Fri, 31 Mar 2023 09:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680279790; cv=none; d=google.com; s=arc-20160816; b=EfhWHDf1AoWaELz5n3ayQDmdzU5XXMC0UdCWf1IQfOLYk3zbjfSnPYzYdVJCzTtcX5 1CUDDzvudRHWvlAEBoFnxXDmZRNurKjH8za+pgjNT62i8oWb3viR3Zyu9dNPntsfjejD gJbn2ufNACww//sFodm1ZE3nZNSGDhMLst8PjS6nwhQ+5DrsZ4NXD1uHd6bU1+wr+nvT 4OMfGTCwWEkRECruVfUHKO+b9SRUEOQhWdZARb5x30IpnS6Iea8UJzc60Hz/FfCUx4is EAfYfbssXYSDzrfqRxln5BZwI0BQo0doc4On9ulo7LVVrBIx/jkm8oJfbdzBDlGznBJc dVwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=z6b0VUjnM8eAW6/Uehm1b7sO2rJK60TCQh47zcnchhs=; b=Q9E3JRW+STEWSmTqZaUVanOHge4uTqz6YHEXstVRj2M9D3JFsX3V0Rh7V7gk8LLswM Huec9LIl7WDLmhvsh9EB6RYhv9BCOvX8IwrsTCH3ufCp8jQikaE1Bf4bMuq6OZzmIZfX zadpmFNnSq7etbM3zgZt96NB73mYUjzb/27jgY1OJSzLgRSSR8aATRGCOCK4a0FQOD0S 0RYxqBevUNu+MFoxhfRVd9yCzR4kCnam72QLRW+X7PCmiwd7CHpYX3iyZdCWmt2wJZ0n gKpF2RWILwschcHXyoi/wL0Hs6I+a/omnR01kcBXPINDeQzFdFa2oU4DPmjRoC4Ix3/a pt0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=AwGxXKDj; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v5-20020a1709060b4500b009212a3f8496si119551ejg.666.2023.03.31.09.23.10; Fri, 31 Mar 2023 09:23: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=@gmail.com header.s=20210112 header.b=AwGxXKDj; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 23C6368C32E; Fri, 31 Mar 2023 19:22:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2657E68C28B for ; Fri, 31 Mar 2023 19:22:17 +0300 (EEST) Received: by mail-lj1-f175.google.com with SMTP id a11so23613594lji.6 for ; Fri, 31 Mar 2023 09:22:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680279736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8rEEYYVIS3CMaaYCT1jYvirXrRc+Efmzaab7J0siwFQ=; b=AwGxXKDj1azusr4ldEEFpj6jZvtRoei3fYuW1dZ15wbkriLRA+ti0TZDnJGkfvsdko JQFAP3o2+lvIZnbs0K2qcs+M/J7vp2i8/cX+QaEA9BjI5mbt64kuX7YkvaxD8dfU7GOg zCf7xDA2SPu+tj3ftOP/oi7w/mwNxD8cxgPE7qw5mHpCUlV0k3J3IuReKmxI9axmN+mP UZDp2xYPW95yxQ4c/DbFtEOrWu4dkdsX2cTgowqap7esYaBvyu9Z7vcSnzRTG26illCE 247Z1tNSwHyBQfIIbib1Rdcg+BPWQ6DNvgQOBie+5viK+DQmz7bmKB16L7zYhxJ+H2MS F48g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680279736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8rEEYYVIS3CMaaYCT1jYvirXrRc+Efmzaab7J0siwFQ=; b=m0HYCOsFJBpelS/fICimM9b3nTZv8m5FbBAyrnpidyVkqewnD6210vKF1XWtwk3XUa xajY4fIDl6Gwx6nBqbfpmZdK5qfuLy09OHoB4tJ26tbqntxxes0dOx3OKzWKE3Ym6S/j dqwZ9tWBssUVDeOXSytEyyeOaeC1oTQ9L/7aSVXBz2jkLeD7MlUN8KUOz81z2bqfStJ4 IaT/dVzNpsA0NccKOCnd7KydHmD4xr+ci+DEJNd4KBqfVLmbVJvGt9uNthpL6GYPjT0Z kp4riTnmNKMAS/XSaxVpaaQVhFPNH7GqaUU19YdULKz9N2qD3QsEMpHvAUCLcPYQ9ajx fpZg== X-Gm-Message-State: AAQBX9eePzi4c5h6SG31vToItYymBhFg1B5vXbWoKBKT+YAr0d++dzI8 4ooi9RigysVVFIKttdXBGOEAShRXpjc= X-Received: by 2002:a2e:9cc9:0:b0:299:bb73:fcd4 with SMTP id g9-20020a2e9cc9000000b00299bb73fcd4mr8305163ljj.7.1680279736402; Fri, 31 Mar 2023 09:22:16 -0700 (PDT) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id n20-20020a2e8794000000b0029573844d03sm411483lji.109.2023.03.31.09.22.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 09:22:16 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Mar 2023 19:21:58 +0300 Message-Id: <20230331162205.428735-6-jeebjp@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230331162205.428735-1-jeebjp@gmail.com> References: <20230331162205.428735-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 05/12] avutil/frame: add helper for adding side data to set 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: hW4/d7HjQCVi --- libavutil/frame.c | 12 ++++++++++++ libavutil/frame.h | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index ab1a4e7f6a..29e9b631f8 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -708,6 +708,18 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, return ret; } + +AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set, + enum AVFrameSideDataType type, + size_t size) +{ + AVBufferRef *buf = av_buffer_alloc(size); + AVFrameSideData *ret = add_side_data_to_set_from_buf(set, type, buf); + if (!ret) + av_buffer_unref(&buf); + return ret; +} + AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type) { diff --git a/libavutil/frame.h b/libavutil/frame.h index 734ac3fe75..167a8f0ff6 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -998,6 +998,19 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type); */ void av_side_data_set_wipe(AVFrameSideDataSet *set); +/** + * Add a new side data entry to a set. + * + * @param set a set to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + */ +AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set, + enum AVFrameSideDataType type, + size_t size); + /** * @} */