mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Put <USFSubtitles> ... </USFSubtitles> into CodecPrivate, too. Otherwise the USF version number is lost.
This commit is contained in:
parent
ac9c14b265
commit
1ec08e1c28
@ -345,6 +345,14 @@ xtr_usf_c::create_file(xtr_base_c *_master,
|
||||
|
||||
} else {
|
||||
try {
|
||||
int end_tag_pos;
|
||||
string codec_private_mod, end_tag = "</USFSubtitles>";
|
||||
|
||||
codec_private_mod = m_codec_private;
|
||||
end_tag_pos = codec_private_mod.find(end_tag);
|
||||
if (0 <= end_tag_pos)
|
||||
codec_private_mod.erase(end_tag_pos, end_tag.length());
|
||||
|
||||
out = new mm_file_io_c(file_name, MODE_CREATE);
|
||||
|
||||
m_formatter =
|
||||
@ -352,8 +360,7 @@ xtr_usf_c::create_file(xtr_base_c *_master,
|
||||
m_formatter->set_doctype("USFSubtitles", "USFV100.dtd");
|
||||
m_formatter->set_stylesheet("text/xsl", "USFV100.xsl");
|
||||
m_formatter->write_header();
|
||||
m_formatter->format("<USFSubtitles version=\"1.00\">\n");
|
||||
m_formatter->format(m_codec_private + "\n");
|
||||
m_formatter->format(codec_private_mod + "\n");
|
||||
} catch (mm_io_error_c &error) {
|
||||
mxerror("Failed to create the file '%s': %d (%s)\n", file_name.c_str(),
|
||||
errno, strerror(errno));
|
||||
|
@ -130,6 +130,8 @@ usf_reader_c::usf_reader_c(track_info_c &_ti)
|
||||
}
|
||||
}
|
||||
|
||||
m_private_data += "</USFSubtitles>";
|
||||
|
||||
for (i = 0; m_tracks.size() > i; ++i) {
|
||||
stable_sort(m_tracks[i].m_entries.begin(), m_tracks[i].m_entries.end());
|
||||
m_tracks[i].m_current_entry = m_tracks[i].m_entries.begin();
|
||||
@ -167,10 +169,6 @@ usf_reader_c::start_cb(const char *name,
|
||||
m_previous_start = name;
|
||||
m_parents.push_back(name);
|
||||
|
||||
if (1 >= m_parents.size())
|
||||
// Nothing to do for the root element.
|
||||
return;
|
||||
|
||||
// Generate the full path to this node.
|
||||
for (i = 0; m_parents.size() > i; ++i) {
|
||||
if (!node.empty())
|
||||
@ -203,7 +201,10 @@ usf_reader_c::start_cb(const char *name,
|
||||
return;
|
||||
}
|
||||
|
||||
if (node == "USFSubtitles.subtitles") {
|
||||
if (node == "USFSubtitles")
|
||||
m_private_data += create_xml_node_name(name, atts);
|
||||
|
||||
else if (node == "USFSubtitles.subtitles") {
|
||||
usf_track_t new_track;
|
||||
m_tracks.push_back(new_track);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user