Fix intervalometer ramp-rate enum property registration

Fixed GLib-GObject-CRITICAL errors caused by incorrect enum type
registration in the intervalometer plugin.

The issue was on line 189 where g_param_spec_enum() was being called
with GST_TYPE_INTERVALOMETER (the class type) instead of a proper
enum GType for the ramp-rate property.

Changes:
- Added gst_intervalometer_ramp_rate_get_type() function to properly
  register the GstIntervalometerRampRate enum as a GType
- Defined GST_TYPE_INTERVALOMETER_RAMP_RATE macro
- Updated PROP_RAMP_RATE property installation to use the correct
  enum type

This fixes the following errors that appeared during pipeline launch:
- g_param_spec_enum: assertion 'G_TYPE_IS_ENUM (enum_type)' failed
- validate_pspec_to_install: assertion 'G_IS_PARAM_SPEC (pspec)' failed
- g_param_spec_ref_sink: assertion 'G_IS_PARAM_SPEC (pspec)' failed
- g_param_spec_unref: assertion 'G_IS_PARAM_SPEC (pspec)' failed
This commit is contained in:
yair
2025-11-17 01:19:09 +02:00
parent b11cd27d14
commit 73fbbaa9fd

View File

@@ -78,6 +78,27 @@ enum
#define gst_intervalometer_parent_class parent_class
G_DEFINE_TYPE (GstIntervalometer, gst_intervalometer, GST_TYPE_BASE_TRANSFORM);
/* Define the enum type for ramp rate */
#define GST_TYPE_INTERVALOMETER_RAMP_RATE (gst_intervalometer_ramp_rate_get_type ())
static GType
gst_intervalometer_ramp_rate_get_type (void)
{
static GType ramp_rate_type = 0;
static const GEnumValue ramp_rate_values[] = {
{RAMP_RATE_VSLOW, "Very Slow", "vslow"},
{RAMP_RATE_SLOW, "Slow", "slow"},
{RAMP_RATE_MEDIUM, "Medium", "medium"},
{RAMP_RATE_FAST, "Fast", "fast"},
{RAMP_RATE_VFAST, "Very Fast", "vfast"},
{0, NULL, NULL}
};
if (!ramp_rate_type) {
ramp_rate_type = g_enum_register_static ("GstIntervalometerRampRate", ramp_rate_values);
}
return ramp_rate_type;
}
static GstStaticPadTemplate gst_intervalometer_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@@ -186,7 +207,7 @@ gst_intervalometer_class_init (GstIntervalometerClass * klass)
g_object_class_install_property (gobject_class, PROP_RAMP_RATE,
g_param_spec_enum ("ramp-rate", "Ramp Rate",
"Speed of exposure/gain ramping", GST_TYPE_INTERVALOMETER,
"Speed of exposure/gain ramping", GST_TYPE_INTERVALOMETER_RAMP_RATE,
DEFAULT_PROP_RAMP_RATE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));