nvencbase: Define sinkpad template in subclass

https://bugzilla.gnome.org/show_bug.cgi?id=795037
This commit is contained in:
Seungha Yang 2018-04-07 00:05:46 +09:00 committed by Jan Schmidt
parent 6242dae832
commit 5f95094f39
2 changed files with 18 additions and 19 deletions

View file

@ -141,23 +141,6 @@ _rc_mode_to_nv (GstNvRCMode mode)
} }
} }
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw, " "format = (string) { NV12, I420 }, " // TODO: YV12, Y444 support
"width = (int) [ 16, 4096 ], height = (int) [ 16, 2160 ], "
"framerate = (fraction) [0, MAX],"
"interlace-mode = { progressive, mixed, interleaved } "
#if HAVE_NVENC_GST_GL
";"
"video/x-raw(memory:GLMemory), "
"format = (string) { NV12, Y444 }, "
"width = (int) [ 16, 4096 ], height = (int) [ 16, 2160 ], "
"framerate = (fraction) [0, MAX],"
"interlace-mode = { progressive, mixed, interleaved } "
#endif
));
enum enum
{ {
PROP_0, PROP_0,
@ -254,8 +237,6 @@ gst_nv_base_enc_class_init (GstNvBaseEncClass * klass)
videoenc_class->finish = GST_DEBUG_FUNCPTR (gst_nv_base_enc_finish); videoenc_class->finish = GST_DEBUG_FUNCPTR (gst_nv_base_enc_finish);
videoenc_class->sink_query = GST_DEBUG_FUNCPTR (gst_nv_base_enc_sink_query); videoenc_class->sink_query = GST_DEBUG_FUNCPTR (gst_nv_base_enc_sink_query);
gst_element_class_add_static_pad_template (element_class, &sink_factory);
g_object_class_install_property (gobject_class, PROP_DEVICE_ID, g_object_class_install_property (gobject_class, PROP_DEVICE_ID,
g_param_spec_uint ("cuda-device-id", g_param_spec_uint ("cuda-device-id",
"Cuda Device ID", "Cuda Device ID",

View file

@ -42,6 +42,23 @@ GST_DEBUG_CATEGORY_STATIC (gst_nv_h264_enc_debug);
G_DEFINE_TYPE (GstNvH264Enc, gst_nv_h264_enc, GST_TYPE_NV_BASE_ENC); G_DEFINE_TYPE (GstNvH264Enc, gst_nv_h264_enc, GST_TYPE_NV_BASE_ENC);
/* *INDENT-OFF* */ /* *INDENT-OFF* */
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw, " "format = (string) { NV12, I420 }, " // TODO: YV12, Y444 support
"width = (int) [ 16, 4096 ], height = (int) [ 16, 2160 ], "
"framerate = (fraction) [0, MAX],"
"interlace-mode = { progressive, mixed, interleaved } "
#if HAVE_NVENC_GST_GL
";"
"video/x-raw(memory:GLMemory), "
"format = (string) { NV12, Y444 }, "
"width = (int) [ 16, 4096 ], height = (int) [ 16, 2160 ], "
"framerate = (fraction) [0, MAX],"
"interlace-mode = { progressive, mixed, interleaved } "
#endif
));
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
@ -92,6 +109,7 @@ gst_nv_h264_enc_class_init (GstNvH264EncClass * klass)
nvenc_class->set_src_caps = gst_nv_h264_enc_set_src_caps; nvenc_class->set_src_caps = gst_nv_h264_enc_set_src_caps;
nvenc_class->set_pic_params = gst_nv_h264_enc_set_pic_params; nvenc_class->set_pic_params = gst_nv_h264_enc_set_pic_params;
gst_element_class_add_static_pad_template (element_class, &sink_factory);
gst_element_class_add_static_pad_template (element_class, &src_factory); gst_element_class_add_static_pad_template (element_class, &src_factory);
gst_element_class_set_static_metadata (element_class, gst_element_class_set_static_metadata (element_class,