A basic dummy player. master
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 10 Aug 2008 20:30:36 +0000 (17:30 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 10 Aug 2008 20:30:36 +0000 (17:30 -0300)
main.c [new file with mode: 0644]

diff --git a/main.c b/main.c
new file mode 100644 (file)
index 0000000..457faed
--- /dev/null
+++ b/main.c
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2008  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include <gst/gst.h>
+
+gboolean
+bus_watch (GstBus *bus, GstMessage *message, gpointer data)
+{
+  if (message->type == GST_MESSAGE_EOS)
+    g_main_loop_quit ((GMainLoop*) data);
+  return TRUE;
+}
+
+int
+main (int argc, char **argv)
+{
+  GMainLoop *loop;
+  GstElement *pipeline;
+  GstBus *bus;
+  GstElement *src;
+  GstElement *filter;
+  GstElement *sink;
+  gst_init (&argc, &argv);
+  loop = g_main_loop_new (g_main_context_default (), TRUE);
+  pipeline = gst_pipeline_new (NULL);
+  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+  gst_bus_add_watch (bus, bus_watch, loop);
+  src = gst_element_factory_make ("videotestsrc", NULL);
+  filter = gst_element_factory_make ("ffmpegcolorspace", NULL);
+  sink = gst_element_factory_make ("ximagesink", NULL);
+  gst_bin_add_many (GST_BIN (pipeline), src, filter, sink, NULL);
+  gst_element_link_many (src, filter, sink, NULL);
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+  g_main_loop_run (loop);
+  return 0;
+}