Commit 47a2f406 authored by Olivier Crete's avatar Olivier Crete
Browse files

Error if the elements try to go to ready without an agent set

darcs-hash:20080403231722-3e2dc-bded4a5e1db4984708083e3d94ce58471de156d1.gz
parent 91b090d0
......@@ -58,6 +58,10 @@ gst_nice_sink_get_property (
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GstStateChangeReturn
gst_nice_sink_change_state (
GstElement * element,
GstStateChange transition);
static const GstElementDetails gst_nice_sink_details =
GST_ELEMENT_DETAILS (
......@@ -96,6 +100,7 @@ static void
gst_nice_sink_class_init (GstNiceSinkClass *klass)
{
GstBaseSinkClass *gstbasesink_class;
GstElementClass *gstelement_class;
GObjectClass *gobject_class;
gstbasesink_class = (GstBaseSinkClass *) klass;
......@@ -105,6 +110,9 @@ gst_nice_sink_class_init (GstNiceSinkClass *klass)
gobject_class->set_property = gst_nice_sink_set_property;
gobject_class->get_property = gst_nice_sink_get_property;
gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state = gst_nice_sink_change_state;
g_object_class_install_property (gobject_class, PROP_AGENT,
g_param_spec_pointer (
"agent",
......@@ -212,3 +220,28 @@ gst_nice_sink_get_property (
}
}
static GstStateChangeReturn
gst_nice_sink_change_state (GstElement * element, GstStateChange transition)
{
GstNiceSink *sink;
GstStateChangeReturn ret;
sink = GST_NICE_SINK (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (sink->agent == NULL)
{
GST_ERROR_OBJECT (element,
"Trying to start Nice sink without an agent set");
return GST_STATE_CHANGE_FAILURE;
}
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return ret;
}
......@@ -66,6 +66,11 @@ gst_nice_src_get_property (
GValue *value,
GParamSpec *pspec);
static GstStateChangeReturn
gst_nice_src_change_state (
GstElement * element,
GstStateChange transition);
static const GstElementDetails gst_nice_src_details =
GST_ELEMENT_DETAILS (
"ICE source",
......@@ -103,6 +108,7 @@ static void
gst_nice_src_class_init (GstNiceSrcClass *klass)
{
GstBaseSrcClass *gstbasesrc_class;
GstElementClass *gstelement_class;
GObjectClass *gobject_class;
gstbasesrc_class = (GstBaseSrcClass *) klass;
......@@ -112,6 +118,9 @@ gst_nice_src_class_init (GstNiceSrcClass *klass)
gobject_class->set_property = gst_nice_src_set_property;
gobject_class->get_property = gst_nice_src_get_property;
gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state = gst_nice_src_change_state;
g_object_class_install_property (gobject_class, PROP_AGENT,
g_param_spec_pointer (
"agent",
......@@ -231,3 +240,30 @@ gst_nice_src_get_property (
}
}
static GstStateChangeReturn
gst_nice_src_change_state (GstElement * element, GstStateChange transition)
{
GstNiceSrc *src;
GstStateChangeReturn ret;
src = GST_NICE_SRC (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (src->agent == NULL)
{
GST_ERROR_OBJECT (element,
"Trying to start Nice source without an agent set");
return GST_STATE_CHANGE_FAILURE;
}
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return ret;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment