using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Threading; using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.MediaEncoding.Subtitles { /// /// TTML subtitle writer. /// public partial class TtmlWriter : ISubtitleWriter { [GeneratedRegex(@"\\n", RegexOptions.IgnoreCase)] private static partial Regex NewLineEscapeRegex(); /// public void Write(SubtitleTrackInfo info, Stream stream, CancellationToken cancellationToken) { // Example: https://github.com/zmalltalker/ttml2vtt/blob/master/data/sample.xml // Parser example: https://github.com/mozilla/popcorn-js/blob/master/parsers/parserTTML/popcorn.parserTTML.js using (var writer = new StreamWriter(stream, Encoding.UTF8, 1024, true)) { writer.WriteLine(""); writer.WriteLine(""); writer.WriteLine(""); writer.WriteLine(""); writer.WriteLine("