Skip to content

Commit

Permalink
Fix: unify gstreamer arguments across plugins (#1034)
Browse files Browse the repository at this point in the history
Using functions from gst_mtl_common to make all
arguments in gstreamer plugins cross compatible,
order the arguments in the header files.
  • Loading branch information
DawidWesierski4 authored Jan 10, 2025
1 parent be8d5dc commit a02c0a3
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 826 deletions.
37 changes: 35 additions & 2 deletions ecosystem/gstreamer_plugin/gst_mtl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ gboolean gst_mtl_common_parse_sampling(gint sampling, enum st30_sampling* st_sam
void gst_mtl_common_init_general_argumetns(GObjectClass* gobject_class) {
g_object_class_install_property(
gobject_class, PROP_GENERAL_LOG_LEVEL,
g_param_spec_boolean("silent", "Silent", "Turn on silent mode.", FALSE,
G_PARAM_READWRITE));
g_param_spec_uint("log-level", "Log Level", "Set the log level (INFO 1 to CRIT 5).",
1, MTL_LOG_LEVEL_MAX, 1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

g_object_class_install_property(
gobject_class, PROP_GENERAL_DEV_ARGS_PORT,
Expand Down Expand Up @@ -391,3 +392,35 @@ gboolean gst_mtl_common_parse_dev_arguments(struct mtl_init_params* mtl_init_par
gst_mtl_port_idx++;
return ret;
}

mtl_handle gst_mtl_common_init_handle(struct mtl_init_params* p, StDevArgs* devArgs,
guint* log_level) {
struct mtl_init_params mtl_init_params = {0};

if (!p || !devArgs || !log_level) {
GST_ERROR("Invalid input");
return NULL;
}

mtl_init_params.num_ports = 0;

if (gst_mtl_common_parse_dev_arguments(&mtl_init_params, devArgs) == FALSE) {
GST_ERROR("Failed to parse dev arguments");
return NULL;
}
mtl_init_params.flags |= MTL_FLAG_BIND_NUMA;

/*
* Log levels range from 1 to LOG_LEVEL_MAX.
* We avoid using 0 (DEBUG) in normal scenarios,
* so it's acceptable to use 0 as a placeholder.
*/
if (*log_level && *log_level < MTL_LOG_LEVEL_MAX) {
mtl_init_params.log_level = *log_level;
} else {
mtl_init_params.log_level = MTL_LOG_LEVEL_INFO;
}
*log_level = mtl_init_params.log_level;

return mtl_init(&mtl_init_params);
}
9 changes: 9 additions & 0 deletions ecosystem/gstreamer_plugin/gst_mtl_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
#define PAYLOAD_TYPE_VIDEO (112)
#define PAYLOAD_TYPE_ANCILLARY (113)

#ifndef NS_PER_MS
#define NS_PER_MS (1000 * 1000)
#endif

#ifndef NS_PER_S
#define NS_PER_S (1000 * NS_PER_MS)
#endif

enum {
PROP_GENERAL_0,
Expand Down Expand Up @@ -95,4 +101,7 @@ void gst_mtl_common_get_general_argumetns(GObject* object, guint prop_id,
StDevArgs* devArgs, SessionPortArgs* portArgs,
guint* log_level);

mtl_handle gst_mtl_common_init_handle(struct mtl_init_params* p, StDevArgs* devArgs,
guint* log_level);

#endif /* __GST_MTL_COMMON_H__ */
Loading

0 comments on commit a02c0a3

Please sign in to comment.