4 extern gboolean _gst_plugin_spew;
6 gboolean idle_func(gpointer data);
11 int main(int argc,char *argv[]) {
13 GstElementFactory *srcfactory;
14 GstElementFactory *videosinkfactory;
22 //_gst_plugin_spew = TRUE;
23 gst_init(&argc,&argv);
24 gst_plugin_load("v4lsrc");
25 gst_plugin_load("videosink");
27 gnome_init("Videotest","0.0.1",argc,argv);
29 bin = gst_bin_new("bin");
31 srcfactory = gst_elementfactory_find("v4lsrc");
32 g_return_if_fail(srcfactory != NULL);
33 videosinkfactory = gst_elementfactory_find("videosink");
34 g_return_if_fail(videosinkfactory != NULL);
36 src = gst_elementfactory_create(srcfactory,"src");
37 videosink = gst_elementfactory_create(videosinkfactory,"videosink");
38 gtk_object_set(GTK_OBJECT(videosink),"width",120,"height",80,NULL);
41 gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
42 gst_bin_add(GST_BIN(bin),GST_ELEMENT(videosink));
44 gst_pad_connect(gst_element_get_pad(src,"src"),
45 gst_element_get_pad(videosink,"sink"));
47 appwindow = gnome_app_new("Videotest","Videotest");
49 vbox1 = gtk_vbox_new (FALSE, 0);
50 gtk_widget_show (vbox1);
52 button = gtk_button_new_with_label(_("test"));//_with_label (_("chup"));
53 gtk_widget_show (button);
54 gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);
55 //gtk_widget_set_usize (button, 50, 50);
56 //gtk_widget_set_usize (button, 0, 0);
58 draw = gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget"),
59 gtk_box_pack_start (GTK_BOX (vbox1),
62 gtk_widget_show (draw);
64 gnome_app_set_contents(GNOME_APP(appwindow), vbox1);
66 gtk_object_set(GTK_OBJECT(appwindow),"allow_grow",TRUE,NULL);
67 gtk_object_set(GTK_OBJECT(appwindow),"allow_shrink",TRUE,NULL);
69 gtk_widget_show_all(appwindow);
71 gst_element_set_state(GST_ELEMENT(bin),GST_STATE_RUNNING);
72 gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);
74 g_idle_add(idle_func,src);
79 gboolean idle_func(gpointer data) {
81 //g_print("pushing %d\n",i++);
82 gst_src_push(GST_SRC(data));