nvcodec: Update for documentation

* Add Since marks
* Make use of GST_PARAM_CONDITIONALLY_AVAILABLE flag
* Add documentation template caps
This commit is contained in:
Seungha Yang 2020-06-09 01:30:39 +09:00 committed by Mathieu Duponchelle
parent db0ab58e14
commit 76793ffabc
5 changed files with 351 additions and 75 deletions

View file

@ -208108,12 +208108,12 @@
"long-name": "NVENC H.264 Video Encoder",
"pad-templates": {
"sink": {
"caps": "video/x-raw:\n format: { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA }\n width: [ 33, 4096 ]\n height: [ 17, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n interlace-mode: { (string)progressive, (string)interleaved, (string)mixed }\n\nvideo/x-raw(memory:GLMemory):\n format: { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA }\n width: [ 33, 4096 ]\n height: [ 17, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n interlace-mode: { (string)progressive, (string)interleaved, (string)mixed }\n",
"caps": "video/x-raw:\n format: { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA }\n width: [ 145, 4096 ]\n height: [ 49, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n interlace-mode: { (string)progressive }\n\nvideo/x-raw(memory:GLMemory):\n format: { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA }\n width: [ 145, 4096 ]\n height: [ 49, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n interlace-mode: { (string)progressive }\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-h264:\n width: [ 33, 4096 ]\n height: [ 17, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n stream-format: byte-stream\n alignment: au\n profile: { (string)main, (string)high, (string)high-4:4:4, (string)baseline }\n",
"caps": "video/x-h264:\n width: [ 145, 4096 ]\n height: [ 49, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n stream-format: byte-stream\n alignment: au\n profile: { (string)main, (string)high, (string)high-4:4:4, (string)baseline }\n",
"direction": "src",
"presence": "always"
}
@ -208132,8 +208132,8 @@
"writable": true
},
"b-adapt": {
"blurb": "Enable adaptive B-frame insert when lookahead is enabled (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Enable adaptive B-frame insert when lookahead is enabled",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208144,8 +208144,8 @@
"writable": true
},
"bframes": {
"blurb": "Number of B-frames between I and P (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Number of B-frames between I and P",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208158,8 +208158,8 @@
"writable": true
},
"rc-lookahead": {
"blurb": "Number of frames for frame type lookahead (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Number of frames for frame type lookahead",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208172,8 +208172,8 @@
"writable": true
},
"temporal-aq": {
"blurb": "Temporal Adaptive Quantization (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Temporal Adaptive Quantization",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208184,8 +208184,8 @@
"writable": true
},
"vbv-buffer-size": {
"blurb": "VBV(HRD) Buffer Size in kbits (0 = NVENC default) (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "VBV(HRD) Buffer Size in kbits (0 = NVENC default)",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208198,8 +208198,8 @@
"writable": true
},
"weighted-pred": {
"blurb": "Weighted Prediction (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Weighted Prediction",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208257,12 +208257,12 @@
"long-name": "NVDEC h265 Video Decoder",
"pad-templates": {
"sink": {
"caps": "video/x-h265:\n stream-format: byte-stream\n alignment: au\n profile: { (string)main, (string)main-10, (string)main-12 }\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n",
"caps": "video/x-h265:\n stream-format: byte-stream\n alignment: au\n profile: { (string)main, (string)main-10, (string)main-12, (string)main-444, (string)main-444-10, (string)main-444-12 }\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-raw:\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12, P010_10LE, P016_LE }\n\nvideo/x-raw(memory:GLMemory):\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12, P010_10LE, P016_LE }\n",
"caps": "video/x-raw:\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }\n\nvideo/x-raw(memory:GLMemory):\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }\n",
"direction": "src",
"presence": "always"
}
@ -208289,12 +208289,12 @@
"long-name": "NVENC HEVC Video Encoder",
"pad-templates": {
"sink": {
"caps": "video/x-raw:\n format: { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA, P010_10LE, BGR10A2_LE, RGB10A2_LE, Y444_16LE }\n width: [ 65, 8192 ]\n height: [ 33, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n interlace-mode: { (string)progressive }\n\nvideo/x-raw(memory:GLMemory):\n format: { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA, P010_10LE, BGR10A2_LE, RGB10A2_LE, Y444_16LE }\n width: [ 65, 8192 ]\n height: [ 33, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n interlace-mode: { (string)progressive }\n",
"caps": "video/x-raw:\n format: { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n\nvideo/x-raw(memory:GLMemory):\n format: { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-h265:\n width: [ 65, 8192 ]\n height: [ 33, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n stream-format: byte-stream\n alignment: au\n profile: { (string)main, (string)main-10, (string)main-444 }\n",
"caps": "video/x-h265:\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n stream-format: byte-stream\n alignment: au\n profile: { (string)main, (string)main-10, (string)main-12, (string)main-444, (string)main-444-10, (string)main-444-12 }\n",
"direction": "src",
"presence": "always"
}
@ -208312,9 +208312,35 @@
"type": "gboolean",
"writable": true
},
"b-adapt": {
"blurb": "Enable adaptive B-frame insert when lookahead is enabled",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "false",
"mutable": "ready",
"readable": true,
"type": "gboolean",
"writable": true
},
"bframes": {
"blurb": "Number of B-frames between I and P",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "0",
"max": "5",
"min": "0",
"mutable": "ready",
"readable": true,
"type": "guint",
"writable": true
},
"rc-lookahead": {
"blurb": "Number of frames for frame type lookahead (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Number of frames for frame type lookahead",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208326,9 +208352,21 @@
"type": "guint",
"writable": true
},
"temporal-aq": {
"blurb": "Temporal Adaptive Quantization",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "false",
"mutable": "playing",
"readable": true,
"type": "gboolean",
"writable": true
},
"vbv-buffer-size": {
"blurb": "VBV(HRD) Buffer Size in kbits (0 = NVENC default) (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "VBV(HRD) Buffer Size in kbits (0 = NVENC default)",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208341,8 +208379,8 @@
"writable": true
},
"weighted-pred": {
"blurb": "Weighted Prediction (Exposed only if supported by device)",
"conditionally-available": false,
"blurb": "Weighted Prediction",
"conditionally-available": true,
"construct": false,
"construct-only": false,
"controllable": false,
@ -208355,6 +208393,35 @@
},
"rank": "primary + 256"
},
"nvh265sldec": {
"author": "Seungha Yang <seungha@centricular.com>",
"description": "Nvidia H.265 video decoder",
"hierarchy": [
"GstNvH265StatelessDec",
"GstNvH265Dec",
"GstH265Decoder",
"GstVideoDecoder",
"GstElement",
"GstObject",
"GInitiallyUnowned",
"GObject"
],
"klass": "Codec/Decoder/Video/Hardware",
"long-name": "NVDEC H.265 Stateless Decoder",
"pad-templates": {
"sink": {
"caps": "video/x-h265:\n stream-format: { (string)hev1, (string)hvc1, (string)byte-stream }\n alignment: au\n profile: { (string)main, (string)main-10, (string)main-12, (string)main-444, (string)main-444-10, (string)main-444-12 }\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-raw:\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }\n\nvideo/x-raw(memory:GLMemory):\n width: [ 144, 8192 ]\n height: [ 144, 8192 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }\n",
"direction": "src",
"presence": "always"
}
},
"rank": "secondary"
},
"nvjpegdec": {
"author": "Ericsson AB, http://www.ericsson.com, Seungha Yang <seungha.yang@navercorp.com>",
"description": "NVDEC video decoder",
@ -208467,6 +208534,34 @@
},
"rank": "primary"
},
"nvvp8dec": {
"author": "Ericsson AB, http://www.ericsson.com, Seungha Yang <seungha.yang@navercorp.com>",
"description": "NVDEC video decoder",
"hierarchy": [
"nvvp8dec",
"GstNvDec",
"GstVideoDecoder",
"GstElement",
"GstObject",
"GInitiallyUnowned",
"GObject"
],
"klass": "Codec/Decoder/Video/Hardware",
"long-name": "NVDEC vp8 Video Decoder",
"pad-templates": {
"sink": {
"caps": "video/x-vp8:\n width: [ 48, 4096 ]\n height: [ 16, 4096 ]\n",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "video/x-raw:\n width: [ 48, 4096 ]\n height: [ 16, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12 }\n\nvideo/x-raw(memory:GLMemory):\n width: [ 48, 4096 ]\n height: [ 16, 4096 ]\n framerate: [ 0/1, 2147483647/1 ]\n format: { NV12 }\n",
"direction": "src",
"presence": "always"
}
},
"rank": "primary"
},
"nvvp9dec": {
"author": "Ericsson AB, http://www.ericsson.com, Seungha Yang <seungha.yang@navercorp.com>",
"description": "NVDEC video decoder",
@ -208904,6 +208999,18 @@
],
"kind": "object"
},
"GstNvH265Dec": {
"hierarchy": [
"GstNvH265Dec",
"GstH265Decoder",
"GstVideoDecoder",
"GstElement",
"GstObject",
"GInitiallyUnowned",
"GObject"
],
"kind": "object"
},
"GstNvPreset": {
"kind": "enum",
"values": [

View file

@ -165,6 +165,12 @@ gst_nv_h264_dec_class_init (GstNvH264DecClass * klass)
GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_CLASS (klass);
GstH264DecoderClass *h264decoder_class = GST_H264_DECODER_CLASS (klass);
/**
* GstNvH264Dec
*
* Since: 1.18
*/
object_class->finalize = gst_nv_h264_decoder_finalize;
element_class->set_context = GST_DEBUG_FUNCPTR (gst_nv_h264_dec_set_context);
@ -827,6 +833,12 @@ gst_nv_h264_dec_register (GstPlugin * plugin, guint device_id, guint rank,
const GValue *value;
GstStructure *s;
/**
* element-nvh264sldec
*
* Since: 1.18
*/
cdata = g_new0 (GstNvH264DecClassData, 1);
cdata->sink_caps = gst_caps_from_string ("video/x-h264, "
"stream-format= (string) { avc, avc3, byte-stream }, "

View file

@ -59,6 +59,27 @@ enum
#define DEFAULT_BFRAMES 0
#define DEFAULT_B_ADAPT FALSE
/* captured using RTX 2080 */
#define DOCUMENTATION_SINK_CAPS_COMM \
"format = (string) { NV12, YV12, I420, BGRA, RGBA, Y444, VUYA }, " \
"width = (int) [ 145, 4096 ], " \
"height = (int) [ 49, 4096 ], " \
"framerate = " GST_VIDEO_FPS_RANGE ", " \
"interlace-mode = (string) { progressive } "
#define DOCUMENTATION_SINK_CAPS \
"video/x-raw, " DOCUMENTATION_SINK_CAPS_COMM "; " \
"video/x-raw(memory:GLMemory), " DOCUMENTATION_SINK_CAPS_COMM
#define DOCUMENTATION_SRC_CAPS \
"video/x-h264, " \
"width = (int) [ 145, 4096 ], " \
"height = (int) [ 49, 4096 ], " \
"framerate = " GST_VIDEO_FPS_RANGE ", " \
"stream-format = (string) byte-stream, " \
"alignment = (string) au, " \
"profile = (string) { main, high, high-4:4:4, baseline }"
static gboolean gst_nv_h264_enc_open (GstVideoEncoder * enc);
static gboolean gst_nv_h264_enc_close (GstVideoEncoder * enc);
static gboolean gst_nv_h264_enc_set_src_caps (GstNvBaseEnc * nvenc,
@ -83,6 +104,8 @@ gst_nv_h264_enc_class_init (GstNvH264EncClass * klass, gpointer data)
GstNvEncDeviceCaps *device_caps = &nvenc_class->device_caps;
GstNvH264EncClassData *cdata = (GstNvH264EncClassData *) data;
gchar *long_name;
GstPadTemplate *pad_templ;
GstCaps *doc_caps;
parent_class = g_type_class_peek_parent (klass);
@ -98,6 +121,13 @@ gst_nv_h264_enc_class_init (GstNvH264EncClass * klass, gpointer data)
nvenc_class->set_src_caps = gst_nv_h264_enc_set_src_caps;
nvenc_class->set_pic_params = gst_nv_h264_enc_set_pic_params;
/**
* GstNvH264Enc:aud:
*
* Use AU (Access Unit) delimiter
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_AUD,
g_param_spec_boolean ("aud", "AUD",
"Use AU (Access Unit) delimiter", DEFAULT_AUD,
@ -105,60 +135,96 @@ gst_nv_h264_enc_class_init (GstNvH264EncClass * klass, gpointer data)
G_PARAM_STATIC_STRINGS));
if (device_caps->weighted_prediction) {
/**
* GstNvH264Enc:weighted-pred:
*
* Weighted Prediction
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_WEIGHTED_PRED,
g_param_spec_boolean ("weighted-pred", "Weighted Pred",
"Weighted Prediction "
"(Exposed only if supported by device)", DEFAULT_WEIGHTED_PRED,
"Weighted Prediction", DEFAULT_WEIGHTED_PRED,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->custom_vbv_bufsize) {
/**
* GstNvH264Enc:vbv-buffer-size:
*
* VBV(HRD) Buffer Size in kbits (0 = NVENC default)
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class,
PROP_VBV_BUFFER_SIZE,
g_param_spec_uint ("vbv-buffer-size", "VBV Buffer Size",
"VBV(HRD) Buffer Size in kbits (0 = NVENC default) "
"(Exposed only if supported by device)", 0, G_MAXUINT,
DEFAULT_VBV_BUFFER_SIZE,
"VBV(HRD) Buffer Size in kbits (0 = NVENC default)",
0, G_MAXUINT, DEFAULT_VBV_BUFFER_SIZE,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->lookahead) {
/**
* GstNvH264Enc:rc-lookahead:
*
* Number of frames for frame type lookahead
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_RC_LOOKAHEAD,
g_param_spec_uint ("rc-lookahead", "Rate Control Lookahead",
"Number of frames for frame type lookahead "
"(Exposed only if supported by device)", 0, 32,
DEFAULT_RC_LOOKAHEAD,
"Number of frames for frame type lookahead",
0, 32, DEFAULT_RC_LOOKAHEAD,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->temporal_aq) {
/**
* GstNvH264Enc:temporal-aq:
*
* Temporal Adaptive Quantization
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_TEMPORAL_AQ,
g_param_spec_boolean ("temporal-aq", "Temporal AQ",
"Temporal Adaptive Quantization "
"(Exposed only if supported by device)", DEFAULT_TEMPORAL_AQ,
"Temporal Adaptive Quantization", DEFAULT_TEMPORAL_AQ,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->bframes > 0) {
/**
* GstNvH264Enc:bframes:
*
* Number of B-frames between I and P
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_BFRAMES,
g_param_spec_uint ("bframes", "B-Frames",
"Number of B-frames between I and P "
"(Exposed only if supported by device)", 0, device_caps->bframes,
"Number of B-frames between I and P", 0, device_caps->bframes,
DEFAULT_BFRAMES,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
/**
* GstNvH264Enc:b-adapt:
*
* Enable adaptive B-frame insert when lookahead is enabled
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_B_ADAPT,
g_param_spec_boolean ("b-adapt", "B Adapt",
"Enable adaptive B-frame insert when lookahead is enabled "
"(Exposed only if supported by device)",
"Enable adaptive B-frame insert when lookahead is enabled",
DEFAULT_B_ADAPT,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (cdata->is_default)
@ -178,12 +244,19 @@ gst_nv_h264_enc_class_init (GstNvH264EncClass * klass, gpointer data)
GST_DEBUG_CATEGORY_INIT (gst_nv_h264_enc_debug,
"nvh264enc", 0, "Nvidia H.264 encoder");
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
cdata->sink_caps));
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
cdata->src_caps));
pad_templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
cdata->sink_caps);
doc_caps = gst_caps_from_string (DOCUMENTATION_SINK_CAPS);
gst_pad_template_set_documentation_caps (pad_templ, doc_caps);
gst_caps_unref (doc_caps);
gst_element_class_add_pad_template (element_class, pad_templ);
pad_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
cdata->src_caps);
doc_caps = gst_caps_from_string (DOCUMENTATION_SRC_CAPS);
gst_pad_template_set_documentation_caps (pad_templ, doc_caps);
gst_caps_unref (doc_caps);
gst_element_class_add_pad_template (element_class, pad_templ);
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);

View file

@ -164,6 +164,12 @@ gst_nv_h265_dec_class_init (GstNvH265DecClass * klass)
GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_CLASS (klass);
GstH265DecoderClass *h265decoder_class = GST_H265_DECODER_CLASS (klass);
/**
* GstNvH265Dec
*
* Since: 1.18
*/
object_class->finalize = gst_nv_h265_decoder_finalize;
element_class->set_context = GST_DEBUG_FUNCPTR (gst_nv_h265_dec_set_context);
@ -1012,6 +1018,12 @@ gst_nv_h265_dec_register (GstPlugin * plugin, guint device_id, guint rank,
GValue value_list = G_VALUE_INIT;
GValue value = G_VALUE_INIT;
/**
* element-nvh265sldec
*
* Since: 1.18
*/
cdata = g_new0 (GstNvH265DecClassData, 1);
cdata->sink_caps = gst_caps_copy (sink_caps);

View file

@ -61,6 +61,25 @@ enum
#define DEFAULT_BFRAMES 0
#define DEFAULT_B_ADAPT FALSE
/* captured using RTX 2080 */
#define DOCUMENTATION_SINK_CAPS_COMM \
"format = (string) { NV12, P010_10LE, P016_LE, Y444, Y444_16LE, Y444_16LE }, " \
"width = (int) [ 144, 8192 ], " \
"height = (int) [ 144, 8192 ], " \
"framerate = " GST_VIDEO_FPS_RANGE
#define DOCUMENTATION_SINK_CAPS \
"video/x-raw, " DOCUMENTATION_SINK_CAPS_COMM "; " \
"video/x-raw(memory:GLMemory), " DOCUMENTATION_SINK_CAPS_COMM
#define DOCUMENTATION_SRC_CAPS \
"video/x-h265, " \
"width = (int) [ 144, 8192 ], " \
"height = (int) [ 144, 8192 ], " \
"stream-format = (string) byte-stream, " \
"alignment = (string) au, " \
"profile = (string) { main, main-10, main-12, main-444, main-444-10, main-444-12 }"
static gboolean gst_nv_h265_enc_open (GstVideoEncoder * enc);
static gboolean gst_nv_h265_enc_close (GstVideoEncoder * enc);
static gboolean gst_nv_h265_enc_stop (GstVideoEncoder * enc);
@ -86,6 +105,8 @@ gst_nv_h265_enc_class_init (GstNvH265EncClass * klass, gpointer data)
GstNvEncDeviceCaps *device_caps = &nvenc_class->device_caps;
GstNvH265EncClassData *cdata = (GstNvH265EncClassData *) data;
gchar *long_name;
GstPadTemplate *pad_templ;
GstCaps *doc_caps;
parent_class = g_type_class_peek_parent (klass);
@ -102,6 +123,13 @@ gst_nv_h265_enc_class_init (GstNvH265EncClass * klass, gpointer data)
nvenc_class->set_src_caps = gst_nv_h265_enc_set_src_caps;
nvenc_class->set_pic_params = gst_nv_h265_enc_set_pic_params;
/**
* GstNvH265Enc:aud:
*
* Use AU (Access Unit) delimiter
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_AUD,
g_param_spec_boolean ("aud", "AUD",
"Use AU (Access Unit) delimiter", DEFAULT_AUD,
@ -109,60 +137,96 @@ gst_nv_h265_enc_class_init (GstNvH265EncClass * klass, gpointer data)
G_PARAM_STATIC_STRINGS));
if (device_caps->weighted_prediction) {
/**
* GstNvH265Enc:weighted-pred:
*
* Weighted Prediction
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_WEIGHTED_PRED,
g_param_spec_boolean ("weighted-pred", "Weighted Pred",
"Weighted Prediction "
"(Exposed only if supported by device)", DEFAULT_WEIGHTED_PRED,
"Weighted Prediction", DEFAULT_WEIGHTED_PRED,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->custom_vbv_bufsize) {
/**
* GstNvH265Enc:vbv-buffer-size:
*
* VBV(HRD) Buffer Size in kbits (0 = NVENC default)
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class,
PROP_VBV_BUFFER_SIZE,
g_param_spec_uint ("vbv-buffer-size", "VBV Buffer Size",
"VBV(HRD) Buffer Size in kbits (0 = NVENC default) "
"(Exposed only if supported by device)", 0, G_MAXUINT,
DEFAULT_VBV_BUFFER_SIZE,
"VBV(HRD) Buffer Size in kbits (0 = NVENC default)",
0, G_MAXUINT, DEFAULT_VBV_BUFFER_SIZE,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->lookahead) {
/**
* GstNvH265Enc:rc-lookahead:
*
* Number of frames for frame type lookahead
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_RC_LOOKAHEAD,
g_param_spec_uint ("rc-lookahead", "Rate Control Lookahead",
"Number of frames for frame type lookahead "
"(Exposed only if supported by device)", 0, 32,
"Number of frames for frame type lookahead", 0, 32,
DEFAULT_RC_LOOKAHEAD,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->temporal_aq) {
/**
* GstNvH265Enc:temporal-aq:
*
* Temporal Adaptive Quantization
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_TEMPORAL_AQ,
g_param_spec_boolean ("temporal-aq", "Temporal AQ",
"Temporal Adaptive Quantization "
"(Exposed only if supported by device)", DEFAULT_TEMPORAL_AQ,
"Temporal Adaptive Quantization", DEFAULT_TEMPORAL_AQ,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (device_caps->bframes > 0) {
/**
* GstNvH265Enc:bframes:
*
* Number of B-frames between I and P
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_BFRAMES,
g_param_spec_uint ("bframes", "B-Frames",
"Number of B-frames between I and P "
"(Exposed only if supported by device)", 0, device_caps->bframes,
"Number of B-frames between I and P", 0, device_caps->bframes,
DEFAULT_BFRAMES,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
/**
* GstNvH265Enc:b-adapt:
*
* Enable adaptive B-frame insert when lookahead is enabled
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_B_ADAPT,
g_param_spec_boolean ("b-adapt", "B Adapt",
"Enable adaptive B-frame insert when lookahead is enabled "
"(Exposed only if supported by device)",
"Enable adaptive B-frame insert when lookahead is enabled",
DEFAULT_B_ADAPT,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS));
GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_STATIC_STRINGS));
}
if (cdata->is_default)
@ -182,12 +246,20 @@ gst_nv_h265_enc_class_init (GstNvH265EncClass * klass, gpointer data)
GST_DEBUG_CATEGORY_INIT (gst_nv_h265_enc_debug,
"nvh265enc", 0, "Nvidia HEVC encoder");
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
cdata->sink_caps));
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
cdata->src_caps));
pad_templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
cdata->sink_caps);
doc_caps = gst_caps_from_string (DOCUMENTATION_SINK_CAPS);
gst_pad_template_set_documentation_caps (pad_templ, doc_caps);
gst_caps_unref (doc_caps);
gst_element_class_add_pad_template (element_class, pad_templ);
pad_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
cdata->src_caps);
doc_caps = gst_caps_from_string (DOCUMENTATION_SRC_CAPS);
gst_pad_template_set_documentation_caps (pad_templ, doc_caps);
gst_caps_unref (doc_caps);
gst_element_class_add_pad_template (element_class, pad_templ);
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);