Project

General

Profile

Proper CableCARD/HDHomeRun Prime support

Added by Robert Cameron over 6 years ago

CableCARD Network support

This branch/patchset adds a CableCARD network type to Tvheadend. When adding muxes, the "Channel" field is used for the channel number as assigned by your cable provider and present in the CableCARD. After a mux has been tuned at least once (including for the discovery of the service carried on that channel), two read-only options are present as well: Callsign, which is the channel name as provided by your cable provider; and Frequency, which is the actual frequency/mux that the channel is carried on.

Because cable providers do not often populate the transport stream metadata fields, information such as a service's channel number, name and provider name are filled at creation time by information present in the mux (channel number and name) or in your network settings (in the case of the provider name).

HDHomeRun Prime

Presently, support for CableCARD networks is only exposed to the HDHomeRun driver. The new functionality in this patchset allows HDHomeRun Prime devices to be recognized as CableCARD tuners, to allow them to be set as the adapter/tuner for CableCARD networks.

Because of the way that these devices tune virtual channels as mapped by the CableCARD, each mux will only have a single service discovered on it. The reason for this is that the hardware device itself performs the PID filtering and program selection when it decrypts a channel's stream. To ensure that the PID filter is not set when using a CableCARD, all calls to PID filtering/resets have been skipped for that particular network type.

Todo

I still want to add the ability to use a device's lineup.json file to create an initial set of muxes much in the same way that pre-defined muxes are used for other network types.

Also, because there is no guide data carried on the network itself, perhaps the ability to use SiliconDust's limited 24 hour guide data provided with their device's could be implemented as a type of internal/OTA EPG grabber type.

Sources

I have created forks on GitHub for both the master development (4.3) branch, as well as a branch for the current stable/release (4.2) branch. Also, attached are the patchsets for either master or release/4.2 branches.

cablecard-4.3
cablecard-4.2


Replies (39)

RE: Proper CableCARD/HDHomeRun Prime support - Added by Robert Cameron over 6 years ago

Yusef Neblett wrote:

Hi Robert,

Thanks so so much for your help and explanation. I realize the issue was a loggin issue to the tvheadend server now with your help. Thanks so mush!!

When I was running the script line by line, I got an error when trying to call the tvheadend server:

[...]

So I created a new user that will not require password to loging and ran the script as you adviced: ./script.sh

Thanks for your time and work. I really appreciate it.

Yusef

Glad you figured it out ... but I believe I mentioned that logging in to your Tvheadend server was most likely the cause of your error a couple of days ago ... Would have saved much time and frustration.

RE: Proper CableCARD/HDHomeRun Prime support - Added by Benjamin Neblett over 6 years ago

Robert
I have to congratulate you for this amazing work.

i compiled it to run in openwrt chaos calmer and it took me 3 weeks but at the end i was able to compile and run it in the firewall an ar71xx chip.
I run version 4.2.6 with the patch very well however i have one question.

when i Run the script to create the muxes it creates all muxes very well and scans all services but the name of the services are all "single Word" if I have 10 FOX Channels , FOX SPORTS, FOX FAMILY, FOX MOOVIES they all show with the name FOX and i cant identify which one is which.
i know the chanel numbers of my cable probider but is there any way to let tvheadend import the complete channel name instead of just the first word?

RE: Proper CableCARD/HDHomeRun Prime support - Added by Robert Cameron over 6 years ago

Benjamin Neblett wrote:

Robert
I have to congratulate you for this amazing work.

i compiled it to run in openwrt chaos calmer and it took me 3 weeks but at the end i was able to compile and run it in the firewall an ar71xx chip.
I run version 4.2.6 with the patch very well however i have one question.

when i Run the script to create the muxes it creates all muxes very well and scans all services but the name of the services are all "single Word" if I have 10 FOX Channels , FOX SPORTS, FOX FAMILY, FOX MOOVIES they all show with the name FOX and i cant identify which one is which.
i know the chanel numbers of my cable probider but is there any way to let tvheadend import the complete channel name instead of just the first word?

Unfortunately, those names are the ones from your CableCARD/provider mapping. They're read from the Prime itself as the callsign on the feed. Also, those service names come when the mux is scanned/service created, and not a part of the mux creation script. The mux creation script only creates a mux for a channel that has been successfully scanned by the HDHomeRun webui.

Perhaps another patchset will be an EPG source for HDHR tuners, or maybe dig into bouquets and how they might be created based upon the lineup.json or guide.json sources.

RE: Proper CableCARD/HDHomeRun Prime support - Added by stefan fiala about 6 years ago

Great work!, thanks.
I pulled the git-tip for 4.3 before seeing you mentioned patchsets.
Built it ran into the issue running the script to setup muxes
(line1 column10)
(created user *, as http://user:password@ ddint want to work).

I now have lots of muxes but no services, should they have been
created and if so is it because tvheadend's git is behind your patches?.
[What should I look for?].

I did see a lot of "tsid 0" messages in the log, but my last
experience with tvheadend+hdhomerun using an iptv setup did similar.
This setup looks to be a lot less hassle than configuring everything
using iptv.

I may be open to testing any upcoming changes, an EPG source would
be great as the schedulesdirect setup is a a bit of a hassle.

RE: Proper CableCARD/HDHomeRun Prime support - Added by saen acro about 6 years ago

stefan fiala wrote:

(created user *, as http://user:password@ ddint want to work).

set authentication to Both plain and digest to work ;)

RE: Proper CableCARD/HDHomeRun Prime support - Added by stefan fiala about 6 years ago

I wandered around in the gui and briefly unnder .hts/ and didnt come across
any obvious authentication settings. Where exactly should I look?.

RE: Proper CableCARD/HDHomeRun Prime support - Added by stefan fiala about 6 years ago

Found it:-
Gui->configuration->view-level-advanced, scroll down thru settings.

RE: Proper CableCARD/HDHomeRun Prime support - Added by Robert Cameron about 6 years ago

The script to create muxes by no means was meant to be an official/bundled way to create muxes for CableCARD channels; rather it is merely a quick hacked-together script that worked for me and I thought others might benefit from it, too.

However, due to several different issues and changes, I have begun migrating my DVR from Tvheadend to Channels. That, combined with my move away from cable to OTA broadcasts, I doubt I will be putting much effort into maintaining this feature. All of the code is up, and support is present in master. I'll offer support where I can, but I can make no guarantees.

RE: Proper CableCARD/HDHomeRun Prime support - Added by stefan fiala about 6 years ago

Many thanks for the background.
So on tvheadend git master [version/sha/date] it all appeared to work for you, services and all?.

Would I have to hack further on the script to add services or is that
expected to work?. If hackery is needed any tips about tidbits of api that maybe useful?.

I only have a vague notion about how all this htsp stuff fits together, muxes,channels and services.
I could probably figure it out if pointed in the right general direction.

RE: Proper CableCARD/HDHomeRun Prime support - Added by Robert Cameron about 6 years ago

stefan fiala wrote:

Many thanks for the background.
So on tvheadend git master [version/sha/date] it all appeared to work for you, services and all?.

Would I have to hack further on the script to add services or is that
expected to work?. If hackery is needed any tips about tidbits of api that maybe useful?.

I only have a vague notion about how all this htsp stuff fits together, muxes,channels and services.
I could probably figure it out if pointed in the right general direction.

The CableCARD network type and using HDHomeRun Prime tuners has been in 4.3 for several months now.

Regarding creating muxes/services: The script is for creating muxes based upon the scanned/enabled channels on your Prime device. Services are only created after a mux is scanned, and the script has nothing to do with that. If you do not wish to use the script, you can still manually create your muxes; there is nothing that requires external scripts.

As far as additional hacks or API documentation: I feel that the script is pretty self-explanatory. For Tvheadend's HTTP/JSON API, I used the source to figure out which endpoints to use. (Take a look in the src/api directory: at the end of each api_*.c file is an api_hook_t array that includes all of the API endpoints. Look for the functions in the source, and use a little trial and error to get it going.)

RE: Proper CableCARD/HDHomeRun Prime support - Added by Reggie Burnett about 6 years ago

Robert

I'm seeing odd behavior that may or may not be related to the cablecard stuff. Very regularly when I try to tune a channel it just hangs. The TVH log says (for example) '2018-10-04 09:34:51.097 subscription: 0095: "192.168.1.102 [ reggie | Kodi Media Center ]" subscribing on channel "CNN HD", weight: 100, adapter: "HDHomeRun CableCARD Tuner #0 (192.168.1.148)", network: "CableCARD Network", mux: "1111", service: "CNNHD", profile="htsp", hostname="192.168.1.102", username="reggie", client="Kodi Media Center".

And it just sits there. If I tune a different channel it works and then go back to try and tune the one that just hung it will also work. This is very regular and is not a kodi problem as I recreated it with the thv client on IOS.

Just wondering if you are seeing anything similar?

RE: Proper CableCARD/HDHomeRun Prime support - Added by Robert Cameron about 6 years ago

Reggie Burnett wrote:

Robert

I'm seeing odd behavior that may or may not be related to the cablecard stuff. Very regularly when I try to tune a channel it just hangs. The TVH log says (for example) '2018-10-04 09:34:51.097 subscription: 0095: "192.168.1.102 [ reggie | Kodi Media Center ]" subscribing on channel "CNN HD", weight: 100, adapter: "HDHomeRun CableCARD Tuner #0 (192.168.1.148)", network: "CableCARD Network", mux: "1111", service: "CNNHD", profile="htsp", hostname="192.168.1.102", username="reggie", client="Kodi Media Center".

And it just sits there. If I tune a different channel it works and then go back to try and tune the one that just hung it will also work. This is very regular and is not a kodi problem as I recreated it with the thv client on IOS.

Just wondering if you are seeing anything similar?

If I had to guess (which is essentially the case), I'd say that your problem is most likely a tuning issue and hardware related. Are you running the most current firmware?

When having tuning issues in the past, sometimes the only way I found to fix it was to power off the tuner and the tuning adapter, plugging both back in, waiting for the TA to be in a ready state, and then re-running a channel scan. (While I am not currently using TVH for my DVR, I had to follow this procedure with my 3 Primes in order to get some channels to tune.)

RE: Proper CableCARD/HDHomeRun Prime support - Added by Reggie Burnett about 6 years ago

Robert Cameron wrote:

Reggie Burnett wrote:

Robert

I'm seeing odd behavior that may or may not be related to the cablecard stuff. Very regularly when I try to tune a channel it just hangs. The TVH log says (for example) '2018-10-04 09:34:51.097 subscription: 0095: "192.168.1.102 [ reggie | Kodi Media Center ]" subscribing on channel "CNN HD", weight: 100, adapter: "HDHomeRun CableCARD Tuner #0 (192.168.1.148)", network: "CableCARD Network", mux: "1111", service: "CNNHD", profile="htsp", hostname="192.168.1.102", username="reggie", client="Kodi Media Center".

And it just sits there. If I tune a different channel it works and then go back to try and tune the one that just hung it will also work. This is very regular and is not a kodi problem as I recreated it with the thv client on IOS.

Just wondering if you are seeing anything similar?

If I had to guess (which is essentially the case), I'd say that your problem is most likely a tuning issue and hardware related. Are you running the most current firmware?

When having tuning issues in the past, sometimes the only way I found to fix it was to power off the tuner and the tuning adapter, plugging both back in, waiting for the TA to be in a ready state, and then re-running a channel scan. (While I am not currently using TVH for my DVR, I had to follow this procedure with my 3 Primes in order to get some channels to tune.)

Appreciate the response. I take it you are not seeing anything like this? It's not a hardware issue because I tested the tuners with the SiliconDust HD app (I have the HD DVR installed as well but idle) and all the channels tune flawlessly. Have never had one not tune correctly. I'm stumped. I'll keep updating the 4.3 docker image and testing to see if some other change happened in TVH that caused this. This is a relatively new development.

RE: Proper CableCARD/HDHomeRun Prime support - Added by Reggie Burnett about 6 years ago

Robert Cameron wrote:

Reggie Burnett wrote:

Robert

I'm seeing odd behavior that may or may not be related to the cablecard stuff. Very regularly when I try to tune a channel it just hangs. The TVH log says (for example) '2018-10-04 09:34:51.097 subscription: 0095: "192.168.1.102 [ reggie | Kodi Media Center ]" subscribing on channel "CNN HD", weight: 100, adapter: "HDHomeRun CableCARD Tuner #0 (192.168.1.148)", network: "CableCARD Network", mux: "1111", service: "CNNHD", profile="htsp", hostname="192.168.1.102", username="reggie", client="Kodi Media Center".

And it just sits there. If I tune a different channel it works and then go back to try and tune the one that just hung it will also work. This is very regular and is not a kodi problem as I recreated it with the thv client on IOS.

Just wondering if you are seeing anything similar?

If I had to guess (which is essentially the case), I'd say that your problem is most likely a tuning issue and hardware related. Are you running the most current firmware?

When having tuning issues in the past, sometimes the only way I found to fix it was to power off the tuner and the tuning adapter, plugging both back in, waiting for the TA to be in a ready state, and then re-running a channel scan. (While I am not currently using TVH for my DVR, I had to follow this procedure with my 3 Primes in order to get some channels to tune.)

BTW, what DVR did you go with?

(26-39/39)