2003-07-17 04:16:42 +00:00
|
|
|
#include <gtk/gtk.h>
|
2002-01-04 21:53:21 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
extern gboolean _gst_plugin_spew;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gboolean idle_func (gpointer data);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
|
|
|
GtkWidget *drawingarea;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
2002-01-04 21:53:21 +00:00
|
|
|
GstElement *bin;
|
|
|
|
GstElementFactory *srcfactory;
|
|
|
|
GstElement *src;
|
|
|
|
GstElementFactory *wavefactory;
|
|
|
|
GstElement *wave;
|
2003-07-17 04:16:42 +00:00
|
|
|
GtkWidget *wave_widget;
|
2002-01-04 21:53:21 +00:00
|
|
|
GtkWidget *appwindow;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_init (&argc, &argv);
|
|
|
|
gst_plugin_load ("libsmoothwave.so");
|
|
|
|
gtk_init (&argc, &argv);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
bin = gst_pipeline_new ("bin");
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
srcfactory = gst_element_factory_find ("sinesrc");
|
|
|
|
g_return_val_if_fail (srcfactory != NULL, -1);
|
|
|
|
wavefactory = gst_element_factory_find ("smoothwave");
|
|
|
|
g_return_val_if_fail (wavefactory != NULL, -1);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
src = gst_element_factory_create (srcfactory, "src");
|
2003-07-17 04:16:42 +00:00
|
|
|
//g_object_set(G_OBJECT(src),"bytes_per_read",(gulong)2048,NULL);
|
2004-03-14 22:34:33 +00:00
|
|
|
wave = gst_element_factory_create (wavefactory, "wave");
|
|
|
|
g_object_set (G_OBJECT (wave), "width", 256, "height", 100, NULL);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_bin_add (GST_BIN (bin), GST_ELEMENT (src));
|
|
|
|
gst_bin_add (GST_BIN (bin), GST_ELEMENT (wave));
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_pad_link (gst_element_get_pad (src, "src"),
|
|
|
|
gst_element_get_pad (wave, "sink"));
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
appwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
g_object_get (G_OBJECT (wave), "widget", &wave_widget, NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (appwindow), wave_widget);
|
|
|
|
gtk_widget_show_all (appwindow);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
|
|
|
|
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_idle_add (idle_func, bin);
|
2002-01-04 21:53:21 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gtk_main ();
|
2002-01-04 21:53:21 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gboolean
|
|
|
|
idle_func (gpointer data)
|
2003-07-17 04:16:42 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_bin_iterate (GST_BIN (data));
|
2002-01-04 21:53:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|