[mythtv] This piece of code is driving me nuts!

Karl Dietz dekarl at spaetfruehstuecken.org
Fri Nov 18 22:19:58 UTC 2016


On 18.11.2016 18:53, roger wrote:
> This piece of code in mpgestreamdata.cpp is driving me nuts.
>
> void init_sections(sections_t &sect, uint last_section)
>
> {
>
> static const unsigned char init_bits[8] =
>
> { 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, };
>
> sect.clear();
>
> uint endz = last_section >> 3;
>
> if (endz)
>
> sect.resize(endz, 0x00);
>
> sect.resize(32, 0xff);
>
> sect[endz] = init_bits[last_section & 0x7];
>
> }

It creates a vector of 256bits packed into 32 unsigned chars of 8 bits.
(256 being the maximum number of sections)
Then initializes last_section bits to 0 and 256-last_section bits to 1.

Later it looks at each received section and sets the corresponding
bits. Once all bits are set we have collected the whole table.

Regards,
Karl


More information about the mythtv-dev mailing list