/gst-gz

A library for gstreamer that has a GZip decoder plugin with support for also BZip2 decompression

Primary LanguageCOtherNOASSERTION

GSTREAMER GZIP DECODER PLUGIN

gst-gz is a library for gstreamer that has a GZip decoder plugin with support for also BZip2 decompression. It acts as a filter element, with one sink pad and one source pad. Its usage is as follows:

$ gst-launch-1.0 filesrc location=file.gz ! gzdec ! filesink location=file

The generated file should be the same as the one generated with:

$ gunzip -c file.gz > file

The plugin name is gzdec and it has 2 properties:

  • blocksize: Size in bytes to read when decoding (0 = input buffer's size)
  • method: The decoding method to use: 0 = GZip, 1 = BZip

REQUIREMENTS

In order to build gst-gz you need the GZip libraries:

  • libz.so (for GZip)
  • libbz2.so (For BZip2)

And either gstreamer 1.0 (default) or 0.10 API:

  • libgstbase-1.0.so libgstreamer-1.0.so
  • libgstbase-0.10.so libgstreamer-0.10.so

BUILD

You can build gst-gz manually using the build/Makefile provided. Select the desired gstreamer API by uncommenting/commenting the GST_API_CFLAGS and GST_API_LFLAGS variables. Once you are done, compile the source with:

$ make -C build

And the plugin library should be generated in src/libgstgz.so. You can now inspect the plugin with the following command (for gstreamer 1.0):

$ GST_PLUGIN_PATH=src gst-inspect-1.0 gzdec

Check if the plugin works with the test/video.mp4 example file:

$ gzip -c test/video.mp4 > test/video.mp4.gz
$ GST_PLUGIN_PATH=src gst-launch-1.0 filesrc location=test/video.mp4.gz ! gzdec ! filesink location=test/output.mp4
$ diff test/video.mp4 test/output.mp4
$ rm test/video.mp4.gz test/output.mp4

Check if BZip decompression works as well:

$ bzip2 -c test/video.mp4 > test/video.mp4.bz2
$ GST_PLUGIN_PATH=src gst-launch-1.0 filesrc location=test/video.mp4.bz2 ! gzdec method=1 ! filesink location=test/output.mp4
$ diff test/video.mp4 test/output.mp4
$ rm test/video.mp4.bz2 test/output.mp4

You can clean up the generated files with:

$ make clean -C build

INSTALLATION

Just copy src/libgstgz.so into the gstreamer system plugin directory, which is /usr/lib/gstreamer-1.0 (for gstreamer 1.0) in most distros:

$ sudo cp src/libgstgz.so /usr/lib/gstreamer-1.0

And now you should be able to use the plugin without using the GST_PLUGIN_PATH environment variable:

$ gst-inspect-1.0 gzdec

You can uninstall the plugin with the following command:

$ sudo rm /usr/lib/gstreamer-1.0/libgstgz.so

AUTOTOOLS

You can also use autotools to build and install the plugin automatically. First off, generate the configuration script:

$ ./autogen.sh

Then configure the project (use the --enable-gstreamer-0.10 flag if you want to use the gstreamer 0.10 API):

$ ./configure

Once the configuration is done, build the project:

$ make

The plugin should be generated under src/.libs, you can test it with the following command (for gstreamer 1.0):

$ GST_PLUGIN_PATH=src/.libs gst-inspect-1.0 gzdec

Finally, install the plugin on your system with:

$ sudo make install

And check if it works without using the GST_PLUGIN_PATH environment variable:

$ gst-inspect-1.0 gzdec

You can uninstall the plugin with:

$ sudo make uninstall

Use the cleanup.sh script to clean all the files generated by autotools:

$ ./cleanup.sh

AUTHOR'S NOTES

  • This project has only been tested on Arch Linux 16/09/1027 with gcc 7.2.0
  • Email to nnoell3@gmail.com if you find bugs or you need help