mkvtoolnix/tests/test-669ssa_ass_zero_duration.rb
Moritz Bunkus 9e1a1f3de6
subtitles: allow duration = 0ms
Various places needed to differentiate better between "no duration is
known or set for this packet" and "this packet has a duration of
0ms". The former means that no duration element should be written to
the file, and the use of `SimpleBlock` instead of `BlockGroup` is
OK. The latter on the other hand means that a `BlockGroup` must be
used and a duration element must be added.

This core change uncovered a couple of subtle bugs in other places
where subtitles were handled:

• The Matroska reader passed 0 as the duration even if no duration
  element was present making it impossible for other code to
  differentiate between "no duration present" and "duration present
  but set to 0".
• The DVB subtitle packetizer always enforced writing the duration
  even if the duration wasn't known.
• The Kate packetizer used a wrong dummy value of 1us for the duration
  for the "end of stream" packet as the core would not write a
  duration of 0.
• The text subtitle packetizer was using the difference between the
  current packet and the following one for packets were the duration
  was 0 or unknown. The correct behavior is to do this only if the
  duration is unknown, not if it is 0.

Fixes #2490.
2019-01-24 16:01:22 +01:00

11 lines
263 B
Ruby
Executable File

#!/usr/bin/ruby -w
# T_669ssa_ass_zero_duration
describe "mkvmerge / SSA/ASS with entries with duration = 0"
test_merge "data/subtitles/ssa-ass/zero_duration.ass", :keep_tmp => true
test "extraction" do
extract tmp, 0 => "#{tmp}-x"
hash_file "#{tmp}-x"
end