diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-08-15 17:59:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-15 17:59:28 -0400 |
| commit | 02a4b90f65bdee74e65cd0549e4ad691c8e1eea8 (patch) | |
| tree | 7b7e42a40f4289845804b3036a5454499e175655 /MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs | |
| parent | 6186e3a4ff6614552e008d93add8fdcd744ae018 (diff) | |
| parent | 7d16988b1b81cc73608c07d61eabb83f8fcbbb05 (diff) | |
Merge pull request #2025 from softworkz/AsyncStreamInterface
Async stream handling: Use interface instead of Func<Stream,Task>
Diffstat (limited to 'MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index 63d71b85e..8c4e23a39 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -4,28 +4,45 @@ using System.IO; using System.Threading; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Controller.Net; +using System.Collections.Generic; +using ServiceStack.Web; namespace MediaBrowser.Api.Playback.Progressive { - public class ProgressiveFileCopier + public class ProgressiveFileCopier : IAsyncStreamSource, IHasOptions { private readonly IFileSystem _fileSystem; private readonly TranscodingJob _job; private readonly ILogger _logger; + private readonly string _path; + private readonly CancellationToken _cancellationToken; + private readonly Dictionary<string, string> _outputHeaders; // 256k private const int BufferSize = 81920; private long _bytesWritten = 0; - public ProgressiveFileCopier(IFileSystem fileSystem, TranscodingJob job, ILogger logger) + public ProgressiveFileCopier(IFileSystem fileSystem, string path, Dictionary<string, string> outputHeaders, TranscodingJob job, ILogger logger, CancellationToken cancellationToken) { _fileSystem = fileSystem; + _path = path; + _outputHeaders = outputHeaders; _job = job; _logger = logger; + _cancellationToken = cancellationToken; } - public async Task StreamFile(string path, Stream outputStream, CancellationToken cancellationToken) + public IDictionary<string, string> Options + { + get + { + return _outputHeaders; + } + } + + public async Task WriteToAsync(Stream outputStream) { try { |
