Opened 16 months ago

Closed 16 months ago

Last modified 14 months ago

#13447 closed Patch - Feature (fixed)

Mythtv-setup option: Logical Channel Number required

Reported by: Klaas de Waal Owned by: Klaas de Waal
Priority: minor Milestone: 31.0
Component: MythTV - Mythtv-setup Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


In a mythtv-setup channelscan of a DVB signal, each channel gets a channel number from the Logical Channel Descriptor (0x83) if that is present; otherwise the service ID is used as channel number.

Initial testing shows that with the filtering on Logical Channel Number the list of channels in MythTV is exactly the same as the list of channels in my (real) TV.

As it is possible to have a DVB signal without Logical Channel Numbers or if somehow channels without a number are of interest the filtering has to be an option.

On my DVB-C signal the services without a channel number are used for software download, for video-on-demand channels and as duplicates of channels with a channel number.

A patch is forthcoming.

For reference:

  • tested with DVB-C signal "Ziggo" in The Netherlands; 220 channels with a channel number, 34 channels without.
  • tested with DVB-T2 signal "Digitenne" in The Netherlands: 33 channels with a channel number, no channels without.

Attachments (4)

20190411-scan-lcn-required.patch (13.3 KB) - added by Klaas de Waal 16 months ago.
Option to select only channels with a Logical Channel Number.
Ticket13447debug.log (14.0 KB) - added by jpilk 16 months ago.
backend debug log for comment 12
mythbackend.20190427090104.8929.log (139.4 KB) - added by jpilk 16 months ago.
ubuntu_mythbackend.20190427132812.3460.log (63.9 KB) - added by jpilk 16 months ago.

Download all attachments as: .zip

Change History (24)

comment:1 Changed 16 months ago by Klaas de Waal

Type: Patch - Bug FixPatch - Feature

Changed 16 months ago by Klaas de Waal

Option to select only channels with a Logical Channel Number.

comment:2 Changed 16 months ago by Klaas de Waal <kdewaal@…>

Resolution: fixed
Status: assignedclosed

In e734a03fa/mythtv:

Add option to select only channels with a DVB Logical Channel Number

Fixes #13447

comment:3 Changed 16 months ago by jpilk

In today's Master I needed to set this option to get correct channel lists for UK Freeview DVB-T and DVB-T/T2 when doing my usual two scans of 'all known and linked' transports. Without it some channel numbers were outside the normal 1-to-800 range.

That's 31Pre449.gded6764, updated from 442.gd3f58fd. Perhaps I skipped the scans for that one.

comment:4 Changed 16 months ago by Klaas de Waal

Thanks for testing and reporting!

It is interesting to have the results of a scan with an older (just before this feature was added) version of mythtv-setup and compare that with today's master on the same signal and on the same moment. In my environment the content of the DVB-C signal changes over time and this can also be the case with your DVB-C/C2 signal.

The result of today's master, with the "LCN required" option switched off, should be identical to that of the older version. The scan result can then have, in additional to channels with the correct channel numbers, a number of channels with high numbers (service ID's). The list of of channels with correct (i.e. low) channel numbers should be the same for both today's master and the older version.

If this is not so then there is something wrong. In that case please collect the output of "mythtv-setup -v general,record,channel,chanscan --loglevel=debug". This will be huge and too big to post here so dropbox or pastebin will be needed but it will help in finding the problem.

comment:5 Changed 16 months ago by jpilk

It's working for me with the 'Require LCN' box ticked, so I'm reluctant to experiment too much, but I've just tried scanning with the DVB-T/T2 MyGica? tuner again, starting from empty. The high channel numbers seen without the tick were all from one mux. Below are partial listings from that in the two cases.

One scan, with the tick, found the ITV2 mux but ignored those results. A second scan worked properly.

The 'number of channels found' display isn't updated after the final transport. I think the pop-up report is OK.

Without tick.  Channel Number displayed is the one after the 'national' 9018

qam_256:554000000:BBC NEWS HD::0:9018:40960:40960=40960:dvb     0:cnt(pnum:1,channum:13)
qam_256:554000000:Channel 4+1 HD::0:9018:41008:40960=40960:dvb  0:cnt(pnum:1,channum:13)
qam_256:554000000:4seven HD::0:9018:41024:40960=40960:dvb       0:cnt(pnum:1,channum:13)
qam_256:554000000:Al Jazeera Eng HD::0:9018:41040:40960=40960:dvb       0:cnt(pnum:1,channum:13)

With tick:  Correct channel number (LCN) is the one after the channel name; and the stream identifier after that is non-zero.

qam_256:554000000:BBC NEWS HD:107:12357:9018:40960:40960=40960:dvb      0:cnt(pnum:1,channum:1)
qam_256:554000000:Channel 4+1 HD:109:12357:9018:41008:40960=40960:dvb   0:cnt(pnum:1,channum:1)
qam_256:554000000:4seven HD:110:12357:9018:41024:40960=40960:dvb        0:cnt(pnum:1,channum:1)
qam_256:554000000:Al Jazeera Eng HD:108:12357:9018:41040:40960=40960:dvb        0:cnt(pnum:1,channum:1)

comment:6 Changed 16 months ago by Klaas de Waal

Until proven wrong by a log file, my best guess is that in the "Without tick" case there was a timeout on the NIT so the network_id for Com78 National (12357) and the logical channel numbers are missing. In the "With tick" case the NIT must have been correctly received.

About the MyGica? T230 tuner, I have found that on my system the scans with this USB device are usually not as good as scans with PCIe bus tuners. With the MyGica? there are lots of "AddTSPacket: Out of sync!!!" error messages and this can be the reason that sometimes the NIT is not received.

Because the logical channel numbers are in the NIT the "LCN required" option effectively discards the result of a transport scan when the NIT is not received.

comment:7 Changed 16 months ago by jpilk

That explanation seems to fit what I see.

I have just rescanned with 31.Pre.454.ga7f4441f71, which includes the fix for #13449, although I didn't test the new feature. All results look good, but at the start of the DVB-T2 scan it reported

2019-04-23 08:57:57.948017 I  CardUtil[2]: Using delivery system: DVB-T2
2019-04-23 08:58:26.401663 E  MPEGStream[-1](0x 566d740): Error: AFCOffset(151)+StartOfFieldPointer(173)>184, pes length & current cannot be queried
2019-04-23 08:58:34.123172 E  MPEGStream[-1](0x 566d740): Error: AFCOffset(215)+StartOfFieldPointer(0)>184, pes length & current cannot be queried
qam_256:770000000:BBC TWO HD:102:12323:9018:17472:16517=16517:dvb       0:cnt(pnum:1,channum:1)
qam_256:770000000:BBC ONE HD:101:12323:9018:17540:16517=16517:dvb       0:cnt(pnum:1,channum:1)

I saw similar pes-error reports here with other recent builds - and occasionally during normal EIT operation - but haven't usually noticed them during scanning.

comment:8 Changed 16 months ago by jpilk

I sent comment 7 before quitting mythtv-setup and starting mythbackend. On startup I saw

2019-04-23 13:47:38.664350 N  MythBackend: Starting up as the master server.
2019-04-23 13:47:39.974427 I  CardUtil[1]: Using delivery system: DVB-T
2019-04-23 13:47:41.709302 I  CardUtil[2]: Using delivery system: DVB-T2
2019-04-23 13:47:41.784138 E  CardUtil: Can't open DVB frontend (/dev/dvb/adapter0/frontend0) for /dev/dvb/adapter0/frontend0.
                        eno: Device or resource busy (16)

followed by 14 other 'Can't open' errors, 7 for each device.  Both have multirec set to 8.

Otherwise it's OK and is currently recording on both devices, both with sequences as below.  It looks as if there migh be a stray '.'

2019-04-23 13:51:01.448151 I  TVRec[1]: TuningFrequency
2019-04-23 13:51:01.448167 E  TVRec[1]: Failed to set channel to . Reverting to kState_None
2019-04-23 13:51:01.841417 I  TVRec[4]: ASK_RECORDING 4 0 0 0
2019-04-23 13:51:01.858791 I  TVRec[5]: ASK_RECORDING 5 0 0 0
2019-04-23 13:51:01.902154 I  TVRec[6]: ASK_RECORDING 6 0 0 0
2019-04-23 13:51:01.909453 I  TVRec[7]: ASK_RECORDING 7 0 0 0
2019-04-23 13:51:01.920529 I  TVRec[8]: ASK_RECORDING 8 0 0 0
2019-04-23 13:51:01.937764 I  TVRec[9]: ASK_RECORDING 9 0 0 0
2019-04-23 13:51:01.955260 I  TVRec[10]: ASK_RECORDING 10 0 0 0
2019-04-23 13:51:02.238087 I  TVRec[1]: TuningFrequency
2019-04-23 13:51:02.238480 E  TVRec[1]: Failed to set channel to . Reverting to kState_None
2019-04-23 13:51:02.601724 I  TVRec[1]: Changing from None to RecordingOnly
2019-04-23 13:51:02.707430 C  ProgramInfo(): Failed to find recorded entry for 0.
2019-04-23 13:51:02.866905 I  TVRec[1]: TuningFrequency
2019-04-23 13:51:03.851365 I  Tuning recording: Impossible: channel 10001 on cardid [1], sourceid 1
2019-04-23 13:51:05.706078 I  Updating status for Impossible on cardid [1] (Tuning => Recording)
2019-04-23 13:51:05.765416 I  TVRec[1]: rec->GetPathname(): '/home/john/SGs/RecsSG2/10001_20190423125100.ts'
2019-04-23 13:51:05.765881 I  TVRec[1]: TuningNewRecorder - CreateRecorder()

For TVrec[2] the other ASKs run from 11 to 17..  'Impossible' is the name of the show.

comment:9 Changed 16 months ago by jpilk

It seemed possible that the 'Can't open DVB frontend' errors would prevent multirec operation, but I have successfully made 3 simultaneous test recordings from a single DVB-T2 transport.

comment:10 Changed 16 months ago by jpilk

Continuing from Comment 8, which isn't strictly related to the title of this Ticket. I had assumed that the new ed70d1 was intended to fix the 'CardUtil?: Can't open DVB frontend' messages on startup of the backend, but I'm still seeing them for the additional slave tuners. That commit only applies to mythtv-setup; perhaps another is cooking :-)

comment:11 Changed 16 months ago by Klaas de Waal

About the "Can't open DVB frontend" errors, I have seen them before but they disappeared after a reboot. At the moment I cannot reproduce these errors. However, as I have nothing done to fix them it is entirely possible that there is still a problem. Please reboot, built the latest master and check. If the problem is still there please make a log file.

About the "MPEGStream[-1](0x 566d740): Error: AFCOffset(151)+StartOfFieldPointer?(173)>184, pes length & current cannot be queried" errors; these appear often but only with the MyGica? USB tuner. Somewhere on my pre-ticket list.

About the "AddTSPacket: Out of sync!!!" errors, they occur frequently with the MyGica? USB tuner, but also sometimes with PCIe bus tuners. Also somewhere on my pre-ticket list.

comment:12 Changed 16 months ago by jpilk

None of those errors seems serious. They just look as if they might be. I don't recall seeing the 'Out of sync' one, but still use Project-X on my DVB-T recordings and that quite often reports 'length index out of bounds, shortened' or 'packet out of sequence, (shifting counter)' in recordings made with an old USB tuner. My old pci cards have fewer of these errors.

I do still see the "Can't open DVB frontend" errors every time I start the backend. It looks as if they come from #13449 CardUtil::OpenVideoDevice? and the log is as in the box in Comment 8. The first 7 refer to adapter0, the remaining 7 to adapter3 which is the MyGica?. The adapter numbers are set in /etc/modprobe.d/dvb.conf and no other adapters are present. All the errors say Device or resource busy(16). I have rebooted twice for new kernels, now 5.0.9 fc28, since Comment 8, and am still running ed70d1. Will try to add debug-level log.

Changed 16 months ago by jpilk

Attachment: Ticket13447debug.log added

backend debug log for comment 12

comment:13 Changed 16 months ago by Klaas de Waal

Given that we use the same tuner MyGica? T230 we should be able to get the same results when running the same software. However, I still cannot reproduce the problem. To be able to dig deeper please send the log file created with:

mythbackend -v general,channel,record --loglevel=debug --logpath=./log

N.B. Whatever logpath you prefer of course, this is how it works for me.

Changed 16 months ago by jpilk

comment:14 Changed 16 months ago by jpilk

I have today's build of master from the Mythbuntu team running on a laptop with the same USB MyGica? T230 as the only tuner, multirec set to 6. I see similar "Can't open DVB frontend" errors for the slave tuners. Incidentally, one transport failed to lock during setup; I had forgotten to specify the 8 MHz bandwidth.


Log as from comment 13 attached.

Changed 16 months ago by jpilk

comment:15 Changed 16 months ago by Klaas de Waal

Thanks to your logs I can now reproduce the problem. In my configuration the option "Open DVB card on demand" is selected and then the problem does not appear. After unselecting this option the open failures messages appear.

This problem is an unexpected side effect of my restructuring efforts in CardUtil?.cpp. Instead of each function doing its own device open I now use the OpenVideoDevice? function and this gives always a message if opening of the device fails. The logic here has not changed, so previously the device open failures will have gone by silently. This is consistent with the observation that making 3 simultaneous recordings does still work.

This points out a problem in (probably) tv_rec.cpp because I think that in this stage the physical device needs to be checked only once even if there are lots of virtual tuners.

To be continued.

comment:16 Changed 16 months ago by jpilk

Good. Thanks for the log guidance. I think I used to have "Open on demand" selected, but deselected it recently because all the systems on which I have tried the #13449 commit seemed to need the "Active EIT" on all devices. The explanation says the device will then be always active...

comment:17 Changed 16 months ago by jpilk

Laptop updated to 2:31.0~master.201904272135.38e40cb~ubuntu18.04.1, rescanned "All known transports" with links enabled and timeouts ignored. LCN required, "Open on demand" not selected.

Multirec works for both DVB-T and DVB-T2.

Only one strangeness in this area at present:


2019-04-28 10:08:32.277742 W  DiSEqCDevTree: No device tree for cardid 1
2019-04-28 10:10:01.554606 I  CardUtil[1]: Using delivery system: DVB-T2
2019-04-28 10:10:01.808091 I  CardUtil[1]: Using delivery system: DVB-T2
2019-04-28 10:10:47.604922 I  CardUtil[1]: Using delivery system: DVB-T2
2019-04-28 10:10:47.623484 E  DVBChan[1](/dev/dvb/adapter0/frontend0): FE_READ_STATUS failed
                        eno: Remote I/O error (121)
2019-04-28 10:10:47.623516 E  DVBSigMon[1](/dev/dvb/adapter0/frontend0): Cannot read DVB status
                        eno: Remote I/O error (121)
qam_256:770000000:BBC TWO HD:102:12323:9018:17472:16517=16517:dvb       10102:cnt(pnum:1,channum:1)
qam_256:770000000:BBC ONE HD:101:12323:9018:17540:16517=16517:dvb       10101:cnt(pnum:1,channum:1)

...and this is a short extract from backend startup, with no worrying messages:

2019-04-28 10:23:00.112944 I  Current MythTV Schema Version (DBSchemaVer): 1350
2019-04-28 10:23:00.113402 I  Loading en_gb translation for module mythfrontend
2019-04-28 10:23:00.114522 N  MythBackend: Starting up as the master server.
2019-04-28 10:23:00.964947 I  CardUtil[1]: Using delivery system: DVB-T2
2019-04-28 10:23:01.474344 I  Found 42 distinct programid authorities
2019-04-28 10:23:01.504055 I  New static DB connectionSchedCon
2019-04-28 10:23:01.515816 I  Registering HouseKeeperTask 'LogClean'.
2019-04-28 10:23:01.515907 I  Registering HouseKeeperTask 'DBCleanup'.

It's looking good now - and not all because it's getting so familiar :-)


comment:18 Changed 16 months ago by Klaas de Waal <kdewaal@…>

In 1beb65dbf9/mythtv:

Do not give "device open failed" log message in ProbeDVBFrontendName

Revert to the previous implementation of CardUtil::ProbeDVBFrontendName
which does not give a log message when the device open fails.

Refs #13447

comment:19 Changed 15 months ago by Klaas de Waal <kdewaal@…>

In e0844ea7e/mythtv:

Remove unused HasLock? call on tuner that is not yet tuned

In DVBSignalMonitor::DVBSignalMonitor function HasLock? is called.
At the time the function is called the tuner has not been
tuned yet so checking for the lock status is not useful.
There is nothing done with the results of this call except
giving an error message if the call fails.
The reason to remove this call is that the frontend
"Silicon Labs Si2168", used in the MyGica? T230, returns
the EREMOTEIO error on FE_READ_STATUS if the tuner is not tuned.

Refs #13447

comment:20 Changed 14 months ago by Klaas de Waal <kdewaal@…>

In aa4f7b7cc/mythtv:

Service filtering on presence of logical channel number.

Simplified the implementation of filtering the services
on the presence of a logical channel number by merging
the body of function FilterChannelNumber? into function
FilterServices? and removing FilterChannelNumber?.
No functional changes.

Refs #13447

Note: See TracTickets for help on using tickets.