Using ushare 1.0 to stream video to XBox 360 from a FreeBSD 6.x server
Grenville Armitage
December 27th 2007

This month I set up a networked, UPnP-controlled home media server and media player combination. For the media player I used an XBox 360 updated with the "Fall 2007 Dashboard Update". For the UPnP-controlled media server, I used uShare 1.0_2 running on my FreeBSD 6.0-based home file server.
This documentation is largely for my own benefit - a record of what I did in case I ever need to do it again. With any luck, this information will be useful to others (like you, if you're reading this page and you aren't me).

An overview of the solution

There are three main components required:
In my case I already had a home file server running FreeBSD 6.0. (Yes, at this point in late 2007 the latest is FreeBSD is 6.2. But I work with the philosophy of "If it ain't broke....")  I also had access to an XBox 360, which provides a UPnP-based media player. With the Fall 2007 Dashboard Update (released December 4th 2007) the XBox 360 can play divx encoded video content in .avi files. The piece of missing 'glue' was a UPnP-capable media server that could interact with the XBox 360. That's where uShare 1.0_2 comes in.

Patching uShare 1.0_2 to adjust reporting mime types of .avi and .divx files

As of 27 Dec 2007 the latest version of uShare is 1.1a from the official developers. Apparently version 1.1a does not need the following patch. However, FreeBSD's Ports system only had version 1.0, ports variant "2" (thus ushare-1.0_2). Whilst uShare 1.0 can happily interact with an XBox 360 (using the "-x" option for the XBox 360 profile) it does not properly tag .avi and .divx files in a way recognised by the Fall 2007 Dashboard Update.

The solution I used is drawn directly from a comment by "jsnwtsn" in this forum thread. The original advice was specific to Ubuntu Linux and uShare 1.1. Below are the steps required to patch uShare 1.0_2, the latest version of uShare in the FreeBSD Ports collection as of 26 Dec 2007.

First grab the uShare source code (assuming your Ports tree is up to date).

cd /usr/ports/net/ushare/
make deinstall            [if you've already got ushare installed.]
make patch
                [download the source, apply any FreeBSD-specific patchs. No compilation.]
cd work/ushare-1.0/src

Now open up mime.c in your favorite text editor. Find the following two lines:

{ "avi",   "MPEG4_P2_TS_SP_MPEG1_L3",  UPNP_VIDEO, "http-get:*:video/x-msvideo:"},

{ "divx",  "MPEG4_P2_TS_SP_MPEG1_L3",  UPNP_VIDEO, "http-get:*:video/x-msvideo:"},

Replace them with:

{ "avi",   "MPEG4_P2_TS_SP_MPEG1_L3",  UPNP_VIDEO, "http-get:*:video/x-ms-wmv:"},
{ "divx",  "MPEG4_P2_TS_SP_MPEG1_L3",  UPNP_VIDEO, "http-get:*:video/x-ms-wmv:"},


Now we pop up three levels in the directory tree, and complete the build and installation of our patched version of uShare 1.0_2

cd ../../../
make reinstall

Running the patched uShare 1.0_2

uShare-1.0_2 runs quite happily under FreeBSD 6.0. Nothing different from before it was patched to 'fake' the mime entries for .avi and .divx files.