GStreamer学习笔记

GStreamer学习笔记1

  • 环境配置
    • Demo
    • 编译
    • 引用

环境配置

开发环境:Ubuntu 16.04.1 x86_64
编译工具及库:sudo apt install libssl1.0.0 libgstreamer1.0-0 gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav libgstrtspserver-1.0-0 libjansson4 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

Demo

#include 

int main (int argc, char *argv[])
{
	GstElement *pipeline;
	GstBus *bus;
	GstMessage *msg;

	/* Initialize GStreamer */
	gst_init (&argc, &argv);

	/* Build the pipeline */
	// pipeline = gst_parse_launch ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL); // use network resource
	pipeline = gst_parse_launch ("playbin uri=file:///home/workspace/Test/GStreamer/src/sintel_trailer-480p.webm", NULL); // use local resource
	
	/* Start playing */
	gst_element_set_state (pipeline, GST_STATE_PLAYING);

	/* Wait until error or EOS */
	bus = gst_element_get_bus (pipeline);
	msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
			GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

	/* Free resources */
	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;
}

编译

gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0`

引用

https://www.cnblogs.com/xleng/p/11008239.html.
https://blog.csdn.net/sinat_27535821/article/details/89498903

你可能感兴趣的:(c/c++,GStreamer)