mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-29 14:27:42 +00:00
8d78387b09
A two-byte header field (one for the ID, one for the content size) can have a content size of at most 127 bytes, meaning a total size of 129 is easy to achieve: set the content size to 127 bytes, libEBML will calculate the required length of the content size field to be 1 and the resulting element's total size will be the desired 129 bytes. A content size of 128 would mean that the content size field must be at least two bytes long. Taking the element's ID into account this would mean a total element size of 128 + 2 + 1 = 131 bytes. So getting libEBML to produce an element of a total size of 131 is easy, too: set the content size to 128 bytes, and libEBML will do the rest. The problematic total size is a 130 bytes. There simply is no content size for which adding the minimal length of the content size field and 1 for the ID would result in a total size of 130 bytes. The solution is writing the length field with more bytes than necessary. In the case of a total size of 130 bytes we could use the maximum one-byte content size = 127 bytes, add one byte for the ID and force the content size field's length to be two instead of one byte (0x407f instead of 0xff). Similar corner cases exist for the transition between content size field being two/three bytes, three/four bytes long etc. In order to keep the code simple we always use an eight-bytes long content size field if the total size is at least nine bytes and a one-byte long content size field otherwise.
10 lines
227 B
Ruby
Executable File
10 lines
227 B
Ruby
Executable File
#!/usr/bin/ruby -w
|
|
|
|
describe "mkvpropedit / create voids for 130 bytes long gaps"
|
|
|
|
test "propedit" do
|
|
sys "cp data/mkv/propedit-gaps-130-bytes.mkv #{tmp}"
|
|
propedit tmp, "--edit track:s1 --set flag-default=0"
|
|
hash_tmp
|
|
end
|