2003-03-25 19:41:23 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
#include "unistd.h"
|
|
|
|
|
2003-03-25 19:41:23 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
static GMainLoop *loop;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
|
|
|
|
{
|
|
|
|
g_print ("message %p\n", message);
|
|
|
|
|
|
|
|
if (message->type == GST_MESSAGE_EOS) {
|
|
|
|
g_print ("EOS!!\n");
|
|
|
|
if (g_main_loop_is_running (loop))
|
|
|
|
g_main_loop_quit (loop);
|
|
|
|
}
|
|
|
|
gst_message_unref (message);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-03-25 19:41:23 +00:00
|
|
|
gint
|
2004-03-13 15:27:01 +00:00
|
|
|
main (gint argc, gchar * argv[])
|
2003-03-25 19:41:23 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
2004-03-13 15:27:01 +00:00
|
|
|
GstElement *fakesrc1, *fakesink1;
|
|
|
|
GstElement *fakesrc2, *fakesink2;
|
2005-03-21 17:34:02 +00:00
|
|
|
GstBus *bus;
|
2003-03-25 19:41:23 +00:00
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
bus = gst_element_get_bus (pipeline);
|
2005-09-23 11:41:30 +00:00
|
|
|
gst_bus_add_watch (bus, GST_MESSAGE_EOS, (GstBusFunc) message_received,
|
|
|
|
(gpointer) pipeline);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (bus);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
2003-03-25 19:41:23 +00:00
|
|
|
fakesrc1 = gst_element_factory_make ("fakesrc", "fakesrc1");
|
|
|
|
g_object_set (G_OBJECT (fakesrc1), "num_buffers", 5, NULL);
|
|
|
|
fakesink1 = gst_element_factory_make ("fakesink", "fakesink1");
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), fakesrc1);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), fakesink1);
|
|
|
|
gst_pad_link (gst_element_get_pad (fakesrc1, "src"),
|
|
|
|
gst_element_get_pad (fakesink1, "sink"));
|
2003-03-25 19:41:23 +00:00
|
|
|
|
|
|
|
fakesrc2 = gst_element_factory_make ("fakesrc", "fakesrc2");
|
|
|
|
g_object_set (G_OBJECT (fakesrc2), "num_buffers", 5, NULL);
|
|
|
|
fakesink2 = gst_element_factory_make ("fakesink", "fakesink2");
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), fakesrc2);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), fakesink2);
|
|
|
|
gst_pad_link (gst_element_get_pad (fakesrc2, "src"),
|
|
|
|
gst_element_get_pad (fakesink2, "sink"));
|
2003-03-25 19:41:23 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_connect (G_OBJECT (pipeline), "deep_notify",
|
2005-03-21 17:34:02 +00:00
|
|
|
G_CALLBACK (gst_object_default_deep_notify), NULL);
|
2003-03-25 19:41:23 +00:00
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
GST_OBJECT_FLAG_SET (fakesrc2, GST_ELEMENT_LOCKED_STATE);
|
|
|
|
GST_OBJECT_FLAG_SET (fakesink2, GST_ELEMENT_LOCKED_STATE);
|
2003-03-25 19:41:23 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
g_print ("play..\n");
|
2003-03-25 19:41:23 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
|
|
|
g_main_loop_run (loop);
|
2003-03-25 19:41:23 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (fakesrc1), "num_buffers", 5, NULL);
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
GST_OBJECT_FLAG_UNSET (fakesrc2, GST_ELEMENT_LOCKED_STATE);
|
|
|
|
GST_OBJECT_FLAG_UNSET (fakesink2, GST_ELEMENT_LOCKED_STATE);
|
2003-03-25 19:41:23 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
g_print ("play..\n");
|
2003-03-25 19:41:23 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
|
|
|
g_main_loop_run (loop);
|
|
|
|
|
2003-03-25 19:41:23 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (pipeline);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-03-25 19:41:23 +00:00
|
|
|
return 0;
|
|
|
|
}
|