From a08d45c4d713b33aea08044b0b93605ec40a9713 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 10 Aug 2008 17:30:36 -0300 Subject: [PATCH] A basic dummy player. --- main.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..457faed --- /dev/null +++ b/main.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2008 Thadeu Lima de Souza Cascardo + * + * 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 + +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; +} -- 2.20.1