static void
gst_switch_sink_init (GstSwitchSink * sink, GstSwitchSinkClass * g_class)
{
  sink->pad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK);
  gst_element_add_pad (GST_ELEMENT (sink), sink->pad);

  gst_switch_sink_reset (sink);
}
static void
gst_switch_sink_init (GstSwitchSink * sink, GstSwitchSinkClass * g_class)
{
  GstElementClass *eklass = GST_ELEMENT_GET_CLASS (sink);
  GstPadTemplate *templ;

  templ = gst_element_class_get_pad_template (eklass, "sink");
  sink->pad = gst_ghost_pad_new_no_target_from_template ("sink", templ);
  gst_element_add_pad (GST_ELEMENT (sink), sink->pad);

  gst_switch_sink_reset (sink);

  GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_IS_SINK);
}
static GstStateChangeReturn
gst_switch_sink_change_state (GstElement * element, GstStateChange transition)
{
  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
  GstSwitchSink *sink = GST_SWITCH_SINK (element);

  ret = GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
      (element, transition), GST_STATE_CHANGE_SUCCESS);

  switch (transition) {
    case GST_STATE_CHANGE_READY_TO_NULL:
      if (!gst_switch_sink_reset (sink))
        ret = GST_STATE_CHANGE_FAILURE;
      break;
    default:
      break;
  }

  return ret;
}