@@ -209,8 +209,9 @@ gboolean gst_mtl_common_parse_sampling(gint sampling, enum st30_sampling* st_sam
209
209
void gst_mtl_common_init_general_argumetns (GObjectClass * gobject_class ) {
210
210
g_object_class_install_property (
211
211
gobject_class , PROP_GENERAL_LOG_LEVEL ,
212
- g_param_spec_boolean ("silent" , "Silent" , "Turn on silent mode." , FALSE,
213
- G_PARAM_READWRITE ));
212
+ g_param_spec_uint ("log-level" , "Log Level" , "Set the log level (INFO 1 to CRIT 5)." ,
213
+ 1 , MTL_LOG_LEVEL_MAX , 1 ,
214
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
214
215
215
216
g_object_class_install_property (
216
217
gobject_class , PROP_GENERAL_DEV_ARGS_PORT ,
@@ -391,3 +392,35 @@ gboolean gst_mtl_common_parse_dev_arguments(struct mtl_init_params* mtl_init_par
391
392
gst_mtl_port_idx ++ ;
392
393
return ret ;
393
394
}
395
+
396
+ mtl_handle gst_mtl_common_init_handle (struct mtl_init_params * p , StDevArgs * devArgs ,
397
+ guint * log_level ) {
398
+ struct mtl_init_params mtl_init_params = {0 };
399
+
400
+ if (!p || !devArgs || !log_level ) {
401
+ GST_ERROR ("Invalid input" );
402
+ return NULL ;
403
+ }
404
+
405
+ mtl_init_params .num_ports = 0 ;
406
+
407
+ if (gst_mtl_common_parse_dev_arguments (& mtl_init_params , devArgs ) == FALSE) {
408
+ GST_ERROR ("Failed to parse dev arguments" );
409
+ return NULL ;
410
+ }
411
+ mtl_init_params .flags |= MTL_FLAG_BIND_NUMA ;
412
+
413
+ /*
414
+ * Log levels range from 1 to LOG_LEVEL_MAX.
415
+ * We avoid using 0 (DEBUG) in normal scenarios,
416
+ * so it's acceptable to use 0 as a placeholder.
417
+ */
418
+ if (* log_level && * log_level < MTL_LOG_LEVEL_MAX ) {
419
+ mtl_init_params .log_level = * log_level ;
420
+ } else {
421
+ mtl_init_params .log_level = MTL_LOG_LEVEL_INFO ;
422
+ }
423
+ * log_level = mtl_init_params .log_level ;
424
+
425
+ return mtl_init (& mtl_init_params );
426
+ }
0 commit comments