Splitting by time was broken: beginning with the second file splitting occured after each key frame.

This commit is contained in:
Moritz Bunkus 2004-02-14 09:32:23 +00:00
parent a22eb8680d
commit adfba59fef
3 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2004-02-14 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Splitting by time was broken.
2004-02-12 Moritz Bunkus <moritz@bunkus.org>
* all: A couple of changes that allow compilation on MacOS X.

View File

@ -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) {

View File

@ -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: