mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +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.
64 lines
1.8 KiB
C
64 lines
1.8 KiB
C
|
|
#include <gst/gst.h>
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
GstElement *src, *sink, *enc, *tee;
|
|
GstElement *pipeline;
|
|
int i;
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
pipeline = gst_element_factory_make ("pipeline", "pipeline");
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
g_assert (src);
|
|
tee = gst_element_factory_make ("tee", "tee1");
|
|
g_assert (tee);
|
|
enc = gst_element_factory_make ("identity", "enc");
|
|
g_assert (enc);
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
g_assert (sink);
|
|
|
|
gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL);
|
|
if (!gst_element_link_many (src, tee, enc, sink, NULL))
|
|
g_assert_not_reached ();
|
|
if (gst_element_set_state (pipeline,
|
|
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
g_assert_not_reached ();
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
g_assert_not_reached ();
|
|
g_print ("%d\n", i);
|
|
}
|
|
|
|
if (gst_element_set_state (pipeline,
|
|
GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS)
|
|
g_assert_not_reached ();
|
|
gst_element_unlink_many (tee, enc, sink, NULL);
|
|
gst_bin_remove_many (GST_BIN (pipeline), enc, sink, NULL);
|
|
|
|
enc = gst_element_factory_make ("identity", "enc");
|
|
g_assert (enc);
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
g_assert (sink);
|
|
gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL);
|
|
if (!gst_element_link_many (tee, enc, sink, NULL))
|
|
g_assert_not_reached ();
|
|
if (gst_element_set_state (pipeline,
|
|
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
|
|
g_assert_not_reached ();
|
|
|
|
for (i = 5; i < 10; i++) {
|
|
if (!gst_bin_iterate (GST_BIN (pipeline)))
|
|
g_assert_not_reached ();
|
|
g_print ("%d\n", i);
|
|
}
|
|
g_print ("cleaning up...\n");
|
|
gst_object_unref (pipeline);
|
|
|
|
g_print ("done.\n");
|
|
return 0;
|
|
}
|