sci-ml/torchvision: fix for ffmpeg8

Closes: https://bugs.gentoo.org/965481
Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
This commit is contained in:
Alfredo Tupone 2025-11-09 09:09:13 +01:00
parent 933e403dee
commit 0ea11ffc78
No known key found for this signature in database
GPG Key ID: FBE5925C5B02CE58
3 changed files with 30 additions and 8 deletions

View File

@ -0,0 +1,14 @@
--- a/torchvision/csrc/io/decoder/video_stream.cpp 2025-11-09 08:27:33.348292544 +0100
+++ b/torchvision/csrc/io/decoder/video_stream.cpp 2025-11-09 08:37:41.401470709 +0100
@@ -122,7 +122,11 @@
void VideoStream::setHeader(DecoderHeader* header, bool flush) {
Stream::setHeader(header, flush);
if (!flush) { // no frames for video flush
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58,7,100)
+ header->keyFrame = frame_->flags & AV_FRAME_FLAG_KEY;
+#else
header->keyFrame = frame_->key_frame;
+#endif
header->fps = av_q2d(av_guess_frame_rate(
inputCtx_, inputCtx_->streams[format_.stream], nullptr));
}

View File

@ -27,13 +27,15 @@ REQUIRED_USE="
"
RDEPEND="
dev-python/numpy
dev-python/pillow
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/pillow[${PYTHON_USEDEP}]
')
jpeg? ( media-libs/libjpeg-turbo:= )
png? ( media-libs/libpng:= )
webp? ( media-libs/libwebp )
ffmpeg? ( media-video/ffmpeg )
sci-ml/caffe2[cuda?,rocm?]
sci-ml/caffe2[cuda?,rocm?,${PYTHON_SINGLE_USEDEP}]
sci-ml/pytorch[${PYTHON_SINGLE_USEDEP}]
"
@ -48,6 +50,8 @@ BDEPEND="
distutils_enable_tests pytest
PATCHES=( "${FILESDIR}"/${PN}-0.24.0-ffmpeg8.patch )
src_prepare() {
# multilib fixes
sed "s/ffmpeg_root, \"lib\"/ffmpeg_root, \"$(get_libdir)\"/" \
@ -84,7 +88,7 @@ python_compile() {
}
python_test() {
rm -rf torchvision || die
rm -r torchvision || die
local EPYTEST_IGNORE=(
test/test_videoapi.py

View File

@ -27,13 +27,15 @@ REQUIRED_USE="
"
RDEPEND="
dev-python/numpy
dev-python/pillow
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/pillow[${PYTHON_USEDEP}]
')
jpeg? ( media-libs/libjpeg-turbo:= )
png? ( media-libs/libpng:= )
webp? ( media-libs/libwebp )
ffmpeg? ( media-video/ffmpeg )
sci-ml/caffe2[cuda?,rocm?]
sci-ml/caffe2[cuda?,rocm?,${PYTHON_SINGLE_USEDEP}]
sci-ml/pytorch[${PYTHON_SINGLE_USEDEP}]
"
@ -48,6 +50,8 @@ BDEPEND="
distutils_enable_tests pytest
PATCHES=( "${FILESDIR}"/${P}-ffmpeg8.patch )
src_prepare() {
# multilib fixes
sed "s/ffmpeg_root, \"lib\"/ffmpeg_root, \"$(get_libdir)\"/" \
@ -84,7 +88,7 @@ python_compile() {
}
python_test() {
rm -rf torchvision || die
rm -r torchvision || die
local EPYTEST_IGNORE=(
test/test_videoapi.py