PR #20530 opened by mkver URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20530 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20530.patch
>From 2438cd28d45abb2d100f6b672f0e558e807a6714 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Mon, 15 Sep 2025 20:10:05 +0200 Subject: [PATCH] avcodec/decode: Inline EXIF Orientation tag value Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/decode.c | 3 ++- libavcodec/exif.c | 5 ++--- libavcodec/exif_internal.h | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index ae86e270df..3d9b91a228 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -48,6 +48,7 @@ #include "codec_internal.h" #include "decode.h" #include "exif.h" +#include "exif_internal.h" #include "hwaccel_internal.h" #include "hwconfig.h" #include "internal.h" @@ -2360,7 +2361,7 @@ static int exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, const AVExifMe for (size_t i = 0; i < ifd->count; i++) { const AVExifEntry *entry = &ifd->entries[i]; - if (entry->id == av_exif_get_tag_id("Orientation") && + if (entry->id == EXIF_ORIENTATION_TAG && entry->count > 0 && entry->type == AV_TIFF_SHORT) { orient = entry; break; diff --git a/libavcodec/exif.c b/libavcodec/exif.c index f9ad3e1bdb..5c9a84420d 100644 --- a/libavcodec/exif.c +++ b/libavcodec/exif.c @@ -47,7 +47,6 @@ #define EXIF_TAG_NAME_LENGTH 32 #define MAKERNOTE_TAG 0x927c -#define ORIENTATION_TAG 0x112 #define EXIFIFD_TAG 0x8769 #define IMAGE_WIDTH_TAG 0x100 #define IMAGE_LENGTH_TAG 0x101 @@ -1250,7 +1249,7 @@ int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, AVExifMetadata *ifd for (size_t i = 0; i < ifd->count; i++) { AVExifEntry *entry = &ifd->entries[i]; - if (entry->id == ORIENTATION_TAG && entry->count > 0 && entry->type == AV_TIFF_SHORT) { + if (entry->id == EXIF_ORIENTATION_TAG && entry->count > 0 && entry->type == AV_TIFF_SHORT) { or = entry; continue; } @@ -1300,7 +1299,7 @@ int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, AVExifMetadata *ifd } if (!or && orientation != 1) { rewrite = 1; - ret = av_exif_set_entry(logctx, ifd, ORIENTATION_TAG, AV_TIFF_SHORT, 1, NULL, 0, &orientation); + ret = av_exif_set_entry(logctx, ifd, EXIF_ORIENTATION_TAG, AV_TIFF_SHORT, 1, NULL, 0, &orientation); if (ret < 0) goto end; } diff --git a/libavcodec/exif_internal.h b/libavcodec/exif_internal.h index c0d2b3ef62..6c3ae3becb 100644 --- a/libavcodec/exif_internal.h +++ b/libavcodec/exif_internal.h @@ -36,6 +36,8 @@ #include "exif.h" #include "version_major.h" +#define EXIF_ORIENTATION_TAG 0x112 + #if LIBAVCODEC_VERSION_MAJOR < 63 /* Used by the AVI demuxer */ int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size, -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
