From: mkver via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: mkver <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/decode: Inline EXIF Orientation tag value (PR #20530)
Date: Mon, 15 Sep 2025 18:23:39 -0000
Message-ID: <175796062001.25.7405766153003853208@463a07221176> (raw)
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 <andreas.rheinhardt@outlook.com>
Date: Mon, 15 Sep 2025 20:10:05 +0200
Subject: [PATCH] avcodec/decode: Inline EXIF Orientation tag value
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-09-15 18:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=175796062001.25.7405766153003853208@463a07221176 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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