2000-02-25 23:19:44 +00:00
|
|
|
#include <gnome.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
extern gboolean _gst_plugin_spew;
|
|
|
|
|
|
|
|
gboolean idle_func(gpointer data);
|
|
|
|
|
2000-02-27 23:18:38 +00:00
|
|
|
GstElement *videosink;
|
2000-02-26 18:55:14 +00:00
|
|
|
GstElement *src;
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
int main(int argc,char *argv[]) {
|
|
|
|
GstElement *bin;
|
|
|
|
GstElementFactory *srcfactory;
|
|
|
|
GstElementFactory *videosinkfactory;
|
|
|
|
|
|
|
|
GtkWidget *appwindow;
|
2000-03-13 22:13:11 +00:00
|
|
|
GtkWidget *vbox1;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *draw;
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
|
2000-04-13 21:59:38 +00:00
|
|
|
//_gst_plugin_spew = TRUE;
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
gst_plugin_load("v4lsrc");
|
|
|
|
gst_plugin_load("videosink");
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
gnome_init("Videotest","0.0.1",argc,argv);
|
|
|
|
|
|
|
|
bin = gst_bin_new("bin");
|
|
|
|
|
|
|
|
srcfactory = gst_elementfactory_find("v4lsrc");
|
|
|
|
g_return_if_fail(srcfactory != NULL);
|
|
|
|
videosinkfactory = gst_elementfactory_find("videosink");
|
|
|
|
g_return_if_fail(videosinkfactory != NULL);
|
|
|
|
|
|
|
|
src = gst_elementfactory_create(srcfactory,"src");
|
|
|
|
videosink = gst_elementfactory_create(videosinkfactory,"videosink");
|
2000-04-13 21:59:38 +00:00
|
|
|
gtk_object_set(GTK_OBJECT(videosink),"width",320,"height",240,NULL);
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
|
|
|
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(videosink));
|
|
|
|
|
|
|
|
gst_pad_connect(gst_element_get_pad(src,"src"),
|
|
|
|
gst_element_get_pad(videosink,"sink"));
|
|
|
|
|
|
|
|
appwindow = gnome_app_new("Videotest","Videotest");
|
2000-03-13 22:13:11 +00:00
|
|
|
|
2000-04-13 21:59:38 +00:00
|
|
|
vbox1 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_widget_show (vbox1);
|
2000-03-13 22:13:11 +00:00
|
|
|
|
|
|
|
button = gtk_button_new_with_label(_("test"));//_with_label (_("chup"));
|
2000-04-13 21:59:38 +00:00
|
|
|
gtk_widget_show (button);
|
2000-03-13 22:13:11 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);
|
|
|
|
//gtk_widget_set_usize (button, 50, 50);
|
|
|
|
//gtk_widget_set_usize (button, 0, 0);
|
|
|
|
|
2000-04-13 21:59:38 +00:00
|
|
|
draw = gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget"),
|
2000-03-13 22:13:11 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox1),
|
2000-04-13 21:59:38 +00:00
|
|
|
draw,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (draw);
|
2000-03-13 22:13:11 +00:00
|
|
|
|
|
|
|
gnome_app_set_contents(GNOME_APP(appwindow), vbox1);
|
|
|
|
|
2000-02-27 23:18:38 +00:00
|
|
|
gtk_object_set(GTK_OBJECT(appwindow),"allow_grow",TRUE,NULL);
|
|
|
|
gtk_object_set(GTK_OBJECT(appwindow),"allow_shrink",TRUE,NULL);
|
|
|
|
|
2000-02-25 23:19:44 +00:00
|
|
|
gtk_widget_show_all(appwindow);
|
|
|
|
|
2000-08-14 15:17:24 +00:00
|
|
|
gst_element_set_state(GST_ELEMENT(bin),GST_STATE_READY);
|
2000-02-25 23:19:44 +00:00
|
|
|
gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);
|
|
|
|
|
2000-04-13 21:59:38 +00:00
|
|
|
//gtk_object_set(GTK_OBJECT(src),"tune",133250,NULL);
|
2000-12-27 22:39:45 +00:00
|
|
|
g_idle_add(idle_func,bin);
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
gtk_main();
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean idle_func(gpointer data) {
|
2000-04-13 21:59:38 +00:00
|
|
|
static int i=0;
|
2000-02-25 23:19:44 +00:00
|
|
|
//g_print("pushing %d\n",i++);
|
2000-12-27 22:39:45 +00:00
|
|
|
gst_bin_iterate(GST_BIN(data));
|
2000-02-25 23:19:44 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|