From 11e4b5cba3e457fffc57d4f766e38a6cab4a5ed9 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 11 Sep 2003 16:24:22 +0000 Subject: [PATCH] When reading Matroska files & splitting all packets were accidentally considered to be splitpoints. Same situation: the list of unique numbers was not cleaned, and therefore the second pass could not keep the UIDs. --- src/cluster_helper.cpp | 2 +- src/common.cpp | 4 ++++ src/common.h | 1 + src/mkvmerge.cpp | 20 +++++++++++++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/cluster_helper.cpp b/src/cluster_helper.cpp index 808964058..bcd59c9c8 100644 --- a/src/cluster_helper.cpp +++ b/src/cluster_helper.cpp @@ -448,7 +448,7 @@ int cluster_helper_c::render() { // The next stuff is for splitting files. if (pass == 1) { // first pass: find splitpoints if ((pack->bref == -1) && // this is a keyframe - ((video_fps == -1) || // either no video track present... + (!video_track_present || // either no video track present... // ...or this is the video track (source->get_track_type() == track_video))) { sp = (splitpoint_t *)safemalloc(sizeof(splitpoint_t)); diff --git a/src/common.cpp b/src/common.cpp index f42377994..d73b273aa 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -552,6 +552,10 @@ char *from_utf8(int handle, const char *utf8) { static vector ru_numbers; +void clear_list_of_unique_uint32() { + ru_numbers.clear(); +} + bool is_unique_uint32(uint32_t number) { int i; diff --git a/src/common.h b/src/common.h index dd907d019..da991873f 100644 --- a/src/common.h +++ b/src/common.h @@ -115,6 +115,7 @@ void utf8_done(); char *to_utf8(int handle, const char *local); char *from_utf8(int handle, const char *utf8); +void clear_list_of_unique_uint32(); bool is_unique_uint32(uint32_t number); void add_unique_uint32(uint32_t number); uint32_t create_unique_uint32(); diff --git a/src/mkvmerge.cpp b/src/mkvmerge.cpp index 7225f775e..400d6b606 100644 --- a/src/mkvmerge.cpp +++ b/src/mkvmerge.cpp @@ -1635,6 +1635,7 @@ static void init_globals() { default_tracks[2] = 0; display_counter = 1; display_reader = NULL; + clear_list_of_unique_uint32(); } static void destroy_readers() { @@ -1986,6 +1987,8 @@ void main_loop() { // {{{ FUNCTION main(int argc, char **argv) int main(int argc, char **argv) { + time_t start, end; + init_globals(); setup(); @@ -1995,6 +1998,8 @@ int main(int argc, char **argv) { if (split_after > 0) { mxinfo("Pass 1: finding split points. This may take a while.\n\n"); + start = time(NULL); + create_readers(); if (packetizers.size() == 0) @@ -2005,7 +2010,12 @@ int main(int argc, char **argv) { main_loop(); finish_file(); - mxinfo("\nPass 2: merging the files. This will take even longer.\n\n"); + end = time(NULL); + + mxinfo("\nPass 1 took %u seconds.\nPass 2: merging the files. This will " + "take even longer.\n\n", end - start); + + start = time(NULL); delete cluster_helper; destroy_readers(); @@ -2021,8 +2031,13 @@ int main(int argc, char **argv) { main_loop(); finish_file(); + end = time(NULL); + mxinfo("Pass 2 took %u seconds.\n", end - start); + } else { + start = time(NULL); + create_readers(); if (packetizers.size() == 0) @@ -2032,6 +2047,9 @@ int main(int argc, char **argv) { create_next_output_file(true, true); main_loop(); finish_file(); + + end = time(NULL); + mxinfo("Muxing took %u seconds.\n", end - start); } cleanup();