From b7ed4df4fa11e691dc91892c274aaeb0960fe0bc Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 15 Oct 2014 00:11:40 -0400 Subject: update live tv return object --- .../Channels/ChannelManager.cs | 62 +--------------------- 1 file changed, 2 insertions(+), 60 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Channels') diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index b9d218215..f1075f77d 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -359,71 +359,13 @@ namespace MediaBrowser.Server.Implementations.Channels private MediaSourceInfo GetMediaSource(IChannelMediaItem item, ChannelMediaInfo info) { - var id = info.Path.GetMD5().ToString("N"); + var source = info.ToMediaSource(); - var source = new MediaSourceInfo - { - MediaStreams = GetMediaStreams(info).ToList(), - - Container = info.Container, - Protocol = info.Protocol, - Path = info.Path, - RequiredHttpHeaders = info.RequiredHttpHeaders, - RunTimeTicks = item.RunTimeTicks, - Name = id, - Id = id - }; - - var bitrate = (info.AudioBitrate ?? 0) + (info.VideoBitrate ?? 0); - - if (bitrate > 0) - { - source.Bitrate = bitrate; - } - - if (item is ChannelVideoItem && info.Protocol != MediaProtocol.Rtmp) - { - - } + source.RunTimeTicks = source.RunTimeTicks ?? item.RunTimeTicks; return source; } - private IEnumerable GetMediaStreams(ChannelMediaInfo info) - { - var list = new List(); - - if (!string.IsNullOrWhiteSpace(info.VideoCodec) && - !string.IsNullOrWhiteSpace(info.AudioCodec)) - { - list.Add(new MediaStream - { - Type = MediaStreamType.Video, - Width = info.Width, - RealFrameRate = info.Framerate, - Profile = info.VideoProfile, - Level = info.VideoLevel, - Index = -1, - Height = info.Height, - Codec = info.VideoCodec, - BitRate = info.VideoBitrate, - AverageFrameRate = info.Framerate - }); - - list.Add(new MediaStream - { - Type = MediaStreamType.Audio, - Index = -1, - Codec = info.AudioCodec, - BitRate = info.AudioBitrate, - Channels = info.AudioChannels, - SampleRate = info.AudioSampleRate - }); - } - - return list; - } - private IEnumerable SortMediaInfoResults(IEnumerable channelMediaSources) { var list = channelMediaSources.ToList(); -- cgit v1.2.3