[FFmpeg-devel] [PATCH] avcodec/nvenc: Drop support for old nvenc api

timo at rothenpieler.org timo at rothenpieler.org
Tue Mar 24 09:56:31 CET 2015


From: Timo Rothenpieler <timo at rothenpieler.org>

---
 libavcodec/nvenc.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 22956b9..7d04afc 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -36,6 +36,10 @@
 #include "internal.h"
 #include "thread.h"
 
+#if NVENCAPI_MAJOR_VERSION < 5
+#error "NVENC API 4 or older is not supported"
+#endif
+
 #if defined(_WIN32)
 #define CUDAAPI __stdcall
 #else
@@ -67,10 +71,6 @@ typedef CUresult(CUDAAPI *PCUCTXDESTROY)(CUcontext ctx);
 
 typedef NVENCSTATUS (NVENCAPI* PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTION_LIST *functionList);
 
-#if NVENCAPI_MAJOR_VERSION < 5
-static const GUID dummy_license = { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } };
-#endif
-
 typedef struct NvencInputSurface
 {
     NV_ENC_INPUT_PTR input_surface;
@@ -474,10 +474,6 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
     int res = 0;
     int dw, dh;
 
-#if NVENCAPI_MAJOR_VERSION < 5
-    GUID license = dummy_license;
-#endif
-
     NvencContext *ctx = avctx->priv_data;
     NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
     NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
@@ -500,10 +496,6 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
     encode_session_params.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER;
     encode_session_params.apiVersion = NVENCAPI_VERSION;
 
-#if NVENCAPI_MAJOR_VERSION < 5
-    encode_session_params.clientKeyPtr = &license;
-#endif
-
     if (ctx->gpu >= dl_fn->nvenc_device_count) {
         av_log(avctx, AV_LOG_FATAL, "Requested GPU %d, but only %d GPUs are available!\n", ctx->gpu, dl_fn->nvenc_device_count);
         res = AVERROR(EINVAL);
@@ -1108,10 +1100,6 @@ static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         pic_params.codecPicParams.h264PicParams.sliceMode = ctx->encode_config.encodeCodecConfig.h264Config.sliceMode;
         pic_params.codecPicParams.h264PicParams.sliceModeData = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;
 
-#if NVENCAPI_MAJOR_VERSION < 5
-        memcpy(&pic_params.rcParams, &ctx->encode_config.rcParams, sizeof(NV_ENC_RC_PARAMS));
-#endif
-
         res = timestamp_queue_enqueue(&ctx->timestamp_list, frame->pts);
 
         if (res)
-- 
2.3.3



More information about the ffmpeg-devel mailing list