Bug #4793
Change order of PMT data in caPMT
0%
Description
This is probably a problem with oscam parsing, but I noticed oscam was not recognizing the PMT pid in the capmt message from Tvheadend. When comparing to enigma2, I found the order of entries was different:
Tvheadend:
12:58:07 444D7CDB c (dvbapi) Got packet with opcode 9F803282 and size 47 12:58:07 444D7CDB c (dvbapi) PMT Update on socket 8. 12:58:07 444D7CDB c (dvbapi) Parsing PMT object: 12:58:07 444D7CDB c (dvbapi) 9F 80 32 82 00 29 03 00 6D 00 00 19 01 82 02 00 12:58:07 444D7CDB c (dvbapi) 02 81 08 00 00 00 00 00 65 00 12 84 02 13 F5 09 12:58:07 444D7CDB c (dvbapi) 04 0E 00 17 71 1B 04 29 00 00 04 04 01 00 00 12:58:07 444D7CDB c (dvbapi) capmt: 12:58:07 444D7CDB c (dvbapi) 03 00 6D 00 00 19 01 82 02 00 02 81 08 00 00 00 12:58:07 444D7CDB c (dvbapi) 00 00 65 00 12 84 02 13 F5 09 04 0E 00 17 71 1B 12:58:07 444D7CDB c (dvbapi) 04 29 00 00 04 04 01 00 00 12:58:07 444D7CDB c (dvbapi) Receiver sends PMT command 3 for channel 006D 12:58:07 444D7CDB c (dvbapi) Receiver wants to demux srvid 006D on adapter 0002 camask 0004 index 0000 pmtpid 0000 12:58:07 444D7CDB c (dvbapi) Demuxer 0 try to start new filter for caid: 0001, provid: 000001, pid: 0000 12:58:07 444D7CDB c (dvbapi) Sending packet to dvbapi client (fd=8): 12:58:07 444D7CDB c (dvbapi) 40 3C 6F 2B 02 00 00 00 00 00 00 00 00 00 00 00 12:58:07 444D7CDB c (dvbapi) 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 12:58:07 444D7CDB c (dvbapi) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12:58:07 444D7CDB c (dvbapi) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12:58:07 444D7CDB c (dvbapi) 04 12:58:07 444D7CDB c (dvbapi) Demuxer 0 Filter 1 started successfully (caid 0001 provid 000001 pid 0000)
Notice PMT pid is not detected and set to 0 - thus starts filter for pid 0
Oscam:
13:12:58 444D7CDB c (dvbapi) Got packet with opcode 9F803282 and size 47 13:12:58 444D7CDB c (dvbapi) PMT Update on socket 8. 13:12:58 444D7CDB c (dvbapi) Parsing PMT object: 13:12:58 444D7CDB c (dvbapi) 9F 80 32 82 00 29 03 00 67 01 00 19 01 81 08 00 13:12:58 444D7CDB c (dvbapi) 00 00 00 00 65 00 12 82 02 00 02 84 02 13 EF 09 13:12:58 444D7CDB c (dvbapi) 04 0E 00 17 75 1B 06 1D 00 00 04 05 F5 00 00 13:12:58 444D7CDB c (dvbapi) capmt: 13:12:58 444D7CDB c (dvbapi) 03 00 67 01 00 19 01 81 08 00 00 00 00 00 65 00 13:12:58 444D7CDB c (dvbapi) 12 82 02 00 02 84 02 13 EF 09 04 0E 00 17 75 1B 13:12:58 444D7CDB c (dvbapi) 06 1D 00 00 04 05 F5 00 00 13:12:58 444D7CDB c (dvbapi) Receiver sends PMT command 3 for channel 0067 13:12:58 444D7CDB c (dvbapi) Receiver wants to demux srvid 0067 on adapter 0000 camask 0000 index 0002 pmtpid 13EF 13:12:58 444D7CDB c (dvbapi) Sending packet to dvbapi client (fd=8): 13:12:58 444D7CDB c (dvbapi) 40 3C 6F 2B 00 00 00 13 EF 02 00 67 00 00 00 00 13:12:58 444D7CDB c (dvbapi) 00 00 00 00 00 00 00 00 00 FF FF FF 00 00 00 00 13:12:58 444D7CDB c (dvbapi) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:12:58 444D7CDB c (dvbapi) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13:12:58 444D7CDB c (dvbapi) 04 13:12:58 444D7CDB c (dvbapi) Demuxer 0 Filter 1 started successfully (caid 0001 provid 000001 pid 13EF)
Fix:
diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index 6f41263..ab31352 100644 --- a/src/descrambler/capmt.c +++ b/src/descrambler/capmt.c @@ -404,7 +404,7 @@ capmt_pid_remove(capmt_t *capmt, int adapter, int pid, uint32_t flags) lock_assert(&capmt->capmt_mutex); - if (pid <= 0) + if (pid < 0) return; for (i = 0; i < MAX_PIDS; i++) { o = &ca->ca_pids[i]; @@ -2184,14 +2184,6 @@ capmt_send_request(capmt_service_t *ct, int lm) /* build program info tags */ - if (capmt->capmt_oscam != CAPMT_OSCAM_SO_WRAPPER) { - /* build SI tag */ - buf[pos++] = CAPMT_DESC_DEMUX; - buf[pos++] = 2; - buf[pos++] = 0; - buf[pos++] = adapter_num; - } - /* build SI tag */ buf[pos++] = CAPMT_DESC_ENIGMA; buf[pos++] = 8; @@ -2204,6 +2196,14 @@ capmt_send_request(capmt_service_t *ct, int lm) buf[pos++] = onid >> 8; buf[pos++] = onid; + if (capmt->capmt_oscam != CAPMT_OSCAM_SO_WRAPPER) { + /* build SI tag */ + buf[pos++] = CAPMT_DESC_DEMUX; + buf[pos++] = 2; + buf[pos++] = 0; + buf[pos++] = adapter_num; + } + if (capmt->capmt_oscam == CAPMT_OSCAM_SO_WRAPPER) { /* build SI tag */ buf[pos++] = CAPMT_DESC_DEMUX;
Here it finds the PMT pid and sets the filter for it.
(sorry, different channels were used, but not really relevant...)
Hopefully this does not break something else???
History
Updated by Joe User almost 7 years ago
Wait on this, while probably the right thing to do, it seems Tvheadend does not want to start descrambling if oscam does not request filter for pid 0... Something else probably also needs to be fixed.
Updated by Jaroslav Kysela almost 7 years ago
It seems that this patch is missing in oscam:
Index: module-dvbapi.c =================================================================== --- module-dvbapi.c (revision 11392) +++ module-dvbapi.c (working copy) @@ -3167,6 +3167,7 @@ *demux_index = buffer[9]; // it is always 0 but you never know *adapter_index = buffer[10]; // adapter index can be 0,1,2 *ca_mask = (1 << *adapter_index); // use adapter_index as ca_mask (used as index for ca_fd[] array) + if (buffer[21]==0x84 && buffer[22]==0x02) *pmtpid = b2i(2, buffer+23); } }
Updated by Joe User almost 7 years ago
Yes, that looks like it. I pulled latest svn today and applied oscam-emu patch and it is not there. Do you know when it was supposed to be added?
Updated by Joe User almost 7 years ago
Reason my change did not work is because while finding the PMT pid, the new order and boxtype=pc means it did not find the correct adapter, so filters not started correctly...
Updated by Jaroslav Kysela almost 7 years ago
- Status changed from New to Fixed
Fixed. See the associated revisions. Your change was not sufficient - the adapter number is in another descriptor for enigma2. My updated code should work with all oscam versions without patch in comment 2.
Updated by Joe User almost 7 years ago
Thanks - was going to try something like that, but had other things I needed to do. :)
BTW - adding the patch from #2 worked, but did not solve the other issue which led me to this...
([[http://tvheadend.org/issues/4788]])
Updated by Jaroslav Kysela almost 7 years ago
Just a note, although I changed the si descriptors in capmt code to enigma2 type, it does not work with adapter >= 8. So I proposed the change from comment 2 to oscam: http://www.streamboard.tv/oscam/ticket/4645
Updated by Petar Ivanov almost 7 years ago
With last 4.3-819~g7c3919b88 and patch on oscam not fixed problem with more then 8, still same 8-9 max.
Updated by Jaroslav Kysela almost 7 years ago
@Petar: does it work when you do this change?
$ cd tvhsrcdir $ git diff c1a5e434b59a0fa08e7a3c256ac6908fae2b0265~1..master src/descrambler/capmt.c | patch -p1 -R
Updated by Petar Ivanov almost 7 years ago
Jaroslav: not work when make this change:
git diff c1a5e434b59a0fa08e7a3c256ac6908fae2b0265~1..master src/descrambler/capmt.c | patch -p1 -R
Updated by Jaroslav Kysela almost 7 years ago
@Petar: which last version of tvh does work for you?