Some ASS files use a column "Actor" instead of "Name". This should be mapped to "Name" in Matroska as well.

This commit is contained in:
Moritz Bunkus 2005-09-09 08:28:22 +00:00
parent 02834b6306
commit feb1a3be54
3 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-09-09 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge, mkvextract: bug fix: ASS files sometimes use a column
called 'Actor' instead of 'Name', but both should be mapped to the
'name' column in a Matroska file.
2005-09-07 Moritz Bunkus <moritz@bunkus.org>
* Released v1.5.6.

View File

@ -235,8 +235,10 @@ xtr_ssa_c::handle_block(KaxBlock &block,
line = "Dialogue: ";
for (i = 0; i < ssa_format.size(); i++) {
string &format = ssa_format[i];
string format = ssa_format[i];
if (downcase(format) == "actor")
format = "name";
if (0 < i)
line += ",";
if (format == "marked")

View File

@ -155,9 +155,9 @@ ssa_reader_c::recode_text(vector<string> &fields) {
void
ssa_reader_c::parse_file(mm_text_io_c *io) {
string line, stime, orig_line, comma;
string line, stime, orig_line, comma, name_field;
string attachment_name, attachment_data_uu;
int num;
int num, i;
int64_t start, end;
vector<string> fields;
ssa_section_e section, previous_section;
@ -168,6 +168,7 @@ ssa_reader_c::parse_file(mm_text_io_c *io) {
section = SSA_SECTION_NONE;
previous_section = SSA_SECTION_NONE;
ti.id = 0; // ID for this track.
name_field = "Name";
while (!io->eof()) {
if (!io->getline2(line))
break;
@ -205,6 +206,13 @@ ssa_reader_c::parse_file(mm_text_io_c *io) {
m_format = split(&line.c_str()[strlen("Format: ")]);
strip(m_format);
// Let's see if "Actor" is used in the format instead of "Name".
for (i = 0; m_format.size() > i; ++i)
if (downcase(m_format[i]) == "actor") {
name_field = "Actor";
break;
}
} else if (starts_with_case(line, "Dialogue: ")) {
if (m_format.size() == 0)
throw error_c("ssa_reader: Invalid format. Could not find the "
@ -245,7 +253,7 @@ ssa_reader_c::parse_file(mm_text_io_c *io) {
comma = ",";
line = to_string(num) + comma + get_element("Layer", fields) + comma +
get_element("Style", fields) + comma +
get_element("Name", fields) + comma +
get_element(name_field.c_str(), fields) + comma +
get_element("MarginL", fields) + comma +
get_element("MarginR", fields) + comma +
get_element("MarginV", fields) + comma +