From 5f95094f39813d0fd0a3c104fe4ab1be2750b556 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 7 Apr 2018 00:05:46 +0900 Subject: [PATCH] nvencbase: Define sinkpad template in subclass https://bugzilla.gnome.org/show_bug.cgi?id=795037 --- sys/nvenc/gstnvbaseenc.c | 19 ------------------- sys/nvenc/gstnvh264enc.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/sys/nvenc/gstnvbaseenc.c b/sys/nvenc/gstnvbaseenc.c index 1862c8f4aa..c890673d7f 100644 --- a/sys/nvenc/gstnvbaseenc.c +++ b/sys/nvenc/gstnvbaseenc.c @@ -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 { 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->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_param_spec_uint ("cuda-device-id", "Cuda Device ID", diff --git a/sys/nvenc/gstnvh264enc.c b/sys/nvenc/gstnvh264enc.c index f250bc0c09..c642b17b7f 100644 --- a/sys/nvenc/gstnvh264enc.c +++ b/sys/nvenc/gstnvh264enc.c @@ -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); /* *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", GST_PAD_SRC, 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_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_set_static_metadata (element_class,