From 28e2e9d04fd3faf0209df017c2bbc87070527097 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Tue, 5 Jun 2018 17:58:28 +0900 Subject: [PATCH] [Common] Commonize default pad-caps for other/tensor We may be changing the default pad-caps for other/tensor later. Make it refer to the same code. Signed-off-by: MyungJoo Ham --- include/tensor_common.h | 11 +++++++++++ tensor_converter/tensor_converter.c | 14 +------------- tensor_filter/tensor_filter.c | 26 ++------------------------ 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/include/tensor_common.h b/include/tensor_common.h index 06e06de..b063861 100644 --- a/include/tensor_common.h +++ b/include/tensor_common.h @@ -58,6 +58,17 @@ G_BEGIN_DECLS +/* @TODO I'm not sure if the range is to be 1, 65535 or larger */ +#define GST_TENSOR_CAP_DEFAULT \ + "other/tensor, " \ + "rank = (int) [ 1, 4 ], " \ + "dim1 = (int) [ 1, 65535 ], " \ + "dim2 = (int) [ 1, 65535 ], " \ + "dim3 = (int) [ 1, 65535 ], " \ + "dim4 = (int) [ 1, 65535 ], " \ + "type = (string) { float32, float64, int32, uint32, int16, uint16, int8, uint8 }, " \ + "framerate = (fraction) [ 0/1, 2147483647/1 ]" + /** * @brief Possible input stream types for other/tensor. * diff --git a/tensor_converter/tensor_converter.c b/tensor_converter/tensor_converter.c index 01f3976..34cf287 100644 --- a/tensor_converter/tensor_converter.c +++ b/tensor_converter/tensor_converter.c @@ -109,23 +109,11 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", /** * @brief The capabilities of the outputs - * - * In v0.0.1, this is 3-d tensor, [color][height][width] - * - * @TODO Note: I'm not sure of this. */ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("other/tensor, " - "rank = (int) [ 1, 4 ], " - "dim1 = (int) [ 1, 4 ], " /* 3 if RGB 4 if BGRx */ - "dim2 = (int) [ 1, 65535 ], " - "dim3 = (int) [ 1, 65535 ], " - "dim4 = (int) { 1 }, " - "type = (string) { float32, float64, int32, uint32, int16, uint16, int8, uint8 }, " - "framerate = (fraction) [ 0/1, 2147483647/1 ]") - ); + GST_STATIC_CAPS(GST_TENSOR_CAP_DEFAULT)); #define gst_tensor_converter_parent_class parent_class G_DEFINE_TYPE (GstTensor_Converter, gst_tensor_converter, GST_TYPE_BASE_TRANSFORM); diff --git a/tensor_filter/tensor_filter.c b/tensor_filter/tensor_filter.c index ca4f15f..7ebe2bd 100644 --- a/tensor_filter/tensor_filter.c +++ b/tensor_filter/tensor_filter.c @@ -128,41 +128,19 @@ enum /** * @brief The capabilities of the inputs - * - * @TODO I'm not sure if the range is to be 1, 65535 or larger - * */ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("other/tensor, " - "rank = (int) [ 1, 65535 ], " - "dim1 = (int) [ 1, 65535 ], " - "dim2 = (int) [ 1, 65535 ], " - "dim3 = (int) [ 1, 65535 ], " - "dim4 = (int) [ 1, 65535 ], " - "type = (string) { float32, float64, int32, uint32, int16, uint16, int8, uint8 }, " - "framerate = (fraction) [ 0/1, 2147483647/1 ]") - ); + GST_STATIC_CAPS(GST_TENSOR_CAP_DEFAULT)); /** * @brief The capabilities of the outputs - * - * @TODO I'm not sure if the range is to be 1, 65535 or larger - * */ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("other/tensor, " - "rank = (int) [ 1, 65535 ], " - "dim1 = (int) [ 1, 65535 ], " - "dim2 = (int) [ 1, 65535 ], " - "dim3 = (int) [ 1, 65535 ], " - "dim4 = (int) [ 1, 65535 ], " - "type = (string) { float32, float64, int32, uint32, int16, uint16, int8, uint8 }, " - "framerate = (fraction) [ 0/1, 2147483647/1 ]") - ); + GST_STATIC_CAPS(GST_TENSOR_CAP_DEFAULT)); #define gst_tensor_filter_parent_class parent_class G_DEFINE_TYPE (GstTensor_Filter, gst_tensor_filter, GST_TYPE_BASE_TRANSFORM); -- 2.7.4