Skip to content

Instantly share code, notes, and snippets.

@tetkuz
Last active September 6, 2017 07:28
Show Gist options
  • Save tetkuz/804cac6a3560de0c2f6ea6ab0fbe276e to your computer and use it in GitHub Desktop.
Save tetkuz/804cac6a3560de0c2f6ea6ab0fbe276e to your computer and use it in GitHub Desktop.
Basic gstreamer application
#include <gst/gst.h>
#include <glib.h>
int main(int argc, char *argv[])
{
GstElement *pipeline;
GstElement *src;
GstElement *sink;
GstBus *bus;
GstMessage *msg;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("sample");
src = gst_element_factory_make ("fakesrc", "src");
sink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add (GST_BIN(pipeline), src);
gst_bin_add (GST_BIN(pipeline), sink);
if (gst_element_link (src, sink) == FALSE) {
g_print ("link failed.\n");
return 1;
}
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);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment