tvheadend/tvheadend — pull request #505 by beralt (2014-10-14 10:41:41+00:00)
Title: HDHomerun input plugin

This is a modified version of the first implementation by pakar. This pull request implements an input plugin which makes it possible to directly use a HDHomerun as a MPEG TS input device.

The idea behind the changes is to try to mimic the linuxdvb plugin as much as possible. The changes are:
- reduction in the number of mutex'es used, which caused bugs in the original code. This version attempts to minimize the synchronization on a minimum number of code points. The only added mutex is around the calls in libhdhomerun that perform _network_ calls to the device and are known to be thread unsafe.
- the libhdhomerun recv() functions are threaded and use a ring buffer, so those functions are dropped in favor of a UDP unicast implementation in the plugin with the builtin tvhpoll stuff (just like linuxdvb).

As to why this has to be a plugin, instead of using dvbhdhomerun and linuxdvb: it is faster according to some users. It also improves the user experience since devices are discovered automatically and installation does not require kernel modules to be compiled/installed.

The code could use some improvements. The functions could be split into several files to resemble the linuxdvb plugin even more. This might improve maintainability.

This code has been tested by a limited number of people. I have had no reports of any issues. It has been running for a week now on my setup, and I've had no issues.