jellyfin/MediaBrowser.Dlna/DlnaManager.cs

1158 lines
42 KiB
C#
Raw Normal View History

2014-03-15 04:14:07 +00:00
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Model.Serialization;
2014-03-13 19:08:02 +00:00
using System.Collections.Generic;
2014-03-17 14:48:16 +00:00
using System.Linq;
2014-03-13 19:08:02 +00:00
using System.Text.RegularExpressions;
namespace MediaBrowser.Dlna
{
public class DlnaManager : IDlnaManager
{
2014-03-15 04:14:07 +00:00
private IApplicationPaths _appPaths;
private readonly IXmlSerializer _xmlSerializer;
private readonly IFileSystem _fileSystem;
public DlnaManager(IXmlSerializer xmlSerializer, IFileSystem fileSystem)
{
_xmlSerializer = xmlSerializer;
_fileSystem = fileSystem;
//GetProfiles();
}
public IEnumerable<DeviceProfile> GetProfiles()
2014-03-13 19:08:02 +00:00
{
2014-03-15 04:14:07 +00:00
var list = new List<DeviceProfile>();
2014-03-13 21:36:19 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-13 21:36:19 +00:00
Name = "Samsung TV (B Series)",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
FriendlyName = "^TV$",
ModelNumber = @"1\.0",
ModelName = "Samsung DTV DMR"
},
2014-03-13 19:08:02 +00:00
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
Type = DlnaProfileType.Audio,
2014-03-14 14:27:32 +00:00
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
2014-03-13 19:08:02 +00:00
}
},
DirectPlayProfiles = new[]
{
2014-03-14 14:27:32 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
Type = DlnaProfileType.Audio,
2014-03-14 14:27:32 +00:00
},
2014-03-13 19:08:02 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mkv",
2014-03-13 19:08:02 +00:00
Type = DlnaProfileType.Video
2014-03-13 21:36:19 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Video
2014-03-14 14:27:32 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Video
2014-03-13 19:08:02 +00:00
}
2014-03-22 19:37:15 +00:00
},
MediaProfiles = new[]
{
new MediaProfile
{
Container ="avi",
MimeType = "video/x-msvideo",
Type = DlnaProfileType.Video
},
new MediaProfile
{
Container ="mkv",
MimeType = "video/x-mkv",
Type = DlnaProfileType.Video
}
2014-03-13 19:08:02 +00:00
}
2014-03-13 21:36:19 +00:00
});
2014-03-13 19:08:02 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-13 21:36:19 +00:00
Name = "Samsung TV (E/F-series)",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
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)"
},
2014-03-13 19:08:02 +00:00
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
Type = DlnaProfileType.Audio
2014-03-14 14:27:32 +00:00
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
2014-03-13 19:08:02 +00:00
}
},
DirectPlayProfiles = new[]
{
2014-03-14 14:27:32 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Audio
},
2014-03-13 19:08:02 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mkv",
2014-03-13 19:08:02 +00:00
Type = DlnaProfileType.Video
2014-03-13 21:36:19 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Video
2014-03-14 14:27:32 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Video
2014-03-13 19:08:02 +00:00
}
2014-03-22 19:37:15 +00:00
},
MediaProfiles = new[]
{
new MediaProfile
{
Container ="avi",
MimeType = "video/x-msvideo",
Type = DlnaProfileType.Video
},
new MediaProfile
{
Container ="mkv",
MimeType = "video/x-mkv",
Type = DlnaProfileType.Video
}
2014-03-13 19:08:02 +00:00
}
2014-03-13 21:36:19 +00:00
});
2014-03-13 19:08:02 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-13 21:36:19 +00:00
Name = "Samsung TV (C/D-series)",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
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)"
},
2014-03-13 19:08:02 +00:00
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
Type = DlnaProfileType.Audio
2014-03-14 14:27:32 +00:00
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
2014-03-13 19:08:02 +00:00
}
},
DirectPlayProfiles = new[]
{
2014-03-14 14:27:32 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Audio
},
2014-03-13 19:08:02 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mkv",
2014-03-13 19:08:02 +00:00
Type = DlnaProfileType.Video
2014-03-13 21:36:19 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Video
2014-03-14 14:27:32 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Video
2014-03-13 19:08:02 +00:00
}
2014-03-22 19:37:15 +00:00
},
MediaProfiles = new[]
{
new MediaProfile
{
Container ="avi",
MimeType = "video/x-msvideo",
Type = DlnaProfileType.Video
},
new MediaProfile
{
Container ="mkv",
MimeType = "video/x-mkv",
Type = DlnaProfileType.Video
}
2014-03-13 19:08:02 +00:00
}
2014-03-13 21:36:19 +00:00
});
2014-03-13 19:08:02 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-13 21:36:19 +00:00
Name = "Xbox 360",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
2014-03-23 00:48:34 +00:00
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,
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
2014-03-23 00:48:34 +00:00
ModelName = "Xbox 360",
Headers = new List<HttpHeaderInfo>
{
new HttpHeaderInfo{ Name="User-Agent", Value="Xbox", Match= HeaderMatchType.Substring},
new HttpHeaderInfo{ Name="User-Agent", Value="Xenon", Match= HeaderMatchType.Substring}
}
2014-03-17 14:48:16 +00:00
},
2014-03-13 19:08:02 +00:00
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
2014-03-23 00:48:34 +00:00
AudioCodec = "mp3",
2014-03-13 19:08:02 +00:00
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
2014-03-23 00:48:34 +00:00
Container = "asf",
VideoCodec = "wmv2",
AudioCodec = "wmav2",
Type = DlnaProfileType.Video,
TranscodeSeekInfo = TranscodeSeekInfo.Bytes,
EstimateContentLength = true,
Settings = new List<TranscodingSetting>
{
2014-03-23 05:10:33 +00:00
new TranscodingSetting { Name = TranscodingSettingType.MaxAudioChannels, Value = "6" },
new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"},
new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"}
2014-03-23 00:48:34 +00:00
}
},
new TranscodingProfile
{
Container = "jpeg",
Type = DlnaProfileType.Photo
2014-03-13 19:08:02 +00:00
}
2014-03-13 21:36:19 +00:00
},
DirectPlayProfiles = new[]
{
2014-03-14 14:27:32 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-23 00:48:34 +00:00
VideoCodec = "mpeg4",
AudioCodec = "ac3,mp3",
Type = DlnaProfileType.Video
2014-03-14 14:27:32 +00:00
},
2014-03-13 21:36:19 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-23 00:48:34 +00:00
VideoCodec = "h264",
AudioCodec = "aac",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Video
2014-03-18 17:05:57 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4,mov",
2014-03-23 00:48:34 +00:00
VideoCodec = "h264,mpeg4",
AudioCodec = "aac,ac3",
Type = DlnaProfileType.Video,
Conditions = new List<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Has64BitOffsets, Value = "false", IsRequired=false}
}
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "asf",
2014-03-23 00:48:34 +00:00
VideoCodec = "wmv2,wmv3,vc1",
AudioCodec = "wmav2,wmapro",
2014-03-18 17:05:57 +00:00
Type = DlnaProfileType.Video
2014-03-23 00:48:34 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "asf",
2014-03-23 00:48:34 +00:00
AudioCodec = "wmav2,wmapro,wmavoice",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
2014-03-23 00:48:34 +00:00
AudioCodec = "mp3",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "jpeg",
2014-03-23 00:48:34 +00:00
Type = DlnaProfileType.Photo,
Conditions = new List<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1920"},
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080"}
}
2014-03-13 21:36:19 +00:00
}
2014-03-22 19:37:15 +00:00
},
MediaProfiles = new[]
{
new MediaProfile
{
Container ="avi",
MimeType = "video/avi",
Type = DlnaProfileType.Video
}
2014-03-23 00:48:34 +00:00
},
CodecProfiles = new[]
{
new CodecProfile
{
Type = CodecType.VideoCodec,
Codec = "mpeg4",
Conditions = new List<ProfileCondition>
{
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<ProfileCondition>
{
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<ProfileCondition>
{
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<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.AudioChannels, Value = "6", IsRequired=false}
}
},
new CodecProfile
{
Type = CodecType.VideoAudioCodec,
Codec = "aac",
Conditions = new List<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.AudioChannels, Value = "6", IsRequired=false},
new ProfileCondition{ Condition = ProfileConditionType.Equals, Property = ProfileConditionValue.AudioProfile, Value = "lc", IsRequired=false}
}
}
2014-03-13 19:08:02 +00:00
}
2014-03-13 21:36:19 +00:00
});
2014-03-13 19:08:02 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-13 21:36:19 +00:00
Name = "Xbox One",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
ModelName = "Xbox One",
FriendlyName = "Xbox-SystemOS"
},
2014-03-13 19:08:02 +00:00
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
}
2014-03-13 21:36:19 +00:00
},
DirectPlayProfiles = new[]
{
2014-03-14 14:27:32 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Audio
},
2014-03-13 21:36:19 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-22 19:37:15 +00:00
Type = DlnaProfileType.Video
}
},
MediaProfiles = new[]
{
new MediaProfile
{
Container ="avi",
MimeType = "video/x-msvideo",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Video
}
2014-03-13 19:08:02 +00:00
}
2014-03-13 21:36:19 +00:00
});
2014-03-13 19:08:02 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 21:36:19 +00:00
{
2014-03-14 14:27:32 +00:00
Name = "Sony Bravia (2012)",
2014-03-13 21:36:19 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
FriendlyName = @"BRAVIA KDL-\d{2}[A-Z]X\d5(\d|G).*"
},
2014-03-13 21:36:19 +00:00
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
}
},
DirectPlayProfiles = new[]
{
2014-03-14 14:27:32 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
2014-03-14 14:27:32 +00:00
Type = DlnaProfileType.Audio
},
2014-03-13 21:36:19 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-22 19:37:15 +00:00
Type = DlnaProfileType.Video
2014-03-18 17:05:57 +00:00
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "asf",
2014-03-22 19:37:15 +00:00
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
2014-03-13 21:36:19 +00:00
}
}
});
2014-03-13 19:08:02 +00:00
list.Add(new DeviceProfile
{
Name = "Sony Bravia (2013)",
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
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",
2014-03-22 19:37:15 +00:00
Type = DlnaProfileType.Video
}
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "wma",
2014-03-22 19:37:15 +00:00
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-22 19:37:15 +00:00
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4",
2014-03-22 19:37:15 +00:00
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
{
2014-03-23 06:07:43 +00:00
Name = "Panasonic Viera",
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
2014-03-23 06:07:43 +00:00
FriendlyName = @"VIERA",
Manufacturer = "Panasonic",
Headers = new List<HttpHeaderInfo>
{
new HttpHeaderInfo{ Name= "User-Agent", Value = "Panasonic MIL DLNA", Match = HeaderMatchType.Substring}
}
2014-03-17 14:48:16 +00:00
},
2014-03-23 06:07:43 +00:00
TimelineOffsetSeconds = 10,
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
2014-03-23 06:07:43 +00:00
AudioCodec = "mp3",
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
2014-03-23 06:07:43 +00:00
AudioCodec = "ac3",
VideoCodec = "h264",
Type = DlnaProfileType.Video
2014-03-23 06:07:43 +00:00
},
new TranscodingProfile
{
Container = "jpeg",
Type = DlnaProfileType.Photo
}
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mpeg",
VideoCodec = "mpeg2video,mpeg4",
AudioCodec = "ac3,mp3",
Type = DlnaProfileType.Video
},
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mkv",
VideoCodec = "h264",
AudioCodec = "aac,ac3,mp3,pcm",
Type = DlnaProfileType.Video
2014-03-23 06:07:43 +00:00
},
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
Container = "ts",
VideoCodec = "h264",
AudioCodec = "aac,mp3",
Type = DlnaProfileType.Video
},
2014-03-17 14:48:16 +00:00
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
Container = "mp4",
VideoCodec = "h264",
AudioCodec = "aac,ac3,mp3,pcm",
Type = DlnaProfileType.Video
},
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mov",
VideoCodec = "h264",
AudioCodec = "aac,pcm",
Type = DlnaProfileType.Video
},
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
VideoCodec = "mpeg4",
AudioCodec = "pcm",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "flv",
VideoCodec = "h264",
AudioCodec = "aac",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Container = "mp3",
AudioCodec = "mp3",
Type = DlnaProfileType.Audio
},
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4",
AudioCodec = "aac",
Type = DlnaProfileType.Audio
},
2014-03-23 06:07:43 +00:00
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "jpeg",
Type = DlnaProfileType.Photo,
Conditions = new List<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1920"},
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Height, Value = "1080"}
}
2014-03-22 19:37:15 +00:00
}
},
2014-03-23 06:07:43 +00:00
CodecProfiles = new []
2014-03-22 19:37:15 +00:00
{
2014-03-23 06:07:43 +00:00
new CodecProfile
2014-03-22 19:37:15 +00:00
{
2014-03-23 06:07:43 +00:00
Conditions = new List<ProfileCondition>
{
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",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
FriendlyName = ".*PHILIPS.*",
ModelName = "WD TV HD Live"
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3,wma",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
2014-03-22 19:37:15 +00:00
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mkv",
2014-03-22 19:37:15 +00:00
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
}
}
});
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-13 21:36:19 +00:00
Name = "WDTV Live",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
TimelineOffsetSeconds = 5,
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
2014-03-22 19:37:15 +00:00
ModelName = "WD TV HD Live",
Headers = new List<HttpHeaderInfo>
{
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",
2014-03-23 05:10:33 +00:00
AudioCodec = "aac",
Settings = new List<TranscodingSetting>
{
new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"},
new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"}
}
},
new TranscodingProfile
{
Container = "jpeg",
Type = DlnaProfileType.Photo
2014-03-22 19:37:15 +00:00
}
2014-03-17 14:48:16 +00:00
},
2014-03-13 20:35:12 +00:00
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi",
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1",
AudioCodec = "ac3,dca,mp2,mp3,pcm"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mpeg",
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video",
AudioCodec = "ac3,dca,mp2,mp3,pcm"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mkv",
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1",
AudioCodec = "ac3,dca,aac,mp2,mp3,pcm"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "ts",
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video,h264,vc1",
AudioCodec = "ac3,dca,mp2,mp3"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4,mov",
Type = DlnaProfileType.Video,
VideoCodec = "h264,mpeg4",
AudioCodec = "ac3,aac,mp2,mp3"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "asf",
Type = DlnaProfileType.Video,
VideoCodec = "vc1",
AudioCodec = "wmav2,wmapro"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "asf",
Type = DlnaProfileType.Video,
VideoCodec = "mpeg2video",
AudioCodec = "mp2,ac3"
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3",
AudioCodec = "mp2,mp3",
2014-03-13 20:35:12 +00:00
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp4",
AudioCodec = "mp4",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "flac",
AudioCodec = "flac",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "asf",
AudioCodec = "wmav2,wmapro,wmavoice",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "ogg",
AudioCodec = "vorbis",
Type = DlnaProfileType.Audio
2014-03-22 20:02:10 +00:00
},
new DirectPlayProfile
{
Type = DlnaProfileType.Photo,
2014-03-23 06:07:43 +00:00
Container = "jpeg,png,gif,bmp,tiff",
2014-03-22 20:02:10 +00:00
Conditions = new List<ProfileCondition>
{
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",
2014-03-22 20:02:10 +00:00
Conditions = new List<ProfileCondition>
{
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",
2014-03-22 20:02:10 +00:00
Conditions = new List<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.AudioChannels, Value = "2"}
}
2014-03-13 20:35:12 +00:00
}
}
2014-03-13 21:36:19 +00:00
});
2014-03-13 19:08:02 +00:00
2014-03-15 04:14:07 +00:00
list.Add(new DeviceProfile
2014-03-13 19:08:02 +00:00
{
2014-03-22 19:37:15 +00:00
// Linksys DMA2100us does not need any transcoding of the formats we support statically
2014-03-13 21:36:19 +00:00
Name = "Linksys DMA2100",
2014-03-13 19:08:02 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
ModelName = "DMA2100us"
},
2014-03-13 19:08:02 +00:00
2014-03-13 21:36:19 +00:00
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3,flac,m4a,wma",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi,mp4,mkv,ts",
2014-03-13 21:36:19 +00:00
Type = DlnaProfileType.Video
}
}
});
list.Add(new DeviceProfile
2014-03-22 19:37:15 +00:00
{
Name = "Denon AVR",
2014-03-22 19:37:15 +00:00
ClientType = "DLNA",
2014-03-17 14:48:16 +00:00
Identification = new DeviceIdentification
{
FriendlyName = @"Denon:\[AVR:.*",
Manufacturer = "Denon"
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3,flac,m4a,wma",
Type = DlnaProfileType.Audio
},
}
});
2014-03-15 04:14:07 +00:00
foreach (var item in list)
{
//_xmlSerializer.SerializeToFile(item, "d:\\" + _fileSystem.GetValidFilename(item.Name));
}
2014-03-13 21:36:19 +00:00
return list;
2014-03-13 19:08:02 +00:00
}
2014-03-15 04:14:07 +00:00
public DeviceProfile GetDefaultProfile()
2014-03-13 19:08:02 +00:00
{
2014-03-15 04:14:07 +00:00
return new DeviceProfile
2014-03-13 20:35:12 +00:00
{
TranscodingProfiles = new[]
{
new TranscodingProfile
{
Container = "mp3",
2014-03-23 05:10:33 +00:00
AudioCodec = "mp3",
2014-03-13 20:35:12 +00:00
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
2014-03-23 05:10:33 +00:00
Type = DlnaProfileType.Video,
AudioCodec = "aac",
VideoCodec = "h264",
Settings = new List<TranscodingSetting>
{
new TranscodingSetting{ Name = TranscodingSettingType.VideoLevel, Value = "3"},
new TranscodingSetting{ Name = TranscodingSettingType.VideoProfile, Value = "baseline"}
}
2014-03-13 20:35:12 +00:00
}
2014-03-13 21:59:24 +00:00
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "mp3,wma",
2014-03-13 21:59:24 +00:00
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
2014-03-23 06:07:43 +00:00
Container = "avi,mp4",
2014-03-13 21:59:24 +00:00
Type = DlnaProfileType.Video
}
2014-03-13 20:35:12 +00:00
}
};
2014-03-13 19:08:02 +00:00
}
2014-03-17 14:48:16 +00:00
public DeviceProfile GetProfile(DeviceIdentification deviceInfo)
{
2014-03-22 19:37:15 +00:00
return GetProfiles().FirstOrDefault(i => IsMatch(deviceInfo, i.Identification)) ??
2014-03-17 14:48:16 +00:00
GetDefaultProfile();
}
private bool IsMatch(DeviceIdentification deviceInfo, DeviceIdentification profileInfo)
2014-03-13 19:08:02 +00:00
{
2014-03-18 01:45:41 +00:00
if (!string.IsNullOrWhiteSpace(profileInfo.DeviceDescription))
{
if (!Regex.IsMatch(deviceInfo.DeviceDescription, profileInfo.DeviceDescription))
return false;
}
if (!string.IsNullOrWhiteSpace(profileInfo.FriendlyName))
2014-03-13 19:08:02 +00:00
{
2014-03-17 14:48:16 +00:00
if (!Regex.IsMatch(deviceInfo.FriendlyName, profileInfo.FriendlyName))
return false;
}
2014-03-13 19:08:02 +00:00
2014-03-18 01:45:41 +00:00
if (!string.IsNullOrWhiteSpace(profileInfo.Manufacturer))
2014-03-17 14:48:16 +00:00
{
2014-03-18 01:45:41 +00:00
if (!Regex.IsMatch(deviceInfo.Manufacturer, profileInfo.Manufacturer))
2014-03-17 14:48:16 +00:00
return false;
}
2014-03-13 19:08:02 +00:00
2014-03-18 01:45:41 +00:00
if (!string.IsNullOrWhiteSpace(profileInfo.ManufacturerUrl))
{
if (!Regex.IsMatch(deviceInfo.ManufacturerUrl, profileInfo.ManufacturerUrl))
return false;
}
if (!string.IsNullOrWhiteSpace(profileInfo.ModelDescription))
{
if (!Regex.IsMatch(deviceInfo.ModelDescription, profileInfo.ModelDescription))
return false;
}
if (!string.IsNullOrWhiteSpace(profileInfo.ModelName))
2014-03-17 14:48:16 +00:00
{
if (!Regex.IsMatch(deviceInfo.ModelName, profileInfo.ModelName))
return false;
}
2014-03-13 19:08:02 +00:00
2014-03-18 01:45:41 +00:00
if (!string.IsNullOrWhiteSpace(profileInfo.ModelNumber))
2014-03-17 14:48:16 +00:00
{
2014-03-18 01:45:41 +00:00
if (!Regex.IsMatch(deviceInfo.ModelNumber, profileInfo.ModelNumber))
2014-03-17 14:48:16 +00:00
return false;
}
2014-03-18 01:45:41 +00:00
if (!string.IsNullOrWhiteSpace(profileInfo.ModelUrl))
2014-03-17 14:48:16 +00:00
{
2014-03-18 01:45:41 +00:00
if (!Regex.IsMatch(deviceInfo.ModelUrl, profileInfo.ModelUrl))
2014-03-17 14:48:16 +00:00
return false;
}
2014-03-13 19:08:02 +00:00
2014-03-18 01:45:41 +00:00
if (!string.IsNullOrWhiteSpace(profileInfo.SerialNumber))
2014-03-17 14:48:16 +00:00
{
if (!Regex.IsMatch(deviceInfo.SerialNumber, profileInfo.SerialNumber))
return false;
2014-03-13 19:08:02 +00:00
}
2014-03-17 14:48:16 +00:00
return true;
2014-03-13 19:08:02 +00:00
}
}
2014-03-14 14:27:32 +00:00
}