Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack@foxmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v3] fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix
Date: Tue, 06 Sep 2022 14:38:17 +0800
Message-ID: <tencent_A2DEA7C0EABE933A1C458BA2661D508B2606@qq.com> (raw)
In-Reply-To: <tencent_2AB3646595CA47E4273F2379D715BEA9A107@qq.com>

On Mon, 2022-09-05 at 18:40 +0800, 1035567130@qq.com wrote:
> 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 | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 9242047f5c..bcc00afe31 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -1915,8 +1915,14 @@ 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);
> -        double theta = get_rotation(displaymatrix);
> +        double theta = 0.0;
> +        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);
> +        theta = get_rotation(displaymatrix);
>  
>          if (fabs(theta - 90) < 1.0) {
>              INSERT_FILT("transpose", "clock");

LGTM.

_______________________________________________
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".

  reply	other threads:[~2022-09-06  6:38 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 ` [FFmpeg-devel] [PATCH v2] fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix 1035567130
2022-09-01  6:50   ` "zhilizhao(赵志立)"
2022-09-05 10:40   ` [FFmpeg-devel] [PATCH v3] " 1035567130
2022-09-06  6:38     ` Zhao Zhili [this message]
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_A2DEA7C0EABE933A1C458BA2661D508B2606@qq.com \
    --to=quinkblack@foxmail.com \
    --cc=ffmpeg-devel@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