From: 1035567130@qq.com
To: ffmpeg-devel@ffmpeg.org
Cc: Wang Yaqiang <wangyaqiang03@kuaishou.com>
Subject: [FFmpeg-devel] [PATCH v2] fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix
Date: Thu, 1 Sep 2022 12:53:03 +0800
Message-ID: <tencent_4BE40C958547BAA76D2330572A3E95A1E607@qq.com> (raw)
In-Reply-To: <tencent_9AE43C1590C7E727332365D73BBE8C21AB07@qq.com>
From: Wang Yaqiang <wangyaqiang03@kuaishou.com>
For example, if the jpeg contains exif information
and the rotation direction is included in the exif,
the displaymatrix will be set on the side_data of the frame when decoding.
However, when ffplay is used to play the image,
only the side data in the stream will be determined.
It does not check whether the frame also contains rotation information,
causing it to play in the wrong direction
Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
---
fftools/ffplay.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 9242047f5c..5bda29169d 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1915,7 +1915,12 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
} while (0)
if (autorotate) {
- int32_t *displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+ int32_t *displaymatrix = NULL;
+ AVFrameSideData *sd = av_frame_get_side_data(frame,AV_FRAME_DATA_DISPLAYMATRIX);
+ if (sd)
+ displaymatrix = (int32_t *)sd->data;
+ if (!displaymatrix)
+ displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = get_rotation(displaymatrix);
if (fabs(theta - 90) < 1.0) {
--
2.33.0
_______________________________________________
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".
next prev parent reply other threads:[~2022-09-01 4:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 10:45 [FFmpeg-devel] [PATCH] fftools/ffplay: fix rotation incorrect when frame contains the side_data(type is AV_FRAME_DATA_DISPLAYMATRIX) 1035567130
2022-08-31 16:34 ` Zhao Zhili
2022-09-01 1:17 ` Steven Liu
2022-09-01 1:24 ` Steven Liu
2022-09-01 3:59 ` wangyaqiang
2022-09-01 4:04 ` wangyaqiang
2022-09-01 4:29 ` Steven Liu
2022-09-01 4:53 ` 1035567130 [this message]
2022-09-01 6:50 ` [FFmpeg-devel] [PATCH v2] fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix "zhilizhao(赵志立)"
2022-09-05 10:40 ` [FFmpeg-devel] [PATCH v3] " 1035567130
2022-09-06 6:38 ` Zhao Zhili
2022-09-15 8:59 ` Steven Liu
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=tencent_4BE40C958547BAA76D2330572A3E95A1E607@qq.com \
--to=1035567130@qq.com \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=wangyaqiang03@kuaishou.com \
/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