diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2018-12-14 21:28:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-14 21:28:12 -0500 |
| commit | 46c75d75bd8702da4d3728c11f28756a9c9abb72 (patch) | |
| tree | dd6a198e3c104ebc732a615153c4bb5514e25660 /MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs | |
| parent | b36b526f27ebd9ac716d743eea26e65407ceeea4 (diff) | |
| parent | a73d255f51f135adbc2c352fef79f776ce9fcb02 (diff) | |
Merge pull request #166 from jellyfin/develop
Develop
Diffstat (limited to 'MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs new file mode 100644 index 000000000..6bb3b6b80 --- /dev/null +++ b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs @@ -0,0 +1,47 @@ +using MediaBrowser.Common.Net; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Model.Services; + +namespace MediaBrowser.Api.Playback +{ + /// <summary> + /// Class StaticRemoteStreamWriter + /// </summary> + public class StaticRemoteStreamWriter : IAsyncStreamWriter, IHasHeaders + { + /// <summary> + /// The _input stream + /// </summary> + private readonly HttpResponseInfo _response; + + /// <summary> + /// The _options + /// </summary> + private readonly IDictionary<string, string> _options = new Dictionary<string, string>(); + + public StaticRemoteStreamWriter(HttpResponseInfo response) + { + _response = response; + } + + /// <summary> + /// Gets the options. + /// </summary> + /// <value>The options.</value> + public IDictionary<string, string> Headers + { + get { return _options; } + } + + public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken) + { + using (_response) + { + await _response.Content.CopyToAsync(responseStream, 81920, cancellationToken).ConfigureAwait(false); + } + } + } +} |
