[Converter] GST Plugin Tutorial 1 (Boilerplate) Followed.
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 26 Mar 2018 12:39:29 +0000 (21:39 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 26 Mar 2018 12:39:29 +0000 (21:39 +0900)
Standard Tensor Media Type Draft Applied as well.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
convert2tensor/README.md
convert2tensor/convert2tensor.c
convert2tensor/convert2tensor.h

index 6dac0ff..380f156 100644 (file)
@@ -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]]...)
index 5a9f907..57082fd 100644 (file)
@@ -2,7 +2,7 @@
  * GStreamer
  * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2018 MyungJoo Ham <<user@hostname.org>>
+ * Copyright (C) 2018 MyungJoo Ham <myungjoo.ham@samsung.com>
  * 
  * 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 <<user@hostname.org>>");
+    "Convert media stream to tensor stream",
+    "Converts audio or video stream to tensor stream for neural network framework filters",
+    "MyungJoo Ham <myungjoo.ham@samsung.com>");
 
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&src_factory));
index eaad37a..bad0092 100644 (file)
@@ -2,7 +2,7 @@
  * GStreamer
  * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2018 MyungJoo Ham <<user@hostname.org>>
+ * Copyright (C) 2018 MyungJoo Ham <myungjoo.ham@samsung.com>
  * 
  * 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