2008-03-14
Building the Firefox video element backends
The git repository has multiple branches which means a little more git usage is needed to get at the Ogg (and soon, GStreamer) backends.
When you clone or pull from the repository you'll automatically pick up the commits for the new branches. You can see these branches with 'git branch -r':
$ git clone git://double.co.nz/git/video.git
$ cd video
$ git branch -r
origin/HEAD
origin/master
origin/ogg
By default the 'master' branch has a checked out working tree. Building this produces <video> element support without any decoder. One approach to building the Ogg backend is to create a local branch with the commits from the remote branch origin/ogg and build that:
$ git checkout -b ogg origin/ogg
Switched to a new branch "ogg"
$ cd mozilla
$ cat >.mozconfig << "EOF"
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-video
ac_add_options --enable-ogg
EOF
$ autoconf2.13
$ make -f client.mk build
When the gstreamer branch is added you can do similar:
$ git checkout -b gstreamer origin/gstreamer
Switched to a new branch "gstreamer"
$ cd mozilla
$ cat >.mozconfig << "EOF"
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-video
ac_add_options --enable-gstreamer
EOF
$ autoconf2.13
$ make -f client.mk
You can do a build which contains both backends by merging. You'll need to fix any merge conflicts and change the ordering of the codec instantiation so that one is preferred over the other when they can both handle the same codec. A merge looks like this:
$ git checkout -b gst_and_ogg origin/master
$ git merge origin/ogg
$ git merge origin/gstreamer
$ cd mozilla
$ cat >.mozconfig << "EOF"
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-video
ac_add_options --enable-ogg
ac_add_options --enable-gstreamer
EOF
$ autoconf2.13
$ make -f client.mk</pre>To update your branches with the latest code from the repository, fetch and merge:<pre>$ git fetch origin
$ git checkout ogg
$ git merge origin/ogg
$ git checkout gstreamer
$ git merge origin/gstreamer
$ git checkout gst_and_ogg
$ git merge origin/ogg
$ git merge origin/gstreamer
Once you've done a successful build you can run it from the obj-dir, or make an installer:
$ cd mozilla
$ make -f client.mk build
$ export NSPR_LOG_MODULE=nsVideoDecoder:5
$ export MOZ_NO_REMOTE=1
$ ./obj-i686-pc-linux-gnu/dist/bin/firefox -ProfileManager
$ make -C browser/installer
When the installer is built there will be a file in the 'dist' subdirectory of the object directory that contains the build. It will be a .tar.gz, .zip or .dmg, depending on the platform. The environment variables set in the above example enable logging of the video debug output and running Firefox even if an existing copy is already running.