mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
e040bb2dbe
Original commit message from CVS: 2005-09-02 Andy Wingo <wingo@pobox.com> * gst/gstelement.h (GstState): Renamed from GstElementState, changed to be a normal enum instead of flags. (GstStateChangeReturn): Renamed from GstElementStateReturn, names munged to be GST_STATE_CHANGE_*. (GST_STATE_CHANGE): Renamed from GST_STATE_TRANSITION, updated to work with the new state representation. (GstStateChange): New enumeration of possible state transitions. Replaces GST_STATE_FOO_TO_BAR with GST_STATE_CHANGE_FOO_TO_BAR. (GstElementClass::change_state): Pass the GstStateChange along as an argument. Helps language bindings, so they don't have to use tricky lock-needing macros like GST_STATE_CHANGE (). * scripts/update-states (file): New script. Run it on a file to update it for state naming and API changes. Updates files in place. * All files updated for the new API.
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
#include <unistd.h>
|
|
#include <gst/gst.h>
|
|
|
|
static GstElement *thread, *pipeline;
|
|
static GstElement *src, *sink;
|
|
|
|
static void
|
|
handoff_src (GstElement * element)
|
|
{
|
|
g_print ("identity handoff\n");
|
|
|
|
if (gst_element_set_state (thread,
|
|
GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS)
|
|
g_assert_not_reached ();
|
|
|
|
if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS)
|
|
g_assert_not_reached ();
|
|
|
|
gst_bin_remove (GST_BIN (thread), src);
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
gst_init (&argc, &argv);
|
|
|
|
pipeline = gst_element_factory_make ("pipeline", "pipeline");
|
|
|
|
thread = gst_element_factory_make ("thread", "thread");
|
|
g_assert (thread);
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
g_assert (src);
|
|
g_signal_connect (G_OBJECT (src), "handoff", (GCallback) handoff_src, NULL);
|
|
g_object_set (G_OBJECT (src), "signal-handoffs", TRUE, NULL);
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
g_assert (sink);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), thread);
|
|
|
|
gst_bin_add_many (GST_BIN (thread), src, sink, NULL);
|
|
if (!gst_element_link_many (src, sink, NULL))
|
|
g_assert_not_reached ();
|
|
|
|
/* run a bit */
|
|
if (gst_element_set_state (pipeline,
|
|
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
g_assert_not_reached ();
|
|
|
|
sleep (2);
|
|
|
|
return 0;
|
|
}
|