/* gcc test.c `pkg-config --cflags --libs gstreamer-1.0` */
#include <gst/gst.h>

static GstPadProbeReturn
idle_probe_cb (GstPad *pad,
    GstPadProbeInfo *info,
    gpointer user_data)
{
  g_print ("Idle probe called, returning OK\n");
  return GST_PAD_PROBE_OK;
}

int main()
{
  GstElement *pipeline;
  GstElement *src;
  GstElement *sink;
  GstPad *srcpad;
  GstPad *sinkpad;

  gst_init (NULL, NULL);

  pipeline = gst_parse_launch ("videotestsrc name=src ! xvimagesink name=sink", NULL);
  src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
  srcpad = gst_element_get_static_pad (src, "src");
  sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
  sinkpad = gst_element_get_static_pad (src, "sink");

  /* Play 1s */
  gst_element_set_state (pipeline, GST_STATE_PLAYING);
  g_usleep (G_USEC_PER_SEC);

  /* Block the stream */
  gst_pad_add_probe (srcpad,
      GST_PAD_PROBE_TYPE_IDLE |
      GST_PAD_PROBE_TYPE_BLOCK |
      GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
      idle_probe_cb, NULL, NULL);

  /* Poor man's main loop */
  while (1);
}
