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 6EF3A49DE3 for ; Mon, 11 Mar 2024 21:00:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1860768D14A; Mon, 11 Mar 2024 22:59:01 +0200 (EET) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CDA468D100 for ; Mon, 11 Mar 2024 22:58:49 +0200 (EET) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-512b3b04995so3747632e87.3 for ; Mon, 11 Mar 2024 13:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710190728; x=1710795528; 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=d3MtCUCOihj3VKTQqRWzPEObCrL2n3nz5OOEwI2agUs=; b=Rfo9uO7Wf3EImu+wTcyeg3ZiA1fjnWOGFmsmQ/0WnlZTikegh2iH7XOa8/uQxSki5S HgG8IjV9FZHpse13LYqX+1lTjPFK1n4lvUxs4kzYjvOatWEaBHOlsFQmJgUp+0NO6ddA T0f71mhwvX4W2of1vk+LOepEUPp9LcF+5XRG1V6eyFLUSczfuxrhr18WhohjpIHWu/9y JheGlZ4+WzMU+NkQjh0A9Wwh1iQOclRitOVkNZDFtvLMTdkHyN/4EMpnEVfi4QbjrY92 tmai7ntwED5A+VmLzm68Rh3V8UoDC7Dz/npS/wCkFcnnSaWYH3QmpbeGNiY5t/2v4aox g3ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710190728; x=1710795528; 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=d3MtCUCOihj3VKTQqRWzPEObCrL2n3nz5OOEwI2agUs=; b=tUnpIOONlpNV12a3bK2q7cgfo/OFcA52mJfWfHlq8p++XtXmLvEwvcmBtzRU2+Gpu7 9mE3dF5X9Gm0876hnwNAC4alu26lFTHKERd+zaA8eNXxT9CXrFRaG8kJaOX2Zo4fjbJs mL2Q8co70+Z+HCMGA5gy0LvBcT0+2WYcxGjeHHuX7Q9ZfU6IsvYFwK3CzI5bflQv0dzy A33gx8/Xn04TIFDDdqP8wf7y+gqWMSNmIt8shj3xtvxIOK7J9slMJn5senUOp/6dpsw3 WXKGioGubTU0nkzm1uXMGB8YocNjzuFr4YGCwKe1lyBoMdDOBCDeVsXF9QG2L2qs6J9h ncrQ== X-Gm-Message-State: AOJu0YwHMxiK4mziCvZOqKdtj1hMAeWGARCIiQVtSnD5LALwkuYxCYn2 PtzvxdHhaDVvrXmBW9lse8t2ODIbhmvwwdMC+7E0RiSUOUynW4SOI8X1YmeS X-Google-Smtp-Source: AGHT+IEMszTo39wf3rWM00zKhuLUVcFmKqyaCC0ntsVAY9e1sysLEt6F0iPCP8PKKB6DDiyq1N7FaA== X-Received: by 2002:a05:6512:238f:b0:513:b8c0:faa8 with SMTP id c15-20020a056512238f00b00513b8c0faa8mr147456lfv.65.1710190728438; Mon, 11 Mar 2024 13:58:48 -0700 (PDT) Received: from maomao.mshome.net (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id c17-20020ac25f71000000b0051333104075sm1249247lfc.259.2024.03.11.13.58.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 13:58:48 -0700 (PDT) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Mar 2024 22:58:31 +0200 Message-ID: <20240311205844.3569895-9-jeebjp@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311205844.3569895-1-jeebjp@gmail.com> References: <20240311205844.3569895-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v8 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 30db83a5e5..47ecd964b8 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -830,16 +830,26 @@ int av_frame_side_data_clone(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 a7e62ded15..e59f033cce 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -1062,6 +1062,20 @@ AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, const AVFrameSideData *src, unsigned int flags); +/** + * Get a side data entry of a specific type from an array. + * + * @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".