2002-01-04 21:29:05 +00:00
|
|
|
#include <gnome.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 20:54:13 +00:00
|
|
|
idle_func (gpointer data)
|
2002-01-04 21:29:05 +00:00
|
|
|
{
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_bin_iterate (GST_BIN (data));
|
2002-01-04 21:29:05 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2002-01-04 21:29:05 +00:00
|
|
|
{
|
|
|
|
GstElement *bin;
|
|
|
|
GstElement *src;
|
|
|
|
GstElement *dvdec;
|
2004-03-14 20:54:13 +00:00
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/*GstElement *cspace; */
|
2002-01-04 21:29:05 +00:00
|
|
|
GstElement *deint;
|
|
|
|
GstElement *videosink;
|
|
|
|
|
|
|
|
GtkWidget *appwindow;
|
|
|
|
GtkWidget *vbox1;
|
|
|
|
GtkWidget *button;
|
|
|
|
guint32 draw;
|
|
|
|
GtkWidget *gtk_socket;
|
|
|
|
|
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_init (&argc, &argv);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gnome_init ("Videotest", "0.0.1", argc, argv);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
bin = gst_pipeline_new ("pipeline");
|
2002-01-04 21:29:05 +00:00
|
|
|
|
|
|
|
if (argc == 1) {
|
2002-04-11 20:42:25 +00:00
|
|
|
src = gst_element_factory_make ("dv1394src", "src");
|
2002-01-04 21:29:05 +00:00
|
|
|
} else {
|
2002-04-11 20:42:25 +00:00
|
|
|
src = gst_element_factory_make ("filesrc", "src");
|
2004-03-14 20:54:13 +00:00
|
|
|
g_object_set (G_OBJECT (src), "location", argv[1], "bytesperread", 480,
|
2004-03-15 19:32:27 +00:00
|
|
|
NULL);
|
2002-01-04 21:29:05 +00:00
|
|
|
}
|
2002-04-11 20:42:25 +00:00
|
|
|
dvdec = gst_element_factory_make ("dvdec", "decoder");
|
2004-03-14 20:54:13 +00:00
|
|
|
if (!dvdec)
|
|
|
|
fprintf (stderr, "no dvdec\n"), exit (1);
|
2002-04-11 20:42:25 +00:00
|
|
|
/* cspace = gst_element_factory_make ("colorspace", "cspace"); */
|
|
|
|
deint = gst_element_factory_make ("deinterlace", "deinterlace");
|
2005-01-07 22:42:32 +00:00
|
|
|
videosink = gst_element_factory_make ("xvimagesink", "videosink");
|
2004-03-14 20:54:13 +00:00
|
|
|
if (!videosink)
|
|
|
|
fprintf (stderr, "no dvdec\n"), exit (1);
|
|
|
|
g_object_set (G_OBJECT (videosink), "width", 720, "height", 576, NULL);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_bin_add (GST_BIN (bin), GST_ELEMENT (src));
|
|
|
|
gst_bin_add (GST_BIN (bin), GST_ELEMENT (dvdec));
|
2002-03-19 04:10:05 +00:00
|
|
|
/* gst_bin_add(GST_BIN(bin),GST_ELEMENT(cspace)); */
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_bin_add (GST_BIN (bin), GST_ELEMENT (videosink));
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_element_link (src, "src", dvdec, "sink");
|
2003-12-02 02:28:13 +00:00
|
|
|
/* gst_element_link(cspace,"src",videosink,"sink"); */
|
|
|
|
/* gst_element_link(dvdec,"video",cspace,"sink"); */
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_element_link (dvdec, "video", deint, "sink");
|
|
|
|
gst_element_link (deint, "src", videosink, "sink");
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
appwindow = gnome_app_new ("Videotest", "Videotest");
|
2002-01-04 21:29:05 +00:00
|
|
|
|
|
|
|
vbox1 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_widget_show (vbox1);
|
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
button = gtk_button_new_with_label ("test");
|
2002-01-04 21:29:05 +00:00
|
|
|
gtk_widget_show (button);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
draw = gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"),
|
2004-03-14 20:54:13 +00:00
|
|
|
gtk_socket = gtk_socket_new ();
|
|
|
|
gtk_widget_set_usize (gtk_socket, 720, 576);
|
2002-01-04 21:29:05 +00:00
|
|
|
gtk_widget_show (gtk_socket);
|
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gnome_app_set_contents (GNOME_APP (appwindow), vbox1);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (gtk_socket), TRUE, TRUE, 0);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
|
|
|
gtk_widget_realize (gtk_socket);
|
|
|
|
gtk_socket_steal (GTK_SOCKET (gtk_socket), draw);
|
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gtk_object_set (GTK_OBJECT (appwindow), "allow_grow", TRUE, NULL);
|
|
|
|
gtk_object_set (GTK_OBJECT (appwindow), "allow_shrink", TRUE, NULL);
|
|
|
|
|
|
|
|
gtk_widget_show_all (appwindow);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2004-03-14 20:54:13 +00:00
|
|
|
xmlSaveFile ("dvshow.xml", gst_xml_write (GST_ELEMENT (bin)));
|
2002-01-04 21:29:05 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
g_idle_add (idle_func, bin);
|
2002-01-04 21:29:05 +00:00
|
|
|
|
2004-03-14 20:54:13 +00:00
|
|
|
gtk_main ();
|
2002-01-04 21:29:05 +00:00
|
|
|
|
|
|
|
exit (0);
|
|
|
|
}
|