From 871d0930d4c8666df5514093beff874acbe5cce0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 1 Feb 2016 15:56:31 +0100 Subject: nvenc: support CUDA frames as input --- libavcodec/nvenc.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libavcodec/nvenc.h') diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index a0020377e6..c8f0745a19 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -29,8 +29,14 @@ #include "avcodec.h" +#define MAX_REGISTERED_FRAMES 64 + typedef struct NVENCFrame { NV_ENC_INPUT_PTR in; + AVFrame *in_ref; + NV_ENC_MAP_INPUT_RESOURCE in_map; + int reg_idx; + NV_ENC_OUTPUT_PTR out; NV_ENC_BUFFER_FORMAT format; int locked; @@ -104,12 +110,24 @@ typedef struct NVENCContext { NV_ENC_CONFIG config; CUcontext cu_context; + CUcontext cu_context_internal; int nb_surfaces; NVENCFrame *frames; AVFifoBuffer *timestamps; AVFifoBuffer *pending, *ready; + struct { + CUdeviceptr ptr; + NV_ENC_REGISTERED_PTR regptr; + int mapped; + } registered_frames[MAX_REGISTERED_FRAMES]; + int nb_registered_frames; + + /* the actual data pixel format, different from + * AVCodecContext.pix_fmt when using hwaccel frames on input */ + enum AVPixelFormat data_pix_fmt; + /* timestamps of the first two frames, for computing the first dts * when b-frames are present */ int64_t initial_pts[2]; -- cgit v1.2.3