From 0ffb2e2efa360e6b03e18cbffbe9b353e30e9e02 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 22 Mar 2014 20:48:34 -0400 Subject: enforce codec profiles --- MediaBrowser.Controller/Dlna/TranscodingProfile.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/Dlna/TranscodingProfile.cs') diff --git a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs index 530a44b8c..1073f74aa 100644 --- a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs @@ -11,6 +11,10 @@ namespace MediaBrowser.Controller.Dlna public string VideoCodec { get; set; } public string AudioCodec { get; set; } + public bool EstimateContentLength { get; set; } + + public TranscodeSeekInfo TranscodeSeekInfo { get; set; } + public List Settings { get; set; } public TranscodingProfile() @@ -27,6 +31,13 @@ namespace MediaBrowser.Controller.Dlna public enum TranscodingSettingType { - Profile + Profile = 0, + MaxAudioChannels = 1 + } + + public enum TranscodeSeekInfo + { + Auto = 0, + Bytes = 1 } } -- cgit v1.2.3 From f3e992b82be4b23e33e6130d1495f2b5203d0576 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 23 Mar 2014 01:10:33 -0400 Subject: support more profile features --- MediaBrowser.Api/Movies/MoviesService.cs | 5 +- MediaBrowser.Api/Playback/BaseStreamingService.cs | 40 +++-- MediaBrowser.Api/Playback/StreamRequest.cs | 5 +- MediaBrowser.Api/Playback/StreamState.cs | 10 -- MediaBrowser.Controller/Dlna/TranscodingProfile.cs | 5 +- MediaBrowser.Dlna/DlnaManager.cs | 26 ++- MediaBrowser.Dlna/PlayTo/DlnaController.cs | 97 +++++++++-- MediaBrowser.Dlna/PlayTo/PlaylistItem.cs | 20 ++- MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs | 64 +------ MediaBrowser.Dlna/PlayTo/StreamHelper.cs | 188 ++++----------------- 10 files changed, 188 insertions(+), 272 deletions(-) (limited to 'MediaBrowser.Controller/Dlna/TranscodingProfile.cs') diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index f9b760869..204a7aab4 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -117,10 +117,9 @@ namespace MediaBrowser.Api.Movies public object Get(GetMovieRecommendations request) { - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = _userManager.GetUserById(request.UserId.Value); - var folder = user.RootFolder; - var movies = folder.RecursiveChildren.OfType().ToList(); + var movies = user.RootFolder.GetRecursiveChildren(user).OfType().ToList(); var result = GetRecommendationCategories(user, movies, request.CategoryLimit, request.ItemLimit, request.GetItemFields().ToList()); diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 1001980ec..9ec28700d 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -745,6 +745,16 @@ namespace MediaBrowser.Api.Playback } } + if (request.MaxAudioChannels.HasValue) + { + if (audioStream != null && audioStream.Channels.HasValue) + { + return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value); + } + + return request.MaxAudioChannels.Value; + } + return request.AudioChannels; } @@ -1205,73 +1215,73 @@ namespace MediaBrowser.Api.Playback } else if (i == 1) { - request.Static = string.Equals("true", val, StringComparison.OrdinalIgnoreCase); + request.MediaSourceId = val; } else if (i == 2) + { + request.Static = string.Equals("true", val, StringComparison.OrdinalIgnoreCase); + } + else if (i == 3) { if (videoRequest != null) { videoRequest.VideoCodec = (VideoCodecs)Enum.Parse(typeof(VideoCodecs), val, true); } } - else if (i == 3) + else if (i == 4) { request.AudioCodec = (AudioCodecs)Enum.Parse(typeof(AudioCodecs), val, true); } - else if (i == 4) + else if (i == 5) { if (videoRequest != null) { videoRequest.AudioStreamIndex = int.Parse(val, UsCulture); } } - else if (i == 5) + else if (i == 6) { if (videoRequest != null) { videoRequest.SubtitleStreamIndex = int.Parse(val, UsCulture); } } - else if (i == 6) + else if (i == 7) { if (videoRequest != null) { videoRequest.VideoBitRate = int.Parse(val, UsCulture); } } - else if (i == 7) + else if (i == 8) { request.AudioBitRate = int.Parse(val, UsCulture); } - else if (i == 8) + else if (i == 9) { - request.AudioChannels = int.Parse(val, UsCulture); + request.MaxAudioChannels = int.Parse(val, UsCulture); } - else if (i == 9) + else if (i == 10) { if (videoRequest != null) { request.StartTimeTicks = long.Parse(val, UsCulture); } } - else if (i == 10) + else if (i == 11) { if (videoRequest != null) { videoRequest.Profile = val; } } - else if (i == 11) + else if (i == 12) { if (videoRequest != null) { videoRequest.Level = val; } } - else if (i == 12) - { - request.ForcedMimeType = val; - } } } diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs index df52e5e3e..2251ce52d 100644 --- a/MediaBrowser.Api/Playback/StreamRequest.cs +++ b/MediaBrowser.Api/Playback/StreamRequest.cs @@ -49,6 +49,9 @@ namespace MediaBrowser.Api.Playback [ApiMember(Name = "AudioChannels", Description = "Optional. Specify a specific number of audio channels to encode to, e.g. 2", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? AudioChannels { get; set; } + [ApiMember(Name = "MaxAudioChannels", Description = "Optional. Specify a maximum number of audio channels to encode to, e.g. 2", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? MaxAudioChannels { get; set; } + /// /// Gets or sets the audio sample rate. /// @@ -69,8 +72,6 @@ namespace MediaBrowser.Api.Playback public bool ThrowDebugError { get; set; } public string Params { get; set; } - - public string ForcedMimeType { get; set; } } public class VideoStreamRequest : StreamRequest diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 88daf9f62..ecc5c93ef 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -79,16 +79,6 @@ namespace MediaBrowser.Api.Playback public string GetMimeType(string outputPath) { - if (!string.IsNullOrWhiteSpace(Request.ForcedMimeType)) - { - if (VideoRequest == null) - { - return "audio/" + Request.ForcedMimeType; - } - - return "video/" + Request.ForcedMimeType; - } - return MimeTypes.GetMimeType(outputPath); } } diff --git a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs index 1073f74aa..32ffb91cf 100644 --- a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs @@ -31,8 +31,9 @@ namespace MediaBrowser.Controller.Dlna public enum TranscodingSettingType { - Profile = 0, - MaxAudioChannels = 1 + VideoLevel = 0, + VideoProfile = 1, + MaxAudioChannels = 2 } public enum TranscodeSeekInfo diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 24e9d83a0..ec2a09c52 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -274,11 +274,9 @@ namespace MediaBrowser.Dlna Settings = new List { - new TranscodingSetting - { - Name = TranscodingSettingType.MaxAudioChannels, - Value = "6" - } + new TranscodingSetting { Name = TranscodingSettingType.MaxAudioChannels, Value = "6" }, + new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"}, + new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"} } }, new TranscodingProfile @@ -791,7 +789,13 @@ namespace MediaBrowser.Dlna Container = "ts", Type = DlnaProfileType.Video, VideoCodec = "h264", - AudioCodec = "aac" + AudioCodec = "aac", + + Settings = new List + { + new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"}, + new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"} + } }, new TranscodingProfile { @@ -1010,12 +1014,20 @@ namespace MediaBrowser.Dlna new TranscodingProfile { Container = "mp3", + AudioCodec = "mp3", Type = DlnaProfileType.Audio }, new TranscodingProfile { Container = "ts", - Type = DlnaProfileType.Video + Type = DlnaProfileType.Video, + AudioCodec = "aac", + VideoCodec = "h264", + Settings = new List + { + new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"}, + new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"} + } } }, diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index e94663802..4f9c92da5 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -270,7 +270,7 @@ namespace MediaBrowser.Dlna.PlayTo playlistItem.StartPositionTicks = newItem.StartPositionTicks; playlistItem.StreamUrl = newItem.StreamUrl; playlistItem.Didl = newItem.Didl; - return _device.SetAvTransport(playlistItem.StreamUrl, playlistItem.DlnaHeaders, playlistItem.Didl); + return _device.SetAvTransport(playlistItem.StreamUrl, GetDlnaHeaders(playlistItem), playlistItem.Didl); } return _device.Seek(TimeSpan.FromTicks(command.SeekPositionTicks ?? 0)); @@ -391,16 +391,20 @@ namespace MediaBrowser.Dlna.PlayTo private PlaylistItem CreatePlaylistItem(BaseItem item, long startPostionTicks, string serverAddress) { - var streams = _itemRepository.GetMediaStreams(new MediaStreamQuery { ItemId = item.Id }).ToList(); + var streams = _itemRepository.GetMediaStreams(new MediaStreamQuery + { + ItemId = item.Id + + }).ToList(); var deviceInfo = _device.Properties; - var playlistItem = GetPlaylistItem(item, _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification())); + var playlistItem = GetPlaylistItem(item, streams, _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification())); playlistItem.StartPositionTicks = startPostionTicks; if (playlistItem.MediaType == DlnaProfileType.Audio) { - playlistItem.StreamUrl = StreamHelper.GetAudioUrl(playlistItem, serverAddress); + playlistItem.StreamUrl = StreamHelper.GetAudioUrl(deviceInfo, playlistItem, streams, serverAddress); } else { @@ -410,32 +414,92 @@ namespace MediaBrowser.Dlna.PlayTo var didl = DidlBuilder.Build(item, _session.UserId.ToString(), serverAddress, playlistItem.StreamUrl, streams); playlistItem.Didl = didl; - var header = StreamHelper.GetDlnaHeaders(playlistItem); - playlistItem.DlnaHeaders = header; return playlistItem; } - private PlaylistItem GetPlaylistItem(BaseItem item, DeviceProfile profile) + private string GetDlnaHeaders(PlaylistItem item) + { + var orgOp = item.Transcode ? ";DLNA.ORG_OP=00" : ";DLNA.ORG_OP=01"; + + var orgCi = item.Transcode ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; + + const string dlnaflags = ";DLNA.ORG_FLAGS=01500000000000000000000000000000"; + + string contentFeatures; + + var container = item.Container.TrimStart('.'); + + if (string.Equals(container, "mp3", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=MP3"; + } + else if (string.Equals(container, "wma", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=WMABASE"; + } + else if (string.Equals(container, "wmw", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=WMVMED_BASE"; + } + else if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=WMVMED_BASE"; + } + else if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=AVI"; + } + else if (string.Equals(container, "mkv", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=MATROSKA"; + } + else if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=AVC_MP4_MP_HD_720p_AAC"; + } + else if (string.Equals(container, "mpeg", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL"; + } + else if (string.Equals(container, "ts", StringComparison.OrdinalIgnoreCase)) + { + contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL"; + } + else if (item.MediaType == DlnaProfileType.Video) + { + // Default to AVI for video + contentFeatures = "DLNA.ORG_PN=AVI"; + } + else + { + // Default to MP3 for audio + contentFeatures = "DLNA.ORG_PN=MP3"; + } + + return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'); + } + + private PlaylistItem GetPlaylistItem(BaseItem item, List mediaStreams, DeviceProfile profile) { var video = item as Video; if (video != null) { - return new PlaylistItemFactory(_itemRepository).Create(video, profile); + return new PlaylistItemFactory().Create(video, mediaStreams, profile); } var audio = item as Audio; if (audio != null) { - return new PlaylistItemFactory(_itemRepository).Create(audio, profile); + return new PlaylistItemFactory().Create(audio, mediaStreams, profile); } var photo = item as Photo; if (photo != null) { - return new PlaylistItemFactory(_itemRepository).Create(photo, profile); + return new PlaylistItemFactory().Create(photo, profile); } throw new ArgumentException("Unrecognized item type."); @@ -482,11 +546,18 @@ namespace MediaBrowser.Dlna.PlayTo await _device.SetStop(); return true; } + nextTrack.PlayState = 1; - _logger.Debug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", _device.Properties.Name, nextTrack.StreamUrl, nextTrack.DlnaHeaders); - await _device.SetAvTransport(nextTrack.StreamUrl, nextTrack.DlnaHeaders, nextTrack.Didl); + + var dlnaheaders = GetDlnaHeaders(nextTrack); + + _logger.Debug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", _device.Properties.Name, nextTrack.StreamUrl, dlnaheaders); + + await _device.SetAvTransport(nextTrack.StreamUrl, dlnaheaders, nextTrack.Didl); + if (nextTrack.StartPositionTicks > 0 && !nextTrack.Transcode) await _device.Seek(TimeSpan.FromTicks(nextTrack.StartPositionTicks)); + return true; } @@ -508,7 +579,7 @@ namespace MediaBrowser.Dlna.PlayTo return Task.FromResult(false); prevTrack.PlayState = 1; - return _device.SetAvTransport(prevTrack.StreamUrl, prevTrack.DlnaHeaders, prevTrack.Didl); + return _device.SetAvTransport(prevTrack.StreamUrl, GetDlnaHeaders(prevTrack), prevTrack.Didl); } #endregion diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs index 1304f61b1..77b9085f7 100644 --- a/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs +++ b/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Dlna; +using System.Collections.Generic; namespace MediaBrowser.Dlna.PlayTo { @@ -14,16 +15,27 @@ namespace MediaBrowser.Dlna.PlayTo public string Container { get; set; } - public string MimeType { get; set; } - public int PlayState { get; set; } public string StreamUrl { get; set; } - public string DlnaHeaders { get; set; } - public string Didl { get; set; } public long StartPositionTicks { get; set; } + + public string VideoCodec { get; set; } + + public string AudioCodec { get; set; } + + public List TranscodingSettings { get; set; } + + public int? AudioStreamIndex { get; set; } + + public int? SubtitleStreamIndex { get; set; } + + public PlaylistItem() + { + TranscodingSettings = new List(); + } } } \ No newline at end of file diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs index 5da845d06..8655e58da 100644 --- a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs +++ b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs @@ -1,9 +1,9 @@ using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using System; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; @@ -12,15 +12,9 @@ namespace MediaBrowser.Dlna.PlayTo { public class PlaylistItemFactory { - private readonly IItemRepository _itemRepo; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - public PlaylistItemFactory(IItemRepository itemRepo) - { - _itemRepo = itemRepo; - } - - public PlaylistItem Create(Audio item, DeviceProfile profile) + public PlaylistItem Create(Audio item, List mediaStreams, DeviceProfile profile) { var playlistItem = new PlaylistItem { @@ -28,12 +22,6 @@ namespace MediaBrowser.Dlna.PlayTo MediaType = DlnaProfileType.Audio }; - var mediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery - { - ItemId = item.Id, - Type = MediaStreamType.Audio - }); - var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); if (profile.CodecProfiles.Where(i => i.Type == CodecType.AudioCodec) @@ -57,11 +45,9 @@ namespace MediaBrowser.Dlna.PlayTo if (transcodingProfile != null) { playlistItem.Transcode = true; - + playlistItem.TranscodingSettings = transcodingProfile.Settings.ToList(); playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.'); } - - AttachMediaProfile(playlistItem, profile); return playlistItem; } @@ -91,16 +77,14 @@ namespace MediaBrowser.Dlna.PlayTo if (transcodingProfile != null) { playlistItem.Transcode = true; - + playlistItem.TranscodingSettings = transcodingProfile.Settings.ToList(); playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.'); } - - AttachMediaProfile(playlistItem, profile); return playlistItem; } - public PlaylistItem Create(Video item, DeviceProfile profile) + public PlaylistItem Create(Video item, List mediaStreams, DeviceProfile profile) { var playlistItem = new PlaylistItem { @@ -108,12 +92,6 @@ namespace MediaBrowser.Dlna.PlayTo MediaType = DlnaProfileType.Video }; - var mediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery - { - ItemId = item.Id - - }).ToList(); - var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); @@ -138,43 +116,13 @@ namespace MediaBrowser.Dlna.PlayTo if (transcodingProfile != null) { playlistItem.Transcode = true; + playlistItem.TranscodingSettings = transcodingProfile.Settings.ToList(); playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.'); } - AttachMediaProfile(playlistItem, profile); - return playlistItem; } - private void AttachMediaProfile(PlaylistItem item, DeviceProfile profile) - { - var mediaProfile = GetMediaProfile(item, profile); - - if (mediaProfile != null) - { - item.MimeType = (mediaProfile.MimeType ?? string.Empty).Split('/').LastOrDefault(); - - // TODO: Org_pn? - } - } - - private MediaProfile GetMediaProfile(PlaylistItem item, DeviceProfile profile) - { - return profile.MediaProfiles.FirstOrDefault(i => - { - if (i.Type == item.MediaType) - { - if (string.Equals(item.Container.TrimStart('.'), i.Container.TrimStart('.'), StringComparison.OrdinalIgnoreCase)) - { - // TODO: Enforce codecs - return true; - } - } - - return false; - }); - } - private bool IsSupported(DirectPlayProfile profile, Photo item) { var mediaPath = item.Path; diff --git a/MediaBrowser.Dlna/PlayTo/StreamHelper.cs b/MediaBrowser.Dlna/PlayTo/StreamHelper.cs index cb2b72a03..2a8e2d617 100644 --- a/MediaBrowser.Dlna/PlayTo/StreamHelper.cs +++ b/MediaBrowser.Dlna/PlayTo/StreamHelper.cs @@ -1,6 +1,5 @@ -using MediaBrowser.Model.Dto; +using MediaBrowser.Controller.Dlna; using MediaBrowser.Model.Entities; -using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -9,91 +8,21 @@ namespace MediaBrowser.Dlna.PlayTo { class StreamHelper { - /// - /// Gets the dlna headers. - /// - /// The item. - /// - internal static string GetDlnaHeaders(PlaylistItem item) - { - var orgOp = item.Transcode ? ";DLNA.ORG_OP=00" : ";DLNA.ORG_OP=01"; - - var orgCi = item.Transcode ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - - const string dlnaflags = ";DLNA.ORG_FLAGS=01500000000000000000000000000000"; - - var contentFeatures = string.Empty; - - if (string.Equals(item.Container, "mp3", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=MP3"; - } - else if (string.Equals(item.Container, "wma", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=WMABASE"; - } - else if (string.Equals(item.Container, "wmw", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=WMVMED_BASE"; - } - else if (string.Equals(item.Container, "asf", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=WMVMED_BASE"; - } - else if (string.Equals(item.Container, "avi", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=AVI"; - } - else if (string.Equals(item.Container, "mkv", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=MATROSKA"; - } - else if (string.Equals(item.Container, "mp4", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=AVC_MP4_MP_HD_720p_AAC"; - } - else if (string.Equals(item.Container, "mpeg", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL"; - } - else if (string.Equals(item.Container, "ts", StringComparison.OrdinalIgnoreCase)) - { - contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL"; - } - else if (item.MediaType == Controller.Dlna.DlnaProfileType.Video) - { - //Default to AVI for video - contentFeatures = "DLNA.ORG_PN=AVI"; - } - else - { - //Default to MP3 for audio - contentFeatures = "DLNA.ORG_PN=MP3"; - } - - return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'); - } - - #region Audio - /// /// Gets the audio URL. /// + /// The device properties. /// The item. + /// The streams. /// The server address. /// System.String. - internal static string GetAudioUrl(PlaylistItem item, string serverAddress) + internal static string GetAudioUrl(DeviceInfo deviceProperties, PlaylistItem item, List streams, string serverAddress) { - if (!item.Transcode) - return string.Format("{0}/audio/{1}/stream{2}?Static=True", serverAddress, item.ItemId, item.Container); + var dlnaCommand = BuildDlnaUrl(item.MediaSourceId, deviceProperties.UUID, !item.Transcode, null, item.AudioCodec, item.AudioStreamIndex, item.SubtitleStreamIndex, null, 128000, item.StartPositionTicks, item.TranscodingSettings); - return string.Format("{0}/audio/{1}/stream.mp3?AudioCodec=Mp3", serverAddress, item.ItemId); + return string.Format("{0}/audio/{1}/stream{2}?{3}", serverAddress, item.ItemId, "." + item.Container.TrimStart('.'), dlnaCommand); } - #endregion - - #region Video - /// /// Gets the video URL. /// @@ -104,97 +33,40 @@ namespace MediaBrowser.Dlna.PlayTo /// The url to send to the device internal static string GetVideoUrl(DeviceInfo deviceProperties, PlaylistItem item, List streams, string serverAddress) { - string dlnaCommand = string.Empty; - if (!item.Transcode) - { - dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, !item.Transcode, null, null, null, null, null, null, null, null, null, null, item.MimeType); - return string.Format("{0}/Videos/{1}/stream{2}?{3}", serverAddress, item.ItemId, item.Container, dlnaCommand); - } - var videostream = streams.Where(m => m.Type == MediaStreamType.Video).OrderBy(m => m.IsDefault).FirstOrDefault(); - var audiostream = streams.Where(m => m.Type == MediaStreamType.Audio).OrderBy(m => m.IsDefault).FirstOrDefault(); - - var videoCodec = GetVideoCodec(videostream); - var audioCodec = GetAudioCodec(audiostream); - int? videoBitrate = null; - int? audioBitrate = null; - int? audioChannels = null; - - if (videoCodec != VideoCodecs.Copy) - videoBitrate = 2000000; + var dlnaCommand = BuildDlnaUrl(item.MediaSourceId, deviceProperties.UUID, !item.Transcode, item.VideoCodec, item.AudioCodec, item.AudioStreamIndex, item.SubtitleStreamIndex, 1500000, 128000, item.StartPositionTicks, item.TranscodingSettings); - if (audioCodec != AudioCodecs.Copy) - { - audioBitrate = 128000; - audioChannels = 2; - } - - dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, !item.Transcode, videoCodec, audioCodec, null, null, videoBitrate, audioChannels, audioBitrate, item.StartPositionTicks, "baseline", "3", item.MimeType); return string.Format("{0}/Videos/{1}/stream{2}?{3}", serverAddress, item.ItemId, item.Container, dlnaCommand); } - /// - /// Gets the video codec. - /// - /// The video stream. - /// - private static VideoCodecs GetVideoCodec(MediaStream videoStream) - { - switch (videoStream.Codec.ToLower()) - { - case "h264": - case "mpeg4": - return VideoCodecs.Copy; - - } - return VideoCodecs.H264; - } - - /// - /// Gets the audio codec. - /// - /// The audio stream. - /// - private static AudioCodecs GetAudioCodec(MediaStream audioStream) - { - if (audioStream != null) - { - switch (audioStream.Codec.ToLower()) - { - case "aac": - case "mp3": - case "wma": - return AudioCodecs.Copy; - - } - } - return AudioCodecs.Aac; - } - /// /// Builds the dlna URL. /// - private static string BuildDlnaUrl(string deviceID, bool isStatic, VideoCodecs? videoCodec, AudioCodecs? audioCodec, int? subtitleIndex, int? audiostreamIndex, int? videoBitrate, int? audiochannels, int? audioBitrate, long? startPositionTicks, string profile, string videoLevel, string mimeType) + private static string BuildDlnaUrl(string mediaSourceId, string deviceID, bool isStatic, string videoCodec, string audioCodec, int? audiostreamIndex, int? subtitleIndex, int? videoBitrate, int? audioBitrate, long? startPositionTicks, List settings) { - var usCulture = new CultureInfo("en-US"); + var profile = settings.Where(i => i.Name == TranscodingSettingType.VideoProfile).Select(i => i.Value).FirstOrDefault(); + var videoLevel = settings.Where(i => i.Name == TranscodingSettingType.VideoLevel).Select(i => i.Value).FirstOrDefault(); + var maxAudioChannels = settings.Where(i => i.Name == TranscodingSettingType.MaxAudioChannels).Select(i => i.Value).FirstOrDefault(); - var dlnaparam = string.Format("Params={0};", deviceID); - dlnaparam += isStatic ? "true;" : "false;"; - dlnaparam += videoCodec.HasValue ? videoCodec.Value + ";" : ";"; - dlnaparam += audioCodec.HasValue ? audioCodec.Value + ";" : ";"; - dlnaparam += audiostreamIndex.HasValue ? audiostreamIndex.Value.ToString(usCulture) + ";" : ";"; - dlnaparam += subtitleIndex.HasValue ? subtitleIndex.Value.ToString(usCulture) + ";" : ";"; - dlnaparam += videoBitrate.HasValue ? videoBitrate.Value.ToString(usCulture) + ";" : ";"; - dlnaparam += audioBitrate.HasValue ? audioBitrate.Value.ToString(usCulture) + ";" : ";"; - dlnaparam += audiochannels.HasValue ? audiochannels.Value.ToString(usCulture) + ";" : ";"; - dlnaparam += startPositionTicks.HasValue ? startPositionTicks.Value.ToString(usCulture) + ";" : ";"; - dlnaparam += profile + ";"; - dlnaparam += videoLevel + ";"; - dlnaparam += mimeType + ";"; + var usCulture = new CultureInfo("en-US"); - return dlnaparam; + var list = new List + { + deviceID ?? string.Empty, + mediaSourceId ?? string.Empty, + isStatic.ToString().ToLower(), + videoCodec ?? string.Empty, + audioCodec ?? string.Empty, + audiostreamIndex.HasValue ? audiostreamIndex.Value.ToString(usCulture) : string.Empty, + subtitleIndex.HasValue ? subtitleIndex.Value.ToString(usCulture) : string.Empty, + videoBitrate.HasValue ? videoBitrate.Value.ToString(usCulture) : string.Empty, + audioBitrate.HasValue ? audioBitrate.Value.ToString(usCulture) : string.Empty, + maxAudioChannels ?? string.Empty, + startPositionTicks.HasValue ? startPositionTicks.Value.ToString(usCulture) : string.Empty, + profile ?? string.Empty, + videoLevel ?? string.Empty + }; + + return string.Format("Params={0}", string.Join(";", list.ToArray())); } - - #endregion - } } \ No newline at end of file -- cgit v1.2.3 From 85aa11e926ae9cba2ad58bf1087ad6efaff925a3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 23 Mar 2014 12:42:02 -0400 Subject: separate profiles --- MediaBrowser.Controller/Dlna/CodecProfile.cs | 4 +- MediaBrowser.Controller/Dlna/ContainerProfile.cs | 22 + .../Dlna/DeviceIdentification.cs | 10 +- MediaBrowser.Controller/Dlna/DeviceProfile.cs | 9 +- MediaBrowser.Controller/Dlna/DirectPlayProfile.cs | 7 - MediaBrowser.Controller/Dlna/TranscodingProfile.cs | 9 +- .../MediaBrowser.Controller.csproj | 1 + MediaBrowser.Dlna/DlnaManager.cs | 1358 +++++--------------- MediaBrowser.Dlna/MediaBrowser.Dlna.csproj | 10 + MediaBrowser.Dlna/PlayTo/DlnaController.cs | 5 +- MediaBrowser.Dlna/PlayTo/PlaylistItem.cs | 2 + MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs | 21 +- MediaBrowser.Dlna/PlayTo/StreamHelper.cs | 7 +- MediaBrowser.Dlna/Profiles/DefaultProfile.cs | 49 + MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs | 28 + .../Profiles/PanasonicVieraProfile.cs | 187 +++ .../Profiles/SonyBravia2010Profile.cs | 242 ++++ .../Profiles/SonyBravia2011Profile.cs | 260 ++++ .../Profiles/SonyBravia2012Profile.cs | 202 +++ .../Profiles/SonyBravia2013Profile.cs | 233 ++++ MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs | 242 ++++ MediaBrowser.Dlna/Profiles/Xbox360Profile.cs | 314 +++++ MediaBrowser.Dlna/Profiles/XboxOneProfile.cs | 60 + MediaBrowser.ServerApplication/ApplicationHost.cs | 2 +- 24 files changed, 2187 insertions(+), 1097 deletions(-) create mode 100644 MediaBrowser.Controller/Dlna/ContainerProfile.cs create mode 100644 MediaBrowser.Dlna/Profiles/DefaultProfile.cs create mode 100644 MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs create mode 100644 MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs create mode 100644 MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs create mode 100644 MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs create mode 100644 MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs create mode 100644 MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs create mode 100644 MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs create mode 100644 MediaBrowser.Dlna/Profiles/Xbox360Profile.cs create mode 100644 MediaBrowser.Dlna/Profiles/XboxOneProfile.cs (limited to 'MediaBrowser.Controller/Dlna/TranscodingProfile.cs') diff --git a/MediaBrowser.Controller/Dlna/CodecProfile.cs b/MediaBrowser.Controller/Dlna/CodecProfile.cs index 0d66d90ae..1dc7f2139 100644 --- a/MediaBrowser.Controller/Dlna/CodecProfile.cs +++ b/MediaBrowser.Controller/Dlna/CodecProfile.cs @@ -6,12 +6,12 @@ namespace MediaBrowser.Controller.Dlna public class CodecProfile { public CodecType Type { get; set; } - public List Conditions { get; set; } + public ProfileCondition[] Conditions { get; set; } public string Codec { get; set; } public CodecProfile() { - Conditions = new List(); + Conditions = new ProfileCondition[] {}; } public List GetCodecs() diff --git a/MediaBrowser.Controller/Dlna/ContainerProfile.cs b/MediaBrowser.Controller/Dlna/ContainerProfile.cs new file mode 100644 index 000000000..3bd3c9eaf --- /dev/null +++ b/MediaBrowser.Controller/Dlna/ContainerProfile.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; + +namespace MediaBrowser.Controller.Dlna +{ + public class ContainerProfile + { + public DlnaProfileType Type { get; set; } + public ProfileCondition[] Conditions { get; set; } + public string Container { get; set; } + + public ContainerProfile() + { + Conditions = new ProfileCondition[] { }; + } + + public List GetContainers() + { + return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + } +} diff --git a/MediaBrowser.Controller/Dlna/DeviceIdentification.cs b/MediaBrowser.Controller/Dlna/DeviceIdentification.cs index 20c94ad50..461c77537 100644 --- a/MediaBrowser.Controller/Dlna/DeviceIdentification.cs +++ b/MediaBrowser.Controller/Dlna/DeviceIdentification.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Controller.Dlna { public class DeviceIdentification @@ -55,11 +54,11 @@ namespace MediaBrowser.Controller.Dlna /// Gets or sets the headers. /// /// The headers. - public List Headers { get; set; } + public HttpHeaderInfo[] Headers { get; set; } public DeviceIdentification() { - Headers = new List(); + Headers = new HttpHeaderInfo[] {}; } } @@ -73,6 +72,7 @@ namespace MediaBrowser.Controller.Dlna public enum HeaderMatchType { Equals = 0, - Substring = 1 + Regex = 1, + Substring = 2 } } diff --git a/MediaBrowser.Controller/Dlna/DeviceProfile.cs b/MediaBrowser.Controller/Dlna/DeviceProfile.cs index 49568e7d4..83500e407 100644 --- a/MediaBrowser.Controller/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Controller/Dlna/DeviceProfile.cs @@ -20,13 +20,15 @@ namespace MediaBrowser.Controller.Dlna /// /// The transcoding profiles. public TranscodingProfile[] TranscodingProfiles { get; set; } - + /// /// Gets or sets the direct play profiles. /// /// The direct play profiles. public DirectPlayProfile[] DirectPlayProfiles { get; set; } + public ContainerProfile[] ContainerProfiles { get; set; } + /// /// Gets or sets the identification. /// @@ -40,6 +42,8 @@ namespace MediaBrowser.Controller.Dlna public string ModelDescription { get; set; } public string ModelNumber { get; set; } public string ModelUrl { get; set; } + public bool IgnoreTranscodeByteRangeRequests { get; set; } + /// /// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace. /// @@ -62,13 +66,14 @@ namespace MediaBrowser.Controller.Dlna public bool RequiresPlainVideoItems { get; set; } public bool RequiresPlainFolders { get; set; } - + public DeviceProfile() { DirectPlayProfiles = new DirectPlayProfile[] { }; TranscodingProfiles = new TranscodingProfile[] { }; MediaProfiles = new MediaProfile[] { }; CodecProfiles = new CodecProfile[] { }; + ContainerProfiles = new ContainerProfile[] { }; } } } diff --git a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs index 56dd15ca3..686b31287 100644 --- a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs @@ -11,13 +11,6 @@ namespace MediaBrowser.Controller.Dlna public DlnaProfileType Type { get; set; } - public List Conditions { get; set; } - - public DirectPlayProfile() - { - Conditions = new List(); - } - public List GetContainers() { return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); diff --git a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs index 32ffb91cf..1ce2adb1b 100644 --- a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Controller.Dlna { public class TranscodingProfile @@ -15,12 +14,14 @@ namespace MediaBrowser.Controller.Dlna public TranscodeSeekInfo TranscodeSeekInfo { get; set; } - public List Settings { get; set; } + public TranscodingSetting[] Settings { get; set; } public TranscodingProfile() { - Settings = new List(); + Settings = new TranscodingSetting[] { }; } + + public bool EnableMpegtsM2TsMode { get; set; } } public class TranscodingSetting diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index b51824bdb..5e6297d06 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -79,6 +79,7 @@ + diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 7c3123b78..9588eb7b6 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.IO; using MediaBrowser.Controller.Dlna; +using MediaBrowser.Dlna.Profiles; using MediaBrowser.Model.Serialization; using System.Collections.Generic; using System.Linq; @@ -13,1035 +14,322 @@ namespace MediaBrowser.Dlna private IApplicationPaths _appPaths; private readonly IXmlSerializer _xmlSerializer; private readonly IFileSystem _fileSystem; + private readonly IJsonSerializer _jsonSerializer; - public DlnaManager(IXmlSerializer xmlSerializer, IFileSystem fileSystem) + public DlnaManager(IXmlSerializer xmlSerializer, IFileSystem fileSystem, IJsonSerializer jsonSerializer) { _xmlSerializer = xmlSerializer; _fileSystem = fileSystem; + _jsonSerializer = jsonSerializer; - //GetProfiles(); + GetProfiles(); } public IEnumerable GetProfiles() { var list = new List(); - list.Add(new DeviceProfile - { - Name = "Samsung TV (B Series)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = "^TV$", - ModelNumber = @"1\.0", - ModelName = "Samsung DTV DMR" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio, - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio, - }, - new DirectPlayProfile - { - Container = "mkv", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "mp4", - Type = DlnaProfileType.Video - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/x-msvideo", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="mkv", - MimeType = "video/x-mkv", - Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Samsung TV (E/F-series)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung|(^\[TV\]Samsung [A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)", - ModelNumber = @"(1\.0)|(AllShare1\.0)" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "mkv", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "mp4", - Type = DlnaProfileType.Video - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/x-msvideo", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="mkv", - MimeType = "video/x-mkv", - Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Samsung TV (C/D-series)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = @"(^TV-\d{2}C\d{3}.*)|(^\[TV\][A-Z]{2}\d{2}(D)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung", - ModelNumber = @"(1\.0)|(AllShare1\.0)" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "mkv", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "mp4", - Type = DlnaProfileType.Video - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/x-msvideo", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="mkv", - MimeType = "video/x-mkv", - Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Xbox 360", - ClientType = "DLNA", - - ModelName = "Windows Media Player Sharing", - ModelNumber = "12.0", - ModelUrl = "http://www.microsoft.com/", - Manufacturer = "Microsoft Corporation", - ManufacturerUrl = "http://www.microsoft.com/", - XDlnaDoc = "DMS-1.50", - - TimelineOffsetSeconds = 40, - RequiresPlainFolders = true, - RequiresPlainVideoItems = true, - - Identification = new DeviceIdentification - { - ModelName = "Xbox 360", - - Headers = new List - { - new HttpHeaderInfo{ Name="User-Agent", Value="Xbox", Match= HeaderMatchType.Substring}, - new HttpHeaderInfo{ Name="User-Agent", Value="Xenon", Match= HeaderMatchType.Substring} - } - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - AudioCodec = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "asf", - VideoCodec = "wmv2", - AudioCodec = "wmav2", - Type = DlnaProfileType.Video, - TranscodeSeekInfo = TranscodeSeekInfo.Bytes, - EstimateContentLength = true, - - Settings = new List - { - new TranscodingSetting { Name = TranscodingSettingType.MaxAudioChannels, Value = "6" }, - new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"}, - new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"} - } - }, - new TranscodingProfile - { - Container = "jpeg", - Type = DlnaProfileType.Photo - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "avi", - VideoCodec = "mpeg4", - AudioCodec = "ac3,mp3", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "avi", - VideoCodec = "h264", - AudioCodec = "aac", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "mp4,mov", - VideoCodec = "h264,mpeg4", - AudioCodec = "aac,ac3", - Type = DlnaProfileType.Video, - - Conditions = new List - { - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Has64BitOffsets, Value = "false", IsRequired=false} - } - }, - new DirectPlayProfile - { - Container = "asf", - VideoCodec = "wmv2,wmv3,vc1", - AudioCodec = "wmav2,wmapro", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "asf", - AudioCodec = "wmav2,wmapro,wmavoice", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "mp3", - AudioCodec = "mp3", - 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[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/avi", - Type = DlnaProfileType.Video - } - }, - - CodecProfiles = new[] - { - new CodecProfile - { - Type = CodecType.VideoCodec, - Codec = "mpeg4", - Conditions = new List - { - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1280"}, - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "720"}, - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.VideoFramerate, Value = "30", IsRequired=false}, - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.VideoBitrate, Value = "5120000", IsRequired=false} - } - }, - - new CodecProfile - { - Type = CodecType.VideoCodec, - Codec = "h264", - 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.VideoLevel, Value = "41", IsRequired=false}, - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.VideoBitrate, Value = "10240000", IsRequired=false} - } - }, - - new CodecProfile - { - Type = CodecType.VideoCodec, - Codec = "wmv2,wmv3,vc1", - 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.VideoFramerate, Value = "30", IsRequired=false}, - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.VideoBitrate, Value = "15360000", IsRequired=false} - } - }, - - new CodecProfile - { - Type = CodecType.VideoAudioCodec, - Codec = "ac3,wmav2,wmapro", - Conditions = new List - { - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.AudioChannels, Value = "6", IsRequired=false} - } - }, - - new CodecProfile - { - Type = CodecType.VideoAudioCodec, - Codec = "aac", - Conditions = new List - { - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.AudioChannels, Value = "6", IsRequired=false}, - new ProfileCondition{ Condition = ProfileConditionType.Equals, Property = ProfileConditionValue.AudioProfile, Value = "lc", IsRequired=false} - } - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Xbox One", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - ModelName = "Xbox One", - FriendlyName = "Xbox-SystemOS" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/x-msvideo", - Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Sony Bravia (2012)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = @"BRAVIA KDL-\d{2}[A-Z]X\d5(\d|G).*" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "asf", - Type = DlnaProfileType.Audio - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/avi", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="asf", - MimeType = "video/x-ms-wmv", - Type = DlnaProfileType.Audio - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Sony Bravia (2013)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = @"BRAVIA (KDL-\d{2}W[689]\d{2}A.*)|(KD-\d{2}X9\d{3}A.*)" - }, - - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "wma", - Type = DlnaProfileType.Audio - }, - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - }, - new DirectPlayProfile - { - Container = "mp4", - Type = DlnaProfileType.Video - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/avi", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="mp4", - MimeType = "video/mp4", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="ts", - MimeType = "video/mpeg", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="wma", - MimeType = "video/x-ms-wma", - Type = DlnaProfileType.Audio - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Panasonic Viera", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - 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 - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mpeg", - VideoCodec = "mpeg2video,mpeg4", - AudioCodec = "ac3,mp3", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "mkv", - VideoCodec = "h264", - AudioCodec = "aac,ac3,mp3,pcm", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "ts", - VideoCodec = "h264", - AudioCodec = "aac,mp3", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - 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"} - } - } - }, - - CodecProfiles = new [] - { - new CodecProfile - { - 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} - } - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Philips (2010-)", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = ".*PHILIPS.*", - ModelName = "WD TV HD Live" - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3,wma", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "mkv", - Type = DlnaProfileType.Video - } - }, - - MediaProfiles = new[] - { - new MediaProfile - { - Container ="avi", - MimeType = "video/avi", - Type = DlnaProfileType.Video - }, - - new MediaProfile - { - Container ="mkv", - MimeType = "video/x-matroska", - Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - Name = "WDTV Live", - ClientType = "DLNA", - - TimelineOffsetSeconds = 5, - - Identification = new DeviceIdentification - { - ModelName = "WD TV HD Live", - - Headers = new List - { - new HttpHeaderInfo{ Name="User-Agent", Value="alphanetworks", Match= HeaderMatchType.Substring}, - new HttpHeaderInfo{ Name="User-Agent", Value="ALPHA Networks", 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", - - Settings = new List - { - new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"}, - new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"} - } - }, - new TranscodingProfile - { - Container = "jpeg", - Type = DlnaProfileType.Photo - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "avi", - Type = DlnaProfileType.Video, - VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", - AudioCodec = "ac3,dca,mp2,mp3,pcm" - }, - - new DirectPlayProfile - { - Container = "mpeg", - Type = DlnaProfileType.Video, - VideoCodec = "mpeg1video,mpeg2video", - AudioCodec = "ac3,dca,mp2,mp3,pcm" - }, - - new DirectPlayProfile - { - Container = "mkv", - Type = DlnaProfileType.Video, - VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", - AudioCodec = "ac3,dca,aac,mp2,mp3,pcm" - }, - - new DirectPlayProfile - { - Container = "ts", - Type = DlnaProfileType.Video, - VideoCodec = "mpeg1video,mpeg2video,h264,vc1", - AudioCodec = "ac3,dca,mp2,mp3" - }, - - new DirectPlayProfile - { - Container = "mp4,mov", - Type = DlnaProfileType.Video, - VideoCodec = "h264,mpeg4", - AudioCodec = "ac3,aac,mp2,mp3" - }, - - new DirectPlayProfile - { - Container = "asf", - Type = DlnaProfileType.Video, - VideoCodec = "vc1", - AudioCodec = "wmav2,wmapro" - }, - - new DirectPlayProfile - { - Container = "asf", - Type = DlnaProfileType.Video, - VideoCodec = "mpeg2video", - AudioCodec = "mp2,ac3" - }, - - new DirectPlayProfile - { - Container = "mp3", - AudioCodec = "mp2,mp3", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "mp4", - AudioCodec = "mp4", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "flac", - AudioCodec = "flac", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "asf", - AudioCodec = "wmav2,wmapro,wmavoice", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "ogg", - AudioCodec = "vorbis", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Type = DlnaProfileType.Photo, - - Container = "jpeg,png,gif,bmp,tiff", - - 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[] - { - new MediaProfile - { - Container ="ts", - OrgPn = "MPEG_TS_SD_NA", - Type = DlnaProfileType.Video - } - }, - - CodecProfiles = new[] - { - new CodecProfile - { - Type = CodecType.VideoCodec, - Codec= "h264", - - 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.VideoLevel, Value = "41"} - } - }, - - new CodecProfile - { - Type = CodecType.VideoAudioCodec, - Codec= "aac", - - Conditions = new List - { - new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.AudioChannels, Value = "2"} - } - } - } - }); - - list.Add(new DeviceProfile - { - // Linksys DMA2100us does not need any transcoding of the formats we support statically - Name = "Linksys DMA2100", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - ModelName = "DMA2100us" - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3,flac,m4a,wma", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "avi,mp4,mkv,ts", - Type = DlnaProfileType.Video - } - } - }); - - list.Add(new DeviceProfile - { - Name = "Denon AVR", - ClientType = "DLNA", - - Identification = new DeviceIdentification - { - FriendlyName = @"Denon:\[AVR:.*", - Manufacturer = "Denon" - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3,flac,m4a,wma", - Type = DlnaProfileType.Audio - }, - } - }); + //list.Add(new DeviceProfile + //{ + // Name = "Samsung TV (B Series)", + // ClientType = "DLNA", + + // Identification = new DeviceIdentification + // { + // FriendlyName = "^TV$", + // ModelNumber = @"1\.0", + // ModelName = "Samsung DTV DMR" + // }, + + // TranscodingProfiles = new[] + // { + // new TranscodingProfile + // { + // Container = "mp3", + // Type = DlnaProfileType.Audio, + // }, + // new TranscodingProfile + // { + // Container = "ts", + // Type = DlnaProfileType.Video + // } + // }, + + // DirectPlayProfiles = new[] + // { + // new DirectPlayProfile + // { + // Container = "mp3", + // Type = DlnaProfileType.Audio, + // }, + // new DirectPlayProfile + // { + // Container = "mkv", + // Type = DlnaProfileType.Video + // }, + // new DirectPlayProfile + // { + // Container = "avi", + // Type = DlnaProfileType.Video + // }, + // new DirectPlayProfile + // { + // Container = "mp4", + // Type = DlnaProfileType.Video + // } + // }, + + // MediaProfiles = new[] + // { + // new MediaProfile + // { + // Container ="avi", + // MimeType = "video/x-msvideo", + // Type = DlnaProfileType.Video + // }, + + // new MediaProfile + // { + // Container ="mkv", + // MimeType = "video/x-mkv", + // Type = DlnaProfileType.Video + // } + // } + //}); + + //list.Add(new DeviceProfile + //{ + // Name = "Samsung TV (E/F-series)", + // ClientType = "DLNA", + + // Identification = new DeviceIdentification + // { + // FriendlyName = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung|(^\[TV\]Samsung [A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)", + // ModelNumber = @"(1\.0)|(AllShare1\.0)" + // }, + + // TranscodingProfiles = new[] + // { + // new TranscodingProfile + // { + // Container = "mp3", + // Type = DlnaProfileType.Audio + // }, + // new TranscodingProfile + // { + // Container = "ts", + // Type = DlnaProfileType.Video + // } + // }, + + // DirectPlayProfiles = new[] + // { + // new DirectPlayProfile + // { + // Container = "mp3", + // Type = DlnaProfileType.Audio + // }, + // new DirectPlayProfile + // { + // Container = "mkv", + // Type = DlnaProfileType.Video + // }, + // new DirectPlayProfile + // { + // Container = "avi", + // Type = DlnaProfileType.Video + // }, + // new DirectPlayProfile + // { + // Container = "mp4", + // Type = DlnaProfileType.Video + // } + // }, + + // MediaProfiles = new[] + // { + // new MediaProfile + // { + // Container ="avi", + // MimeType = "video/x-msvideo", + // Type = DlnaProfileType.Video + // }, + + // new MediaProfile + // { + // Container ="mkv", + // MimeType = "video/x-mkv", + // Type = DlnaProfileType.Video + // } + // } + //}); + + //list.Add(new DeviceProfile + //{ + // Name = "Samsung TV (C/D-series)", + // ClientType = "DLNA", + + // Identification = new DeviceIdentification + // { + // FriendlyName = @"(^TV-\d{2}C\d{3}.*)|(^\[TV\][A-Z]{2}\d{2}(D)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung", + // ModelNumber = @"(1\.0)|(AllShare1\.0)" + // }, + + // TranscodingProfiles = new[] + // { + // new TranscodingProfile + // { + // Container = "mp3", + // Type = DlnaProfileType.Audio + // }, + // new TranscodingProfile + // { + // Container = "ts", + // Type = DlnaProfileType.Video + // } + // }, + + // DirectPlayProfiles = new[] + // { + // new DirectPlayProfile + // { + // Container = "mp3", + // Type = DlnaProfileType.Audio + // }, + // new DirectPlayProfile + // { + // Container = "mkv", + // Type = DlnaProfileType.Video + // }, + // new DirectPlayProfile + // { + // Container = "avi", + // Type = DlnaProfileType.Video + // }, + // new DirectPlayProfile + // { + // Container = "mp4", + // Type = DlnaProfileType.Video + // } + // }, + + // MediaProfiles = new[] + // { + // new MediaProfile + // { + // Container ="avi", + // MimeType = "video/x-msvideo", + // Type = DlnaProfileType.Video + // }, + + // new MediaProfile + // { + // Container ="mkv", + // MimeType = "video/x-mkv", + // Type = DlnaProfileType.Video + // } + // } + //}); + + list.Add(new Xbox360Profile()); + + list.Add(new XboxOneProfile()); + + list.Add(new SonyBravia2010Profile()); + + list.Add(new SonyBravia2011Profile()); + + list.Add(new SonyBravia2012Profile()); + + list.Add(new SonyBravia2013Profile()); + + list.Add(new PanasonicVieraProfile()); + + //list.Add(new DeviceProfile + //{ + // Name = "Philips (2010-)", + // ClientType = "DLNA", + + // Identification = new DeviceIdentification + // { + // FriendlyName = ".*PHILIPS.*", + // ModelName = "WD TV HD Live" + // }, + + // DirectPlayProfiles = new[] + // { + // new DirectPlayProfile + // { + // Container = "mp3,wma", + // Type = DlnaProfileType.Audio + // }, + + // new DirectPlayProfile + // { + // Container = "avi", + // Type = DlnaProfileType.Video + // }, + + // new DirectPlayProfile + // { + // Container = "mkv", + // Type = DlnaProfileType.Video + // } + // }, + + // MediaProfiles = new[] + // { + // new MediaProfile + // { + // Container ="avi", + // MimeType = "video/avi", + // Type = DlnaProfileType.Video + // }, + + // new MediaProfile + // { + // Container ="mkv", + // MimeType = "video/x-matroska", + // Type = DlnaProfileType.Video + // } + // } + //}); + + list.Add(new WdtvLiveProfile()); + + //list.Add(new DeviceProfile + //{ + // // Linksys DMA2100us does not need any transcoding of the formats we support statically + // Name = "Linksys DMA2100", + // ClientType = "DLNA", + + // Identification = new DeviceIdentification + // { + // ModelName = "DMA2100us" + // }, + + // DirectPlayProfiles = new[] + // { + // new DirectPlayProfile + // { + // Container = "mp3,flac,m4a,wma", + // Type = DlnaProfileType.Audio + // }, + + // new DirectPlayProfile + // { + // Container = "avi,mp4,mkv,ts", + // Type = DlnaProfileType.Video + // } + // } + //}); + + list.Add(new DenonAvrProfile()); foreach (var item in list) { - //_xmlSerializer.SerializeToFile(item, "d:\\" + _fileSystem.GetValidFilename(item.Name)); + //_xmlSerializer.SerializeToFile(item, "d:\\" + _fileSystem.GetValidFilename(item.Name) + ".xml"); + //_jsonSerializer.SerializeToFile(item, "d:\\" + _fileSystem.GetValidFilename(item.Name) + ".json"); } return list; @@ -1049,45 +337,7 @@ namespace MediaBrowser.Dlna public DeviceProfile GetDefaultProfile() { - return new DeviceProfile - { - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - AudioCodec = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - Type = DlnaProfileType.Video, - AudioCodec = "aac", - VideoCodec = "h264", - Settings = new List - { - new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"}, - new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"} - } - } - }, - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mp3,wma", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "avi,mp4", - Type = DlnaProfileType.Video - } - } - }; + return new DefaultProfile(); } public DeviceProfile GetProfile(DeviceIdentification deviceInfo) diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index 800fb1b23..590d6378f 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -81,6 +81,16 @@ + + + + + + + + + + diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index 4f9c92da5..ecda07f0b 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -399,8 +399,11 @@ namespace MediaBrowser.Dlna.PlayTo var deviceInfo = _device.Properties; - var playlistItem = GetPlaylistItem(item, streams, _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification())); + var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()); + + var playlistItem = GetPlaylistItem(item, streams, profile); playlistItem.StartPositionTicks = startPostionTicks; + playlistItem.DeviceProfileName = profile.Name; if (playlistItem.MediaType == DlnaProfileType.Audio) { diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs index 77b9085f7..3992fbfbf 100644 --- a/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs +++ b/MediaBrowser.Dlna/PlayTo/PlaylistItem.cs @@ -32,6 +32,8 @@ namespace MediaBrowser.Dlna.PlayTo public int? AudioStreamIndex { get; set; } public int? SubtitleStreamIndex { get; set; } + + public string DeviceProfileName { get; set; } public PlaylistItem() { diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs index a9a33ee3d..31f15b1c3 100644 --- a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs +++ b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs @@ -47,6 +47,7 @@ namespace MediaBrowser.Dlna.PlayTo playlistItem.Transcode = true; playlistItem.TranscodingSettings = transcodingProfile.Settings.ToList(); playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.'); + playlistItem.AudioCodec = transcodingProfile.AudioCodec; } return playlistItem; @@ -118,6 +119,8 @@ namespace MediaBrowser.Dlna.PlayTo playlistItem.Transcode = true; playlistItem.TranscodingSettings = transcodingProfile.Settings.ToList(); playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.'); + playlistItem.AudioCodec = transcodingProfile.AudioCodec.Split(',').FirstOrDefault(); + playlistItem.VideoCodec = transcodingProfile.VideoCodec; } return playlistItem; @@ -137,12 +140,6 @@ namespace MediaBrowser.Dlna.PlayTo } } - // Check additional conditions - if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, null, null))) - { - return false; - } - return true; } @@ -160,12 +157,6 @@ namespace MediaBrowser.Dlna.PlayTo } } - // Check additional conditions - if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, null, audioStream))) - { - return false; - } - return true; } @@ -210,12 +201,6 @@ namespace MediaBrowser.Dlna.PlayTo } } - // Check additional conditions - if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, videoStream, audioStream))) - { - return false; - } - return true; } diff --git a/MediaBrowser.Dlna/PlayTo/StreamHelper.cs b/MediaBrowser.Dlna/PlayTo/StreamHelper.cs index 2a8e2d617..6cd66c16a 100644 --- a/MediaBrowser.Dlna/PlayTo/StreamHelper.cs +++ b/MediaBrowser.Dlna/PlayTo/StreamHelper.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Dlna.PlayTo /// System.String. internal static string GetAudioUrl(DeviceInfo deviceProperties, PlaylistItem item, List streams, string serverAddress) { - var dlnaCommand = BuildDlnaUrl(item.MediaSourceId, deviceProperties.UUID, !item.Transcode, null, item.AudioCodec, item.AudioStreamIndex, item.SubtitleStreamIndex, null, 128000, item.StartPositionTicks, item.TranscodingSettings); + var dlnaCommand = BuildDlnaUrl(item.DeviceProfileName, item.MediaSourceId, deviceProperties.UUID, !item.Transcode, null, item.AudioCodec, item.AudioStreamIndex, item.SubtitleStreamIndex, null, 128000, item.StartPositionTicks, item.TranscodingSettings); return string.Format("{0}/audio/{1}/stream{2}?{3}", serverAddress, item.ItemId, "." + item.Container.TrimStart('.'), dlnaCommand); } @@ -33,7 +33,7 @@ namespace MediaBrowser.Dlna.PlayTo /// The url to send to the device internal static string GetVideoUrl(DeviceInfo deviceProperties, PlaylistItem item, List streams, string serverAddress) { - var dlnaCommand = BuildDlnaUrl(item.MediaSourceId, deviceProperties.UUID, !item.Transcode, item.VideoCodec, item.AudioCodec, item.AudioStreamIndex, item.SubtitleStreamIndex, 1500000, 128000, item.StartPositionTicks, item.TranscodingSettings); + var dlnaCommand = BuildDlnaUrl(item.DeviceProfileName, item.MediaSourceId, deviceProperties.UUID, !item.Transcode, item.VideoCodec, item.AudioCodec, item.AudioStreamIndex, item.SubtitleStreamIndex, 1500000, 128000, item.StartPositionTicks, item.TranscodingSettings); return string.Format("{0}/Videos/{1}/stream{2}?{3}", serverAddress, item.ItemId, item.Container, dlnaCommand); } @@ -41,7 +41,7 @@ namespace MediaBrowser.Dlna.PlayTo /// /// Builds the dlna URL. /// - private static string BuildDlnaUrl(string mediaSourceId, string deviceID, bool isStatic, string videoCodec, string audioCodec, int? audiostreamIndex, int? subtitleIndex, int? videoBitrate, int? audioBitrate, long? startPositionTicks, List settings) + private static string BuildDlnaUrl(string deviceProfileName, string mediaSourceId, string deviceID, bool isStatic, string videoCodec, string audioCodec, int? audiostreamIndex, int? subtitleIndex, int? videoBitrate, int? audioBitrate, long? startPositionTicks, List settings) { var profile = settings.Where(i => i.Name == TranscodingSettingType.VideoProfile).Select(i => i.Value).FirstOrDefault(); var videoLevel = settings.Where(i => i.Name == TranscodingSettingType.VideoLevel).Select(i => i.Value).FirstOrDefault(); @@ -51,6 +51,7 @@ namespace MediaBrowser.Dlna.PlayTo var list = new List { + deviceProfileName ?? string.Empty, deviceID ?? string.Empty, mediaSourceId ?? string.Empty, isStatic.ToString().ToLower(), diff --git a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs new file mode 100644 index 000000000..2580e8f8c --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs @@ -0,0 +1,49 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class DefaultProfile : DeviceProfile + { + public DefaultProfile() + { + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + + new TranscodingProfile + { + Container = "ts", + Type = DlnaProfileType.Video, + AudioCodec = "aac", + VideoCodec = "h264", + + Settings = new [] + { + new TranscodingSetting {Name = TranscodingSettingType.VideoLevel, Value = "3"}, + new TranscodingSetting {Name = TranscodingSettingType.VideoProfile, Value = "baseline"} + } + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "mp3,wma", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "avi,mp4", + Type = DlnaProfileType.Video + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs b/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs new file mode 100644 index 000000000..8029912d0 --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/DenonAvrProfile.cs @@ -0,0 +1,28 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class DenonAvrProfile : DefaultProfile + { + public DenonAvrProfile() + { + Name = "Denon AVR"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + FriendlyName = @"Denon:\[AVR:.*", + Manufacturer = "Denon" + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "mp3,flac,m4a,wma", + Type = DlnaProfileType.Audio + }, + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs b/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs new file mode 100644 index 000000000..ced648e5c --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs @@ -0,0 +1,187 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class PanasonicVieraProfile : DefaultProfile + { + public PanasonicVieraProfile() + { + Name = "Panasonic Viera"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + FriendlyName = @"VIERA", + Manufacturer = "Panasonic", + + Headers = new[] + { + 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 + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "mpeg", + VideoCodec = "mpeg2video,mpeg4", + AudioCodec = "ac3,mp3", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "mkv", + VideoCodec = "h264", + AudioCodec = "aac,ac3,mp3,pcm", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "aac,mp3", + Type = DlnaProfileType.Video + }, + + new DirectPlayProfile + { + 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 + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + + Conditions = new[] + { + 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 + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs new file mode 100644 index 000000000..32eab4ae4 --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs @@ -0,0 +1,242 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class SonyBravia2010Profile : DefaultProfile + { + public SonyBravia2010Profile() + { + Name = "Sony Bravia (2010)"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + FriendlyName = @"KDL-\d{2}[EHLNPB]X\d[01]\d.*", + Manufacturer = "Sony", + + Headers = new [] + { + new HttpHeaderInfo + { + Name = "X-AV-Client-Info", + Value = @".*KDL-\d{2}[EHLNPB]X\d[01]\d.*", + Match = HeaderMatchType.Regex + } + } + }; + + ModelName = "Windows Media Player Sharing"; + ModelNumber = "3.0"; + ModelUrl = "http://www.microsoft.com/"; + Manufacturer = "Microsoft Corporation"; + ManufacturerUrl = "http://www.microsoft.com/"; + SonyAggregationFlags = "10"; + ProtocolInfo = + "http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=81500000000000000000000000000000,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=00;DLNA.ORG_FLAGS=00D00000000000000000000000000000,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL;DLNA.ORG_OP=11;DLNA.ORG_FLAGS=81500000000000000000000000000000"; + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac", + Type = DlnaProfileType.Video, + EnableMpegtsM2TsMode = true + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "mpeg1video,mpeg2video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mpeg", + VideoCodec = "mpeg2video,mpeg1video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "avi", + MimeType = "video/avi", + Type = DlnaProfileType.Video + }, + + new MediaProfile + { + Container = "asf", + MimeType = "video/x-ms-wmv", + Type = DlnaProfileType.Audio + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "h264", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "20000000" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoLevel, + Value = "41" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "mpeg2video", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "20000000" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "ac3", + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "6" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "aac", + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "2" + }, + new ProfileCondition + { + Condition = ProfileConditionType.NotEquals, + Property = ProfileConditionValue.AudioProfile, + Value = "he-aac" + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs new file mode 100644 index 000000000..c679dec21 --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs @@ -0,0 +1,260 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class SonyBravia2011Profile : DefaultProfile + { + public SonyBravia2011Profile() + { + Name = "Sony Bravia (2011)"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + FriendlyName = @"KDL-\d{2}([A-Z]X\d2\d|CX400).*", + Manufacturer = "Sony", + + Headers = new[] + { + new HttpHeaderInfo + { + Name = "X-AV-Client-Info", + Value = @".*KDL-\d{2}([A-Z]X\d2\d|CX400).*", + Match = HeaderMatchType.Regex + } + } + }; + + ModelName = "Windows Media Player Sharing"; + ModelNumber = "3.0"; + ModelUrl = "http://www.microsoft.com/"; + Manufacturer = "Microsoft Corporation"; + ManufacturerUrl = "http://www.microsoft.com/"; + SonyAggregationFlags = "10"; + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac", + Type = DlnaProfileType.Video, + EnableMpegtsM2TsMode = true + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "mpeg2video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp4", + VideoCodec = "h264,mpeg4", + AudioCodec = "ac3,aac,mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mpeg", + VideoCodec = "mpeg2video,mpeg1video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "asf", + VideoCodec = "wmv2,wmv3,vc1", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "asf", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Audio + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "avi", + MimeType = "video/avi", + Type = DlnaProfileType.Video + }, + + new MediaProfile + { + Container = "asf", + MimeType = "video/x-ms-wmv", + Type = DlnaProfileType.Audio + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "h264", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "20000000" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoLevel, + Value = "41" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "mpeg2video", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "20000000" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "ac3", + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "6" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "aac", + + Conditions = new[] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "2" + }, + new ProfileCondition + { + Condition = ProfileConditionType.NotEquals, + Property = ProfileConditionValue.AudioProfile, + Value = "he-aac" + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs new file mode 100644 index 000000000..488b7f740 --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs @@ -0,0 +1,202 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class SonyBravia2012Profile : DefaultProfile + { + public SonyBravia2012Profile() + { + Name = "Sony Bravia (2012)"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + FriendlyName = @"KDL-\d{2}[A-Z]X\d5(\d|G).*", + Manufacturer = "Sony", + + Headers = new[] + { + new HttpHeaderInfo + { + Name = "X-AV-Client-Info", + Value = @".*KDL-\d{2}[A-Z]X\d5(\d|G).*", + Match = HeaderMatchType.Regex + } + } + }; + + ModelName = "Windows Media Player Sharing"; + ModelNumber = "3.0"; + ModelUrl = "http://www.microsoft.com/"; + Manufacturer = "Microsoft Corporation"; + ManufacturerUrl = "http://www.microsoft.com/"; + SonyAggregationFlags = "10"; + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac", + Type = DlnaProfileType.Video, + EnableMpegtsM2TsMode = true + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "mpeg2video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp4", + VideoCodec = "h264,mpeg4", + AudioCodec = "ac3,aac,mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "mpeg4", + AudioCodec = "ac3,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mpeg", + VideoCodec = "mpeg2video,mpeg1video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "asf", + VideoCodec = "wmv2,wmv3,vc1", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "asf", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "avi", + MimeType = "video/avi", + Type = DlnaProfileType.Video + }, + + new MediaProfile + { + Container = "asf", + MimeType = "video/x-ms-wmv", + Type = DlnaProfileType.Audio + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + Conditions = new[] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "ac3", + + Conditions = new[] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "6" + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs new file mode 100644 index 000000000..21a6ad40a --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs @@ -0,0 +1,233 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class SonyBravia2013Profile : DefaultProfile + { + public SonyBravia2013Profile() + { + Name = "Sony Bravia (2013)"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + FriendlyName = @"KDL-\d{2}[WR][5689]\d{2}A.*", + Manufacturer = "Sony", + + Headers = new[] + { + new HttpHeaderInfo + { + Name = "X-AV-Client-Info", + Value = @".*KDL-\d{2}[WR][5689]\d{2}A.*", + Match = HeaderMatchType.Regex + } + } + }; + + ModelName = "Windows Media Player Sharing"; + ModelNumber = "3.0"; + ModelUrl = "http://www.microsoft.com/"; + Manufacturer = "Microsoft Corporation"; + ManufacturerUrl = "http://www.microsoft.com/"; + SonyAggregationFlags = "10"; + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,aac", + Type = DlnaProfileType.Video, + EnableMpegtsM2TsMode = true + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "ac3,eac3,aac,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "ts", + VideoCodec = "mpeg2video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp4", + VideoCodec = "h264,mpeg4", + AudioCodec = "ac3,eac3,aac,mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mov", + VideoCodec = "h264,mpeg4,mjpeg", + AudioCodec = "ac3,eac3,aac,mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mkv", + VideoCodec = "h264,mpeg4,vp8", + AudioCodec = "ac3,eac3,aac,mp3,mp2,pcm,vorbis", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "mpeg4", + AudioCodec = "ac3,eac3,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "mjpeg", + AudioCodec = "pcm", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mpeg", + VideoCodec = "mpeg2video,mpeg1video", + AudioCodec = "mp3,mp2", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "asf", + VideoCodec = "wmv2,wmv3,vc1", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "mp4", + AudioCodec = "aac", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "wav", + AudioCodec = "pcm", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "asf", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "avi", + MimeType = "video/avi", + Type = DlnaProfileType.Video + }, + + new MediaProfile + { + Container = "mp4", + MimeType = "video/mp4", + Type = DlnaProfileType.Video + }, + + new MediaProfile + { + Container = "ts", + MimeType = "video/mpeg", + Type = DlnaProfileType.Video + }, + + new MediaProfile + { + Container = "wma", + MimeType = "video/x-ms-wma", + Type = DlnaProfileType.Audio + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs b/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs new file mode 100644 index 000000000..3487044a9 --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs @@ -0,0 +1,242 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class WdtvLiveProfile : DefaultProfile + { + public WdtvLiveProfile() + { + Name = "WDTV Live"; + ClientType = "DLNA"; + + TimelineOffsetSeconds = 5; + IgnoreTranscodeByteRangeRequests = true; + + Identification = new DeviceIdentification + { + ModelName = "WD TV HD Live", + + Headers = new [] + { + new HttpHeaderInfo {Name = "User-Agent", Value = "alphanetworks", Match = HeaderMatchType.Substring}, + new HttpHeaderInfo + { + Name = "User-Agent", + Value = "ALPHA Networks", + 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", + + Settings = new [] + { + new TranscodingSetting {Name = TranscodingSettingType.VideoLevel, Value = "3"}, + new TranscodingSetting {Name = TranscodingSettingType.VideoProfile, Value = "baseline"} + } + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "avi", + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", + AudioCodec = "ac3,dca,mp2,mp3,pcm" + }, + + new DirectPlayProfile + { + Container = "mpeg", + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video", + AudioCodec = "ac3,dca,mp2,mp3,pcm" + }, + + new DirectPlayProfile + { + Container = "mkv", + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1", + AudioCodec = "ac3,dca,aac,mp2,mp3,pcm" + }, + + new DirectPlayProfile + { + Container = "ts", + Type = DlnaProfileType.Video, + VideoCodec = "mpeg1video,mpeg2video,h264,vc1", + AudioCodec = "ac3,dca,mp2,mp3" + }, + + new DirectPlayProfile + { + Container = "mp4,mov", + Type = DlnaProfileType.Video, + VideoCodec = "h264,mpeg4", + AudioCodec = "ac3,aac,mp2,mp3" + }, + + new DirectPlayProfile + { + Container = "asf", + Type = DlnaProfileType.Video, + VideoCodec = "vc1", + AudioCodec = "wmav2,wmapro" + }, + + new DirectPlayProfile + { + Container = "asf", + Type = DlnaProfileType.Video, + VideoCodec = "mpeg2video", + AudioCodec = "mp2,ac3" + }, + + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp2,mp3", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "mp4", + AudioCodec = "mp4", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "flac", + AudioCodec = "flac", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "asf", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Container = "ogg", + AudioCodec = "vorbis", + Type = DlnaProfileType.Audio + }, + + new DirectPlayProfile + { + Type = DlnaProfileType.Photo, + + Container = "jpeg,png,gif,bmp,tiff" + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "ts", + OrgPn = "MPEG_TS_SD_NA", + Type = DlnaProfileType.Video + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "h264", + + Conditions = new [] + { + 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.VideoLevel, + Value = "41" + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "aac", + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "2" + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs new file mode 100644 index 000000000..82b70fe01 --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs @@ -0,0 +1,314 @@ +using MediaBrowser.Controller.Dlna; +using System.Collections.Generic; + +namespace MediaBrowser.Dlna.Profiles +{ + public class Xbox360Profile : DefaultProfile + { + public Xbox360Profile() + { + Name = "Xbox 360"; + ClientType = "DLNA"; + + ModelName = "Windows Media Player Sharing"; + ModelNumber = "12.0"; + ModelUrl = "http://www.microsoft.com/"; + Manufacturer = "Microsoft Corporation"; + ManufacturerUrl = "http://www.microsoft.com/"; + XDlnaDoc = "DMS-1.50"; + + TimelineOffsetSeconds = 40; + RequiresPlainFolders = true; + RequiresPlainVideoItems = true; + + Identification = new DeviceIdentification + { + ModelName = "Xbox 360", + + Headers = new [] + { + new HttpHeaderInfo {Name = "User-Agent", Value = "Xbox", Match = HeaderMatchType.Substring}, + new HttpHeaderInfo {Name = "User-Agent", Value = "Xenon", Match = HeaderMatchType.Substring} + } + }; + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "asf", + VideoCodec = "wmv2", + AudioCodec = "wmav2", + Type = DlnaProfileType.Video, + TranscodeSeekInfo = TranscodeSeekInfo.Bytes, + EstimateContentLength = true, + + Settings = new [] + { + new TranscodingSetting {Name = TranscodingSettingType.MaxAudioChannels, Value = "6"}, + new TranscodingSetting {Name = TranscodingSettingType.VideoLevel, Value = "3"}, + new TranscodingSetting {Name = TranscodingSettingType.VideoProfile, Value = "baseline"} + } + }, + new TranscodingProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "mpeg4", + AudioCodec = "ac3,mp3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "avi", + VideoCodec = "h264", + AudioCodec = "aac", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "mp4,mov", + VideoCodec = "h264,mpeg4", + AudioCodec = "aac,ac3", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "asf", + VideoCodec = "wmv2,wmv3,vc1", + AudioCodec = "wmav2,wmapro", + Type = DlnaProfileType.Video + }, + new DirectPlayProfile + { + Container = "asf", + AudioCodec = "wmav2,wmapro,wmavoice", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "jpeg", + Type = DlnaProfileType.Photo + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "avi", + MimeType = "video/avi", + Type = DlnaProfileType.Video + } + }; + + ContainerProfiles = new[] + { + new ContainerProfile + { + Type = DlnaProfileType.Video, + Container = "mp4,mov", + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Has64BitOffsets, + Value = "false", + IsRequired = false + } + } + }, + + new ContainerProfile + { + Type = DlnaProfileType.Photo, + + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1920" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "1080" + } + } + } + }; + + CodecProfiles = new[] + { + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "mpeg4", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Width, + Value = "1280" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.Height, + Value = "720" + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoFramerate, + Value = "30", + IsRequired = false + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "5120000", + IsRequired = false + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "h264", + Conditions = new [] + { + 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.VideoLevel, + Value = "41", + IsRequired = false + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "10240000", + IsRequired = false + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoCodec, + Codec = "wmv2,wmv3,vc1", + Conditions = new [] + { + 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.VideoFramerate, + Value = "30", + IsRequired = false + }, + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.VideoBitrate, + Value = "15360000", + IsRequired = false + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "ac3,wmav2,wmapro", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "6", + IsRequired = false + } + } + }, + + new CodecProfile + { + Type = CodecType.VideoAudioCodec, + Codec = "aac", + Conditions = new [] + { + new ProfileCondition + { + Condition = ProfileConditionType.LessThanEqual, + Property = ProfileConditionValue.AudioChannels, + Value = "6", + IsRequired = false + }, + new ProfileCondition + { + Condition = ProfileConditionType.Equals, + Property = ProfileConditionValue.AudioProfile, + Value = "lc", + IsRequired = false + } + } + } + }; + } + } +} diff --git a/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs b/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs new file mode 100644 index 000000000..0a5203a9c --- /dev/null +++ b/MediaBrowser.Dlna/Profiles/XboxOneProfile.cs @@ -0,0 +1,60 @@ +using MediaBrowser.Controller.Dlna; + +namespace MediaBrowser.Dlna.Profiles +{ + public class XboxOneProfile : DefaultProfile + { + public XboxOneProfile() + { + Name = "Xbox One"; + ClientType = "DLNA"; + + Identification = new DeviceIdentification + { + ModelName = "Xbox One", + FriendlyName = "Xbox-SystemOS" + }; + + TranscodingProfiles = new[] + { + new TranscodingProfile + { + Container = "mp3", + AudioCodec = "mp3", + Type = DlnaProfileType.Audio + }, + new TranscodingProfile + { + Container = "ts", + VideoCodec = "h264", + AudioCodec = "aac", + Type = DlnaProfileType.Video + } + }; + + DirectPlayProfiles = new[] + { + new DirectPlayProfile + { + Container = "mp3", + Type = DlnaProfileType.Audio + }, + new DirectPlayProfile + { + Container = "avi", + Type = DlnaProfileType.Video + } + }; + + MediaProfiles = new[] + { + new MediaProfile + { + Container = "avi", + MimeType = "video/x-msvideo", + Type = DlnaProfileType.Video + } + }; + } + } +} diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 879fbc1b6..dec1a1031 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -498,7 +498,7 @@ namespace MediaBrowser.ServerApplication var appThemeManager = new AppThemeManager(ApplicationPaths, FileSystemManager, JsonSerializer, Logger); RegisterSingleInstance(appThemeManager); - var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager); + var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, JsonSerializer); RegisterSingleInstance(dlnaManager); var collectionManager = new CollectionManager(LibraryManager, FileSystemManager, LibraryMonitor); -- cgit v1.2.3