From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 6527E4BAB5 for ; Sat, 23 Aug 2025 22:56:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id CC6C7680135; Sun, 24 Aug 2025 01:55:54 +0300 (EEST) Received: from 0f4167fb2350 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 3E3EF68020E for ; Sun, 24 Aug 2025 01:55:53 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_avcodec/exif=3A_make_the_ge?= =?utf-8?q?t_and_remove_helpers_take_a_flag_argument_=28PR_=2320324=29?= 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: , From: James Almer via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: James Almer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250823225554.CC6C7680135@ffbox0-bg.ffmpeg.org> Date: Sun, 24 Aug 2025 01:55:54 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20324 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20324 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20324.patch This makes the functions extensible, as future behavior change flags can be introduced. This is strictly speaking not an API break. Only if a user was setting recursive to anything other than 1 it would now behave differently, but given these functions have been in the tree for only a few days, the chances for that are practically zero. >From a694126f31c51ab9fdf415408b15c3b0d2c1f208 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 23 Aug 2025 19:52:06 -0300 Subject: [PATCH] avcodec/exif: make the get and remove helpers take a flag argument This makes the functions extensible, as future behavior change flags can be introduced. This is strictly speaking not an API break. Only if a user was setting recursive to anything other than 1 it would now behave differently, but given these functions have been in the tree for only a few days, the chances for that are practically zero. Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavcodec/exif.c | 6 +++--- libavcodec/exif.h | 15 +++++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 81970f17f4..3737bca01b 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2025-08-xx - xxxxxxxx - lavc 62.13.101 - exif.h + Add AV_EXIF_FLAG_RECURSIVE + 2025-08-19 - ad77345a5d1..fe496b0308f - lavc 62.13.100 - exif.h Add: - enum AVTiffDataType, enum AVExifHeaderMode diff --git a/libavcodec/exif.c b/libavcodec/exif.c index 1332fa68bb..441a6778a2 100644 --- a/libavcodec/exif.c +++ b/libavcodec/exif.c @@ -1038,9 +1038,9 @@ static int exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int de return 0; } -int av_exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int recursive, AVExifEntry **value) +int av_exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags, AVExifEntry **value) { - return exif_get_entry(logctx, ifd, id, recursive ? 0 : INT_MAX, value); + return exif_get_entry(logctx, ifd, id, (flags & AV_EXIF_FLAG_RECURSIVE) ? 0 : INT_MAX, value); } int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum AVTiffDataType type, @@ -1129,7 +1129,7 @@ static int exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int recursive) { - return exif_remove_entry(logctx, ifd, id, recursive ? 0 : INT_MAX); + return exif_remove_entry(logctx, ifd, id, (flags & AV_EXIF_FLAG_RECURSIVE) ? 0 : INT_MAX); } AVExifMetadata *av_exif_clone_ifd(const AVExifMetadata *ifd) diff --git a/libavcodec/exif.h b/libavcodec/exif.h index 944d7ee666..1824a38d1c 100644 --- a/libavcodec/exif.h +++ b/libavcodec/exif.h @@ -144,26 +144,29 @@ int32_t av_exif_get_tag_id(const char *name); int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum AVTiffDataType type, uint32_t count, const uint8_t *ifd_lead, uint32_t ifd_offset, const void *value); +/** + * Also check subdirectories. + */ +#define AV_EXIF_FLAG_RECURSIVE (1 << 0) + /** * Get an entry with the tagged ID from the EXIF metadata struct. A pointer to the entry - * will be written into *value. If the recursive flag is set to true, this function will check - * subdirectories as well. + * will be written into *value. * * If the entry was present and returned successfully, a positive number is returned. * If the entry was not found, *value is left untouched and zero is returned. * If an error occurred, a negative number is returned. */ -int av_exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int recursive, AVExifEntry **value); +int av_exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags, AVExifEntry **value); /** - * Remove an entry from the provided EXIF metadata struct. If the recursive flag is set - * to true, then this function will check subdirectories as well. + * Remove an entry from the provided EXIF metadata struct. * * If the entry was present and removed successfully, a positive number is returned. * If the entry was not found, zero is returned. * If an error occurred, a negative number is returned. */ -int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int recursive); +int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags); /** * Decodes the EXIF data provided in the buffer and writes it into the -- 2.49.1 _______________________________________________ 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".