diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-10-15 00:11:40 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-10-15 00:11:40 -0400 |
| commit | b7ed4df4fa11e691dc91892c274aaeb0960fe0bc (patch) | |
| tree | c031639e4940fe6a738601d7835fe75e2e318a00 /MediaBrowser.Api/Playback/BaseStreamingService.cs | |
| parent | bd1bd5e87e1744b363279577a6550afc5f2229c1 (diff) | |
update live tv return object
Diffstat (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index c188376fe..919e51ecc 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -859,19 +859,12 @@ namespace MediaBrowser.Api.Playback state.LiveTvStreamId = streamInfo.Id; - if (!string.IsNullOrEmpty(streamInfo.Path)) - { - state.MediaPath = streamInfo.Path; - } - else if (!string.IsNullOrEmpty(streamInfo.Url)) - { - state.MediaPath = streamInfo.Url; - } + state.MediaPath = streamInfo.Path; + state.InputProtocol = streamInfo.Protocol; await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false); - - state.InputProtocol = GetProtocol(state.MediaPath); - AttachMediaStreamInfo(state, streamInfo.MediaStreams, state.VideoRequest, state.RequestedUrl); + + AttachMediaStreamInfo(state, streamInfo, state.VideoRequest, state.RequestedUrl); checkCodecs = true; } @@ -882,19 +875,12 @@ namespace MediaBrowser.Api.Playback state.LiveTvStreamId = streamInfo.Id; - if (!string.IsNullOrEmpty(streamInfo.Path)) - { - state.MediaPath = streamInfo.Path; - } - else if (!string.IsNullOrEmpty(streamInfo.Url)) - { - state.MediaPath = streamInfo.Url; - } + state.MediaPath = streamInfo.Path; + state.InputProtocol = streamInfo.Protocol; await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false); - state.InputProtocol = GetProtocol(state.MediaPath); - AttachMediaStreamInfo(state, streamInfo.MediaStreams, state.VideoRequest, state.RequestedUrl); + AttachMediaStreamInfo(state, streamInfo, state.VideoRequest, state.RequestedUrl); checkCodecs = true; } @@ -1006,7 +992,7 @@ namespace MediaBrowser.Api.Playback await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false); } - if (state.IsInputVideo && transcodingJob.Type == Api.TranscodingJobType.Progressive) + if (state.IsInputVideo && transcodingJob.Type == TranscodingJobType.Progressive) { await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false); @@ -1713,6 +1699,23 @@ namespace MediaBrowser.Api.Playback } private void AttachMediaStreamInfo(StreamState state, + ChannelMediaInfo mediaInfo, + VideoStreamRequest videoRequest, + string requestedUrl) + { + var mediaSource = mediaInfo.ToMediaSource(); + + state.InputProtocol = mediaSource.Protocol; + state.MediaPath = mediaSource.Path; + state.RunTimeTicks = mediaSource.RunTimeTicks; + state.RemoteHttpHeaders = mediaSource.RequiredHttpHeaders; + state.InputBitrate = mediaSource.Bitrate; + state.InputFileSize = mediaSource.Size; + + AttachMediaStreamInfo(state, mediaSource.MediaStreams, videoRequest, requestedUrl); + } + + private void AttachMediaStreamInfo(StreamState state, List<MediaStream> mediaStreams, VideoStreamRequest videoRequest, string requestedUrl) |
