[Gst Example] tutorial 1
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 22 Mar 2018 02:06:43 +0000 (11:06 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 22 Mar 2018 02:06:43 +0000 (11:06 +0900)
Learning https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst_example/tutorial1/basic-tutorial-1.c [new file with mode: 0644]

diff --git a/gst_example/tutorial1/basic-tutorial-1.c b/gst_example/tutorial1/basic-tutorial-1.c
new file mode 100644 (file)
index 0000000..0f1928e
--- /dev/null
@@ -0,0 +1,23 @@
+#include <gst/gst.h>
+
+int main(int argc, char *argv[]) {
+  GstElement *pipeline;
+  GstBus *bus;
+  GstMessage *msg;
+
+  gst_init(&argc, &argv);
+
+  pipeline = gst_parse_launch("playbin url=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL);
+
+  gst_element_set_state(pipeline, GST_STATE_PLAYING);
+
+  bus = gst_element_get_bus(pipeline);
+  msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
+
+  if (msg != NULL)
+    gst_message_unref(msg);
+  gst_object_unref(bus);
+  gst_element_set_state(pipeline, GST_STATE_NULL);
+  gst_object_unref(pipeline);
+  return 0;
+}