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 864AE48F04 for ; Thu, 29 Feb 2024 16:44:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 54ECA68D212; Thu, 29 Feb 2024 18:43:33 +0200 (EET) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8003A68D1D2 for ; Thu, 29 Feb 2024 18:43:22 +0200 (EET) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-51321e71673so1280122e87.2 for ; Thu, 29 Feb 2024 08:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709225002; x=1709829802; 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=b4DtfMau1XK9pX7wduRF82HqDPei5ki+6VYYfzHOMzE=; b=YO+5ELH5bCD1iAp/nnfr2GrycfNF4XB95KsmAgukxonVq+ZmSsGVpiQKt533T98phq Y4HKp0rRNBypYCd26WL5nMKwRIxc8NH3Lop8YB45YE/wBdtVkc3B7zS9y2P4fb55zJKi Yenl+hUzhJEv1kTZcv2YZiHRL73pD+EtX6Hj4BMhNaCxRvIzeLqXBKCzNrFfaHENT87V 8u+0K7FO9oF762eQn52YhammENWbAhvQzROqW9VyzHL+Em9MFup4By6boD9TR5HnyQEs igE+oBCEq3Kg3SQXB5E+TX+fqpLvHxs+gsw2TkOYyy40VpDUPBPlwSvWOaoOkLiC74IQ u+9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709225002; x=1709829802; 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=b4DtfMau1XK9pX7wduRF82HqDPei5ki+6VYYfzHOMzE=; b=RVfDEr67J+btNK8KceI+VtyRaGi1HcGY4rXOdo2ilxklckHYv60ySfM5bteAfrkSZs 4I8IFGbDIgpEizpBQs1A6GZrLfoRNWb4XM4Z3sAtmGmHMrEh3Rt4mlUxs+NwSepH6ghj gSY/dMrhZlefqGROij8Whw+TuoIxJaRFvmK391MZN3n4trNOco8UIDCsTNQP0R0MLyXP PIdEssTYCrY7QHbywfK1u0llFEmAL/Ln+3OzCJ3ZWLPfyizwQ443L1w6OsKTsN3JiCru OMbN1Ojswv/9Sig7k7o8QlE72tcKgwxrEhBM3WVGjLt9z7ggVou8wDVGvDGSOAMm8r+l dBWg== X-Gm-Message-State: AOJu0YzAbIwAOCePCEt3dM4ioa2TpfFhMeoRwtsD8enpcsz8kVVCg1ZJ jTKpDQOglrnfv6B0dIRIrlzunpCre1V4WlhCoSeRJe3lnoWEKsiTx8G3AZhu X-Google-Smtp-Source: AGHT+IGytGweW4ap9BK8jPV56yP3JvUH6AKRyCg96G35UGouxXA2xltb7700sc9Y6KN2NuMiZG2ZcQ== X-Received: by 2002:a05:6512:3e18:b0:512:ee1f:b5af with SMTP id i24-20020a0565123e1800b00512ee1fb5afmr2262423lfv.41.1709225001638; Thu, 29 Feb 2024 08:43:21 -0800 (PST) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id k6-20020ac24566000000b00513290734cbsm206248lfm.292.2024.02.29.08.43.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 08:43:21 -0800 (PST) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Feb 2024 18:42:55 +0200 Message-ID: <20240229164307.3535613-9-jeebjp@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240229164307.3535613-1-jeebjp@gmail.com> References: <20240229164307.3535613-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 08/14] 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 3a2084d1ca..fd4b53f9ff 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -940,16 +940,26 @@ int av_frame_side_data_from_sd(AVFrameSideData ***sd, int *nb_sd, return 0; } -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 908fd4a90d..01311e68eb 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1120,6 +1120,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.44.0 _______________________________________________ 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".