mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 20:50:25 +08:00
Merge pull request #22089 from tailsu:sd/fix-displaymatrix-orientation
This commit is contained in:
commit
b19683eb41
@ -1840,7 +1840,7 @@ void CvCapture_FFMPEG::get_rotation_angle()
|
|||||||
data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
|
data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
rotation_angle = cvRound(av_display_rotation_get((const int32_t*)data));
|
rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data));
|
||||||
if (rotation_angle < 0)
|
if (rotation_angle < 0)
|
||||||
rotation_angle += 360;
|
rotation_angle += 360;
|
||||||
}
|
}
|
||||||
|
@ -413,6 +413,11 @@ TEST(videoio, mp4_orientation_meta_auto)
|
|||||||
EXPECT_NO_THROW(cap.open(video_file, CAP_FFMPEG));
|
EXPECT_NO_THROW(cap.open(video_file, CAP_FFMPEG));
|
||||||
ASSERT_TRUE(cap.isOpened()) << "Can't open the video: " << video_file << " with backend " << CAP_FFMPEG << std::endl;
|
ASSERT_TRUE(cap.isOpened()) << "Can't open the video: " << video_file << " with backend " << CAP_FFMPEG << std::endl;
|
||||||
|
|
||||||
|
#ifndef _WIN32 // TODO: FFmpeg wrapper update
|
||||||
|
// related issue: https://github.com/opencv/opencv/issues/22088
|
||||||
|
EXPECT_EQ(90, cap.get(CAP_PROP_ORIENTATION_META));
|
||||||
|
#endif
|
||||||
|
|
||||||
cap.set(CAP_PROP_ORIENTATION_AUTO, true);
|
cap.set(CAP_PROP_ORIENTATION_AUTO, true);
|
||||||
if (cap.get(CAP_PROP_ORIENTATION_AUTO) == 0)
|
if (cap.get(CAP_PROP_ORIENTATION_AUTO) == 0)
|
||||||
throw SkipTestException("FFmpeg frame rotation metadata is not supported");
|
throw SkipTestException("FFmpeg frame rotation metadata is not supported");
|
||||||
|
Loading…
Reference in New Issue
Block a user