26 #define OFFSET(x) offsetof(NvencContext, x) 
   27 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM 
   47     { 
"level", 
"Set the encoding level restriction", 
OFFSET(
level), 
AV_OPT_TYPE_INT, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_H264_51, 
VE, 
"level" },
 
   48     { 
"auto",     
"",                                     0,                   
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_LEVEL_AUTOSELECT },  0, 0, 
VE,  
"level" },
 
   71     { 
"rc",       
"Override the preset rate-control",     
OFFSET(rc),          
AV_OPT_TYPE_INT,    { .i64 = -1 },                   -1, INT_MAX, 
VE, 
"rc" },
 
   72     { 
"constqp",          
"Constant QP mode",                                                            0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_CONSTQP },              0, 0, 
VE, 
"rc" },
 
   73     { 
"vbr",              
"Variable bitrate mode",                                                       0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_VBR },                  0, 0, 
VE, 
"rc" },
 
   74     { 
"cbr",              
"Constant bitrate mode",                                                       0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_CBR },                  0, 0, 
VE, 
"rc" },
 
   75     { 
"vbr_minqp",        
"Variable bitrate mode with MinQP",                                            0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_VBR_MINQP },            0, 0, 
VE, 
"rc" },
 
   76     { 
"ll_2pass_quality", 
"Multi-pass optimized for image quality (only for low-latency presets)",       0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_2_PASS_QUALITY },       0, 0, 
VE, 
"rc" },
 
   77     { 
"ll_2pass_size",    
"Multi-pass optimized for constant frame size (only for low-latency presets)", 0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP }, 0, 0, 
VE, 
"rc" },
 
   78     { 
"vbr_2pass",        
"Multi-pass variable bitrate mode",                                            0, 
AV_OPT_TYPE_CONST,  { .i64 = NV_ENC_PARAMS_RC_2_PASS_VBR },           0, 0, 
VE, 
"rc" },
 
   79     { 
"surfaces", 
"Number of concurrent surfaces",        
OFFSET(nb_surfaces), 
AV_OPT_TYPE_INT,    { .i64 = 32 },                   0, INT_MAX, 
VE },
 
   82     { 
"gpu", 
"Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", 
OFFSET(device), 
AV_OPT_TYPE_INT, { .i64 = 
ANY_DEVICE }, -2, INT_MAX, 
VE, 
"gpu" },
 
   85     { 
"delay",    
"Delay frame output by the given amount of frames", 
OFFSET(async_depth), 
AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, 
VE },
 
  101 #if FF_API_NVENC_OLD_NAME 
  109 #if CONFIG_NVENC_ENCODER 
  110 static const AVClass nvenc_class = {
 
  126     .priv_class     = &nvenc_class,
 
  127     .defaults       = defaults,
 
  135 #if CONFIG_NVENC_H264_ENCODER 
  136 static const AVClass nvenc_h264_class = {
 
  143 AVCodec ff_nvenc_h264_encoder = {
 
  144     .
name           = 
"nvenc_h264",
 
  152     .priv_class     = &nvenc_h264_class,
 
  153     .defaults       = defaults,
 
  170     .
name           = 
"h264_nvenc",
 
  178     .priv_class     = &h264_nvenc_class,
 
  179     .defaults       = defaults,
 
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
 
av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
 
static av_cold int nvenc_old_init(AVCodecContext *avctx)
 
#define AV_LOG_WARNING
Something somehow does not look correct. 
 
#define LIBAVUTIL_VERSION_INT
 
static const AVClass h264_nvenc_class
 
static const AVCodecDefault defaults[]
 
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
 
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
 
enum AVPixelFormat ff_nvenc_pix_fmts[]
 
AVCodec ff_h264_nvenc_encoder
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
const char * name
Name of the codec implementation. 
 
common internal API header 
 
av_cold int ff_nvenc_encode_init(AVCodecContext *avctx)
 
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
Libavcodec external API header. 
 
main external API structure. 
 
Describe the class of an AVClass context structure. 
 
static enum AVPixelFormat pix_fmts[]
 
common internal api header. 
 
static const AVOption options[]