internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet <int> processed) { base.SetXML(xml, host, processed); xml.AppendChild(ContainerProfile.GetXML(xml.OwnerDocument, "ContainerProfile", this, processed)); xml.AppendChild(Operator.GetXML(xml.OwnerDocument, "Operator", this, processed)); setAttribute(xml, "Label", Label); }
public void Add(IContainerProfile p) { var profile = new ContainerProfile { ContainerProfileName = p.ContainerProfileName, Repository = p.Repository, Folder = p.Folder, SitecoreAdminPassword = p.SitecoreAdminPassword, SaPassword = p.SaPassword, InitializeScript = p.InitializeScript, Notes = p.Notes }; _profiles = _profiles.Append(profile); }
private StreamInfo?BuildVideoItemSimpleTest(VideoOptions options, PlayMethod?playMethod, TranscodeReason why, string transcodeMode, string transcodeProtocol) { if (string.IsNullOrEmpty(transcodeProtocol)) { transcodeProtocol = playMethod == PlayMethod.DirectStream ? "http" : "HLS.ts"; } var builder = GetStreamBuilder(); var val = builder.BuildVideoItem(options); Assert.NotNull(val); if (playMethod != null) { Assert.Equal(playMethod, val.PlayMethod); } Assert.Equal(why, val.TranscodeReasons); var audioStreamIndexInput = options.AudioStreamIndex; var targetVideoStream = val.TargetVideoStream; var targetAudioStream = val.TargetAudioStream; var mediaSource = options.MediaSources.First(source => source.Id == val.MediaSourceId); Assert.NotNull(mediaSource); var videoStreams = mediaSource.MediaStreams.Where(stream => stream.Type == MediaStreamType.Video); var audioStreams = mediaSource.MediaStreams.Where(stream => stream.Type == MediaStreamType.Audio); // TODO: Check AudioStreamIndex vs options.AudioStreamIndex var inputAudioStream = mediaSource.GetDefaultAudioStream(audioStreamIndexInput ?? mediaSource.DefaultAudioStreamIndex); var uri = ParseUri(val); if (playMethod == PlayMethod.DirectPlay) { // Check expected container var containers = ContainerProfile.SplitValue(mediaSource.Container); // TODO: Test transcode too // Assert.Contains(uri.Extension, containers); // Check expected video codec (1) Assert.Contains(targetVideoStream.Codec, val.TargetVideoCodec); Assert.Single(val.TargetVideoCodec); // Check expected audio codecs (1) Assert.Contains(targetAudioStream.Codec, val.TargetAudioCodec); Assert.Single(val.TargetAudioCodec); // Assert.Single(val.AudioCodecs); if (transcodeMode == "DirectStream") { Assert.Equal(val.Container, uri.Extension); } } else if (playMethod == PlayMethod.DirectStream || playMethod == PlayMethod.Transcode) { Assert.NotNull(val.Container); Assert.NotEmpty(val.VideoCodecs); Assert.NotEmpty(val.AudioCodecs); // Check expected container (todo: this could be a test param) if (transcodeProtocol == "http") { // Assert.Equal("webm", val.Container); Assert.Equal(val.Container, uri.Extension); Assert.Equal("stream", uri.Filename); Assert.Equal("http", val.SubProtocol); } else if (transcodeProtocol == "HLS.mp4") { Assert.Equal("mp4", val.Container); Assert.Equal("m3u8", uri.Extension); Assert.Equal("master", uri.Filename); Assert.Equal("hls", val.SubProtocol); } else { Assert.Equal("ts", val.Container); Assert.Equal("m3u8", uri.Extension); Assert.Equal("master", uri.Filename); Assert.Equal("hls", val.SubProtocol); } // Full transcode if (transcodeMode == "Transcode") { if ((val.TranscodeReasons & (StreamBuilder.ContainerReasons | TranscodeReason.DirectPlayError)) == 0) { Assert.All( videoStreams, stream => Assert.DoesNotContain(stream.Codec, val.VideoCodecs)); } // TODO: Fill out tests here } // DirectStream and Remux else { // Check expected video codec (1) Assert.Contains(targetVideoStream.Codec, val.TargetVideoCodec); Assert.Single(val.TargetVideoCodec); if (transcodeMode == "DirectStream") { // Check expected audio codecs (1) if (!targetAudioStream.IsExternal) { if (val.TranscodeReasons.HasFlag(TranscodeReason.ContainerNotSupported)) { Assert.Contains(targetAudioStream.Codec, val.AudioCodecs); } else { Assert.DoesNotContain(targetAudioStream.Codec, val.AudioCodecs); } } } else if (transcodeMode == "Remux") { // Check expected audio codecs (1) Assert.Contains(targetAudioStream.Codec, val.AudioCodecs); Assert.Single(val.AudioCodecs); } // Video details var videoStream = targetVideoStream; Assert.False(val.EstimateContentLength); Assert.Equal(TranscodeSeekInfo.Auto, val.TranscodeSeekInfo); Assert.Contains(videoStream.Profile?.ToLowerInvariant() ?? string.Empty, val.TargetVideoProfile?.Split(",").Select(s => s.ToLowerInvariant()) ?? Array.Empty <string>()); Assert.Equal(videoStream.Level, val.TargetVideoLevel); Assert.Equal(videoStream.BitDepth, val.TargetVideoBitDepth); Assert.InRange(val.VideoBitrate.GetValueOrDefault(), videoStream.BitRate.GetValueOrDefault(), int.MaxValue); // Audio codec not supported if ((why & TranscodeReason.AudioCodecNotSupported) != 0) { // Audio stream specified if (options.AudioStreamIndex >= 0) { // TODO:fixme if (!targetAudioStream.IsExternal) { Assert.DoesNotContain(targetAudioStream.Codec, val.AudioCodecs); } } // Audio stream not specified else { // TODO: Fixme Assert.All(audioStreams, stream => { if (!stream.IsExternal) { Assert.DoesNotContain(stream.Codec, val.AudioCodecs); } }); } } } } else if (playMethod == null) { Assert.Null(val.SubProtocol); Assert.Equal("stream", uri.Filename); Assert.False(val.EstimateContentLength); Assert.Equal(TranscodeSeekInfo.Auto, val.TranscodeSeekInfo); } return(val); }
public VlcProfile() { Name = "Vlc"; TimelineOffsetSeconds = 5; Identification = new DeviceIdentification { ModelName = "Vlc", Headers = new[] { new HttpHeaderInfo { Name = "User-Agent", Value = "vlc", Match = HeaderMatchType.Substring } } }; TranscodingProfiles = new[] { new TranscodingProfile { Container = "mp3", Type = DlnaProfileType.Audio, AudioCodec = "mp3" }, new TranscodingProfile { Container = "ts", Type = DlnaProfileType.Video, VideoCodec = "h264", AudioCodec = "aac" }, new TranscodingProfile { Container = "jpeg", Type = DlnaProfileType.Photo } }; DirectPlayProfiles = new[] { new DirectPlayProfile { Container = "avi,mpeg,mkv,ts,mp4,mov,m4v,asf,webm,ogg,ogv,iso", Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "mp3,flac,asf,off,oga,aac", Type = DlnaProfileType.Audio }, new DirectPlayProfile { Type = DlnaProfileType.Photo, Container = "jpeg,png,gif,bmp,tiff" } }; ResponseProfiles = new ResponseProfile[] { }; ContainerProfiles = new ContainerProfile[] { }; CodecProfiles = new CodecProfile[] { }; }
public CloudSyncProfile(bool supportsAc3, bool supportsDca) { Name = "Cloud Sync"; MaxStreamingBitrate = 20000000; MaxStaticBitrate = 20000000; var mkvAudio = "aac,mp3"; var mp4Audio = "aac"; if (supportsAc3) { mkvAudio += ",ac3"; mp4Audio += ",ac3"; } if (supportsDca) { mkvAudio += ",dca"; } DirectPlayProfiles = new[] { new DirectPlayProfile { Container = "mkv", VideoCodec = "h264,mpeg4", AudioCodec = mkvAudio, Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "mp4,mov,m4v", VideoCodec = "h264,mpeg4", AudioCodec = mp4Audio, Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "mp3", Type = DlnaProfileType.Audio } }; ContainerProfiles = new ContainerProfile[] { }; CodecProfiles = new[] { new CodecProfile { Type = CodecType.Video, Conditions = new [] { new ProfileCondition { Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.VideoBitDepth, Value = "8", IsRequired = false }, new ProfileCondition { Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080", IsRequired = false }, new ProfileCondition { Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.RefFrames, Value = "12", IsRequired = false } } } }; SubtitleProfiles = new[] { new SubtitleProfile { Format = "srt", Method = SubtitleDeliveryMethod.External } }; TranscodingProfiles = new[] { new TranscodingProfile { Container = "mp3", AudioCodec = "mp3", Type = DlnaProfileType.Audio, Context = EncodingContext.Static }, new TranscodingProfile { Container = "mp4", Type = DlnaProfileType.Video, AudioCodec = "aac", VideoCodec = "h264", Context = EncodingContext.Static }, new TranscodingProfile { Container = "jpeg", Type = DlnaProfileType.Photo, Context = EncodingContext.Static } }; }
public BubbleUpnpProfile() { Name = "BubbleUPnp"; Identification = new DeviceIdentification { ModelName = "BubbleUPnp", Headers = new[] { new HttpHeaderInfo { Name = "User-Agent", Value = "BubbleUPnp", Match = HeaderMatchType.Substring } } }; TranscodingProfiles = new[] { new TranscodingProfile { Container = "mp3", AudioCodec = "mp3", Type = DlnaProfileType.Audio }, new TranscodingProfile { Container = "ts", Type = DlnaProfileType.Video, AudioCodec = "aac", VideoCodec = "h264" }, new TranscodingProfile { Container = "jpeg", Type = DlnaProfileType.Photo } }; DirectPlayProfiles = new[] { new DirectPlayProfile { Container = "", Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "", Type = DlnaProfileType.Audio }, new DirectPlayProfile { Container = "", Type = DlnaProfileType.Photo, } }; ResponseProfiles = new ResponseProfile[] { }; ContainerProfiles = new ContainerProfile[] { }; CodecProfiles = new CodecProfile[] { }; SubtitleProfiles = new[] { new SubtitleProfile { Format = "srt", Method = SubtitleDeliveryMethod.External, }, new SubtitleProfile { Format = "sub", Method = SubtitleDeliveryMethod.External, }, new SubtitleProfile { Format = "srt", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "ass", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "ssa", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "smi", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "dvdsub", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "pgs", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "pgssub", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", }, new SubtitleProfile { Format = "sub", Method = SubtitleDeliveryMethod.Embed, DidlMode = "", } }; }
public KodiProfile() { Name = "Kodi"; MaxStreamingBitrate = 100000000; MaxStaticBitrate = 100000000; MusicStreamingTranscodingBitrate = 1280000; MusicSyncBitrate = 1280000; TimelineOffsetSeconds = 5; Identification = new DeviceIdentification { ModelName = "Kodi", Headers = new[] { new HttpHeaderInfo { Name = "User-Agent", Value = "Kodi", Match = HeaderMatchType.Substring } } }; TranscodingProfiles = new[] { new TranscodingProfile { Container = "mp3", AudioCodec = "mp3", Type = DlnaProfileType.Audio }, new TranscodingProfile { Container = "ts", Type = DlnaProfileType.Video, AudioCodec = "aac", VideoCodec = "h264" }, new TranscodingProfile { Container = "jpeg", Type = DlnaProfileType.Photo } }; DirectPlayProfiles = new[] { new DirectPlayProfile { Container = "", Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "", Type = DlnaProfileType.Audio }, new DirectPlayProfile { Container = "", Type = DlnaProfileType.Photo, } }; ResponseProfiles = new ResponseProfile[] { }; ContainerProfiles = new ContainerProfile[] { }; CodecProfiles = new CodecProfile[] { }; SubtitleProfiles = new[] { new SubtitleProfile { Format = "srt", Method = SubtitleDeliveryMethod.External, }, new SubtitleProfile { Format = "sub", Method = SubtitleDeliveryMethod.External, } }; }