Merged 2233

This commit is contained in:
Moritz Bunkus 2004-09-28 18:25:43 +00:00
parent e1f9a62abc
commit d29a4552fa
3 changed files with 56 additions and 30 deletions

View File

@ -1,5 +1,8 @@
2004-09-28 Moritz Bunkus <moritz@bunkus.org> 2004-09-28 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge, mkvextract: bug fix: ASS was handled like SSA which is
not correct in each case, especially when extracting it.
* mkvextract: bug fix: The WAV writer was not endian safe. * mkvextract: bug fix: The WAV writer was not endian safe.
2004-09-27 Moritz Bunkus <moritz@bunkus.org> 2004-09-27 Moritz Bunkus <moritz@bunkus.org>

View File

@ -534,7 +534,7 @@ create_output_files() {
tracks[i].out->write_bom(tracks[i].sub_charset); tracks[i].out->write_bom(tracks[i].sub_charset);
} else if (tracks[i].type == TYPESSA) { } else if (tracks[i].type == TYPESSA) {
char *s; char *s, *p1;
unsigned char *pd; unsigned char *pd;
int bom_len; int bom_len;
string sconv; string sconv;
@ -568,8 +568,19 @@ create_output_files() {
sconv = s; sconv = s;
safefree(s); safefree(s);
tracks[i].out->write_bom(tracks[i].sub_charset); tracks[i].out->write_bom(tracks[i].sub_charset);
if (((p1 = strstr(sconv.c_str(), "[Events]")) == NULL) ||
(strstr(p1, "Format:") == NULL)) {
if (!strcmp(tracks[i].codec_id, MKV_S_TEXTSSA))
sconv += "\n[Events]\nFormat: Marked, Start, End, " sconv += "\n[Events]\nFormat: Marked, Start, End, "
"Style, Name, MarginL, MarginR, MarginV, Effect, Text\n"; "Style, Name, MarginL, MarginR, MarginV, Effect, Text\n";
else
sconv += "\n[Events]\nFormat: Layer, Start, End, "
"Style, Actor, MarginL, MarginR, MarginV, Effect, Text\n";
} else if ((sconv.length() == 0) ||
(sconv[sconv.length()- 1] != '\n'))
sconv += "\n";
from_utf8(tracks[i].conv_handle, sconv); from_utf8(tracks[i].conv_handle, sconv);
tracks[i].out->puts_unl(sconv.c_str()); tracks[i].out->puts_unl(sconv.c_str());
@ -764,30 +775,46 @@ handle_data(KaxBlock *block,
// Reconstruct the 'original' line. It'll look like this for SSA: // Reconstruct the 'original' line. It'll look like this for SSA:
// Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, // Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect,
// Text // Text
// and for ASS:
// Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect,
// Text
line = string("Dialogue: Marked=0,"); if (!strcmp(track->codec_id, MKV_S_TEXTSSA))
line = string("Dialogue: Marked=0,") +
// Append the start and end time. // Append the start and end time.
mxprints(buffer, "%lld:%02lld:%02lld.%02lld", mxsprintf("%lld:%02lld:%02lld.%02lld",
start / 1000 / 60 / 60, (start / 1000 / 60) % 60, start / 1000 / 60 / 60, (start / 1000 / 60) % 60,
(start / 1000) % 60, (start % 1000) / 10); (start / 1000) % 60, (start % 1000) / 10) + comma +
line += string(buffer) + comma; mxsprintf("%lld:%02lld:%02lld.%02lld",
mxprints(buffer, "%lld:%02lld:%02lld.%02lld",
end / 1000 / 60 / 60, (end / 1000 / 60) % 60, end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
(end / 1000) % 60, (end % 1000) / 10); (end / 1000) % 60, (end % 1000) / 10) + comma +
line += string(buffer) + comma;
// Append the other fields. // Append the other fields.
line += fields[2] + comma + // Style fields[2] + comma + // Style
fields[3] + comma + // Name fields[3] + comma + // Name
fields[4] + comma + // MarginL fields[4] + comma + // MarginL
fields[5] + comma + // MarginR fields[5] + comma + // MarginR
fields[6] + comma + // MarginV fields[6] + comma + // MarginV
fields[7] + comma; // Effect fields[7] + comma + // Effect
fields[8] + string("\n"); // Text
else
line = string("Dialogue: ") +
fields[1] + comma + // Layer
mxsprintf("%lld:%02lld:%02lld.%02lld",
start / 1000 / 60 / 60, (start / 1000 / 60) % 60,
(start / 1000) % 60, (start % 1000) / 10) + comma +
mxsprintf("%lld:%02lld:%02lld.%02lld",
end / 1000 / 60 / 60, (end / 1000 / 60) % 60,
(end / 1000) % 60, (end % 1000) / 10) + comma +
fields[2] + comma + // Style
comma + // Actor
fields[4] + comma + // MarginL
fields[5] + comma + // MarginR
fields[6] + comma + // MarginV
fields[7] + comma + // Effect
fields[8] + string("\n"); // Text
// Do the charset conversion. // Do the charset conversion.
line += fields[8] + "\n";
from_utf8(track->conv_handle, line); from_utf8(track->conv_handle, line);
// Now store that entry. // Now store that entry.

View File

@ -120,13 +120,9 @@ ssa_reader_c::ssa_reader_c(track_info_c *nti)
strip(format); strip(format);
} }
// Now just append the current line and some DOS style newlines.
// But not if we've already encountered the [Events] section.
if (section != 'e') {
global += "\r\n"; global += "\r\n";
global += line; global += line;
} }
}
if (format.size() == 0) if (format.size() == 0)
throw error_c("ssa_reader: Invalid format. Could not find the " throw error_c("ssa_reader: Invalid format. Could not find the "
@ -232,7 +228,7 @@ ssa_reader_c::read(generic_packetizer_c *,
vector<string> fields; vector<string> fields;
ssa_line_c cline; ssa_line_c cline;
num = 1; num = 0;
do { do {
line = mm_io->getline(); line = mm_io->getline();