#include "avcodec.h"
#if CONFIG_CUDA
-#include <cuda.h>
+#include "libavutil/hwcontext_cuda.h"
#else
#if defined(_WIN32)
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;
NV_ENCODE_API_FUNCTION_LIST nvenc_funcs;
int nvenc_device_count;
- CUdevice nvenc_devices[16];
-
} NvencDynLoadFunctions;
enum {
NVENC_TWO_PASSES = 8,
};
+enum {
+ LIST_DEVICES = -2,
+ ANY_DEVICE,
+};
+
typedef struct NvencContext
{
AVClass *avclass;
CUcontext cu_context;
CUcontext cu_context_internal;
- int max_surface_count;
+ int nb_surfaces;
NvencSurface *surfaces;
AVFifoBuffer *output_surface_queue;
* 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;
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);