diff options
| author | Martin Lambers <marlam@marlam.de> | 2011-04-22 15:50:52 +0200 |
|---|---|---|
| committer | Martin Lambers <marlam@marlam.de> | 2011-04-22 15:50:52 +0200 |
| commit | a8a90d5355e3751a98b053ad2906e1cf72ce437f (patch) | |
| tree | cff8c9158c26b11563da33c026923a777c41f85f | |
| parent | 6e3b65e0c2d5c71325179ee37e7db31fa4ca87a4 (diff) | |
| download | bino-a8a90d5355e3751a98b053ad2906e1cf72ce437f.tar.gz | |
Subtitles: properly handle newlines in text format subtitles.
| -rw-r--r-- | src/subtitle_renderer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/subtitle_renderer.cpp b/src/subtitle_renderer.cpp index 6bbfdf1..d41c7ac 100644 --- a/src/subtitle_renderer.cpp +++ b/src/subtitle_renderer.cpp @@ -360,6 +360,7 @@ void subtitle_renderer::prerender_ass(const subtitle_box &box, int64_t timestamp } else { + // Set a default ASS style for text subtitles std::string style = "[Script Info]\n" "ScriptType: v4.00+\n" @@ -373,8 +374,11 @@ void subtitle_renderer::prerender_ass(const subtitle_box &box, int64_t timestamp "[Events]\n" "Format: Layer, Start, End, Text\n" "\n"; - std::string str = "Dialogue: 0,0:00:00.00,9:59:59.99," + conv_str; ass_process_codec_private(_ass_track, const_cast<char *>(style.c_str()), style.length()); + // Convert text to ASS + str::replace(conv_str, "\r\n", "\\N"); + str::replace(conv_str, "\n", "\\N"); + std::string str = "Dialogue: 0,0:00:00.00,9:59:59.99," + conv_str; ass_process_data(_ass_track, const_cast<char *>(str.c_str()), str.length()); } set_ass_parameters(params); |
