Question regarding deepstream config file parser?

Each source has a parameter called “type” in the config file. The config parser location,

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:admin%40123@172.16.16.22:554/streaming/channels/201
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0
/opt/nvidia/deepstream/deepstream-4.0/sources/apps/apps-common/src/deepstream_config_file_parser.c
if (!g_strcmp0 (*key, CONFIG_GROUP_SOURCE_TYPE)) {
      config->type =
          g_key_file_get_integer (key_file, group,
          CONFIG_GROUP_SOURCE_TYPE, &error);
      CHECK_ERROR (error);
    }

Definition of config->type param,

/opt/nvidia/deepstream/deepstream-4.0/sources/apps/apps-common/includes/deepstream_sources.h
typedef enum
{
  NV_DS_SOURCE_CAMERA_V4L2 = 1,
  NV_DS_SOURCE_URI,
  NV_DS_SOURCE_URI_MULTIPLE,
  NV_DS_SOURCE_RTSP,
  NV_DS_SOURCE_CAMERA_CSI
} NvDsSourceType;

typedef struct
{
  NvDsSourceType type;
  gboolean enable;
  gboolean loop;
  gboolean live_source;
  gboolean Intra_decode;
  gint source_width;
  gint source_height;
  gint source_fps_n;
  gint source_fps_d;
  gint camera_csi_sensor_id;
  gint camera_v4l2_dev_node;
  gchar *uri;
  gint latency;
  guint num_sources;
  guint gpu_id;
  guint camera_id;
  guint select_rtp_protocol;
  guint num_decode_surfaces;
  guint num_extra_surfaces;
  guint nvbuf_memory_type;
  guint cuda_memory_type;
  NvDsDewarperConfig dewarper_config;
  guint drop_frame_interval;
} NvDsSourceConfig;

How does the config parser even work with config->type being a custom structure and config->type is being assigned an integer?

deepstream_source_bin.c
create_source_bin()
create_multi_source_bin()

Guess that was the due to implicit conversion of int to type enum which is allowed in C but not in C++. Learnt it the hard way. Thanks.

Thanks.
Do you have better solution to fix it? Set source type as string in config file ?

No ended up setting it as a type of the structure it was declared.