GStreamer学習ノート

4599 ワード

GStreamer学習ノート1
  • 環境構成
  • Demo
  • コンパイル
  • 参照
    環境設定
    開発環境:Ubuntu 16.04.1 x86_64コンパイルツールおよびライブラリ:sudo apt install libssl 1.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