[Decoder] Refactor mode name array defs
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Sun, 4 Nov 2018 07:49:31 +0000 (07:49 +0000)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Mon, 5 Nov 2018 05:10:59 +0000 (14:10 +0900)
We don't want future confusion or inconsistency between
enum values and string values

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst/tensor_decoder/tensordec.h

index 798202a..9b0c056 100644 (file)
@@ -117,12 +117,23 @@ typedef enum
 } dec_output_types;
 
 /**
+ * @brief Decoder Mode.
+ */
+typedef enum
+{
+  DIRECT_VIDEO = 0,
+  IMAGE_LABELING,
+  BOUNDING_BOXES,
+  DECODE_MODE_UNKNOWN
+} dec_modes;
+
+/**
  * @brief Decoder Mode  string.
  */
 static const gchar *mode_names[] = {
-  "direct_video",
-  "image_labeling",
-  "bounding_boxes",
+  [DIRECT_VIDEO] = "direct_video",
+  [IMAGE_LABELING] = "image_labeling",
+  [BOUNDING_BOXES] = "bounding_boxes",
   NULL
 };
 
@@ -137,17 +148,6 @@ static const dec_output_types dec_output_type[] = {
 };
 
 /**
- * @brief Decoder Mode.
- */
-enum
-{
-  DIRECT_VIDEO,
-  IMAGE_LABELING,
-  BOUNDING_BOXES,
-  DECODE_MODE_UNKNOWN
-};
-
-/**
  * @brief Get Type function required for gst elements
  */
 GType gst_tensordec_get_type (void);