diff --git a/MediaBrowser.Controller/Dlna/CodecProfile.cs b/MediaBrowser.Controller/Dlna/CodecProfile.cs index f178056543..bff3742988 100644 --- a/MediaBrowser.Controller/Dlna/CodecProfile.cs +++ b/MediaBrowser.Controller/Dlna/CodecProfile.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Controller.Dlna { @@ -6,12 +7,16 @@ namespace MediaBrowser.Controller.Dlna { public CodecType Type { get; set; } public List Conditions { get; set; } - public string[] Codecs { get; set; } + public string Codec { get; set; } public CodecProfile() { Conditions = new List(); - Codecs = new string[] { }; + } + + public List GetCodecs() + { + return (Codec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); } } diff --git a/MediaBrowser.Controller/Dlna/DeviceProfile.cs b/MediaBrowser.Controller/Dlna/DeviceProfile.cs index 179321a534..91be73bba8 100644 --- a/MediaBrowser.Controller/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Controller/Dlna/DeviceProfile.cs @@ -58,6 +58,8 @@ namespace MediaBrowser.Controller.Dlna public MediaProfile[] MediaProfiles { get; set; } public CodecProfile[] CodecProfiles { get; set; } + public int TimelineOffsetSeconds { get; set; } + public DeviceProfile() { DirectPlayProfiles = new DirectPlayProfile[] { }; diff --git a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs index 29665cbec7..53d32a2f8d 100644 --- a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs @@ -1,12 +1,13 @@ using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Controller.Dlna { public class DirectPlayProfile { public string[] Containers { get; set; } - public string[] AudioCodecs { get; set; } - public string[] VideoCodecs { get; set; } + public string AudioCodec { get; set; } + public string VideoCodec { get; set; } public DlnaProfileType Type { get; set; } @@ -16,10 +17,18 @@ namespace MediaBrowser.Controller.Dlna { Conditions = new List(); - AudioCodecs = new string[] { }; - VideoCodecs = new string[] { }; Containers = new string[] { }; } + + public List GetAudioCodecs() + { + return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + + public List GetVideoCodecs() + { + return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } } public enum DlnaProfileType diff --git a/MediaBrowser.Controller/Dlna/MediaProfile.cs b/MediaBrowser.Controller/Dlna/MediaProfile.cs index c237b1f912..5fa41b18aa 100644 --- a/MediaBrowser.Controller/Dlna/MediaProfile.cs +++ b/MediaBrowser.Controller/Dlna/MediaProfile.cs @@ -1,20 +1,26 @@ - +using System.Collections.Generic; +using System.Linq; + namespace MediaBrowser.Controller.Dlna { public class MediaProfile { public string Container { get; set; } - public string[] AudioCodecs { get; set; } - public string[] VideoCodecs { get; set; } - + public string AudioCodec { get; set; } + public string VideoCodec { get; set; } + public DlnaProfileType Type { get; set; } public string OrgPn { get; set; } public string MimeType { get; set; } - public MediaProfile() + public List GetAudioCodecs() { - AudioCodecs = new string[] { }; - VideoCodecs = new string[] { }; + return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + + public List GetVideoCodecs() + { + return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); } } } diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index fd74ba24a2..be7295e12f 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -625,6 +625,8 @@ namespace MediaBrowser.Dlna Name = "WDTV Live", ClientType = "DLNA", + TimelineOffsetSeconds = 5, + Identification = new DeviceIdentification { ModelName = "WD TV HD Live", @@ -650,6 +652,11 @@ namespace MediaBrowser.Dlna Type = DlnaProfileType.Video, VideoCodec = "h264", AudioCodec = "aac" + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo } }, @@ -657,20 +664,101 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3", "flac", "m4a", "wma", "aac"}, + Containers = new[]{"avi"}, + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", + AudioCodec = "ac3,dca,mp2,mp3,pcm" + }, + + new DirectPlayProfile + { + Containers = new[]{"mpeg"}, + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video", + AudioCodec = "ac3,dca,mp2,mp3,pcm" + }, + + new DirectPlayProfile + { + Containers = new[]{"mkv"}, + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", + AudioCodec = "ac3,dca,aac,mp2,mp3,pcm" + }, + + new DirectPlayProfile + { + Containers = new[]{"ts"}, + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video,h264,vc1", + AudioCodec = "ac3,dca,mp2,mp3" + }, + + new DirectPlayProfile + { + Containers = new[]{"mp4", "mov"}, + Type = DlnaProfileType.Video, + VideoCodec = "h264,mpeg4", + AudioCodec = "ac3,aac,mp2,mp3" + }, + + new DirectPlayProfile + { + Containers = new[]{"asf"}, + Type = DlnaProfileType.Video, + VideoCodec = "vc1", + AudioCodec = "wmav2,wmapro" + }, + + new DirectPlayProfile + { + Containers = new[]{"asf"}, + Type = DlnaProfileType.Video, + VideoCodec = "mpeg2video", + AudioCodec = "mp2,ac3" + }, + + new DirectPlayProfile + { + Containers = new[]{"mp3"}, + AudioCodec = "mp2,mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi", "mp4", "mkv", "ts"}, - Type = DlnaProfileType.Video + Containers = new[]{"mp4"}, + AudioCodec = "mp4", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Containers = new[]{"flac"}, + AudioCodec = "flac", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Containers = new[]{"asf"}, + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Containers = new[]{"ogg"}, + AudioCodec = "vorbis", + Type = DlnaProfileType.Audio }, new DirectPlayProfile { Type = DlnaProfileType.Photo, + Containers = new[]{"jpeg", "png", "gif", "bmp", "tiff"}, + Conditions = new List { new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1920"}, @@ -694,7 +782,7 @@ namespace MediaBrowser.Dlna new CodecProfile { Type = CodecType.VideoCodec, - Codecs = new[]{"h264"}, + Codec= "h264", Conditions = new List { @@ -706,8 +794,8 @@ namespace MediaBrowser.Dlna new CodecProfile { - Type = CodecType.VideoAudioCodec, - Codecs = new[]{"aac"}, + Type = CodecType.VideoAudioCodec, + Codec= "aac", Conditions = new List { diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs index 968f7643a5..6817c4eaa0 100644 --- a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs +++ b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs @@ -233,20 +233,22 @@ namespace MediaBrowser.Dlna.PlayTo } // Check video codec - if (profile.VideoCodecs.Length > 0) + var videoCodecs = profile.GetVideoCodecs(); + if (videoCodecs.Count > 0) { var videoCodec = videoStream == null ? null : videoStream.Codec; - if (string.IsNullOrWhiteSpace(videoCodec) || !profile.VideoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase)) + if (string.IsNullOrWhiteSpace(videoCodec) || !videoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase)) { return false; } } - if (profile.AudioCodecs.Length > 0) + var audioCodecs = profile.GetAudioCodecs(); + if (audioCodecs.Count > 0) { // Check audio codecs var audioCodec = audioStream == null ? null : audioStream.Codec; - if (string.IsNullOrWhiteSpace(audioCodec) || !profile.AudioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase)) + if (string.IsNullOrWhiteSpace(audioCodec) || !audioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase)) { return false; }