Using ushare 1.0 to stream video to XBox 360 from a FreeBSD 6.x server

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. 

An overview of the solution

There are three main components required:

  • File server (Holds the actual video files)
  • Media server (Streams video files off the file server under the control of media players on your network)
  • Media player (Provide user interface to control content selection and play-back. Play videos on your TV from data streamed by the media server.)

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 source, apply FreeBSD-specific patchs.]
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.

Historical note: This blog entry was actually made on June 12th 2012, to archive a web page I wrote in December 2007. Although largely for my own benefit, I’ve archived it in the hope it will be useful to others (like you, if you’re reading this page and you aren’t me).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: