diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-02-01 15:56:31 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-02-14 22:31:47 +0100 |
commit | 871d0930d4c8666df5514093beff874acbe5cce0 (patch) | |
tree | 096ac00185f68c9932489d1e3000b2ffcfd0e4d4 /libavcodec/nvenc.h | |
parent | 7b3214d0050613bd347a2e41c9f78ffb766da25e (diff) | |
download | ffmpeg-streaming-871d0930d4c8666df5514093beff874acbe5cce0.zip ffmpeg-streaming-871d0930d4c8666df5514093beff874acbe5cce0.tar.gz |
nvenc: support CUDA frames as input
Diffstat (limited to 'libavcodec/nvenc.h')
-rw-r--r-- | libavcodec/nvenc.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index a002037..c8f0745 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]; |