aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-22 16:50:28 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-22 16:50:28 -0400
commit9b294c8bc96b31f6c458cc47fa8d330be2df086a (patch)
treea45f20a51af3842097e1ca98ff7653a6a8523675
parente2c01947443379f38f55bc9fed223c92410b4e10 (diff)
add more codecs to direct play profiles
-rw-r--r--MediaBrowser.Controller/Dlna/CodecProfile.cs9
-rw-r--r--MediaBrowser.Controller/Dlna/DeviceProfile.cs2
-rw-r--r--MediaBrowser.Controller/Dlna/DirectPlayProfile.cs17
-rw-r--r--MediaBrowser.Controller/Dlna/MediaProfile.cs20
-rw-r--r--MediaBrowser.Dlna/DlnaManager.cs100
-rw-r--r--MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs10
6 files changed, 135 insertions, 23 deletions
diff --git a/MediaBrowser.Controller/Dlna/CodecProfile.cs b/MediaBrowser.Controller/Dlna/CodecProfile.cs
index f17805654..bff374298 100644
--- a/MediaBrowser.Controller/Dlna/CodecProfile.cs
+++ b/MediaBrowser.Controller/Dlna/CodecProfile.cs
@@ -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();
}
}
diff --git a/MediaBrowser.Controller/Dlna/DeviceProfile.cs b/MediaBrowser.Controller/Dlna/DeviceProfile.cs
index 179321a53..91be73bba 100644
--- a/MediaBrowser.Controller/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Controller/Dlna/DeviceProfile.cs
@@ -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[] { };
diff --git a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs
index 29665cbec..53d32a2f8 100644
--- a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs
+++ b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs
@@ -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
diff --git a/MediaBrowser.Controller/Dlna/MediaProfile.cs b/MediaBrowser.Controller/Dlna/MediaProfile.cs
index c237b1f91..5fa41b18a 100644
--- a/MediaBrowser.Controller/Dlna/MediaProfile.cs
+++ b/MediaBrowser.Controller/Dlna/MediaProfile.cs
@@ -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();
}
}
}
diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs
index fd74ba24a..be7295e12 100644
--- a/MediaBrowser.Dlna/DlnaManager.cs
+++ b/MediaBrowser.Dlna/DlnaManager.cs
@@ -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>
{
@@ -706,8 +794,8 @@ namespace MediaBrowser.Dlna
new CodecProfile
{
- Type = CodecType.VideoAudioCodec,
- Codecs = new[]{"aac"},
+ Type = CodecType.VideoAudioCodec,
+ Codec= "aac",
Conditions = new List<ProfileCondition>
{
diff --git a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs
index 968f7643a..6817c4eaa 100644
--- a/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs
+++ b/MediaBrowser.Dlna/PlayTo/PlaylistItemFactory.cs
@@ -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;
}