2 * Copyright (C) <2006> Zaheer Abbas Merali <zaheerabbas at merali dot org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
26 static GMainLoop *loop;
29 terminate_playback (GstElement * pipeline)
31 g_print ("Terminating playback\n");
32 g_main_loop_quit (loop);
37 main (int argc, char **argv)
41 #ifndef G_DISABLE_ASSERT
42 GstState state, pending;
46 gst_init (&argc, &argv);
48 pipeline = gst_parse_launch ("ximagesrc ! fakesink", &error);
50 g_print ("Error while parsing pipeline description: %s\n", error->message);
54 loop = g_main_loop_new (NULL, FALSE);
56 bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
58 gst_element_set_state (pipeline, GST_STATE_PLAYING);
60 /* lets check it gets to PLAYING */
61 g_assert (gst_element_get_state (pipeline, &state, &pending,
62 GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_FAILURE);
63 g_assert (state == GST_STATE_PLAYING || pending == GST_STATE_PLAYING);
65 /* We want to get out after 5 seconds */
66 g_timeout_add (5000, (GSourceFunc) terminate_playback, pipeline);
68 g_main_loop_run (loop);
70 g_main_loop_unref (loop);