HDHomeRun Prime CableCard support
Added by Robert Cameron over 8 years ago
I know it's been mentioned in the past—and some less-than-great workarounds exist—but has there been any discussion lately about modifying the HDHomeRun support to include the Prime and CableCard?
Looking at the source for the HDHomeRun support, it looks like it could be possible to get a proof-of-concept for Prime support put together without too much trouble. Muxes and services would have to be manually indicated and could not be scanned because of the way that virtual channels differ from frequency/programs, but I'd be willing to work with the developers and maybe put something together if there is still interest.
(Or would the best route to go be to fork/clone the repository, create a working branch, and submit a patch for review? I'm not very familiar with GitHub's PR process.)
Replies (9)
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron over 8 years ago
After browsing through the source more, I have questions regarding Service creation and Mux scanning. Apparently TVH does not allow one to create Services manually: they can only be created from a mux scan (unless I misread the sources). Since Channels are tied to Services and not Muxes, this means that an override as I was imagining must somehow be duplicated from the Mux into the Service. Since the MPEGTS network scan seems to assign Services based upon programs found in the TS tables (I haven't fully parsed that part of the code yet), it seems as if Service creation would be a problem. Tuning is based upon Muxes, but Channels are based upon Services ...
Ultimately the best solution looks to be to implement a new Input type: a CableCARD Network type that extends the existing MPEGTS type, a Mux type that uses virtual channels as the mux and a Service type includes the combined information that would normally be found in the mux and service, such as frequency, program, channel and name.
It's a bit tough to fully wrap my head around because TVH seems to have been created with DVB as its original and primary raison d'être with other input types shoehorned into its architecture: the network -> mux -> service -> channel paradigm seems to be impossible to escape, which makes this harder because CableCARD essentially obviates the mux stage and only uses (abstract) services ... but TVH cannot cope with Services without a Mux ...
I truly wish there was a decent CableCARD-capable DVR that ran on POSIX systems other than MythTV—which is a bloated kitchen-sink style mess!
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron about 8 years ago
I don't know if there is interest in this from other users, but every now and then I've been looking at any quick fixes that would at least get a UDP stream from the Prime without using an IPTV network. So far, all of my quick hacks have been unsuccessful, mostly because the tvhomerun classes are all built with the expectation of DVB/ATSC, which isn't really compatible with the way CanleCARD tuning works.
Therefore, I think the only real solution is to subclass the mpegts_{network,mux{,_instance},service}_t classes, and modify the tvhomerun classes to check for mpegts_network_class types to implement CableCARD support for the Prime.
This is mostly a spare time endeavor, as I'm unfamiliar with OO-based programming in C versus C++, and the added complexity if idnodes/idclasses is foreign to me. Hopefully the resolution of this will also coincide with SD finally fixing their TCP and DHCP/GbE issues.
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron about 8 years ago
After some playing around trying to get my mpegts_cablecard_ additions, I decided to look back at why my quick and dirty hack didn't work, and I found the root problem. When making my changes I thought the only relevant parts I needed to modify was in the tvhdhomerun_frontend_tune function, but tvhdhomerun_frontend_start_mux is actually the calling function, and after it tunes a mux, it then applies a filter to the programs. This causes problems with the Prime, because when you tune a virtual channel it sets the frequency and the program both; the resetting of the program filter in tvhdhomerun_frontend_start_mux wipes that out, and Prime can no longer get the proper program set.
So, while working on getting CableCARD support properly in Tvheadend, I have created a (rather quite hacky) workaround that allows one to tune the Prime using the hdhomerun_client support in Tvheadend. This also means that it is streaming over UDP rather than TCP, which should result in less continuity errors because of resent packets.
In short, it works like this: The Prime is created as an ATSC-C network. Muxes must be manually created; the mux frequency is the virtual channel number * 1000000—so virtual channel 702 is saved in Tvheadend as a mux with frequency 702MHz. After the mux is scanned, you must select the proper Service/Program: you can find this by using the command line tool hdhomerun_config
to first set the proper channel (hdhomerun_config FFFFFFFF set /tuner#/vchannel ###
, where FFFFFFFF is the Device ID of your Prime, tuner#
is the tuner number you wish you set—either 0, 1 or 2—and the ### is the cable channel you wish to tune—702 in the example from above), and then you can use it to find the proper program number: hdhomerun_config FFFFFFFF get /tuner#/program
. The Service that matches the mux and program number will be the one that you assign a Channel to.
The advantage to this is streaming over UDP, as well as getting the signal strength and quality information for the feed. While it is a bit more work getting the muxes/services mapped to Channels, I feel that the benefits it gives outweigh the negatives from using TCP/IPTV as the workaround.
If anyone is interested, I have created a patch (only about 7 lines) that can be applied to the current master's tvheadend_frontend.c to enable this hack.
I am still working on getting proper CableCARD support working, but I thought I might share this information in case there are others who are interested ....
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron about 8 years ago
So while I can use this hack to view streams with the TVHClient on iOS or directly through the web interface with vlc or mpv, it won't work with Kodi's pvr.hts. Kodi initiates the stream, and it's being tuned a streamed from Tvheadend, but it never starts actually playing in Kodi.
RE: HDHomeRun Prime CableCard support - Added by Teddy Thomas about 8 years ago
Hi Robert!
I would be very interested in testing the patch you have. Is there a Github repository, or another link where the patch can be found?
Thank you for your work!
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron about 8 years ago
I have the patch, and I'll post it later today. I just returned back home from being out of town, so I'll put that up when I get my main machine up.
There are a couple of notes for it, though. While it works in general, it does not seem to work with the HTSP PVR client for Kodi. The logs show that it tunes and streams, but Kodi just seems to sit there; otherwise it works fine if you access your channels from TVH directly, or VLC, &c.
I've since abandoned this route, as I'd much rather see support via an actual CableCARD network type, similar to the DVB types.
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron about 8 years ago
Here is the patch for CableCARD support. When creating a network, create it as "ATSC-C". Then when you create your muxes, in the frequency field just input the vchannel number.
Perhaps some other intrepid user can figure out why I can't get the Kodi HTSP addon to actually stream anything when using this, but I can in VLC/&c.
prime.patch (1.74 KB) prime.patch |
RE: HDHomeRun Prime CableCard support - Added by Reggie Burnett almost 7 years ago
I just read this thread and saw that it doesn't work with Kodi. That's a real shame. Maybe I'll try to find some time to help you get real hdhomerun support into the product.
RE: HDHomeRun Prime CableCard support - Added by Robert Cameron almost 7 years ago
I don't know where you got the idea that it won't work with Kodi. I use Kodi for my frontend at home. The advantage of these patches with Kodi is that the signal strength and quality from the tuners are reported properly in Kodi's interface, too.
I apply this patch each time before I rebuild Tvheadend, and haven't had any issues in over a year so far.