Ensure that the text field is terminated when writing EBU STL files

The text field must be terminated with 0x8F, so write an extra block if
the last block is filled exactly.

Originally committed to SVN as r6637.
This commit is contained in:
Thomas Goyne 2012-03-29 19:05:37 +00:00
parent 4294e5857d
commit 7335c520c1

View file

@ -546,9 +546,14 @@ namespace
tti.push_back(base);
// write an extension block number if the remaining text doesn't fit in the block
tti.back().ebn = bytes_remaining > block_size ? num_blocks++ : 255;
tti.back().ebn = bytes_remaining >= block_size ? num_blocks++ : 255;
std::copy(&fullstring[pos], &fullstring[pos + std::min(block_size, bytes_remaining)], tti.back().tf);
// Write another block for the terminator if we exactly used up
// the last block
if (bytes_remaining == block_size)
tti.push_back(base);
}
}