private MediaSourceInfo BuildMediaSourceInfo(MediaIdentifier source, int width, int height, out TimeSpan RunTimeTicks) { var res = new ChannelMediaInfo { Protocol = MediaProtocol.Http, Path = source.mediaUrl, Width = width, Height = height, Container = Container.MP4, SupportsDirectPlay = true, RunTimeTicks = TimeSpan.TryParse(source.runningTime, out RunTimeTicks) ? RunTimeTicks.Ticks : 0 }; return(res.ToMediaSource()); }
private IEnumerable <MediaStream> GetMediaStreams(ChannelMediaInfo info) { var list = new List <MediaStream>(); if (!string.IsNullOrWhiteSpace(info.VideoCodec)) { 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 }); } if (!string.IsNullOrWhiteSpace(info.AudioCodec)) { list.Add(new MediaStream { Type = MediaStreamType.Audio, Index = -1, Codec = info.AudioCodec, BitRate = info.AudioBitrate, Channels = info.AudioChannels, SampleRate = info.AudioSampleRate }); } return(list); }