#include <stdio.h>

#define GST_USE_UNSTABLE_API
#include <gst/gst.h>

GstPad *spad;

static gboolean
reconfigure(gpointer data)
{
  GstEvent *event = gst_event_new_reconfigure ();
  gst_pad_send_event (spad, event);

  return TRUE;
}

int
main (int argc, char ** argv)
{
  GMainLoop *loop;
  GstElement *src, *sink, *pipeline;

  gst_init (&argc, &argv);

  pipeline = gst_pipeline_new (NULL);
  g_assert (pipeline);

  src = gst_element_factory_make ("pulsesrc", NULL);
  sink = gst_element_factory_make ("fakesink", NULL);
  spad = gst_element_get_static_pad (src, "src");

  g_assert (src && sink);

  gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
  gst_element_link (src, sink);

  loop = g_main_loop_new (NULL, FALSE);

  gst_element_set_state (pipeline, GST_STATE_PLAYING);
  g_timeout_add_seconds(1, reconfigure, NULL);

  g_main_loop_run (loop);

  return 0;
}
