PR #20845 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20845
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20845.patch


From 08d327e92c967f75e024d8a3b0dc8399ab2c0156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 5 Nov 2025 18:50:29 +0100
Subject: [PATCH 1/4] fftools/ffmpeg: suppress unused variable warning, but
 using it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <[email protected]>
---
 fftools/ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 32289112a8..444d027c15 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -250,7 +250,7 @@ void term_init(void)
 /* read a key without blocking */
 static int read_key(void)
 {
-    unsigned char ch;
+    unsigned char ch = -1;
 #if HAVE_TERMIOS_H
     int n = 1;
     struct timeval tv;
@@ -297,7 +297,7 @@ static int read_key(void)
     if(kbhit())
         return(getch());
 #endif
-    return -1;
+    return ch;
 }
 
 static int decode_interrupt_cb(void *ctx)
-- 
2.49.1


From c3ff7d23f5cf1c295cb79ac25569555e12efa6cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 5 Nov 2025 18:51:12 +0100
Subject: [PATCH 2/4] avcodec/dxva2: move variable declaration to for loop to
 avoid warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/dxva2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 22ecd5acaf..a282e6c0c7 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -773,7 +773,6 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext 
*avctx,
                                     int curr)
 {
     void *surface = get_surface(avctx, frame);
-    unsigned i;
 
 #if CONFIG_D3D12VA
     if (avctx->pix_fmt == AV_PIX_FMT_D3D12) {
@@ -790,7 +789,7 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext 
*avctx,
     }
 #endif
 #if CONFIG_DXVA2
-    for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
+    for (unsigned i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
         if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == 
surface)
             return i;
     }
-- 
2.49.1


From f47896422674504d053712a59f42f130c3836e46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 5 Nov 2025 18:51:38 +0100
Subject: [PATCH 3/4] avcodec/vulkan_encode_av1: fix unit_elems check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Wrong enum value was used to check unit_elems. While
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA (11) would trigger when
UNIT_MASTERING_DISPLAY (2) was set, it also would match
UNIT_CONTENT_LIGHT_LEVEL (1) which is not expected.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/vulkan_encode_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vulkan_encode_av1.c b/libavcodec/vulkan_encode_av1.c
index bb47ddd7f1..1f26b37316 100644
--- a/libavcodec/vulkan_encode_av1.c
+++ b/libavcodec/vulkan_encode_av1.c
@@ -1081,7 +1081,7 @@ static int write_extra_headers(AVCodecContext *avctx,
     VulkanEncodeAV1Picture  *ap = base_pic->codec_priv;
     CodedBitstreamFragment *obu = &enc->current_access_unit;
 
-    if (ap->units_needed & AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
+    if (ap->units_needed & UNIT_MASTERING_DISPLAY) {
         err = vulkan_encode_av1_add_obu(avctx, obu,
                                         AV1_OBU_METADATA,
                                         &enc->meta_mastering_obu);
-- 
2.49.1


From 3eb0cb3b0b0c4ad3ca14818adb26e0f2b6fa1c6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 5 Nov 2025 18:58:42 +0100
Subject: [PATCH 4/4] avutil/hwcontext_vulkan: use correct bitmask types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Vulkan headers define *FlagBits enum with individual bit values, and
coresponding *Flags typedef to be used to store the bitmask of
coresponding bits.

In practice those two types map to the same type, but for consistency
*Flags should be used.

Fixes MSVC warnings about type mismatch.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/hwcontext_vulkan.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index f7b487913b..85bae53e5a 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1439,14 +1439,14 @@ static inline int 
pick_queue_family(VkQueueFamilyProperties2 *qf, uint32_t num_q
 
 static inline int pick_video_queue_family(VkQueueFamilyProperties2 *qf,
                                           VkQueueFamilyVideoPropertiesKHR 
*qf_vid, uint32_t num_qf,
-                                          VkVideoCodecOperationFlagBitsKHR 
flags)
+                                          VkVideoCodecOperationFlagsKHR flags)
 {
     int index = -1;
     uint32_t min_score = UINT32_MAX;
 
     for (int i = 0; i < num_qf; i++) {
-        const VkQueueFlagBits qflags = qf[i].queueFamilyProperties.queueFlags;
-        const VkQueueFlagBits vflags = qf_vid[i].videoCodecOperations;
+        const VkQueueFlags qflags = qf[i].queueFamilyProperties.queueFlags;
+        const VkVideoCodecOperationFlagsKHR vflags = 
qf_vid[i].videoCodecOperations;
 
         if (!(qflags & (VK_QUEUE_VIDEO_ENCODE_BIT_KHR | 
VK_QUEUE_VIDEO_DECODE_BIT_KHR)))
             continue;
@@ -2675,7 +2675,7 @@ fail:
 /* Checks if an export flag is enabled, and if it is ORs it with *iexp */
 static void try_export_flags(AVHWFramesContext *hwfc,
                              VkExternalMemoryHandleTypeFlags 
*comp_handle_types,
-                             VkExternalMemoryHandleTypeFlagBits *iexp,
+                             VkExternalMemoryHandleTypeFlags *iexp,
                              VkExternalMemoryHandleTypeFlagBits exp)
 {
     VkResult ret;
@@ -2846,7 +2846,7 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
     AVVulkanFramesContext *hwctx = &fp->p;
     VulkanDevicePriv *p = hwfc->device_ctx->hwctx;
     AVVulkanDeviceContext *dev_hwctx = &p->p;
-    VkImageUsageFlagBits supported_usage;
+    VkImageUsageFlags supported_usage;
     FFVulkanFunctions *vk = &p->vkctx.vkfn;
     const struct FFVkFormatEntry *fmt;
     int disable_multiplane = p->disable_multiplane ||
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to