From e1ec78d94c3de4a1ec55ac3e123b9b8816d6a68b Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Wed, 28 Mar 2018 11:03:25 +0900 Subject: [PATCH] [Convert] Added skeletons for GstBaseTransform class Added null impementation of virtual methods of GstBaseTransform Signed-off-by: MyungJoo Ham --- convert2tensor/convert2tensor.c | 79 +++++++++++++++++++++++++++++++++++++++++ convert2tensor/convert2tensor.h | 8 ++--- 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/convert2tensor/convert2tensor.c b/convert2tensor/convert2tensor.c index 1246949..187abed 100644 --- a/convert2tensor/convert2tensor.c +++ b/convert2tensor/convert2tensor.c @@ -125,6 +125,29 @@ static void gst_convert2tensor_set_property (GObject * object, guint prop_id, static void gst_convert2tensor_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); +/* GstBaseTransformer vmethod implementations */ +static GstFlowReturn gst_convert2tensor_transform(GstBaseTransform *trans, + GstBuffer *inbuf, + GstBuffer *outbuf); +static GstFlowReturn gst_convert2tensor_transform_ip(GstBaseTransform *trans, + GstBuffer *buf); +static GstCaps* gst_convert2tensor_transform_caps(GstBaseTransform *trans, + GstPadDirection direction, + GstCaps *caps, + GstCaps *filter); +static GstCaps* gst_convert2tensor_fixate_caps(GstBaseTransform *trans, + GstPadDirection direction, + GstCaps *caps, + GstCaps *othercaps); +static gboolean gst_convert2tensor_set_caps(GstBaseTransform *trans, + GstCaps *incaps, + GstCaps *outcaps); +static gboolean gst_convert2tensor_transform_size(GstBaseTransform *trans, + GstPadDirection direction, + GstCaps *caps, gsize size, + GstCaps *othercpas, gsize *othersize); +static gboolean gst_convert2tensor_get_unit_size(GstBaseTransform *trans, + GstCaps *caps, gsize *size); /* GObject vmethod implementations */ /* initialize the convert2tensor's class */ @@ -162,6 +185,18 @@ gst_convert2tensor_class_init (GstConvert2TensorClass * g_class) /* Refer: https://gstreamer.freedesktop.org/documentation/design/element-transform.html */ trans_class->passthrough_on_same_caps = FALSE; + /* Processing units */ + trans_class->transform = GST_DEBUG_FUNCPTR(gst_convert2tensor_transform); + trans_class->transform_ip = GST_DEBUG_FUNCPTR(gst_convert2tensor_transform_ip); + + /* Negotiation units */ + trans_class->transform_caps = GST_DEBUG_FUNCPTR(gst_convert2tensor_transform_caps); + trans_class->fixate_caps = GST_DEBUG_FUNCPTR(gst_convert2tensor_fixate_caps); + trans_class->set_caps = GST_DEBUG_FUNCPTR(gst_convert2tensor_set_caps); + + /* Allocation units */ + trans_class->transform_size = GST_DEBUG_FUNCPTR(gst_convert2tensor_transform_size); + trans_class->get_unit_size = GST_DEBUG_FUNCPTR(gst_convert2tensor_get_unit_size); } /* initialize the new element @@ -310,3 +345,47 @@ GST_PLUGIN_DEFINE ( "GStreamer", "http://gstreamer.net/" ) + + +static GstFlowReturn gst_convert2tensor_transform(GstBaseTransform *trans, + GstBuffer *inbuf, + GstBuffer *outbuf) +{ +} + +static GstFlowReturn gst_convert2tensor_transform_ip(GstBaseTransform *trans, + GstBuffer *buf) +{ +} + +static GstCaps* gst_convert2tensor_transform_caps(GstBaseTransform *trans, + GstPadDirection direction, + GstCaps *caps, + GstCaps *filter) +{ +} + +static GstCaps* gst_convert2tensor_fixate_caps(GstBaseTransform *trans, + GstPadDirection direction, + GstCaps *caps, + GstCaps *othercaps) +{ +} + +static gboolean gst_convert2tensor_set_caps(GstBaseTransform *trans, + GstCaps *incaps, + GstCaps *outcaps) +{ +} + +static gboolean gst_convert2tensor_transform_size(GstBaseTransform *trans, + GstPadDirection direction, + GstCaps *caps, gsize size, + GstCaps *othercpas, gsize *othersize) +{ +} + +static gboolean gst_convert2tensor_get_unit_size(GstBaseTransform *trans, + GstCaps *caps, gsize *size) +{ +} diff --git a/convert2tensor/convert2tensor.h b/convert2tensor/convert2tensor.h index 44ade3b..b158c2f 100644 --- a/convert2tensor/convert2tensor.h +++ b/convert2tensor/convert2tensor.h @@ -69,6 +69,7 @@ G_BEGIN_DECLS (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONVERT2TENSOR)) #define GST_IS_CONVERT2TENSOR_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONVERT2TENSOR)) +#define GST_CONVERT2TENSOR_CAST(obj) ((GstConvert2Tensor *)(obj)) typedef struct _GstConvert2Tensor GstConvert2Tensor; @@ -89,11 +90,10 @@ typedef enum _tensor_type { } tensor_type; struct _GstConvert2Tensor { - GstElement element; /**< This element itself is the convert2tensor filter */ - GstPad *sinkpad; /**< Media stream input */ - GstPad *srcpad; /**< Tensor stream output */ + GstBaseTransform element; /**< This is the parent object */ + gboolean silent; /**< True if logging is minimized */ - gboolean tensorConfigured; /**< True if sinkpad has successfully configured tensor metadata */ + gboolean tensorConfigured; /**< True if already successfully configured tensor metadata */ gint rank; /**< Tensor Rank (# dimensions) */ gint dimension[GST_CONVERT2TENSOR_TENSOR_RANK_LIMIT]; /**< Dimensions. We support up to 4th ranks */ tensor_type type; /**< Type of each element in the tensor. User must designate this. Otherwise, this is UINT8 for video/x-raw byte stream */ -- 2.7.4