diff --git a/src/subtitle_format.cpp b/src/subtitle_format.cpp index 8df9bf0ab..c9fb991d5 100644 --- a/src/subtitle_format.cpp +++ b/src/subtitle_format.cpp @@ -86,14 +86,9 @@ bool SubtitleFormat::CanSave(const AssFile *subs) const { if (!subs->Attachments.empty()) return false; - std::string defstyle = AssStyle().GetEntryData(); - for (auto const& line : subs->Styles) { - if (line.GetEntryData() != defstyle) - return false; - } - + auto def = boost::flyweight("Default"); for (auto const& line : subs->Events) { - if (line.GetStrippedText() != line.Text) + if (line.Style != def || line.GetStrippedText() != line.Text) return false; } diff --git a/src/subtitle_format_srt.cpp b/src/subtitle_format_srt.cpp index 398f24243..f08c397ca 100644 --- a/src/subtitle_format_srt.cpp +++ b/src/subtitle_format_srt.cpp @@ -334,9 +334,7 @@ SRTSubtitleFormat::SRTSubtitleFormat() } std::vector SRTSubtitleFormat::GetReadWildcards() const { - std::vector formats; - formats.push_back("srt"); - return formats; + return {"srt"}; } std::vector SRTSubtitleFormat::GetWriteWildcards() const { @@ -494,7 +492,11 @@ bool SRTSubtitleFormat::CanSave(const AssFile *file) const { if (!file->Attachments.empty()) return false; + auto def = boost::flyweight("Default"); for (auto const& line : file->Events) { + if (line.Style != def) + return false; + auto blocks = line.ParseTags(); for (auto ovr : blocks | agi::of_type()) { // Verify that all overrides used are supported