07/30/19 01:15:50 (12 months ago)

[dvbapi] Reworked "ca_pmt_cmd_id" skipping logic

According to the spec (https://www.dvb.org/resources/public/standards/En50221.V1.pdf), the "ca_pmt_cmd_id"
value shall be present inside the ES info loop. Unfortunately, each dvbapi client does each own thing. The
only reliable way to detect when this info is present in the CA PMT is to actually check its value, like it
was done in the old code.

Most boxes always send the typical value of 0x01 (ok_descrambling) and the above check works fine because
there is no descriptor_tag 0x01 to get confused with. On the contrary, for enigma2, values like 0x03 (query),
0x04 (not_selected) are possible (not yet, but soon). Skipping these higher values the same way will not work,
because descriptors with such tags can exist, so a different check is implemented for enigma2.

In practice, this commit fixes the VDR dvbapi plugin, as well as the enigma2 boxes with wrong dvbapi boxtype
setting ("none" instead on the correct "dreambox" - the setting is irrelevant now, but will make a difference
in the future, so make sure you set it correctly).

1 edited


  • trunk/module-dvbapi.c

    r11536 r11537  
    40704070        if(es_info_length != 0 && es_info_length < length)
    40714071        {
    4072             // We are on CA PMT parsing
    4073             // Only enigma2 and Spark follow the CA PMT specification ("ca_pmt_cmd_id"
    4074             // shall be present in the ES info loop), so we need to check for the box type.
    4075             if(ca_pmt_cmd_id != NULL && cfg.dvbapi_boxtype == BOXTYPE_DREAMBOX)
    4076             {
    4077                 *ca_pmt_cmd_id = buffer[i + 5]; // It should be identical for all ES and the same as in program info
    4078                 offset = 1;
     4072            if(ca_pmt_cmd_id != NULL) // We are on CA PMT parsing
     4073            {
     4074                // Only enigma2, Spark and VDR follow the CA PMT specification ("ca_pmt_cmd_id"
     4075                // shall be present in the ES info loop). For the first two, checking for boxtype
     4076                // "dreambox" is sufficient, but for VDR this is not enough, because it shares
     4077                // the same boxtype with tvheadend. So, for every other box (including VDR and
     4078                // tvheadend), we stick to the old style check based on the value (descriptors
     4079                // with tag 0x00 or 0x01 are not allowed, so this works), while for enigma2 we
     4080                // do a proper check, because the "ca_pmt_cmd_id" can also take greater values.
     4081                if(cfg.dvbapi_boxtype == BOXTYPE_DREAMBOX)
     4082                {
     4083                    *ca_pmt_cmd_id = buffer[i + 5]; // It should be identical for all ES and the same as in program info
     4084                    offset = 1;
     4085                }
     4086                else
     4087                {
     4088                    offset = (buffer[i + 5] <= 0x01) ? 1 : 0;
     4089                }
    40794090            }
Note: See TracChangeset for help on using the changeset viewer.