PR #23463 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23463
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23463.patch

NV_ENC_CLOCK_TIMESTAMP_SET was changed in SDK 13.1: countingType was replaced 
by countingTypeLSB and countingTypeMSB.


>From 29d5205afe69ed75af71ebf0f440d60f68133bdf Mon Sep 17 00:00:00 2001
From: Diego de Souza <[email protected]>
Date: Thu, 5 Mar 2026 17:06:12 +0100
Subject: [PATCH] avcodec/nvenc: fix compatibility with Video Codec SDK 13.1

NV_ENC_CLOCK_TIMESTAMP_SET was changed in SDK 13.1: countingType was
replaced by countingTypeLSB and countingTypeMSB.

Signed-off-by: Diego de Souza <[email protected]>
Signed-off-by: Timo Rothenpieler <[email protected]>
(cherry picked from commit 0a7c5e507b4448f02ca914c50654a3bc979d02dd)
---
 libavcodec/nvenc.c | 9 ++++++++-
 libavcodec/nvenc.h | 5 +++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 392230526d..5eab67a1fe 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -263,8 +263,10 @@ static void nvenc_map_preset(NvencContext *ctx)
 
 static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
 {
-#if NVENCAPI_CHECK_VERSION(13, 1)
+#if NVENCAPI_CHECK_VERSION(13, 2)
     const char *minver = "(unknown)";
+#elif NVENCAPI_CHECK_VERSION(13, 1)
+    const char *minver = "610.00";
 #elif NVENCAPI_CHECK_VERSION(13, 0)
     const char *minver = "570.0";
 #elif NVENCAPI_CHECK_VERSION(12, 2)
@@ -2526,7 +2528,12 @@ static void nvenc_fill_time_code(AVCodecContext *avctx, 
const AVFrame *frame, NV
             unsigned hh, mm, ss, ff, drop;
             ff_timecode_set_smpte(&drop, &hh, &mm, &ss, &ff, avctx->framerate, 
tc[i + 1], 0, 0);
 
+#ifdef NVENC_NEW_COUNTING_TYPE
+            time_code->clockTimestamp[i].countingTypeLSB = 0;
+            time_code->clockTimestamp[i].countingTypeMSB = 0;
+#else
             time_code->clockTimestamp[i].countingType = 0;
+#endif
             time_code->clockTimestamp[i].discontinuityFlag = 0;
             time_code->clockTimestamp[i].cntDroppedFrames = drop;
             time_code->clockTimestamp[i].nFrames = ff;
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 069ba82bc9..46f1d9f4c4 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -111,6 +111,11 @@ typedef void ID3D11Device;
 #define NVENC_HAVE_MVHEVC
 #endif
 
+// SDK 13.1 compile time feature checks
+#if NVENCAPI_CHECK_VERSION(13, 1)
+#define NVENC_NEW_COUNTING_TYPE
+#endif
+
 typedef struct NvencSurface
 {
     NV_ENC_INPUT_PTR input_surface;
-- 
2.52.0

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

Reply via email to