gentoo-ebuilds/media-libs/opencv/files/opencv-4.11.0-ffmpeg8.patch
Paul Zander b8dc6ddcb3
media-libs/opencv: add 4.12.0
Closes: https://bugs.gentoo.org/957618
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43702
Closes: https://github.com/gentoo/gentoo/pull/43702
Signed-off-by: Sam James <sam@gentoo.org>
2025-09-07 22:00:54 +01:00

40 lines
1.4 KiB
Diff

https://github.com/opencv/opencv/pull/27691
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Wed, 20 Aug 2025 10:53:51 +0300
Subject: [PATCH] FFmpeg 8.0 support.
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -685,7 +685,10 @@ void CvCapture_FFMPEG::close()
if( video_st )
{
#ifdef CV_FFMPEG_CODECPAR
+// avcodec_close removed in FFmpeg release 8.0
+# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
avcodec_close( context );
+# endif
#endif
video_st = NULL;
}
@@ -2005,7 +2008,21 @@ void CvCapture_FFMPEG::get_rotation_angle()
rotation_angle = 0;
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(57, 68, 100)
const uint8_t *data = 0;
+ // av_stream_get_side_data removed in FFmpeg release 8.0
+# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+# else
+ AVPacketSideData* sd = video_st->codecpar->coded_side_data;
+ int nb_sd = video_st->codecpar->nb_coded_side_data;
+ if (sd && nb_sd > 0)
+ {
+ const AVPacketSideData* mtx = av_packet_side_data_get(sd, nb_sd, AV_PKT_DATA_DISPLAYMATRIX);
+ if ( mtx != NULL )
+ {
+ data = mtx->data;
+ }
+ }
+# endif
if (data)
{
rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data));