Skip to content

Instantly share code, notes, and snippets.

@tetkuz
Created December 8, 2016 17:38
Show Gist options
  • Save tetkuz/5ef915a82c48cab02b084a7edbfc158a to your computer and use it in GitHub Desktop.
Save tetkuz/5ef915a82c48cab02b084a7edbfc158a to your computer and use it in GitHub Desktop.
#include <gst/gst.h>
#include <glib.h>
int main(int argc, char *argv[])
{
GString *launch_str;
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
gst_init(&argc, &argv);
launch_str = g_string_new("fakesrc num-buffers=100 ! fakesink");
pipeline = gst_parse_launch (launch_str->str, NULL);
g_string_free (launch_str, TRUE);
if (pipeline == NULL) {
g_print("parse_launch fail.\n");
goto exit;
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
bus = gst_element_get_bus (pipeline);
msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, GST_CLOCK_TIME_NONE);
if (msg != NULL)
gst_message_unref(msg);
gst_object_unref(bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
exit:
gst_object_unref(pipeline);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment