From 3cd1d0c7bc44d566109dcf18fd3a3ae470cbd779 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 22 Nov 2018 14:01:28 +0900 Subject: [PATCH] nvenc: Fix MSVC build error C2121 --- sys/nvenc/gstnvh264enc.c | 21 +++++++++++++-------- sys/nvenc/gstnvh265enc.c | 19 ++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/sys/nvenc/gstnvh264enc.c b/sys/nvenc/gstnvh264enc.c index 76e0eee5da..7d61b644bd 100644 --- a/sys/nvenc/gstnvh264enc.c +++ b/sys/nvenc/gstnvh264enc.c @@ -40,6 +40,18 @@ GST_DEBUG_CATEGORY_STATIC (gst_nv_h264_enc_debug); #define parent_class gst_nv_h264_enc_parent_class G_DEFINE_TYPE (GstNvH264Enc, gst_nv_h264_enc, GST_TYPE_NV_BASE_ENC); +#if HAVE_NVENC_GST_GL +#define GL_CAPS_STR \ + ";" \ + "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 } " +#else +#define GL_CAPS_STR "" +#endif + /* *INDENT-OFF* */ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -48,14 +60,7 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", "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 + GL_CAPS_STR )); static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", diff --git a/sys/nvenc/gstnvh265enc.c b/sys/nvenc/gstnvh265enc.c index 48c2e296da..2e958f8116 100644 --- a/sys/nvenc/gstnvh265enc.c +++ b/sys/nvenc/gstnvh265enc.c @@ -41,6 +41,17 @@ GST_DEBUG_CATEGORY_STATIC (gst_nv_h265_enc_debug); #define parent_class gst_nv_h265_enc_parent_class G_DEFINE_TYPE (GstNvH265Enc, gst_nv_h265_enc, GST_TYPE_NV_BASE_ENC); +#if HAVE_NVENC_GST_GL +#define GL_CAPS_STR \ + ";" \ + "video/x-raw(memory:GLMemory), " \ + "format = (string) { NV12, Y444 }, " \ + "width = (int) [ 16, 4096 ], height = (int) [ 16, 2160 ], " \ + "framerate = (fraction) [0, MAX] " +#else +#define GL_CAPS_STR "" +#endif + /* *INDENT-OFF* */ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -48,13 +59,7 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", 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] " -#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] " -#endif + GL_CAPS_STR )); static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",