April 3, 2013

Developing with GStreamer and Farstream, examples in C

Recently I got hired to develop a VoIP software for an ARM device, a Tiny6410 board. I already knew what libraries I'd be using for this project as I have been learning from KaKaRoTo since I joined the aMSN team, and KaKaRoTo works for Collabora, the company behind GStreamer and Farstream (among others). I just had to read something about those libraries before starting to write the actual code.

I must say that there are some examples in Google, but most of them won't work with current GStreamer/Farstream releases (0.10 at the time I'm writing this, 1.0 is about to be release) as they're too old. There is some documentation, but I'd say some descriptions, explanations and how-to's are missing. (inline edit: I started writing this post in September 2012, we're in April 2013, 1.0 was released and docs have been improved a lot, last statement is not valid anymore).

Anyways, after a few days I managed to get all the demos that I wanted to do before the actual VoIP software. Those are the typical one-liners for:
  • send the microphone signal to the speakers
  • send the build-in camera signal to the frame-buffer
  • send both the microphone signal and the built-in camera signal to the speakers and the frame-buffer
  • play audio from a file to the speakers
  • play video from a file to the frame-buffer
  • play both audio and video from a file to the speakers and the frame-buffer
  • record from the microphone to a file
  • record from the build-in camera to a file
  • record from both the microphone and the build-in camera to a file
There's just one thing I didn't want to use: the parse-command stuff. I'm aware of the existence of the parsing abilities in GStreamer, aka copy&paste the command from gst-launch in your code and let the library expand it, but I just wanted to do the things more manually and learn how exactly every part of the library works. 

I uploaded the code to GitHub, you can get it from here, just keep in mind that this is a work in progress. I'll try to develop as many examples as possible and support both 0.10 and 1.0 versions of GStreamer.