colorbalance: add some guards to interface methods

https://bugzilla.gnome.org/show_bug.cgi?id=658584
This commit is contained in:
Tim-Philipp Müller 2011-09-09 13:07:57 +01:00
parent 4095551b31
commit 0f38f86182

View file

@ -124,7 +124,11 @@ gst_color_balance_class_init (GstColorBalanceClass * klass)
const GList *
gst_color_balance_list_channels (GstColorBalance * balance)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
GstColorBalanceClass *klass;
g_return_val_if_fail (GST_IS_COLOR_BALANCE (balance), NULL);
klass = GST_COLOR_BALANCE_GET_CLASS (balance);
if (klass->list_channels) {
return klass->list_channels (balance);
@ -175,7 +179,11 @@ gint
gst_color_balance_get_value (GstColorBalance * balance,
GstColorBalanceChannel * channel)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
GstColorBalanceClass *klass;
g_return_val_if_fail (GST_IS_COLOR_BALANCE (balance), 0);
klass = GST_COLOR_BALANCE_GET_CLASS (balance);
if (klass->get_value) {
return klass->get_value (balance, channel);
@ -197,7 +205,12 @@ gst_color_balance_get_value (GstColorBalance * balance,
GstColorBalanceType
gst_color_balance_get_balance_type (GstColorBalance * balance)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
GstColorBalanceClass *klass;
g_return_val_if_fail (GST_IS_COLOR_BALANCE (balance),
GST_COLOR_BALANCE_SOFTWARE);
klass = GST_COLOR_BALANCE_GET_CLASS (balance);
return klass->balance_type;
}
@ -217,6 +230,9 @@ void
gst_color_balance_value_changed (GstColorBalance * balance,
GstColorBalanceChannel * channel, gint value)
{
g_return_if_fail (GST_IS_COLOR_BALANCE (balance));
g_signal_emit (G_OBJECT (balance),
gst_color_balance_signals[VALUE_CHANGED], 0, channel, value);