summaryrefslogtreecommitdiff
path: root/gst/smoothwave/demo-osssrc.c
blob: 9c55a3b3588c06e997b1ac73a05747f1b23912e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gtk/gtk.h>
#include <gst/gst.h>

extern gboolean _gst_plugin_spew;

gboolean idle_func (gpointer data);

GtkWidget *drawingarea;

int
main (int argc, char *argv[])
{
  GstElement *bin;
  GstElement *src;
  GstElement *wave;
  GstElement *ximage;

  gst_init (&argc, &argv);
  gst_plugin_load ("libsmoothwave.so");
  gtk_init (&argc, &argv);

  bin = gst_pipeline_new ("bin");

  src = gst_element_factory_make ("sinesrc", "src");
  wave = gst_element_factory_make ("smoothwave", "wave");
  ximage = gst_element_factory_make (DEFAULT_VIDEOSINK, "sink");
  g_return_val_if_fail (src != NULL, -1);
  g_return_val_if_fail (wave != NULL, -1);
  g_return_val_if_fail (ximage != NULL, -1);


  gst_bin_add_many (GST_BIN (bin), src, wave, ximage, NULL);
  g_return_val_if_fail (gst_element_link_many (src, wave, ximage,
          NULL) != FALSE, -1);

  gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
  g_idle_add (idle_func, bin);

  gtk_main ();

  return 0;
}

gboolean
idle_func (gpointer data)
{
  gst_bin_iterate (GST_BIN (data));
  return TRUE;
}