From a050b23a26a0bc78f3cffdec8df565a48bb801be Mon Sep 17 00:00:00 2001 From: Nikolai Vavilov Date: Tue, 31 Dec 2024 15:03:53 +0200 Subject: [PATCH] Allow \an in SubRip --- src/subtitle_format_srt.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/subtitle_format_srt.cpp b/src/subtitle_format_srt.cpp index d4529465e0..3632e6dd84 100644 --- a/src/subtitle_format_srt.cpp +++ b/src/subtitle_format_srt.cpp @@ -464,9 +464,9 @@ bool SRTSubtitleFormat::CanSave(const AssFile *file) const { for (auto ovr : blocks | agi::of_type()) { // Verify that all overrides used are supported for (auto const& tag : ovr->Tags) { - if (tag.Name.size() != 2) + if (tag.Name.size() != 2 && tag.Name != "\\an") return false; - if (!strchr("bisu", tag.Name[1])) + if (tag.Name.size() == 2 && !strchr("bisu", tag.Name[1])) return false; } } @@ -489,7 +489,13 @@ std::string SRTSubtitleFormat::ConvertTags(const AssDialogue *diag) const { switch (block->GetType()) { case AssBlockType::OVERRIDE: for (auto const& tag : static_cast(*block).Tags) { - if (!tag.IsValid() || tag.Name.size() != 2) + if (!tag.IsValid()) + continue; + if (tag.Name == "\\an") { + final += agi::format("{%s}", std::string(tag)); + continue; + } + if (tag.Name.size() != 2) continue; for (auto& state : tag_states) { if (state.tag != tag.Name[1]) continue;