/*
 * Author: Matthew Waters <matthew@centricular.com>
 *
 * gcc -Wall $(pkg-config --cflags gstreamer-1.0) glvideomixer-dynamic-input.c -o glvideomixer-dynamic-input $(pkg-config --libs gstreamer-1.0)
 */

#include <gst/gst.h>

static GstElement *pipeline;
static GstElement *capsfilter; 

int
main (int argc, char *argv[])
{
  GstCaps *caps;

  gst_init (&argc, &argv);

  pipeline = gst_parse_launch ("videotestsrc ! capsfilter name=cf ! glvideomixer ! glimagesink", NULL);
  capsfilter = gst_bin_get_by_name (GST_BIN (pipeline), "cf");
  caps = gst_caps_from_string ("video/x-raw,width=320,height=240,framerate=2/1");
  g_object_set (capsfilter, "caps", caps, NULL);
  gst_caps_unref (caps);

  gst_element_set_state (pipeline, GST_STATE_PLAYING);

  g_usleep (2 * 1000 * 1000);

  caps = gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=2/1");
  g_object_set (capsfilter, "caps", caps, NULL);
  gst_caps_unref (caps);

  g_usleep (2 * 1000 * 1000);

  gst_element_set_state (pipeline, GST_STATE_NULL);
  gst_object_unref (capsfilter);
  gst_object_unref (pipeline);

  gst_deinit ();

  return 0;
}
