From e0c60dc29ade31bb29501562126d3cc55c8eb881 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 23 Mar 2014 02:07:43 -0400 Subject: [PATCH] update panasonic profile --- MediaBrowser.Controller/Dlna/CodecProfile.cs | 1 + .../Dlna/DirectPlayProfile.cs | 7 +- MediaBrowser.Dlna/DlnaManager.cs | 244 ++++++++++-------- MediaBrowser.Dlna/PlayTo/PlayToManager.cs | 10 +- .../PlayTo/PlaylistItemFactory.cs | 12 +- 5 files changed, 158 insertions(+), 116 deletions(-) diff --git a/MediaBrowser.Controller/Dlna/CodecProfile.cs b/MediaBrowser.Controller/Dlna/CodecProfile.cs index a4592e654a..0d66d90ae8 100644 --- a/MediaBrowser.Controller/Dlna/CodecProfile.cs +++ b/MediaBrowser.Controller/Dlna/CodecProfile.cs @@ -57,6 +57,7 @@ namespace MediaBrowser.Controller.Dlna Width, Height, Has64BitOffsets, + VideoBitDepth, VideoBitrate, VideoFramerate, VideoLevel, diff --git a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs index 53d32a2f8d..56dd15ca32 100644 --- a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs @@ -5,7 +5,7 @@ namespace MediaBrowser.Controller.Dlna { public class DirectPlayProfile { - public string[] Containers { get; set; } + public string Container { get; set; } public string AudioCodec { get; set; } public string VideoCodec { get; set; } @@ -16,8 +16,11 @@ namespace MediaBrowser.Controller.Dlna public DirectPlayProfile() { Conditions = new List(); + } - Containers = new string[] { }; + public List GetContainers() + { + return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); } public List GetAudioCodecs() diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index ec2a09c52e..7c3123b781 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -56,22 +56,22 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", Type = DlnaProfileType.Audio, }, new DirectPlayProfile { - Containers = new[]{"mkv"}, + Container = "mkv", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"mp4"}, + Container = "mp4", Type = DlnaProfileType.Video } }, @@ -123,22 +123,22 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"mkv"}, + Container = "mkv", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"mp4"}, + Container = "mp4", Type = DlnaProfileType.Video } }, @@ -190,22 +190,22 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"mkv"}, + Container = "mkv", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"mp4"}, + Container = "mp4", Type = DlnaProfileType.Video } }, @@ -290,21 +290,21 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", VideoCodec = "mpeg4", AudioCodec = "ac3,mp3", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", VideoCodec = "h264", AudioCodec = "aac", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"mp4", "mov"}, + Container = "mp4,mov", VideoCodec = "h264,mpeg4", AudioCodec = "aac,ac3", Type = DlnaProfileType.Video, @@ -316,26 +316,26 @@ namespace MediaBrowser.Dlna }, new DirectPlayProfile { - Containers = new[]{"asf"}, + Container = "asf", VideoCodec = "wmv2,wmv3,vc1", AudioCodec = "wmav2,wmapro", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"asf"}, + Container = "asf", AudioCodec = "wmav2,wmapro,wmavoice", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", AudioCodec = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"jpeg"}, + Container = "jpeg", Type = DlnaProfileType.Photo, Conditions = new List @@ -449,12 +449,12 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video } }, @@ -498,17 +498,17 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"asf"}, + Container = "asf", Type = DlnaProfileType.Audio } }, @@ -559,22 +559,22 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"wma"}, + Container = "wma", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"mp4"}, + Container = "mp4", Type = DlnaProfileType.Video } }, @@ -613,27 +613,41 @@ namespace MediaBrowser.Dlna list.Add(new DeviceProfile { - //Panasonic Viera (2011|2012) Without AVI Support - Name = "Panasonic Viera E/S/ST/VT (2011)", + Name = "Panasonic Viera", ClientType = "DLNA", Identification = new DeviceIdentification { - FriendlyName = @"(VIERA (E|S)T?(3|5)0?.*)|(VIERA VT30.*)", - Manufacturer = "Panasonic" + FriendlyName = @"VIERA", + Manufacturer = "Panasonic", + + Headers = new List + { + new HttpHeaderInfo{ Name= "User-Agent", Value = "Panasonic MIL DLNA", Match = HeaderMatchType.Substring} + } }, + TimelineOffsetSeconds = 10, + TranscodingProfiles = new[] { new TranscodingProfile { Container = "mp3", + AudioCodec = "mp3", Type = DlnaProfileType.Audio }, new TranscodingProfile { Container = "ts", + AudioCodec = "ac3", + VideoCodec = "h264", Type = DlnaProfileType.Video + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo } }, @@ -641,69 +655,97 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3"}, - Type = DlnaProfileType.Audio + Container = "mpeg", + VideoCodec = "mpeg2video,mpeg4", + AudioCodec = "ac3,mp3", + Type = DlnaProfileType.Video }, + new DirectPlayProfile { - Containers = new[]{"mkv"}, + Container = "mkv", + VideoCodec = "h264", + AudioCodec = "aac,ac3,mp3,pcm", Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - //Panasonic Viera (2011|2012) With AVI Support - Name = "Panasonic Viera G/GT/DT/UT/VT (2011/2012)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = @"(VIERA (G|D|U)T?(3|5)0?.*)|(VIERA VT50.*)", - Manufacturer = "Panasonic" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio }, - new TranscodingProfile + + new DirectPlayProfile { Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Containers = new[]{"mp3"}, - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Containers = new[]{"mkv"}, + VideoCodec = "h264", + AudioCodec = "aac,mp3", Type = DlnaProfileType.Video }, - new DirectPlayProfile + + new DirectPlayProfile { - Containers = new[]{"avi"}, - Type = DlnaProfileType.Video + Container = "mp4", + VideoCodec = "h264", + AudioCodec = "aac,ac3,mp3,pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mov", + VideoCodec = "h264", + AudioCodec = "aac,pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "mpeg4", + AudioCodec = "pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "flv", + VideoCodec = "h264", + AudioCodec = "aac", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "mp4", + AudioCodec = "aac", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo, + + Conditions = new List + { + new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1920"}, + new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080"} + } } }, - MediaProfiles = new[] + CodecProfiles = new [] { - new MediaProfile + new CodecProfile { - Container ="avi", - MimeType = "video/divx", - Type = DlnaProfileType.Video + Conditions = new List + { + new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1920"}, + new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080"}, + new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.VideoBitDepth, Value = "8", IsRequired = false} + } } } }); @@ -723,19 +765,19 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3", "wma"}, + Container = "mp3,wma", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video }, new DirectPlayProfile { - Containers = new[]{"mkv"}, + Container = "mkv", Type = DlnaProfileType.Video } }, @@ -808,7 +850,7 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"avi"}, + Container = "avi", Type = DlnaProfileType.Video, VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", AudioCodec = "ac3,dca,mp2,mp3,pcm" @@ -816,7 +858,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"mpeg"}, + Container = "mpeg", Type = DlnaProfileType.Video, VideoCodec = "mpeg1video,mpeg2video", AudioCodec = "ac3,dca,mp2,mp3,pcm" @@ -824,7 +866,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"mkv"}, + Container = "mkv", Type = DlnaProfileType.Video, VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", AudioCodec = "ac3,dca,aac,mp2,mp3,pcm" @@ -832,7 +874,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"ts"}, + Container = "ts", Type = DlnaProfileType.Video, VideoCodec = "mpeg1video,mpeg2video,h264,vc1", AudioCodec = "ac3,dca,mp2,mp3" @@ -840,7 +882,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"mp4", "mov"}, + Container = "mp4,mov", Type = DlnaProfileType.Video, VideoCodec = "h264,mpeg4", AudioCodec = "ac3,aac,mp2,mp3" @@ -848,7 +890,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"asf"}, + Container = "asf", Type = DlnaProfileType.Video, VideoCodec = "vc1", AudioCodec = "wmav2,wmapro" @@ -856,7 +898,7 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"asf"}, + Container = "asf", Type = DlnaProfileType.Video, VideoCodec = "mpeg2video", AudioCodec = "mp2,ac3" @@ -864,35 +906,35 @@ namespace MediaBrowser.Dlna new DirectPlayProfile { - Containers = new[]{"mp3"}, + Container = "mp3", AudioCodec = "mp2,mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"mp4"}, + Container = "mp4", AudioCodec = "mp4", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"flac"}, + Container = "flac", AudioCodec = "flac", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"asf"}, + Container = "asf", AudioCodec = "wmav2,wmapro,wmavoice", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"ogg"}, + Container = "ogg", AudioCodec = "vorbis", Type = DlnaProfileType.Audio }, @@ -901,7 +943,7 @@ namespace MediaBrowser.Dlna { Type = DlnaProfileType.Photo, - Containers = new[]{"jpeg", "png", "gif", "bmp", "tiff"}, + Container = "jpeg,png,gif,bmp,tiff", Conditions = new List { @@ -964,13 +1006,13 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3", "flac", "m4a", "wma"}, + Container = "mp3,flac,m4a,wma", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi", "mp4", "mkv", "ts"}, + Container = "avi,mp4,mkv,ts", Type = DlnaProfileType.Video } } @@ -991,7 +1033,7 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3", "flac", "m4a", "wma"}, + Container = "mp3,flac,m4a,wma", Type = DlnaProfileType.Audio }, } @@ -1035,13 +1077,13 @@ namespace MediaBrowser.Dlna { new DirectPlayProfile { - Containers = new[]{"mp3", "wma"}, + Container = "mp3,wma", Type = DlnaProfileType.Audio }, new DirectPlayProfile { - Containers = new[]{"avi", "mp4"}, + Container = "avi,mp4", Type = DlnaProfileType.Video } } diff --git a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs index d02da303b6..6279fb1cb6 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs @@ -7,6 +7,7 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Session; using System; using System.Collections.Concurrent; using System.Linq; @@ -16,7 +17,6 @@ using System.Net.Sockets; using System.Text; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.Session; namespace MediaBrowser.Dlna.PlayTo { @@ -54,10 +54,8 @@ namespace MediaBrowser.Dlna.PlayTo _config = config; } - public async void Start() + public void Start() { - _logger.Log(LogSeverity.Info, "PlayTo-Manager starting"); - _locations = new ConcurrentDictionary(); foreach (var network in NetworkInterface.GetAllNetworkInterfaces()) @@ -73,7 +71,7 @@ namespace MediaBrowser.Dlna.PlayTo IPAddress localIp = null; - foreach (UnicastIPAddressInformation ipInfo in network.GetIPProperties().UnicastAddresses) + foreach (var ipInfo in network.GetIPProperties().UnicastAddresses) { if (ipInfo.Address.AddressFamily == AddressFamily.InterNetwork) { @@ -95,8 +93,6 @@ namespace MediaBrowser.Dlna.PlayTo { _logger.ErrorException("Failed to Initilize Socket", e); } - - await Task.Delay(100).ConfigureAwait(false); } } diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs index 8655e58da0..a9a33ee3dc 100644 --- a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs +++ b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs @@ -127,11 +127,11 @@ namespace MediaBrowser.Dlna.PlayTo { var mediaPath = item.Path; - if (profile.Containers.Length > 0) + if (profile.Container.Length > 0) { // Check container type var mediaContainer = Path.GetExtension(mediaPath); - if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase))) + if (!profile.GetContainers().Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase))) { return false; } @@ -150,11 +150,11 @@ namespace MediaBrowser.Dlna.PlayTo { var mediaPath = item.Path; - if (profile.Containers.Length > 0) + if (profile.Container.Length > 0) { // Check container type var mediaContainer = Path.GetExtension(mediaPath); - if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase))) + if (!profile.GetContainers().Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase))) { return false; } @@ -178,11 +178,11 @@ namespace MediaBrowser.Dlna.PlayTo var mediaPath = item.Path; - if (profile.Containers.Length > 0) + if (profile.Container.Length > 0) { // Check container type var mediaContainer = Path.GetExtension(mediaPath); - if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase))) + if (!profile.GetContainers().Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase))) { return false; }