From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 167CB441AA for ; Wed, 31 Aug 2022 10:45:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BEA4368BB17; Wed, 31 Aug 2022 13:45:38 +0300 (EEST) Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 53F0968BAA0 for ; Wed, 31 Aug 2022 13:45:32 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1661942728; bh=mgVhb3PK+8vc9U2C8ggfIgRvBh1/LhyXiAsQUW7ZZuE=; h=From:To:Cc:Subject:Date; b=xUoy9CptPGvDCo1HonP7HlG5fXwbC34dvGr771OPH58viUk+QaMlL5ifYh0Qh9ji+ z8qFnVCgwl77Y4NS8trKLCsrkp+5zClCCyAJJWYwsEa2Wt4vpgWIGKr3dUTNe/Ecnm Ezy5lCdlNr4xAmgocO4BbDq2D4GPMT5k9yn4kuPM= Received: from localhost.localdomain ([103.107.217.225]) by newxmesmtplogicsvrsza35.qq.com (NewEsmtp) with SMTP id B5A0FE5A; Wed, 31 Aug 2022 18:45:26 +0800 X-QQ-mid: xmsmtpt1661942726tscb14fw8 Message-ID: X-QQ-XMAILINFO: MmpliBmRb3iCQD4xO+tfo1FkX3akOmHWqcDICnb9fxznQ71oKluh96I61Pve/H 1Lg1eIrBj2WTRVH2J2O2PNmWKEhjluFJ0DB71ICyZSzikYSAuNqh09zeJV+z0a3RHE5zCN/hskbg MUO5Au7wUICjY6/Df8JnHasktX+MpHSbi0Mm3QNgZCO/rMwMVyVnASHf2tQa8Ntou1r8QxWc1WS5 Kn3O/2RRwC96X9dMPS8aj6VweOK3+u8BqFAP+sCRpfZrkk6J0kMTjueGWreG5YUI18/ushDI7rW4 agy/W3eMjGw2CN2eDVLkdJu28d8pQ0QgBIMHwp9TfJmupwtLAFVLzjkJXo7S6yxsHyLJOj3to2jI jNTi/r2xeO/bW+4vIxv/ttFpQjv6Sb//NZvXW07xLNqMYHqK4vW7OtWUeHP/GXDHpgNffGXfVz+4 0XHzQlx0WkAbNZDeloUiQR9nmJDvU7J3UP5IXMljYD+0SH9SVjJZFZgQGoDM7l7Zed6MgTO/e6jR uKZTgIknrAHElQDxPK2vjyHOK5fLWOaZy2bC5TEUEyhewUrfI5gT8UFuUIIb2+td6ZtFDC9x8Hhg 5OnQI+CETYWMm3MiftUT0HYmaX5SF2o9qPBDKRW6LNzpFDkQoEdpWCDLFu28vFA8+zYE3qRWRbSi rH6ZSK4m9sazodtcnTQg4nFVV//RUzk8lWjL1BAmY3qhETBtTebczgqnQijDVWyVlOFa1RYvpg8U VSIGSZ0Kzibny02a1ObrtkcMFHFp+CEbR7ibVAqlJgBnB2bVAZjVDUzh0W9CtzdP4ugQUAesHtQc aN4jyshy75HJAQJyDMbRmxM8IeSwn38O9kuPnBRGkKg6fh6zDGlccNRM5nB7WIXsyc12wpnqt4PF qAzZ7fEJyCl3sFi1SZZC0c/0cTiiTGzskXZPtIWMfEzyOeMa7M2QP9TphL5wmZ1WRblKgqW8qCz7 KWSYlFxGNNA22qHAu/GFat+Mh/LgqlbuT5HP3eIcbl6LdoytFDMOqcBx9mmh8nZKU5ZAja/h5KJK 3gpE4pEQ== From: 1035567130@qq.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 31 Aug 2022 18:45:23 +0800 X-OQ-MSGID: <20220831104523.16226-1-1035567130@qq.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffplay: fix rotation incorrect when frame contains the side_data(type is AV_FRAME_DATA_DISPLAYMATRIX) X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wang Yaqiang , 1445440736@qq.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Wang Yaqiang 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 --- fftools/ffplay.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 9242047f5c..868123dc65 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1917,7 +1917,8 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c 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); - + int frame_rotation_checked = 0; + rotation: if (fabs(theta - 90) < 1.0) { INSERT_FILT("transpose", "clock"); } else if (fabs(theta - 180) < 1.0) { @@ -1930,6 +1931,15 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta); INSERT_FILT("rotate", rotate_buf); } + if (!frame_rotation_checked) { + frame_rotation_checked = 1; + AVFrameSideData *sd = av_frame_get_side_data(frame,AV_FRAME_DATA_DISPLAYMATRIX); + if (sd) { + displaymatrix = (int32_t *)sd->data; + theta = get_rotation(displaymatrix); + goto rotation; + } + } } if ((ret = configure_filtergraph(graph, vfilters, filt_src, last_filter)) < 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".