Submitted By:            Rahul Chandra <rahul AT chandra D0T net>
Date:                    2025-09-05
Initial Package Version: 0.4.62
Upstream Status:         Applied eda8ba51786f197b72265eafcdab407d91ec9c70
Origin:                  Gnome Gitlab
Description:             Fixes building against FFMPEG  8.0

From eda8ba51786f197b72265eafcdab407d91ec9c70 Mon Sep 17 00:00:00 2001
From: Bruno Lopes <brunvonlope@outlook.com>
Date: Fri, 5 Sep 2025 19:46:24 -0300
Subject: [PATCH] operations: Support FFMPEG 8 on ff-load

Closes #428

Patch from https://github.com/msys2/MINGW-packages/pull/25335
---
 operations/external/ff-load.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index a8c266827..babd7f6d6 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -349,7 +349,11 @@ decode_frame (GeglOperation *operation,
   if (frame < 2 || frame > prevframe + 64 || frame < prevframe )
   {
     int64_t seek_target = av_rescale_q (((frame) * AV_TIME_BASE * 1.0) / o->frame_rate
+#if LIBAVCODEC_VERSION_MAJOR < 60
 , AV_TIME_BASE_Q, p->video_stream->time_base) / p->video_ctx->ticks_per_frame;
+#else
+, AV_TIME_BASE_Q, p->video_stream->time_base) / (p->video_ctx->codec_descriptor->props & AV_CODEC_PROP_FIELDS ? 2 : 1);
+#endif
 
     if (av_seek_frame (p->video_fcontext, p->video_index, seek_target, (AVSEEK_FLAG_BACKWARD )) < 0)
       fprintf (stderr, "video seek error!\n");
@@ -403,7 +407,11 @@ decode_frame (GeglOperation *operation,
                   break;
                 }
               got_picture = 1;
+#if LIBAVUTIL_VERSION_MAJOR < 58
               if ((pkt.dts == pkt.pts) || (p->lavc_frame->key_frame!=0))
+#else
+              if ((pkt.dts == pkt.pts) || (p->lavc_frame->flags & AV_FRAME_FLAG_KEY))
+#endif
                 {
                   // cur_dts and first_dts are moved to libavformat/internal.h
                   /*
-- 
GitLab

