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;
|
2001-02-24 00:23:21 +00:00
|
|
|
GstElement *videosink2;
|
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;
|
2001-02-24 00:23:21 +00:00
|
|
|
GstElement *tee;
|
2000-02-25 23:19:44 +00:00
|
|
|
GstElementFactory *srcfactory;
|
|
|
|
GstElementFactory *videosinkfactory;
|
|
|
|
|
|
|
|
GtkWidget *appwindow;
|
2001-02-24 00:23:21 +00:00
|
|
|
GtkWidget *appwindow2;
|
2000-03-13 22:13:11 +00:00
|
|
|
GtkWidget *vbox1;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *draw;
|
2001-02-24 00:23:21 +00:00
|
|
|
GtkWidget *draw2;
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
|
2000-04-13 21:59:38 +00:00
|
|
|
//_gst_plugin_spew = TRUE;
|
|
|
|
gst_init(&argc,&argv);
|
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");
|
2001-03-01 23:25:23 +00:00
|
|
|
gtk_object_set(GTK_OBJECT(src),"format",3,NULL);
|
2001-02-24 00:23:21 +00:00
|
|
|
gtk_object_set(GTK_OBJECT(src),"width",320,"height",240,NULL);
|
|
|
|
|
2000-02-25 23:19:44 +00:00
|
|
|
videosink = gst_elementfactory_create(videosinkfactory,"videosink");
|
2001-02-24 00:23:21 +00:00
|
|
|
gtk_object_set(GTK_OBJECT(videosink),"xv_enabled",FALSE,NULL);
|
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
|
|
|
|
2001-02-24 00:23:21 +00:00
|
|
|
videosink2 = gst_elementfactory_create(videosinkfactory,"videosink2");
|
|
|
|
gtk_object_set(GTK_OBJECT(videosink2),"xv_enabled",FALSE,NULL);
|
|
|
|
gtk_object_set(GTK_OBJECT(videosink2),"width",320,"height",240,NULL);
|
|
|
|
|
|
|
|
tee = gst_elementfactory_make ("tee", "tee");
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
|
2001-02-24 00:23:21 +00:00
|
|
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(tee));
|
2000-02-25 23:19:44 +00:00
|
|
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(videosink));
|
2001-02-24 00:23:21 +00:00
|
|
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(videosink2));
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
gst_pad_connect(gst_element_get_pad(src,"src"),
|
2001-02-24 00:23:21 +00:00
|
|
|
gst_element_get_pad(tee,"sink"));
|
|
|
|
gst_pad_connect(gst_element_request_pad_by_name (tee,"src%d"),
|
2000-02-25 23:19:44 +00:00
|
|
|
gst_element_get_pad(videosink,"sink"));
|
2001-02-24 00:23:21 +00:00
|
|
|
gst_pad_connect(gst_element_request_pad_by_name (tee,"src%d"),
|
|
|
|
gst_element_get_pad(videosink2,"sink"));
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
appwindow = gnome_app_new("Videotest","Videotest");
|
2001-02-24 00:23:21 +00:00
|
|
|
appwindow2 = gnome_app_new("Videotest2","Videotest2");
|
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);
|
2001-02-24 00:23:21 +00:00
|
|
|
|
|
|
|
draw2 = gst_util_get_widget_arg(GTK_OBJECT(videosink2),"widget"),
|
|
|
|
gtk_widget_show (draw2);
|
2000-03-13 22:13:11 +00:00
|
|
|
|
|
|
|
gnome_app_set_contents(GNOME_APP(appwindow), vbox1);
|
|
|
|
|
2001-02-24 00:23:21 +00:00
|
|
|
gnome_app_set_contents(GNOME_APP(appwindow2), draw2);
|
|
|
|
|
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);
|
2001-02-24 00:23:21 +00:00
|
|
|
gtk_widget_show_all(appwindow2);
|
2000-02-25 23:19:44 +00:00
|
|
|
|
|
|
|
gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);
|
|
|
|
|
2001-03-01 23:25:23 +00:00
|
|
|
gtk_object_set(GTK_OBJECT(src),"bright",32000,"contrast", 32000,NULL);
|
|
|
|
|
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;
|
|
|
|
}
|