1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

avcodec/decode: remove Exif Orientation tag after adding it as display matrix

Don't replace it with a conflicting value.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-08-20 13:03:21 -03:00
committed by Leo Izen
parent 5a9e5d8031
commit 5ed1d72792

View File

@@ -2290,24 +2290,22 @@ static int exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, const AVExifMe
if (ret < 0) { if (ret < 0) {
av_log(avctx, AV_LOG_WARNING, "unable to attach displaymatrix from EXIF\n"); av_log(avctx, AV_LOG_WARNING, "unable to attach displaymatrix from EXIF\n");
} else { } else {
const AVExifEntry *cloned_orient;
cloned = av_exif_clone_ifd(ifd); cloned = av_exif_clone_ifd(ifd);
if (!cloned) { if (!cloned) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto end; goto end;
} }
// will have the same offset in the clone as in the original av_exif_remove_entry(avctx, cloned, orient->id, 0);
cloned_orient = &cloned->entries[orient - ifd->entries]; ifd = cloned;
cloned_orient->value.uint[0] = 1;
} }
} }
ret = av_exif_ifd_to_dict(avctx, cloned ? cloned : ifd, &frame->metadata); ret = av_exif_ifd_to_dict(avctx, ifd, &frame->metadata);
if (ret < 0) if (ret < 0)
goto end; goto end;
if (cloned || !og) { if (cloned || !og) {
ret = av_exif_write(avctx, cloned ? cloned : ifd, &written, AV_EXIF_TIFF_HEADER); ret = av_exif_write(avctx, ifd, &written, AV_EXIF_TIFF_HEADER);
if (ret < 0) if (ret < 0)
goto end; goto end;
} }