[mythtv] This piece of code is driving me nuts!
roger
roger at beardandsandals.co.uk
Fri Nov 18 17:53:55 UTC 2016
This piece of code in mpgestreamdata.cpp is driving me nuts.
void init_sections(sections_t §, 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];
}
Can anyone tell me why it resizes the vector twice? What am I missing?
Also what is the significance off the final line?
I think it currently does this.
1. Clears the sect vector.
2. Divides last_section by 8 to give endz. This results in a number in
the range 0 - 31 (segment numbers are 0 - 255).
3. Resizes the vector to 0 - 31 entries according to the value of endz
and sets these entries to zero.
4. Resizes the vector to 32 entries and set all these to 0xff including
the ones it has just set to zero.
5. The last bit I am guessing may be related to some sort of optimised
search tree. Feel free to speculate on this.
Roger
More information about the mythtv-dev
mailing list