diff --git a/ChangeLog b/ChangeLog index 5b632eb40..64fc9905f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-02-14 Moritz Bunkus + + * mkvmerge: bug fix: Splitting by time was broken. + 2004-02-12 Moritz Bunkus * all: A couple of changes that allow compilation on MacOS X. diff --git a/src/cluster_helper.cpp b/src/cluster_helper.cpp index de959a640..2f48611ed 100644 --- a/src/cluster_helper.cpp +++ b/src/cluster_helper.cpp @@ -63,6 +63,7 @@ cluster_helper_c::cluster_helper_c() { timecode_offset = 0; last_packets = NULL; first_timecode = 0; + first_timecode_in_file = -1; bytes_in_file = 0; } @@ -138,6 +139,8 @@ void cluster_helper_c::add_packet(packet_t *packet) { track_video) || !video_track_present)) { split = false; c = clusters[num_clusters - 1]; + if (first_timecode_in_file == -1) + first_timecode_in_file = packet->assigned_timecode; // Maybe we want to start a new file now. if (!split_by_time) { @@ -169,7 +172,7 @@ void cluster_helper_c::add_packet(packet_t *packet) { if ((header_overhead + additional_size + bytes_in_file) >= split_after) split = true; - } else if ((packet->assigned_timecode - first_timecode) >= + } else if ((packet->assigned_timecode - first_timecode_in_file) >= (split_after * 1000000ull)) split = true; @@ -187,6 +190,7 @@ void cluster_helper_c::add_packet(packet_t *packet) { add_cluster(new kax_cluster_c()); bytes_in_file = 0; + first_timecode_in_file = -1; max_timecode = old_max_timecode; if (no_linking) { diff --git a/src/cluster_helper.h b/src/cluster_helper.h index 7c03f0d98..82c3517cc 100644 --- a/src/cluster_helper.h +++ b/src/cluster_helper.h @@ -52,7 +52,7 @@ private: int num_clusters, cluster_content_size; int64_t max_timecode, last_cluster_tc, num_cue_elements, header_overhead; int64_t packet_num, timecode_offset, *last_packets, first_timecode; - int64_t bytes_in_file; + int64_t bytes_in_file, first_timecode_in_file; mm_io_c *out; public: