summaryrefslogtreecommitdiffstats
path: root/multimedia/obs-studio/patches/2_92fc9f6.patch
blob: db0221d0a96f2c66a67a5bd1384c11bc4a7b5efd (plain)
From 92fc9f69ccff2cb12bb8ef877e9238f5d46588a8 Mon Sep 17 00:00:00 2001
From: Stephen Seo <seo.disparate@gmail.com>
Date: Wed, 29 Nov 2023 22:08:42 +0900
Subject: [PATCH] deps/media-playback: In check for key-frame, use new FFmpeg
 6.1 API

Fixes for using FFmpeg 6.1 due to deprecations. Uses `#if` macros to
allow builds for using older versions of FFmpeg.

AVFrame.key_frame was replaced with a flag in AVFrame.flags. The commit
adding the flag is [1] in FFmpeg's repository, and the deprecation is in
commit [2].

In summary of the "key_frame" change, AVFrame.key_frame is deprecated,
and AVFrame.flags indicates with a bit flag if it is a key frame (with
the enum/defined AV_FRAME_FLAG_KEY).

[1]: avutil/frame: add a keyframe flag to AVFrame
https://github.com/FFmpeg/FFmpeg/commit/cc11191fda0471017b03c1434d6d8cb79f6914e5

[2]: avutil/frame: deprecate key_frame
https://github.com/FFmpeg/FFmpeg/commit/3e06f6f04020bef32fa42bc9d7f96e76a46453aa
---
 deps/media-playback/media-playback/media.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/deps/media-playback/media-playback/media.c b/deps/media-playback/media-playback/media.c
index 566eb9e35c9ef..07b040dd8235c 100644
--- a/deps/media-playback/media-playback/media.c
+++ b/deps/media-playback/media-playback/media.c
@@ -504,7 +504,12 @@ void mp_media_next_video(mp_media_t *m, bool preload)
 	}
 
 	if (!m->is_local_file && !d->got_first_keyframe) {
+
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(58, 29, 100)
 		if (!f->key_frame)
+#else
+		if (!(f->flags & AV_FRAME_FLAG_KEY))
+#endif
 			return;
 
 		d->got_first_keyframe = true;