[mythtv] Adding support for R5000 STB

Alan Nisota alannisota at gmail.com
Fri Feb 22 03:02:36 UTC 2008

I recently got access to an R5000 STB for Dish Network.  For those who 
aren't familiar with it, this is a modification where you send in your 
set top box and the R5000 folks add a USB port to the back which allows 
you to record the stream from it.  This mean that using the R5000, you 
can use a legitimate subscription and record HD material from Dish 
Network to your PC.

The R5000 folks only support Windows, but I have the box working in 
Linux now, and it is almost working with MythTV.

There are a few caveats:
1) a modification to th eUSB kernel modules is needed because the R5k 
uses a packet size of 1024 which is not valid according to the USB 
spec.  The linux-usb folks said they'd likely be willing to take a patch 
to support this (in fact one was already posted to the mailing list) and 
if it isn't accepted, I'll write one myself..  the R5000 folks said the 
next firmware release would allow support of 512byte packets so no 
changes would be needed.

Also, for HD, you need my CoreAVC patch since ffmpeg's H264 AVC code 
isn't sufficient to decode Dish Network.

Anyhow, with that sorted, the patch for Myth wasn't too complicated (I 
wrote some libusb code to read from the device and basically copied the 
firewire code in myth and modified it for the r5k).

The problem I have at the moment is that while the STB constantly 
monitors the PAT, it only reads the PMT when a channel is changed.  I 
can sort of fake it by manually changing the channel after starting a 
recoding in myth, but Myth seems to need several (at regular intervals?) 
PMT packets in order to generate a stream it is happy with.

I'm not really clear on how all the DTV stuff works in Myth, but the 
streams I record with Myth can be played in mplayer, so I assume the 
problem is simply that the recorder/playback code doesn't know which 
PIDs are needed for audio/video

I'm thinking about either caching the last PMT and replaying it every 
time I see a PAT, or possibly building it from scratch based on the 
currently available PIDs, but I was wondering if there was a better way 
or if I'm perhaps missing something here.

Note that my work so far is only for Dish Network.  I'm not sure whether 
the R5000 works for DirecTV HD, and I know that DirectTV SD usess DSS 
rather than DVB (I have some code I worked on over a year ago to convert 
DSS to DVB but I never got it all that reliable so it would need some 
work, and I don't have access to a DirecTV enabled R5000 box to play with.

Once I can actually watch the recordings I'm making with MythTV, I will 
post the relevant patches.

More information about the mythtv-dev mailing list