Skip to content

BuildGStreamer

Tobias Kammacher edited this page Dec 20, 2016 · 10 revisions

Build GStreamer manually

In order to use the Userptr and Dmabuf modes of buffer passing, we need to modify the v4l2src plugin. Therefore it is required to build GStreamer 1.8.0 and all its plugins by hand. The default GStreamer can not be used.

This process is described for the TX1 in the L4T_Tegra_X1_Multimedia_User_Guide_Release_24.1.pdf on page 22 Build GStreamer manually.

Important: When building gst-plugins-good make sure that libv4l development headers are NOT available. sudo apt-get remove libv4l-dev

Enable Userptr and Dmabuf modes in GStreamer Plugins Good

To enable the Userptr and Dmabuf modes, apply the following patch before building the Gstreamer Good Plugins: PATCH_gstreamer_enable_userptr_xvimagesink.txt (the patch was created based on GStreamer version 1.8.0).

--- gstv4l2object_ORIG.c	2016-06-06 12:11:47.703300833 +0000
+++ gstv4l2object.c	2016-06-06 12:13:22.102241011 +0000
@@ -3244,6 +3244,13 @@
     format.fmt.pix.pixelformat = pixelformat;
     format.fmt.pix.field = field;
 
+/* DEBUG!! */
+    GST_WARNING_OBJECT (v4l2object->element, "DBG: width=%d, height=%d, pixelformat=%d", format.fmt.pix.width, format.fmt.pix.height, format.fmt.pix.pixelformat);
+    GST_WARNING_OBJECT (v4l2object->element, "DBG: format.fmt.pix.sizeimage=%d", format.fmt.pix.sizeimage );
+    // This only works for pixelformats with 2 bytes per pixel (e.g. UYVY)
+    format.fmt.pix.sizeimage = width * height * 2; 
+/* END DEBUG */
+
     if (GST_VIDEO_FORMAT_INFO_IS_TILED (info.finfo))
       stride = GST_VIDEO_TILE_X_TILES (stride) <<
           GST_VIDEO_FORMAT_INFO_TILE_WS (info.finfo);

Using the manually built GStreamer version

When executing a GStreamer pipeline that should use the manually built version of GStreamer, export the following environment variables first (replace YOURPATH with your path to the GStreamer build):

export LD_LIBRARY_PATH=/YOURPATH/gst_1.8.0/out/lib/
export PATH=/YOURPATH/gst_1.8.0/out/bin/:$PATH
export GST_PLUGIN_PATH=$LD_LIBRARY_PATH

Clone this wiki locally