From 6a594e6b877b3f9387da157e7a343e32ab06f25e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 3 Nov 2015 20:59:45 +0100 Subject: [PATCH] mkvmerge: don't generate segment UIDs for discarded segments on splitting Fixes #1497. --- ChangeLog | 4 ++ src/merge/output_control.cpp | 3 ++ tests/results.txt | 1 + ...splitting_by_parts_with_segment_linking.rb | 49 +++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100755 tests/test-508splitting_by_parts_with_segment_linking.rb diff --git a/ChangeLog b/ChangeLog index d23ad2fac..9b49e8fdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-11-03 Moritz Bunkus + * mkvmerge: bug fix: fixed the values of the "previous/next + segment UID" elements when splitting by parts with segment linking + enabled. Fixes #1497. + * mkvmerge: bug fix: mkvmerge no longer creates a "next segment UID" field in the last file when splitting and segment linking is active. diff --git a/src/merge/output_control.cpp b/src/merge/output_control.cpp index 9b391f462..6279309e7 100644 --- a/src/merge/output_control.cpp +++ b/src/merge/output_control.cpp @@ -497,6 +497,9 @@ rerender_ebml_head() { static void generate_segment_uids() { + if (g_cluster_helper->discarding()) + return; + // Generate the segment UIDs. if (hack_engaged(ENGAGE_NO_VARIABLE_DATA)) { s_seguid_current.zero_content(); diff --git a/tests/results.txt b/tests/results.txt index 37d378a50..855ff14f6 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -353,3 +353,4 @@ T_504dts_96_24_identification:1837ab5b411944e143f9dae6fe6436d8-bb7c41b5aa1b57f18 T_505cisco_talos_can_0036:bf0fedc494cf99a0920d7a6e69edf952-6ef415b0f84d3e5dd435244362a37584:passed:20151020-161153:0.071686357 T_506cisco_talos_can_0037:5461288548eac976164cd13f01bc9426-ed695caee29b1456da8629d38321ec9c-92b7169fc05ddf54c46816869c108f31-54a55a6d87bd4c08269891efb03980b3-fef3d018523c7d1fbed763f6666c1ae2-ac584cc44854f9396739df6e93d78acc-b415b2ef2a6dddf5d89733446fae2970-dd53fee23372c569d35e0b2918d86239:passed:20151020-161234:0.319298931 T_507rerender_track_headers:7b16f08b7858a1d332516a6fb25a184b-ac9514a1f09f26ac0cb2f527ec2de0b7:passed:20151022-104930:2.573204876 +T_508splitting_by_parts_with_segment_linking:existence0-true-true-true-existence1-true-true-true-existence2-true-true-true-equality_previous-true-true-equality_next-true-true:passed:20151103-204257:0.111807853 diff --git a/tests/test-508splitting_by_parts_with_segment_linking.rb b/tests/test-508splitting_by_parts_with_segment_linking.rb new file mode 100755 index 000000000..4767e4925 --- /dev/null +++ b/tests/test-508splitting_by_parts_with_segment_linking.rb @@ -0,0 +1,49 @@ +#!/usr/bin/ruby -w + +# T_508splitting_by_parts_with_segment_linking +describe "mkvmerge / splitting by parts with segment linking enabled" + +self.sys "../src/mkvmerge -o #{tmp} data/avi/v-h264-aac.avi --split parts:00:00:00-00:00:10,00:00:30-00:00:40,00:00:50- --link", :keep_tmp => true, :exit_code => :success + +test "segment UIDs" do + uids = [] + result = [] + + (1..3).each do |idx| + uids << info("#{tmp}-00#{idx}", :output => :return). + first. + select { |line| /segment uid/i.match(line) }. + map { |line| line.gsub(/^\| *\+ */, '').chomp.downcase.split(/ *uid: */) }. + to_h + end + + result << "existence0" + + result << uids[0]['previous segment'].nil? + result << !uids[0]['segment'].nil? + result << !uids[0]['next segment'].nil? + + result << "existence1" + + result << !uids[1]['previous segment'].nil? + result << !uids[1]['segment'].nil? + result << !uids[1]['next segment'].nil? + + result << "existence2" + + result << !uids[2]['previous segment'].nil? + result << !uids[2]['segment'].nil? + result << uids[2]['next segment'].nil? + + result << "equality_previous" + + result << (uids[0]['segment'] == uids[1]['previous segment']) + result << (uids[1]['segment'] == uids[2]['previous segment']) + + result << "equality_next" + + result << (uids[1]['segment'] == uids[0]['next segment']) + result << (uids[2]['segment'] == uids[1]['next segment']) + + result.map(&:to_s).join('-') +end