]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/nvenc.h
Merge commit '755f79f84cbeb5d749fb120e55e0098a2d7663a0'
[ffmpeg] / libavcodec / nvenc.h
index 8007311da1c7bb626fabbca7957aeb3e52f8860f..961cbc7e646ad8a3e3dc86dbbc6952c6bfe8d120 100644 (file)
@@ -29,7 +29,7 @@
 #include "avcodec.h"
 
 #if CONFIG_CUDA
-#include <cuda.h>
+#include "libavutil/hwcontext_cuda.h"
 #else
 
 #if defined(_WIN32)
@@ -77,17 +77,9 @@ typedef NVENCSTATUS (NVENCAPI *PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTIO
 typedef struct NvencDynLoadFunctions
 {
 #if !CONFIG_CUDA
-#if defined(_WIN32)
-    HMODULE cuda_lib;
-#else
-    void* cuda_lib;
-#endif
-#endif
-#if defined(_WIN32)
-    HMODULE nvenc_lib;
-#else
-    void* nvenc_lib;
+    void *cuda;
 #endif
+    void *nvenc;
 
     PCUINIT cu_init;
     PCUDEVICEGETCOUNT cu_device_get_count;
@@ -100,8 +92,6 @@ typedef struct NvencDynLoadFunctions
 
     NV_ENCODE_API_FUNCTION_LIST nvenc_funcs;
     int nvenc_device_count;
-    CUdevice nvenc_devices[16];
-
 } NvencDynLoadFunctions;
 
 enum {
@@ -133,6 +123,11 @@ enum {
     NVENC_TWO_PASSES = 8,
 };
 
+enum {
+    LIST_DEVICES = -2,
+    ANY_DEVICE,
+};
+
 typedef struct NvencContext
 {
     AVClass *avclass;
@@ -144,7 +139,7 @@ typedef struct NvencContext
     CUcontext cu_context;
     CUcontext cu_context_internal;
 
-    int max_surface_count;
+    int nb_surfaces;
     NvencSurface *surfaces;
 
     AVFifoBuffer *output_surface_queue;
@@ -162,7 +157,10 @@ typedef struct NvencContext
      * AVCodecContext.pix_fmt when using hwaccel frames on input */
     enum AVPixelFormat data_pix_fmt;
 
-    int64_t last_dts;
+    /* timestamps of the first two frames, for computing the first dts
+     * when B-frames are present */
+    int64_t initial_pts[2];
+    int first_packet_output;
 
     void *nvencoder;
 
@@ -170,11 +168,12 @@ typedef struct NvencContext
     int profile;
     int level;
     int tier;
+    int rc;
     int cbr;
     int twopass;
-    int gpu;
+    int device;
     int flags;
-    int buffer_delay;
+    int async_depth;
 } NvencContext;
 
 int ff_nvenc_encode_init(AVCodecContext *avctx);