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 6A97748DF5 for ; Tue, 27 Feb 2024 22:13:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4EFDE68CD95; Wed, 28 Feb 2024 00:12:54 +0200 (EET) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B14A168CA1A for ; Wed, 28 Feb 2024 00:12:39 +0200 (EET) Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2d27fef509eso45488401fa.3 for ; Tue, 27 Feb 2024 14:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709071958; x=1709676758; 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=SRViwMZmL6BF+MLzeVFgqw1Z53adVywNqfTCQRn1wcE=; b=Js3kb5W1OJvxQNaVWm0DkdsPi5xEe8xyrg6b/ArGV3cSxpy/Wbr5TX4XZkxrDzbhBn 6FwsLiOH5N0bcWkkVs0KV1pYhiEQTVK/wF2cczPggl+kR0KIAziZR28t7oqS02I8ecqj M/nkunKNxq2G51KzsaCPrK7BOIB8mh//nxjZK1y+mXWOMG0e1AfAXIVYl3dSKgfpAACN SnK6spUnqf76Xsy52FqaZAK8VeCHYagTRkmg0Dh/kV/RoCFBoijRDVNGecPpufb27ChV m2a8KklKaBBtwd85ZUrxGPPM0ZhaXRth8JhINRsZjPAA2QtU5htFnv3SA9fZlkJ8ecUQ wcsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709071958; x=1709676758; 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=SRViwMZmL6BF+MLzeVFgqw1Z53adVywNqfTCQRn1wcE=; b=XOk++m33tfKH4ssDtW/IS9SlxyFq6ufqQIdQga5eu3JOC5N/uNrT8k7A7kKTsef+gx 4ScCVhwcuawfah6BcrUHh8NDQtjpqlF5lYTnT7X14DJUNjf64pYDAHzk/iTiHtzadEdB rLnLPnzXcWtZCNORO9z9Yv2X0aRRoXhCxXY9qRDm7++B37hHhbi2b3lBZnGwD+XjRgMH B1SfM+Ji3Dt8CoPqBL8+pxpAMbw+ftKTuXL3U2dV3N59VwV6BgEaEaXSzy7b0vYJGxVG f814I9PIw68Jz/1isQR3Kan7HOm81ZquXDgYcwTSAc68N2cpgG8CYMDxcNwqm6T0h3Zw mblA== X-Gm-Message-State: AOJu0YzmOF5E6JpVt5hpiijOI8uOGeqvUHKgcXi51rkv986iHyO4GkTC 14u/RDTm+HVwLT5+V/0NjUUy7Ee7kfXRWw7einWKRRc/owE6e/Zuyl+fU6Od X-Google-Smtp-Source: AGHT+IHlMKLmiiSkCyNZviVa9E+VS6VX7SdW0SXcFLaiSz/uMUM7gm2wnLyubCW+LTwLj/wB23Wpjg== X-Received: by 2002:a05:651c:1201:b0:2d2:66bf:2c1d with SMTP id i1-20020a05651c120100b002d266bf2c1dmr6432770lja.2.1709071958600; Tue, 27 Feb 2024 14:12:38 -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.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 14:12:38 -0800 (PST) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Feb 2024 00:12:10 +0200 Message-ID: <20240227221226.1377758-8-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 07/13] avutil/frame: add helper for getting side data from array 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 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: --- libavutil/frame.c | 20 +++++++++++++++----- libavutil/frame.h | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index 99c9ce4119..e7679bf34d 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -921,16 +921,26 @@ int av_frame_side_data_from_sd(AVFrameSideData ***sd, int *nb_sd, } } -AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, - enum AVFrameSideDataType type) +const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd, + const int nb_sd, + enum AVFrameSideDataType type) { - for (int i = 0; i < frame->nb_side_data; i++) { - if (frame->side_data[i]->type == type) - return frame->side_data[i]; + for (int i = 0; i < nb_sd; i++) { + if (sd[i]->type == type) + return sd[i]; } return NULL; } +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, + enum AVFrameSideDataType type) +{ + return (AVFrameSideData *)av_frame_side_data_get( + (const AVFrameSideData **)frame->side_data, frame->nb_side_data, + type + ); +} + static int frame_copy_video(AVFrame *dst, const AVFrame *src) { int planes; diff --git a/libavutil/frame.h b/libavutil/frame.h index 47d0096bc4..751f7a67d6 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1100,6 +1100,20 @@ int av_frame_side_data_from_sd(AVFrameSideData ***sd, int *nb_sd, const AVFrameSideData *src, unsigned int flags); +/** + * Get a side data entry of a specific type from a set. + * + * @param sd array of side data. + * @param nb_sd integer containing the number of entries in the array. + * @param type type of side data to be queried + * + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this set. + */ +const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd, + const int nb_sd, + enum AVFrameSideDataType type); + /** * @} */ -- 2.43.2 _______________________________________________ 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".