static void gst_audio_echo_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstAudioEcho *self = GST_AUDIO_ECHO (object); switch (prop_id) { case PROP_DELAY: GST_BASE_TRANSFORM_LOCK (self); g_value_set_uint64 (value, self->delay); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_MAX_DELAY: GST_BASE_TRANSFORM_LOCK (self); g_value_set_uint64 (value, self->max_delay); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_INTENSITY: GST_BASE_TRANSFORM_LOCK (self); g_value_set_float (value, self->intensity); GST_BASE_TRANSFORM_UNLOCK (self); break; case PROP_FEEDBACK: GST_BASE_TRANSFORM_LOCK (self); g_value_set_float (value, self->feedback); GST_BASE_TRANSFORM_UNLOCK (self); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_audio_echo_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstAudioEcho *self = GST_AUDIO_ECHO (object); switch (prop_id) { case PROP_DELAY:{ guint64 max_delay, delay; GST_BASE_TRANSFORM_LOCK (self); delay = g_value_get_uint64 (value); max_delay = self->max_delay; if (delay > max_delay && GST_STATE (self) > GST_STATE_READY) { GST_WARNING_OBJECT (self, "New delay (%" GST_TIME_FORMAT ") " "is larger than maximum delay (%" GST_TIME_FORMAT ")", GST_TIME_ARGS (delay), GST_TIME_ARGS (max_delay)); self->delay = max_delay; } else { self->delay = delay; self->max_delay = MAX (delay, max_delay); } GST_BASE_TRANSFORM_UNLOCK (self); } break; case PROP_MAX_DELAY:{ guint64 max_delay, delay; GST_BASE_TRANSFORM_LOCK (self); max_delay = g_value_get_uint64 (value); delay = self->delay; if (GST_STATE (self) > GST_STATE_READY) { GST_ERROR_OBJECT (self, "Can't change maximum delay in" " PLAYING or PAUSED state"); } else { self->delay = delay; self->max_delay = max_delay; } GST_BASE_TRANSFORM_UNLOCK (self); } break; case PROP_INTENSITY:{ GST_BASE_TRANSFORM_LOCK (self); self->intensity = g_value_get_float (value); GST_BASE_TRANSFORM_UNLOCK (self); } break; case PROP_FEEDBACK:{ GST_BASE_TRANSFORM_LOCK (self); self->feedback = g_value_get_float (value); GST_BASE_TRANSFORM_UNLOCK (self); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_spectrum_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstSpectrum *filter = GST_SPECTRUM (object); switch (prop_id) { case PROP_MESSAGE: case PROP_POST_MESSAGES: filter->post_messages = g_value_get_boolean (value); break; case PROP_MESSAGE_MAGNITUDE: filter->message_magnitude = g_value_get_boolean (value); break; case PROP_MESSAGE_PHASE: filter->message_phase = g_value_get_boolean (value); break; case PROP_INTERVAL:{ guint64 interval = g_value_get_uint64 (value); if (filter->interval != interval) { GST_BASE_TRANSFORM_LOCK (filter); filter->interval = interval; gst_spectrum_reset_state (filter); GST_BASE_TRANSFORM_UNLOCK (filter); } } break; case PROP_BANDS:{ guint bands = g_value_get_uint (value); if (filter->bands != bands) { GST_BASE_TRANSFORM_LOCK (filter); filter->bands = bands; gst_spectrum_reset_state (filter); GST_BASE_TRANSFORM_UNLOCK (filter); } } break; case PROP_THRESHOLD: filter->threshold = g_value_get_int (value); break; case PROP_MULTI_CHANNEL:{ gboolean multi_channel = g_value_get_boolean (value); if (filter->multi_channel != multi_channel) { GST_BASE_TRANSFORM_LOCK (filter); filter->multi_channel = multi_channel; gst_spectrum_reset_state (filter); GST_BASE_TRANSFORM_UNLOCK (filter); } } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_video_balance_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstVideoBalance *balance = GST_VIDEO_BALANCE (object); gdouble d; const gchar *label = NULL; GST_BASE_TRANSFORM_LOCK (balance); GST_OBJECT_LOCK (balance); switch (prop_id) { case PROP_CONTRAST: d = g_value_get_double (value); GST_DEBUG_OBJECT (balance, "Changing contrast from %lf to %lf", balance->contrast, d); if (d != balance->contrast) label = "CONTRAST"; balance->contrast = d; break; case PROP_BRIGHTNESS: d = g_value_get_double (value); GST_DEBUG_OBJECT (balance, "Changing brightness from %lf to %lf", balance->brightness, d); if (d != balance->brightness) label = "BRIGHTNESS"; balance->brightness = d; break; case PROP_HUE: d = g_value_get_double (value); GST_DEBUG_OBJECT (balance, "Changing hue from %lf to %lf", balance->hue, d); if (d != balance->hue) label = "HUE"; balance->hue = d; break; case PROP_SATURATION: d = g_value_get_double (value); GST_DEBUG_OBJECT (balance, "Changing saturation from %lf to %lf", balance->saturation, d); if (d != balance->saturation) label = "SATURATION"; balance->saturation = d; break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } gst_video_balance_update_properties (balance); GST_OBJECT_UNLOCK (balance); GST_BASE_TRANSFORM_UNLOCK (balance); if (label) { GstColorBalanceChannel *channel = gst_video_balance_find_channel (balance, label); gst_color_balance_value_changed (GST_COLOR_BALANCE (balance), channel, gst_color_balance_get_value (GST_COLOR_BALANCE (balance), channel)); } }
static void gst_audio_fx_base_fir_filter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstAudioFXBaseFIRFilter *self = GST_AUDIO_FX_BASE_FIR_FILTER (object); switch (prop_id) { case PROP_LOW_LATENCY:{ gboolean low_latency; if (GST_STATE (self) >= GST_STATE_PAUSED) { g_warning ("Changing the \"low-latency\" property " "is only allowed in states < PAUSED"); return; } GST_BASE_TRANSFORM_LOCK (self); low_latency = g_value_get_boolean (value); if (self->low_latency != low_latency) { self->low_latency = low_latency; gst_audio_fx_base_fir_filter_calculate_frequency_response (self); gst_audio_fx_base_fir_filter_select_process_function (self, GST_AUDIO_FILTER_CAST (self)->format.width, GST_AUDIO_FILTER_CAST (self)->format.channels); } GST_BASE_TRANSFORM_UNLOCK (self); break; } case PROP_DRAIN_ON_CHANGES:{ GST_BASE_TRANSFORM_LOCK (self); self->drain_on_changes = g_value_get_boolean (value); GST_BASE_TRANSFORM_UNLOCK (self); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
void gst_audio_fx_base_fir_filter_set_kernel (GstAudioFXBaseFIRFilter * self, gdouble * kernel, guint kernel_length, guint64 latency) { gboolean latency_changed; g_return_if_fail (kernel != NULL); g_return_if_fail (self != NULL); GST_BASE_TRANSFORM_LOCK (self); latency_changed = (self->latency != latency || (!self->low_latency && self->kernel_length < FFT_THRESHOLD && kernel_length >= FFT_THRESHOLD) || (!self->low_latency && self->kernel_length >= FFT_THRESHOLD && kernel_length < FFT_THRESHOLD)); /* FIXME: If the latency changes, the buffer size changes too and we * have to drain in any case until this is fixed in the future */ if (self->buffer && (!self->drain_on_changes || latency_changed)) { gst_audio_fx_base_fir_filter_push_residue (self); self->start_ts = GST_CLOCK_TIME_NONE; self->start_off = GST_BUFFER_OFFSET_NONE; self->nsamples_out = 0; self->nsamples_in = 0; self->buffer_fill = 0; } g_free (self->kernel); if (!self->drain_on_changes || latency_changed) { g_free (self->buffer); self->buffer = NULL; self->buffer_fill = 0; self->buffer_length = 0; } self->kernel = kernel; self->kernel_length = kernel_length; gst_audio_fx_base_fir_filter_calculate_frequency_response (self); gst_audio_fx_base_fir_filter_select_process_function (self, GST_AUDIO_FILTER_CAST (self)->format.width, GST_AUDIO_FILTER_CAST (self)->format.channels); if (latency_changed) { self->latency = latency; gst_element_post_message (GST_ELEMENT (self), gst_message_new_latency (GST_OBJECT (self))); } GST_BASE_TRANSFORM_UNLOCK (self); }
static void gst_video_balance_update_properties (GstVideoBalance * videobalance) { gboolean passthrough = gst_video_balance_is_passthrough (videobalance); GstBaseTransform *base = GST_BASE_TRANSFORM (videobalance); GST_BASE_TRANSFORM_LOCK (base); base->passthrough = passthrough; GST_BASE_TRANSFORM_UNLOCK (base); if (!passthrough) gst_video_balance_update_tables (videobalance); }
static void gst_video_balance_colorbalance_set_value (GstColorBalance * balance, GstColorBalanceChannel * channel, gint value) { GstVideoBalance *vb = GST_VIDEO_BALANCE (balance); gdouble new_val; gboolean changed = FALSE; g_return_if_fail (vb != NULL); g_return_if_fail (GST_IS_VIDEO_BALANCE (vb)); g_return_if_fail (GST_IS_VIDEO_FILTER (vb)); g_return_if_fail (channel->label != NULL); GST_BASE_TRANSFORM_LOCK (vb); GST_OBJECT_LOCK (vb); if (!g_ascii_strcasecmp (channel->label, "HUE")) { new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0; changed = new_val != vb->hue; vb->hue = new_val; } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) { new_val = (value + 1000.0) * 2.0 / 2000.0; changed = new_val != vb->saturation; vb->saturation = new_val; } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) { new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0; changed = new_val != vb->brightness; vb->brightness = new_val; } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) { new_val = (value + 1000.0) * 2.0 / 2000.0; changed = new_val != vb->contrast; vb->contrast = new_val; } if (changed) gst_video_balance_update_properties (vb); GST_OBJECT_UNLOCK (vb); GST_BASE_TRANSFORM_UNLOCK (vb); if (changed) { gst_color_balance_value_changed (balance, channel, gst_color_balance_get_value (balance, channel)); } }
void gst_audio_fx_base_fir_filter_set_kernel (GstAudioFXBaseFIRFilter * self, gdouble * kernel, guint kernel_length, guint64 latency) { g_return_if_fail (kernel != NULL); g_return_if_fail (self != NULL); GST_BASE_TRANSFORM_LOCK (self); if (self->residue) { gst_audio_fx_base_fir_filter_push_residue (self); self->next_ts = GST_CLOCK_TIME_NONE; self->next_off = GST_BUFFER_OFFSET_NONE; self->residue_length = 0; } g_free (self->kernel); g_free (self->residue); self->kernel = kernel; self->kernel_length = kernel_length; if (GST_AUDIO_FILTER (self)->format.channels) { self->residue = g_new0 (gdouble, kernel_length * GST_AUDIO_FILTER (self)->format.channels); self->residue_length = 0; } if (self->latency != latency) { self->latency = latency; gst_element_post_message (GST_ELEMENT (self), gst_message_new_latency (GST_OBJECT (self))); } GST_BASE_TRANSFORM_UNLOCK (self); }
static void gst_smpte_alpha_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstSMPTEAlpha *smpte = GST_SMPTE_ALPHA (object); switch (prop_id) { case PROP_TYPE:{ gint type; type = g_value_get_enum (value); GST_BASE_TRANSFORM_LOCK (smpte); GST_OBJECT_LOCK (smpte); gst_smpte_alpha_update_mask (smpte, type, smpte->invert, smpte->depth, smpte->width, smpte->height); GST_OBJECT_UNLOCK (smpte); GST_BASE_TRANSFORM_UNLOCK (smpte); break; } case PROP_BORDER: GST_OBJECT_LOCK (smpte); smpte->border = g_value_get_int (value); GST_OBJECT_UNLOCK (smpte); break; case PROP_DEPTH:{ gint depth; depth = g_value_get_int (value); GST_BASE_TRANSFORM_LOCK (smpte); /* also lock with the object lock so that reading the property doesn't * have to wait for the transform lock */ GST_OBJECT_LOCK (smpte); gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->invert, depth, smpte->width, smpte->height); GST_OBJECT_UNLOCK (smpte); GST_BASE_TRANSFORM_UNLOCK (smpte); break; } case PROP_POSITION: GST_OBJECT_LOCK (smpte); smpte->position = g_value_get_double (value); GST_OBJECT_UNLOCK (smpte); break; case PROP_INVERT:{ gboolean invert; invert = g_value_get_boolean (value); GST_BASE_TRANSFORM_LOCK (smpte); /* also lock with the object lock so that reading the property doesn't * have to wait for the transform lock */ GST_OBJECT_LOCK (smpte); gst_smpte_alpha_update_mask (smpte, smpte->type, invert, smpte->depth, smpte->width, smpte->height); GST_OBJECT_UNLOCK (smpte); GST_BASE_TRANSFORM_UNLOCK (smpte); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }