aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-10-15 00:11:40 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-10-15 00:11:40 -0400
commitb7ed4df4fa11e691dc91892c274aaeb0960fe0bc (patch)
treec031639e4940fe6a738601d7835fe75e2e318a00 /MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
parentbd1bd5e87e1744b363279577a6550afc5f2229c1 (diff)
update live tv return object
Diffstat (limited to 'MediaBrowser.Server.Implementations/Channels/ChannelManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Channels/ChannelManager.cs62
1 files changed, 2 insertions, 60 deletions
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<MediaStream> GetMediaStreams(ChannelMediaInfo info)
- {
- var list = new List<MediaStream>();
-
- 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<ChannelMediaInfo> SortMediaInfoResults(IEnumerable<ChannelMediaInfo> channelMediaSources)
{
var list = channelMediaSources.ToList();