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",
|
2014-03-15 18:47:50 +00:00
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
2014-03-15 18:47:50 +00:00
|
|
|
|
Type = DlnaProfileType.Audio,
|
2014-03-14 14:27:32 +00:00
|
|
|
|
},
|
2014-03-13 19:08:02 +00:00
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mkv"},
|
|
|
|
|
MimeType = "x-mkv",
|
|
|
|
|
Type = DlnaProfileType.Video
|
2014-03-13 21:36:19 +00:00
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
MimeType = "x-msvideo",
|
|
|
|
|
Type = DlnaProfileType.Video
|
2014-03-14 14:27:32 +00:00
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp4"},
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
2014-03-13 19:08:02 +00:00
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mkv"},
|
|
|
|
|
MimeType = "x-mkv",
|
|
|
|
|
Type = DlnaProfileType.Video
|
2014-03-13 21:36:19 +00:00
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
MimeType = "x-msvideo",
|
|
|
|
|
Type = DlnaProfileType.Video
|
2014-03-14 14:27:32 +00:00
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp4"},
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
2014-03-13 19:08:02 +00:00
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mkv"},
|
|
|
|
|
MimeType = "x-mkv",
|
|
|
|
|
Type = DlnaProfileType.Video
|
2014-03-13 21:36:19 +00:00
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
MimeType = "x-msvideo",
|
|
|
|
|
Type = DlnaProfileType.Video
|
2014-03-14 14:27:32 +00:00
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp4"},
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
Identification = new DeviceIdentification
|
|
|
|
|
{
|
|
|
|
|
ModelName = "Xbox 360"
|
|
|
|
|
},
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
2014-03-13 21:36:19 +00:00
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
2014-03-15 16:11:10 +00:00
|
|
|
|
MimeType = "avi",
|
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 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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
2014-03-13 21:36:19 +00:00
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
MimeType = "x-msvideo",
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
2014-03-13 21:36:19 +00:00
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
Type = DlnaProfileType.Video,
|
|
|
|
|
MimeType = "avi"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2014-03-13 19:08:02 +00:00
|
|
|
|
|
2014-03-15 16:11:10 +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.*)"
|
|
|
|
|
},
|
2014-03-15 16:11:10 +00:00
|
|
|
|
|
|
|
|
|
TranscodingProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "mp3",
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "ts",
|
|
|
|
|
Type = DlnaProfileType.Video,
|
|
|
|
|
MimeType = "mpeg"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"wma"},
|
|
|
|
|
Type = DlnaProfileType.Audio,
|
|
|
|
|
MimeType = "x-ms-wma"
|
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
Type = DlnaProfileType.Video,
|
|
|
|
|
MimeType = "avi"
|
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp4"},
|
|
|
|
|
Type = DlnaProfileType.Video,
|
|
|
|
|
MimeType = "mp4"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
list.Add(new DeviceProfile
|
|
|
|
|
{
|
|
|
|
|
//Panasonic Viera (2011|2012) Without AVI Support
|
|
|
|
|
Name = "Panasonic Viera E/S/ST/VT (2011)",
|
|
|
|
|
ClientType = "DLNA",
|
2014-03-17 14:48:16 +00:00
|
|
|
|
|
|
|
|
|
Identification = new DeviceIdentification
|
|
|
|
|
{
|
|
|
|
|
FriendlyName = @"(VIERA (E|S)T?(3|5)0?.*)|(VIERA VT30.*)",
|
|
|
|
|
Manufacturer = "Panasonic"
|
|
|
|
|
},
|
2014-03-15 16:11:10 +00:00
|
|
|
|
|
|
|
|
|
TranscodingProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "mp3",
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "ts",
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mkv"},
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
list.Add(new DeviceProfile
|
|
|
|
|
{
|
|
|
|
|
//Panasonic Viera (2011|2012) With AVI Support
|
|
|
|
|
Name = "Panasonic Viera G/GT/DT/UT/VT (2011/2012)",
|
|
|
|
|
ClientType = "DLNA",
|
2014-03-17 14:48:16 +00:00
|
|
|
|
|
|
|
|
|
Identification = new DeviceIdentification
|
|
|
|
|
{
|
|
|
|
|
FriendlyName = @"(VIERA (G|D|U)T?(3|5)0?.*)|(VIERA VT50.*)",
|
|
|
|
|
Manufacturer = "Panasonic"
|
|
|
|
|
},
|
2014-03-15 16:11:10 +00:00
|
|
|
|
|
|
|
|
|
TranscodingProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "mp3",
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "ts",
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mkv"},
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
},
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
Type = DlnaProfileType.Video ,
|
|
|
|
|
MimeType="divx"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//WDTV does not need any transcoding of the formats we support statically
|
|
|
|
|
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"
|
|
|
|
|
},
|
2014-03-15 16:11:10 +00:00
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3", "wma"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi"},
|
|
|
|
|
Type = DlnaProfileType.Video,
|
|
|
|
|
MimeType = "avi"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mkv"},
|
|
|
|
|
Type = DlnaProfileType.Video,
|
|
|
|
|
MimeType = "x-matroska"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2014-03-13 19:08:02 +00:00
|
|
|
|
//WDTV does not need any transcoding of the formats we support statically
|
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
|
|
|
|
|
|
|
|
|
Identification = new DeviceIdentification
|
|
|
|
|
{
|
|
|
|
|
ModelName = "WD TV HD Live"
|
|
|
|
|
},
|
2014-03-13 20:35:12 +00:00
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3", "flac", "m4a", "wma"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi", "mp4", "mkv", "ts"},
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
{
|
|
|
|
|
//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
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"mp3", "flac", "m4a", "wma"},
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi", "mp4", "mkv", "ts"},
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2014-03-15 16:11:10 +00:00
|
|
|
|
list.Add(new DeviceProfile
|
|
|
|
|
{
|
|
|
|
|
Name = "Denon AVR",
|
2014-03-17 14:48:16 +00:00
|
|
|
|
ClientType = "DLNA",
|
|
|
|
|
|
|
|
|
|
Identification = new DeviceIdentification
|
|
|
|
|
{
|
|
|
|
|
FriendlyName = @"Denon:\[AVR:.*",
|
|
|
|
|
Manufacturer = "Denon"
|
|
|
|
|
},
|
2014-03-15 16:11:10 +00:00
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"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",
|
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
new TranscodingProfile
|
|
|
|
|
{
|
|
|
|
|
Container = "ts",
|
|
|
|
|
Type = DlnaProfileType.Video
|
|
|
|
|
}
|
2014-03-13 21:59:24 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
DirectPlayProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
2014-03-14 14:27:32 +00:00
|
|
|
|
Containers = new[]{"mp3", "wma"},
|
2014-03-13 21:59:24 +00:00
|
|
|
|
Type = DlnaProfileType.Audio
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
new DirectPlayProfile
|
|
|
|
|
{
|
|
|
|
|
Containers = new[]{"avi", "mp4"},
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
return GetProfiles().FirstOrDefault(i => IsMatch(deviceInfo, i.Identification)) ??
|
|
|
|
|
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-15 16:11:10 +00:00
|
|
|
|
|
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
|
|
|
|
}
|