From: MyungJoo Ham Date: Mon, 26 Mar 2018 12:39:29 +0000 (+0900) Subject: [Converter] GST Plugin Tutorial 1 (Boilerplate) Followed. X-Git-Tag: v0.0.1~233 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a630ab9dfbac4859d1d8e09eb62fd86165bd5082;p=platform%2Fupstream%2Fnnstreamer.git [Converter] GST Plugin Tutorial 1 (Boilerplate) Followed. Standard Tensor Media Type Draft Applied as well. Signed-off-by: MyungJoo Ham --- diff --git a/convert2tensor/README.md b/convert2tensor/README.md index 6dac0ff..380f156 100644 --- a/convert2tensor/README.md +++ b/convert2tensor/README.md @@ -26,6 +26,7 @@ Direct conversion of general audio stream to FORMAT-TO-BE-DETERMINED - Properties - rank: int (0: scalar, 1: vector, 2: matrix, 3: 3-tensor, ...) - dimension: int[] (1 .. rank) - - type: int32., float32, int8, uint8, ... (C types only?) - - data: (binary data, can be treated as an C array of [dimension[0]][dimension[1]]...) + - type: int32, uint32, float32, float64, int16, uint16, int8, uint8, ... (C types only?) + - framerate; fraction + - data: (binary data, can be treated as an C array of [dimension[0]][dimension[1]]...) diff --git a/convert2tensor/convert2tensor.c b/convert2tensor/convert2tensor.c index 5a9f907..57082fd 100644 --- a/convert2tensor/convert2tensor.c +++ b/convert2tensor/convert2tensor.c @@ -2,7 +2,7 @@ * GStreamer * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2018 MyungJoo Ham <> + * Copyright (C) 2018 MyungJoo Ham * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -88,20 +88,28 @@ enum PROP_SILENT }; -/* the capabilities of the inputs and outputs. +/* the capabilities of the inputs * - * describe the real formats here. + * In v0.0.1, this is "bitmap" image stream */ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") + GST_STATIC_CAPS ("video/x-raw, format = (string)RGB") ); +/* the capabilities of the outputs + * + * In v0.0.1, this is 3-d tensor, [color][height][width] + */ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") + GST_STATIC_CAPS ("other/tensor, " + "rank = (int) [ 1, 4 ], " + "dimension = (int) [ 0, 65536 ], (int) [ 0, 65536 ], (int) [ 0, 65536 ], (int) [0, 65536 ], " + "type = (string) { float32, float64, int32, uint32, int16, uint16, int8, uint8 }, " + "framerate = (fraction) [ 0, 1024 ], ") ); #define gst_convert2tensor_parent_class parent_class @@ -136,9 +144,9 @@ gst_convert2tensor_class_init (GstConvert2TensorClass * klass) gst_element_class_set_details_simple(gstelement_class, "Convert2Tensor", - "FIXME:Generic", - "FIXME:Generic Template Element", - "MyungJoo Ham <>"); + "Convert media stream to tensor stream", + "Converts audio or video stream to tensor stream for neural network framework filters", + "MyungJoo Ham "); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&src_factory)); diff --git a/convert2tensor/convert2tensor.h b/convert2tensor/convert2tensor.h index eaad37a..bad0092 100644 --- a/convert2tensor/convert2tensor.h +++ b/convert2tensor/convert2tensor.h @@ -2,7 +2,7 @@ * GStreamer * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2018 MyungJoo Ham <> + * Copyright (C) 2018 MyungJoo Ham * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -69,16 +69,16 @@ G_BEGIN_DECLS #define GST_IS_CONVERT2TENSOR_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONVERT2TENSOR)) -typedef struct _GstConvert2Tensor GstConvert2Tensor; +typedef struct _GstConvert2Tensor GstConvert2Tensor; + typedef struct _GstConvert2TensorClass GstConvert2TensorClass; struct _GstConvert2Tensor { - GstElement element; - - GstPad *sinkpad, *srcpad; - - gboolean silent; + GstElement element; /**< This element itself is the convert2tensor filter */ + GstPad *sinkpad; /**< Media stream input */ + GstPad *srcpad; /**< Tensor stream output */ + gboolean silent; /**< True if logging is minimized */ }; struct _GstConvert2TensorClass