From: Julien M. <do...@pd...> - 2004-02-19 15:07:51
|
CVS Root: /home/cvs/gstreamer Module: gst-sandbox Changes by: dolphy Date: Thu Feb 19 2004 07:02:14 PST Log message: 2004-02-19 Julien MOUTTE <ju...@mo...> * live_client.c: (videowindow_realized), (setup_pipeline), (idle_func), (main): * live_server.c: (main): Adding the video wall client/server files after a quick 0.7 rewrite. Added files: gst-videowall : ChangeLog live_client.c live_server.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-sandbox/gst-videowall/ChangeLog?rev=1.1&content-type=text/vnd.viewcvs-markup http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-sandbox/gst-videowall/live_client.c?rev=1.1&content-type=text/vnd.viewcvs-markup http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-sandbox/gst-videowall/live_server.c?rev=1.1&content-type=text/vnd.viewcvs-markup ====Begin Diffs==== --- NEW FILE: ChangeLog --- 2004-02-19 Julien MOUTTE <ju...@mo...> * live_client.c: (videowindow_realized), (setup_pipeline), (idle_func), (main): * live_server.c: (main): Adding the video wall client/server files after a quick 0.7 rewrite. --- NEW FILE: live_client.c --- /* live_client.c * A sample client application for a Gstreamer + Xinerama * powered video-wall. It receive mpeg 1 video from the networks * broadcast address and then plays with it. */ #include <gst/gst.h> #include <gst/xoverlay/xoverlay.h> #include <gdk/gdkx.h> #include <gnome.h> #include <unistd.h> #include <stdlib.h> #define CROP_TOP 0 #define CROP_BOT 0 #define CROP_LEFT 0 #define CROP_RIGHT 0 typedef struct _GstVideoWallClient GstVideoWallClient; /* Internal stuff */ struct _GstVideoWallClient { GtkWidget *vw_window; GstElement *pipeline; GstElement *video_sink; }; static void videowindow_realized (GtkWidget * widget, GstVideoWallClient *client) { gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (client->video_sink), GDK_WINDOW_XID (client->vw_window->window)); gtk_window_fullscreen (GTK_WINDOW (client->vw_window)); } static gboolean setup_pipeline (GstVideoWallClient *client) GstElement *udp_src, *mpg_decoder, *colorspace, *videocrop; /* Creating pipeline */ client->pipeline = gst_pipeline_new ("main_pipe"); g_return_val_if_fail (GST_IS_ELEMENT (client->pipeline), FALSE); udp_src = gst_element_factory_make ("udpsrc", "movie_src"); g_return_val_if_fail (GST_IS_ELEMENT (udp_src), FALSE); mpg_decoder = gst_element_factory_make ("mpeg2dec", "mpegdecoder"); g_return_val_if_fail (GST_IS_ELEMENT (mpg_decoder), FALSE); videocrop = gst_element_factory_make ("videocrop", "video_crop"); g_return_val_if_fail (GST_IS_ELEMENT (videocrop), FALSE); g_object_set (G_OBJECT (videocrop), "top", CROP_TOP, "bottom", CROP_BOT, "left", CROP_LEFT, "right", CROP_RIGHT, NULL); colorspace = gst_element_factory_make ("ffcolorspace", "colorspace"); g_return_val_if_fail (GST_IS_ELEMENT (colorspace), FALSE); client->video_sink = gst_element_factory_make ("xvimagesink", "video_sink"); g_return_val_if_fail (GST_IS_ELEMENT (client->video_sink), FALSE); /* Our Application Window */ client->vw_window = gnome_app_new ("Video-Wall Client", "Video-Wall Client"); /* we need no borders */ gtk_window_set_decorated (GTK_WINDOW (client->vw_window), FALSE); g_signal_connect_after (G_OBJECT (client->vw_window), "realize", G_CALLBACK (videowindow_realized), client); gtk_widget_show (client->vw_window); /* Connect the appropritate elements */ gst_element_link_many (udp_src, mpg_decoder, videocrop, colorspace, client->video_sink, NULL); /* Add all element to their appropriate bins */ gst_bin_add_many (GST_BIN (client->pipeline), udp_src, mpg_decoder, videocrop, colorspace, client->video_sink, NULL); return TRUE; idle_func (gpointer data) GstVideoWallClient *client = (GstVideoWallClient *) data; gst_bin_iterate (GST_BIN (client->pipeline)); return (GST_STATE (client->pipeline) == GST_STATE_PLAYING); int main (int argc, char *argv[]) GstVideoWallClient *client = NULL; client = g_new0 (GstVideoWallClient, 1); gnome_init ("Video-Wall Client", "0.0.1", argc, argv); gst_init (&argc, &argv); if (!setup_pipeline (client)) return -1; gtk_idle_add (idle_func, client); /* Lets get started */ gst_element_set_state (client->pipeline, GST_STATE_PLAYING); gtk_main (); gst_element_set_state (client->pipeline, GST_STATE_READY); gst_object_unref (GST_OBJECT (client->pipeline)); g_print ("Normal Program Termination\n"); return 0; --- NEW FILE: live_server.c --- /* live_server.c * A sample server application for a Gstreamer + Xinerama * powered video-wall. It grabs live video from a v4lsrc * device and streams it on the broadcast address of the network. */ GstElement *main_pipe, *v4lsrc = NULL, *udp_sink = NULL, *mpg_encoder = NULL; if (argc != 2) g_print ("wrong syntax: %s <ip> where ip is the target host address\n", argv[0]); g_print ("using host address %s\n", argv[1]); main_pipe = gst_pipeline_new ("main_pipe"); g_return_val_if_fail (GST_IS_ELEMENT (main_pipe), -1); /* Get the main Srcs & sinks */ v4lsrc = gst_element_factory_make ("v4lsrc", "movie_src"); g_return_val_if_fail (GST_IS_ELEMENT (v4lsrc), -1); g_object_set (G_OBJECT (v4lsrc), "device", "/dev/video0", "width", 320, "height", 240, NULL); mpg_encoder = gst_element_factory_make ("mpeg2enc", "mpg_encoder"); g_return_val_if_fail (GST_IS_ELEMENT (mpg_encoder), -1); udp_sink = gst_element_factory_make ("udpsink", "udp_sink"); g_return_val_if_fail (GST_IS_ELEMENT (udp_sink), -1); g_object_set (G_OBJECT (udp_sink), "host", "192.168.1.255", NULL); gst_element_link_many (v4lsrc, mpg_encoder, udp_sink, NULL); gst_bin_add_many (GST_BIN (main_pipe), v4lsrc, mpg_encoder, udp_sink, NULL); gst_element_set_state (GST_ELEMENT (main_pipe), GST_STATE_PLAYING); while (gst_bin_iterate (GST_BIN (main_pipe))); gst_element_set_state (GST_ELEMENT (main_pipe), GST_STATE_READY); gst_object_unref (GST_OBJECT (main_pipe)); exit (0); |