Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2009-03-26

oggplayer - A simple Ogg player using liboggplay

To help track down performance issues, and fix some a/v synchronisation bugs, I wrote a simple Ogg player in C++ using the same libraries and a similar approach to what I use in the Firefox video implementation.

The source to 'oggplayer' is available on github.

I've setup the repository to facilitate my experimenting with different approaches and different library versions. What this means is I've taken the, probably unusual, approach of having a 'thirdparty' directory containing git submodules for each of the Ogg based libraries I'm using. I configure and build these and link statically to them. This lets me use experimental versions of the Ogg libraries without dealing with 'shared library hell'.

This is all explained in the README, but just quickly these are the steps to clone oggplayer, and get the third party libraries from git:

$ git clone git://github.com/doublec/oggplayer.git
$ cd oggplayer
$ git submodules init
$ git submodules update

Once that's done you need to build the third party libraries:

$ cd thirdparty
$ sh build.sh

Run 'make' to build oggplayer itself. The third party libraries are built and installed in a 'local' subdirectory.

You'll notice the unix-centric leaning of these commands. I've only built on Linux. I'm using cross platform libraries so it should build with minor changes on Mac OS X. Mainly changing the audio library to link against in the Makefile. For Windows you'll probably need to use Cygwin or MSYS.

To run, just pass the filename on the command line:

$ ./oggplayer foo.ogg

Press ESC to exit the playback, and space bar to toggle full screen on supported platforms (those that SDL supports full screen).

These are the third party libraries I use, and include as submodules:

  • libogg
  • libvorbis
  • libtheora
  • liboggz
  • libfishsound
  • liboggplay
  • libsydneyaudio

You'll need the following system libraries to build:

  • Boost C++ libraries
  • SDL

There's not much error checking, I mostly use 'assert' to bail on an error. I don't want to spend time creating an awesome player, rather something I can use to try test out the way I'm using the third party libraries.

Interestingly with this example player I can play back the problematic HD video I mentioned previously. Part of this is the newer YUV conversion routines in liboggplay and the more lower level optimized SDL libraries for blitting the video data. I'm also not seeing audio buffer underruns which I see with some videos in Firefox. Time to do some investigating!

Tags


This site is accessable over tor as hidden service 6vp5u25g4izec5c37wv52skvecikld6kysvsivnl6sdg6q7wy25lixad.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-61/


Tags

Archives
Links