From patchwork Tue Feb 27 22:12:05 2024 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: 46598 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:aea4:b0:19e:cdac:8cce with SMTP id do36csp11402pzb; Tue, 27 Feb 2024 14:13:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVHgV90mZqMrNA+KVq377NFPF0icTnBlOLdFNzzOKcPB0+7cP8GPZOv0awqv4g5/hKOSMkkn7qyW0V2Z3myHOB1dN6Y5kyySZigew== X-Google-Smtp-Source: AGHT+IEpM9P7OgcSPomOv8bbqahiBADT+SKjNREEIdv29jF6wmP+yQqCZX19xpvbDQPGaKUlkjyg X-Received: by 2002:a50:9549:0:b0:565:4b6e:7f71 with SMTP id v9-20020a509549000000b005654b6e7f71mr8582539eda.3.1709071986241; Tue, 27 Feb 2024 14:13:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709071986; cv=none; d=google.com; s=arc-20160816; b=xtybQoZ6x2l0eZZp//dNNekyUov8GAhXskKUrp20geqCu1q4Wue6zoHnVedp8I308G 660aBO3PEEuWUPTGPSWKqwaGsVk7kPLN3RRSJJhF01wXX1beMfjqBGd676buW1My583B cAjcji0fRgVy1Is8Sq8vz3IE+w/aXFrCBe5LlU8EXqKsE8G8UsHrjOH9HufKLX9AcUwP ktU4lQO/V/VO6bBobRuzC5qvH0AXl4Et49UJWUqW8Hf34+4qq+rEqSuSn8Tt/vZEpY/9 W2dVfBwPC2UJsZqbFRBMkz2CaRXJ9W4f7/G4Un4Me5fnq41HrMSpbFVGX4xclHtpLrFa UOJw== 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=pf9tthx6KLltYLDATo5y/nXiR11h4gFqp7/Z4S2ujYs=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=dP+5vYmPMoGIMzZcGTM8o4p0ImojGRESOKVT5WY0Qe6xkNyWgUj6MU3UUBGZzF3EC4 vSbcyCvTZggSGd8lxvnS4Tpqa/pV4pnu45NuWNK+03+Tk4TEFyri7QQE8X0Zf293J7xw GomLLMbi5GlrWUsbOYQqyNP11CmkBX8ynUKL4GJMt2T3RT9o1GYxtdIiVPKbXpq5vIRm ljI/pcovRFly+EeeXv4WxeMUWtQO0lzbGwlgKnc1dYTmquyeUThV55oOd6fqulmXj293 VYg5TN4G4wFuySKlOqGD4IVw46OOaj4kMjiF8zmdsZOTYj93T371iP4vQ+0JN30iHLrt dGPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=jyIq4z+p; 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 d10-20020a056402000a00b00565ae90009fsi1025625edu.584.2024.02.27.14.13.05; Tue, 27 Feb 2024 14:13:06 -0800 (PST) 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=20230601 header.b=jyIq4z+p; 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 3209968CBD4; Wed, 28 Feb 2024 00:12:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5D7F868C119 for ; Wed, 28 Feb 2024 00:12:37 +0200 (EET) Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d29aad15a5so15275931fa.3 for ; Tue, 27 Feb 2024 14:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709071956; x=1709676756; darn=ffmpeg.org; 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=AydlSf4letThiHNJqbGM7A50qax+b4WC1ievPaI0SmI=; b=jyIq4z+pWugK5LjAarRynRVcJfDC02xq5dLZRL41b5fWcCb5wticSil9oircZPojgT eVnimoL5ffU15+Es8VJl10SuNyaujLZ5fe1XIlzoaqQ9h5+xWt0mOLQ8j2dSGNHqcQiO VtEBOZz3Ye4LceAbKglgTX3dMbRmkYSPiaxw4cG1mwS7PmYRtB6zZrAXAhF6QIdDb+5c CbaLmTZ5GRAX5mEVpbADILtgptxhov9elSTxooQrjjrN7ZGXYc5deSxEafKGvf8oCEOJ WHj95VcGn8QuPTeUSVb618/cITXk07gIPO7BsV3/J4O+ScE9I3j2n7ab118xd0kkkuZE BFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709071956; x=1709676756; 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=AydlSf4letThiHNJqbGM7A50qax+b4WC1ievPaI0SmI=; b=PpnQu7yb5ggHjarCn27uzxuXn3rdfeGhsQs0aapA1CRF4Iv+X+TP8SXm1QcvlM/ZqT Cy85/5rp0CBioIPo/n4TV9WPCgQIAZxutWy5x1Qf0YtaGuSM6f65n++U9/5dTl68Xa5U ynBqnq46kTVkouuWVYgD/zgKlvhrGt2Wx+lcitamKg8Nnz0HNbTIp7sR0iWlpq0Q5qT3 KE5AV7tWcy6cVhhnuOn4hjJAhFKa4f7+J+++n4xd6G4aYM0hczVtAYWEMydPKSdmr7B4 Y6Ks1GotOkL/FTss1Dlp96AHJwBQs6gdBzJ8qRVQUrD2yQ94OmFNoctUsJjHuaMCIU7S ioFw== X-Gm-Message-State: AOJu0YzPCs0eR8sj9lfsx6Blc+4xCBo+ZCUNDI0RV7lwxYWe2VqGGT+G YFgdtDxxrERzJW1N6AmUqk7oZWrzn9kT171Jwe1HaCfzwSX4sm5QXAkoQwrf X-Received: by 2002:a2e:b0e6:0:b0:2d2:6d19:75ff with SMTP id h6-20020a2eb0e6000000b002d26d1975ffmr6123866ljl.50.1709071956417; Tue, 27 Feb 2024 14:12:36 -0800 (PST) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id j9-20020a2e8009000000b002d09bc941e8sm1373564ljg.139.2024.02.27.14.12.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 14:12:36 -0800 (PST) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Feb 2024 00:12:05 +0200 Message-ID: <20240227221226.1377758-3-jeebjp@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240227221226.1377758-1-jeebjp@gmail.com> References: <20240227221226.1377758-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 02/13] avutil/frame: add helper for freeing arrays of side data 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: vJ5aO9GyQWw8 --- libavutil/frame.c | 5 +++++ libavutil/frame.h | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index d94710687b..615dcb1b83 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -90,6 +90,11 @@ static void frame_side_data_wipe(AVFrame *frame) wipe_side_data(&frame->side_data, &frame->nb_side_data); } +void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd) +{ + wipe_side_data(sd, nb_sd); +} + AVFrame *av_frame_alloc(void) { AVFrame *frame = av_malloc(sizeof(*frame)); diff --git a/libavutil/frame.h b/libavutil/frame.h index c0c1b23db7..921f2212cf 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1049,6 +1049,17 @@ int av_frame_apply_cropping(AVFrame *frame, int flags); */ const char *av_frame_side_data_name(enum AVFrameSideDataType type); +/** + * Free all side data entries and their contents, then zeroes out the + * struct values. + * + * @param sd pointer to array of side data to free. Will be set to NULL + * upon return. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. Will be set to 0 upon return. + */ +void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd); + /** * @} */