add more codecs to direct play profiles

pull/702/head
Luke Pulverenti 11 years ago
parent e2c0194744
commit 9b294c8bc9

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Dlna
{
@ -6,12 +7,16 @@ namespace MediaBrowser.Controller.Dlna
{
public CodecType Type { get; set; }
public List<ProfileCondition> Conditions { get; set; }
public string[] Codecs { get; set; }
public string Codec { get; set; }
public CodecProfile()
{
Conditions = new List<ProfileCondition>();
Codecs = new string[] { };
}
public List<string> GetCodecs()
{
return (Codec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
}
}

@ -58,6 +58,8 @@ namespace MediaBrowser.Controller.Dlna
public MediaProfile[] MediaProfiles { get; set; }
public CodecProfile[] CodecProfiles { get; set; }
public int TimelineOffsetSeconds { get; set; }
public DeviceProfile()
{
DirectPlayProfiles = new DirectPlayProfile[] { };

@ -1,12 +1,13 @@
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Dlna
{
public class DirectPlayProfile
{
public string[] Containers { get; set; }
public string[] AudioCodecs { get; set; }
public string[] VideoCodecs { get; set; }
public string AudioCodec { get; set; }
public string VideoCodec { get; set; }
public DlnaProfileType Type { get; set; }
@ -16,10 +17,18 @@ namespace MediaBrowser.Controller.Dlna
{
Conditions = new List<ProfileCondition>();
AudioCodecs = new string[] { };
VideoCodecs = new string[] { };
Containers = new string[] { };
}
public List<string> GetAudioCodecs()
{
return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
}
public List<string> GetVideoCodecs()
{
return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
}
}
public enum DlnaProfileType

@ -1,20 +1,26 @@

using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Dlna
{
public class MediaProfile
{
public string Container { get; set; }
public string[] AudioCodecs { get; set; }
public string[] VideoCodecs { get; set; }
public string AudioCodec { get; set; }
public string VideoCodec { get; set; }
public DlnaProfileType Type { get; set; }
public string OrgPn { get; set; }
public string MimeType { get; set; }
public MediaProfile()
public List<string> GetAudioCodecs()
{
return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
}
public List<string> GetVideoCodecs()
{
AudioCodecs = new string[] { };
VideoCodecs = new string[] { };
return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
}
}
}

@ -625,6 +625,8 @@ namespace MediaBrowser.Dlna
Name = "WDTV Live",
ClientType = "DLNA",
TimelineOffsetSeconds = 5,
Identification = new DeviceIdentification
{
ModelName = "WD TV HD Live",
@ -650,6 +652,11 @@ namespace MediaBrowser.Dlna
Type = DlnaProfileType.Video,
VideoCodec = "h264",
AudioCodec = "aac"
},
new TranscodingProfile
{
Container = "jpeg",
Type = DlnaProfileType.Photo
}
},
@ -657,20 +664,101 @@ namespace MediaBrowser.Dlna
{
new DirectPlayProfile
{
Containers = new[]{"mp3", "flac", "m4a", "wma", "aac"},
Containers = new[]{"avi"},
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1",
AudioCodec = "ac3,dca,mp2,mp3,pcm"
},
new DirectPlayProfile
{
Containers = new[]{"mpeg"},
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video",
AudioCodec = "ac3,dca,mp2,mp3,pcm"
},
new DirectPlayProfile
{
Containers = new[]{"mkv"},
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video,mpeg4,h264,vc1",
AudioCodec = "ac3,dca,aac,mp2,mp3,pcm"
},
new DirectPlayProfile
{
Containers = new[]{"ts"},
Type = DlnaProfileType.Video,
VideoCodec = "mpeg1video,mpeg2video,h264,vc1",
AudioCodec = "ac3,dca,mp2,mp3"
},
new DirectPlayProfile
{
Containers = new[]{"mp4", "mov"},
Type = DlnaProfileType.Video,
VideoCodec = "h264,mpeg4",
AudioCodec = "ac3,aac,mp2,mp3"
},
new DirectPlayProfile
{
Containers = new[]{"asf"},
Type = DlnaProfileType.Video,
VideoCodec = "vc1",
AudioCodec = "wmav2,wmapro"
},
new DirectPlayProfile
{
Containers = new[]{"asf"},
Type = DlnaProfileType.Video,
VideoCodec = "mpeg2video",
AudioCodec = "mp2,ac3"
},
new DirectPlayProfile
{
Containers = new[]{"mp3"},
AudioCodec = "mp2,mp3",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"avi", "mp4", "mkv", "ts"},
Type = DlnaProfileType.Video
Containers = new[]{"mp4"},
AudioCodec = "mp4",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"flac"},
AudioCodec = "flac",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"asf"},
AudioCodec = "wmav2,wmapro,wmavoice",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"ogg"},
AudioCodec = "vorbis",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Type = DlnaProfileType.Photo,
Containers = new[]{"jpeg", "png", "gif", "bmp", "tiff"},
Conditions = new List<ProfileCondition>
{
new ProfileCondition{ Condition = ProfileConditionType.LessThanEqual, Property = ProfileConditionValue.Width, Value = "1920"},
@ -694,7 +782,7 @@ namespace MediaBrowser.Dlna
new CodecProfile
{
Type = CodecType.VideoCodec,
Codecs = new[]{"h264"},
Codec= "h264",
Conditions = new List<ProfileCondition>
{
@ -707,7 +795,7 @@ namespace MediaBrowser.Dlna
new CodecProfile
{
Type = CodecType.VideoAudioCodec,
Codecs = new[]{"aac"},
Codec= "aac",
Conditions = new List<ProfileCondition>
{

@ -233,20 +233,22 @@ namespace MediaBrowser.Dlna.PlayTo
}
// Check video codec
if (profile.VideoCodecs.Length > 0)
var videoCodecs = profile.GetVideoCodecs();
if (videoCodecs.Count > 0)
{
var videoCodec = videoStream == null ? null : videoStream.Codec;
if (string.IsNullOrWhiteSpace(videoCodec) || !profile.VideoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase))
if (string.IsNullOrWhiteSpace(videoCodec) || !videoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase))
{
return false;
}
}
if (profile.AudioCodecs.Length > 0)
var audioCodecs = profile.GetAudioCodecs();
if (audioCodecs.Count > 0)
{
// Check audio codecs
var audioCodec = audioStream == null ? null : audioStream.Codec;
if (string.IsNullOrWhiteSpace(audioCodec) || !profile.AudioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase))
if (string.IsNullOrWhiteSpace(audioCodec) || !audioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase))
{
return false;
}

Loading…
Cancel
Save