* [FFmpeg-devel] [PATCH] avcodec/exif: make the get and remove helpers take a flag argument (PR #20324)
@ 2025-08-23 22:55 James Almer via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: James Almer via ffmpeg-devel @ 2025-08-23 22:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: James Almer
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 <jamrial@gmail.com>
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 <jamrial@gmail.com>
---
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".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-23 22:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-23 22:55 [FFmpeg-devel] [PATCH] avcodec/exif: make the get and remove helpers take a flag argument (PR #20324) James Almer via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git