diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-22 11:47:44 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-22 11:47:44 -0400 |
| commit | 21d88faa187f89854f2ab5f5146baea70b6bc118 (patch) | |
| tree | 58b85677968f1f5a7f61b00380f072f88ce51958 /MediaBrowser.MediaEncoding/Subtitles/JsonWriter.cs | |
| parent | ca66390e2445c94c769d19d601c88fe2f79f901a (diff) | |
added json subtitle output
Diffstat (limited to 'MediaBrowser.MediaEncoding/Subtitles/JsonWriter.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Subtitles/JsonWriter.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/MediaBrowser.MediaEncoding/Subtitles/JsonWriter.cs b/MediaBrowser.MediaEncoding/Subtitles/JsonWriter.cs new file mode 100644 index 000000000..a4fc5d795 --- /dev/null +++ b/MediaBrowser.MediaEncoding/Subtitles/JsonWriter.cs @@ -0,0 +1,27 @@ +using MediaBrowser.Model.Serialization; +using System.IO; +using System.Text; +using System.Threading; + +namespace MediaBrowser.MediaEncoding.Subtitles +{ + public class JsonWriter : ISubtitleWriter + { + private readonly IJsonSerializer _json; + + public JsonWriter(IJsonSerializer json) + { + _json = json; + } + + public void Write(SubtitleTrackInfo info, Stream stream, CancellationToken cancellationToken) + { + using (var writer = new StreamWriter(stream, Encoding.UTF8, 1024, true)) + { + var json = _json.SerializeToString(info); + + writer.Write(json); + } + } + } +} |
