From fccd0ff6c24f7a49322358339608ae98d763d7f5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 25 Sep 2004 20:14:35 +0000 Subject: [PATCH] Merged 2201:2203 --- avilib-0.6.10/avilib.c | 10 +++++++++- avilib-0.6.10/avilib.h | 4 ++++ src/extract/mkvextract.cpp | 4 ++++ src/extract/mkvextract.h | 1 + src/extract/tracks.cpp | 5 +++++ tests/results.txt | 2 +- tests/run.rb | 7 +++++-- 7 files changed, 29 insertions(+), 4 deletions(-) diff --git a/avilib-0.6.10/avilib.c b/avilib-0.6.10/avilib.c index 1db34ee17..48f97fb1b 100644 --- a/avilib-0.6.10/avilib.c +++ b/avilib-0.6.10/avilib.c @@ -1596,7 +1596,10 @@ static int avi_close_output_file(avi_t *AVI) //OUTLONG(MAX_INFO_STRLEN); memset(id_str, 0, MAX_INFO_STRLEN); - sprintf(id_str, "%s-%s", PACKAGE, VERSION); + if (AVI->writing_app != NULL) + strncpy(id_str, AVI->writing_app, MAX_INFO_STRLEN - 1); + else + snprintf(id_str, MAX_INFO_STRLEN - 1, "%s-%s", PACKAGE, VERSION); real_id_len = id_len = strlen(id_str)+1; if (id_len&1) id_len++; @@ -1624,6 +1627,11 @@ static int avi_close_output_file(avi_t *AVI) // nhb += MAX_INFO_STRLEN; #endif + if (AVI->writing_app != NULL) { + free(AVI->writing_app); + AVI->writing_app = NULL; + } + // ---------------------------- /* Calculate the needed amount of junk bytes, output junk */ diff --git a/avilib-0.6.10/avilib.h b/avilib-0.6.10/avilib.h index d74990f46..8b2f466df 100644 --- a/avilib-0.6.10/avilib.h +++ b/avilib-0.6.10/avilib.h @@ -254,6 +254,10 @@ typedef struct void* extradata; unsigned long extradata_size; + + /* This info is put into the AVI header. May be set by the application. + If set then avilib will free() it. */ + char *writing_app; } avi_t; #define AVI_MODE_WRITE 0 diff --git a/src/extract/mkvextract.cpp b/src/extract/mkvextract.cpp index ccfc9df22..a3580a666 100644 --- a/src/extract/mkvextract.cpp +++ b/src/extract/mkvextract.cpp @@ -80,6 +80,7 @@ using namespace std; #define MODE_CUESHEET 4 vector tracks; +bool no_variable_data = false; bool ssa_line_c::operator < (const ssa_line_c &cmp) @@ -237,6 +238,9 @@ parse_args(int argc, if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) verbose++; + else if (!strcmp(argv[i], "--no-variable-data")) + no_variable_data = true; + else if (!strcmp(argv[i], "-f") || !strcmp(argv[i], "--parse-fully")) parse_fully = true; diff --git a/src/extract/mkvextract.h b/src/extract/mkvextract.h index ac3035c59..54cec6bca 100644 --- a/src/extract/mkvextract.h +++ b/src/extract/mkvextract.h @@ -93,6 +93,7 @@ typedef struct { extern vector tracks; extern char typenames[TYPEMAX + 1][20]; +extern bool no_variable_data; #define fits_parent(l, p) (l->GetElementPosition() < \ (p->GetElementPosition() + p->ElementSize())) diff --git a/src/extract/tracks.cpp b/src/extract/tracks.cpp index c4eb5d283..a03a5dc20 100644 --- a/src/extract/tracks.cpp +++ b/src/extract/tracks.cpp @@ -415,11 +415,16 @@ create_output_files() { if (tracks[i].type == TYPEAVI) { alBITMAPINFOHEADER *bih; char ccodec[5]; + string writing_app; tracks[i].avi = AVI_open_output_file(tracks[i].out_name); if (tracks[i].avi == NULL) mxerror(_("The file '%s' could not be opened for writing (%s).\n"), tracks[i].out_name, AVI_strerror()); + writing_app = "mkvextract"; + if (!no_variable_data) + writing_app += mxsprintf(" %s", VERSION); + tracks[i].avi->writing_app = safestrdup(writing_app.c_str()); bih = (alBITMAPINFOHEADER *)tracks[i].private_data; memcpy(ccodec, &bih->bi_compression, 4); diff --git a/tests/results.txt b/tests/results.txt index d930efef0..a349456c9 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -30,7 +30,7 @@ T_029link:b3076d997bcdb4202de374ba77a2a5c6:passed:20040825-235039 T_032cues:2d852a5c1ee169ddc713318c86a0b616:passed:20040825-235040 T_033timecode_scale:ba6bc8dff27d7d9fd433670067fa716d-d54414d993caad6cea47ef7913cb13db:passed:20040825-235040 T_034ac3misdetected_as_mp2:f6765afb6d86ae09e0859f32ba65ced4:passed:20040920-100447 -T_035X_vfw_video:8b5ff6d70e8ac38e9f037f5baf4f0a04:passed:20040920-185358 +T_035X_vfw_video:5bcb3426b2635ae5c89a5e5fe46aa416:passed:20040920-185358 T_036X_mp3:b3bb67d316e20da12926d5c1d628f6e5:passed:20040920-190109 T_037X_aac:66ccc4dde4eb9b3109b810b5a2be99ee:passed:20040920-190110 T_038X_ac3:6ca341797c5f93e273c8502f4d6f4fba:passed:20040920-185449 diff --git a/tests/run.rb b/tests/run.rb index 44319dc58..318a2e04a 100755 --- a/tests/run.rb +++ b/tests/run.rb @@ -93,7 +93,8 @@ class Test end def xtr_tracks_s(*args) - command = "../src/mkvextract tracks data/mkv/complex.mkv " + command = "../src/mkvextract tracks data/mkv/complex.mkv " + + "--no-variable-data " command += args.join(" ") command += ":#{tmp}" sys(command, 0) @@ -102,7 +103,9 @@ class Test def xtr_tracks(*args) command = "../src/mkvextract tracks " - command += args.join(" ") + command += args[0] + command += " --no-variable-data " + command += args[1..args.size - 1].join(" ") sys(command, 0) end end