mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
added media profiles
This commit is contained in:
parent
76fe96e3e3
commit
bd7486b952
@ -67,5 +67,12 @@ namespace MediaBrowser.Controller.Dlna
|
|||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
public HeaderMatchType Match { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum HeaderMatchType
|
||||||
|
{
|
||||||
|
Equals = 0,
|
||||||
|
Substring = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,13 @@ namespace MediaBrowser.Controller.Dlna
|
|||||||
|
|
||||||
public string ProtocolInfo { get; set; }
|
public string ProtocolInfo { get; set; }
|
||||||
|
|
||||||
|
public MediaProfile[] MediaProfiles { get; set; }
|
||||||
|
|
||||||
public DeviceProfile()
|
public DeviceProfile()
|
||||||
{
|
{
|
||||||
DirectPlayProfiles = new DirectPlayProfile[] { };
|
DirectPlayProfiles = new DirectPlayProfile[] { };
|
||||||
TranscodingProfiles = new TranscodingProfile[] { };
|
TranscodingProfiles = new TranscodingProfile[] { };
|
||||||
|
MediaProfiles = new MediaProfile[] { };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,60 +1,13 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Dlna
|
namespace MediaBrowser.Controller.Dlna
|
||||||
{
|
{
|
||||||
public class DirectPlayProfile
|
public class DirectPlayProfile
|
||||||
{
|
{
|
||||||
public string Container { get; set; }
|
public string[] Containers { get; set; }
|
||||||
public string AudioCodec { get; set; }
|
public string[] AudioCodecs { get; set; }
|
||||||
public string VideoCodec { get; set; }
|
public string[] VideoCodecs { get; set; }
|
||||||
|
|
||||||
[IgnoreDataMember]
|
|
||||||
[XmlIgnore]
|
|
||||||
public string[] Containers
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (Container ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Container = value == null ? null : string.Join(",", value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[IgnoreDataMember]
|
|
||||||
[XmlIgnore]
|
|
||||||
public string[] AudioCodecs
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (AudioCodec ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
AudioCodec = value == null ? null : string.Join(",", value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[IgnoreDataMember]
|
|
||||||
[XmlIgnore]
|
|
||||||
public string[] VideoCodecs
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (VideoCodec ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
VideoCodec = value == null ? null : string.Join(",", value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string OrgPn { get; set; }
|
|
||||||
public string MimeType { get; set; }
|
|
||||||
public DlnaProfileType Type { get; set; }
|
public DlnaProfileType Type { get; set; }
|
||||||
|
|
||||||
public List<ProfileCondition> Conditions { get; set; }
|
public List<ProfileCondition> Conditions { get; set; }
|
||||||
@ -62,6 +15,10 @@ namespace MediaBrowser.Controller.Dlna
|
|||||||
public DirectPlayProfile()
|
public DirectPlayProfile()
|
||||||
{
|
{
|
||||||
Conditions = new List<ProfileCondition>();
|
Conditions = new List<ProfileCondition>();
|
||||||
|
|
||||||
|
AudioCodecs = new string[] { };
|
||||||
|
VideoCodecs = new string[] { };
|
||||||
|
Containers = new string[] { };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +52,7 @@ namespace MediaBrowser.Controller.Dlna
|
|||||||
VideoWidth,
|
VideoWidth,
|
||||||
VideoHeight,
|
VideoHeight,
|
||||||
VideoBitrate,
|
VideoBitrate,
|
||||||
VideoFramerate
|
VideoFramerate,
|
||||||
|
VideoLevel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
MediaBrowser.Controller/Dlna/MediaProfile.cs
Normal file
20
MediaBrowser.Controller/Dlna/MediaProfile.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Dlna
|
||||||
|
{
|
||||||
|
public class MediaProfile
|
||||||
|
{
|
||||||
|
public string Container { get; set; }
|
||||||
|
public string[] AudioCodecs { get; set; }
|
||||||
|
public string[] VideoCodecs { get; set; }
|
||||||
|
|
||||||
|
public DlnaProfileType Type { get; set; }
|
||||||
|
public string OrgPn { get; set; }
|
||||||
|
public string MimeType { get; set; }
|
||||||
|
|
||||||
|
public MediaProfile()
|
||||||
|
{
|
||||||
|
AudioCodecs = new string[] { };
|
||||||
|
VideoCodecs = new string[] { };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,12 +8,7 @@ namespace MediaBrowser.Controller.Dlna
|
|||||||
|
|
||||||
public DlnaProfileType Type { get; set; }
|
public DlnaProfileType Type { get; set; }
|
||||||
|
|
||||||
public string MimeType { get; set; }
|
|
||||||
|
|
||||||
public string OrgPn { get; set; }
|
|
||||||
|
|
||||||
public string VideoCodec { get; set; }
|
public string VideoCodec { get; set; }
|
||||||
|
|
||||||
public string AudioCodec { get; set; }
|
public string AudioCodec { get; set; }
|
||||||
|
|
||||||
public List<TranscodingSetting> Settings { get; set; }
|
public List<TranscodingSetting> Settings { get; set; }
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
<Compile Include="Dlna\DirectPlayProfile.cs" />
|
<Compile Include="Dlna\DirectPlayProfile.cs" />
|
||||||
<Compile Include="Dlna\IDlnaManager.cs" />
|
<Compile Include="Dlna\IDlnaManager.cs" />
|
||||||
<Compile Include="Dlna\DeviceProfile.cs" />
|
<Compile Include="Dlna\DeviceProfile.cs" />
|
||||||
|
<Compile Include="Dlna\MediaProfile.cs" />
|
||||||
<Compile Include="Dlna\TranscodingProfile.cs" />
|
<Compile Include="Dlna\TranscodingProfile.cs" />
|
||||||
<Compile Include="Drawing\IImageProcessor.cs" />
|
<Compile Include="Drawing\IImageProcessor.cs" />
|
||||||
<Compile Include="Drawing\ImageFormat.cs" />
|
<Compile Include="Drawing\ImageFormat.cs" />
|
||||||
|
@ -62,13 +62,11 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"mkv"},
|
Containers = new[]{"mkv"},
|
||||||
MimeType = "x-mkv",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
MimeType = "x-msvideo",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
@ -76,6 +74,23 @@ namespace MediaBrowser.Dlna
|
|||||||
Containers = new[]{"mp4"},
|
Containers = new[]{"mp4"},
|
||||||
Type = DlnaProfileType.Video
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -114,13 +129,11 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"mkv"},
|
Containers = new[]{"mkv"},
|
||||||
MimeType = "x-mkv",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
MimeType = "x-msvideo",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
@ -128,6 +141,23 @@ namespace MediaBrowser.Dlna
|
|||||||
Containers = new[]{"mp4"},
|
Containers = new[]{"mp4"},
|
||||||
Type = DlnaProfileType.Video
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -166,13 +196,11 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"mkv"},
|
Containers = new[]{"mkv"},
|
||||||
MimeType = "x-mkv",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
MimeType = "x-msvideo",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
@ -180,6 +208,23 @@ namespace MediaBrowser.Dlna
|
|||||||
Containers = new[]{"mp4"},
|
Containers = new[]{"mp4"},
|
||||||
Type = DlnaProfileType.Video
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,7 +262,6 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
MimeType = "avi",
|
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
@ -225,6 +269,16 @@ namespace MediaBrowser.Dlna
|
|||||||
Containers = new[]{"mp4"},
|
Containers = new[]{"mp4"},
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
MediaProfiles = new[]
|
||||||
|
{
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="avi",
|
||||||
|
MimeType = "video/avi",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -263,7 +317,16 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
MimeType = "x-msvideo",
|
Type = DlnaProfileType.Video
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
MediaProfiles = new[]
|
||||||
|
{
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="avi",
|
||||||
|
MimeType = "video/x-msvideo",
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,14 +366,29 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video
|
||||||
MimeType = "avi"
|
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"asf"},
|
Containers = new[]{"asf"},
|
||||||
Type = DlnaProfileType.Audio,
|
Type = DlnaProfileType.Audio
|
||||||
MimeType = "x-ms-wmv"
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
MediaProfiles = new[]
|
||||||
|
{
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="avi",
|
||||||
|
MimeType = "video/avi",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
|
},
|
||||||
|
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="asf",
|
||||||
|
MimeType = "video/x-ms-wmv",
|
||||||
|
Type = DlnaProfileType.Audio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -335,8 +413,7 @@ namespace MediaBrowser.Dlna
|
|||||||
new TranscodingProfile
|
new TranscodingProfile
|
||||||
{
|
{
|
||||||
Container = "ts",
|
Container = "ts",
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video
|
||||||
MimeType = "mpeg"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -350,20 +427,48 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"wma"},
|
Containers = new[]{"wma"},
|
||||||
Type = DlnaProfileType.Audio,
|
Type = DlnaProfileType.Audio
|
||||||
MimeType = "x-ms-wma"
|
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video
|
||||||
MimeType = "avi"
|
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"mp4"},
|
Containers = new[]{"mp4"},
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video
|
||||||
MimeType = "mp4"
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -450,13 +555,21 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
Type = DlnaProfileType.Video ,
|
Type = DlnaProfileType.Video
|
||||||
MimeType="divx"
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
MediaProfiles = new[]
|
||||||
|
{
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="avi",
|
||||||
|
MimeType = "video/divx",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//WDTV does not need any transcoding of the formats we support statically
|
|
||||||
list.Add(new DeviceProfile
|
list.Add(new DeviceProfile
|
||||||
{
|
{
|
||||||
Name = "Philips (2010-)",
|
Name = "Philips (2010-)",
|
||||||
@ -479,20 +592,34 @@ namespace MediaBrowser.Dlna
|
|||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"avi"},
|
Containers = new[]{"avi"},
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video
|
||||||
MimeType = "avi"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Containers = new[]{"mkv"},
|
Containers = new[]{"mkv"},
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video
|
||||||
MimeType = "x-matroska"
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
MediaProfiles = new[]
|
||||||
|
{
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="avi",
|
||||||
|
MimeType = "video/avi",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
|
},
|
||||||
|
|
||||||
|
new MediaProfile
|
||||||
|
{
|
||||||
|
Container ="mkv",
|
||||||
|
MimeType = "video/x-matroska",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//WDTV does not need any transcoding of the formats we support statically
|
|
||||||
list.Add(new DeviceProfile
|
list.Add(new DeviceProfile
|
||||||
{
|
{
|
||||||
Name = "WDTV Live",
|
Name = "WDTV Live",
|
||||||
@ -500,7 +627,30 @@ namespace MediaBrowser.Dlna
|
|||||||
|
|
||||||
Identification = new DeviceIdentification
|
Identification = new DeviceIdentification
|
||||||
{
|
{
|
||||||
ModelName = "WD TV HD Live"
|
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",
|
||||||
|
AudioCodec = "aac"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DirectPlayProfiles = new[]
|
DirectPlayProfiles = new[]
|
||||||
@ -521,7 +671,7 @@ namespace MediaBrowser.Dlna
|
|||||||
|
|
||||||
list.Add(new DeviceProfile
|
list.Add(new DeviceProfile
|
||||||
{
|
{
|
||||||
//Linksys DMA2100us does not need any transcoding of the formats we support statically
|
// Linksys DMA2100us does not need any transcoding of the formats we support statically
|
||||||
Name = "Linksys DMA2100",
|
Name = "Linksys DMA2100",
|
||||||
ClientType = "DLNA",
|
ClientType = "DLNA",
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
|
|
||||||
public DlnaProfileType MediaType { get; set; }
|
public DlnaProfileType MediaType { get; set; }
|
||||||
|
|
||||||
public string FileFormat { get; set; }
|
public string Container { get; set; }
|
||||||
|
|
||||||
public string MimeType { get; set; }
|
public string MimeType { get; set; }
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
if (directPlay != null)
|
if (directPlay != null)
|
||||||
{
|
{
|
||||||
playlistItem.Transcode = false;
|
playlistItem.Transcode = false;
|
||||||
playlistItem.FileFormat = Path.GetExtension(item.Path);
|
playlistItem.Container = Path.GetExtension(item.Path);
|
||||||
playlistItem.MimeType = directPlay.MimeType;
|
|
||||||
|
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
@ -55,10 +54,11 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
{
|
{
|
||||||
playlistItem.Transcode = true;
|
playlistItem.Transcode = true;
|
||||||
|
|
||||||
playlistItem.FileFormat = "." + transcodingProfile.Container.TrimStart('.');
|
playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.');
|
||||||
playlistItem.MimeType = transcodingProfile.MimeType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachMediaProfile(playlistItem, profile);
|
||||||
|
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
if (directPlay != null)
|
if (directPlay != null)
|
||||||
{
|
{
|
||||||
playlistItem.Transcode = false;
|
playlistItem.Transcode = false;
|
||||||
playlistItem.FileFormat = Path.GetExtension(item.Path);
|
playlistItem.Container = Path.GetExtension(item.Path);
|
||||||
playlistItem.MimeType = directPlay.MimeType;
|
|
||||||
|
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
@ -89,10 +88,11 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
{
|
{
|
||||||
playlistItem.Transcode = true;
|
playlistItem.Transcode = true;
|
||||||
|
|
||||||
playlistItem.FileFormat = "." + transcodingProfile.Container.TrimStart('.');
|
playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.');
|
||||||
playlistItem.MimeType = transcodingProfile.MimeType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachMediaProfile(playlistItem, profile);
|
||||||
|
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +119,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
if (directPlay != null)
|
if (directPlay != null)
|
||||||
{
|
{
|
||||||
playlistItem.Transcode = false;
|
playlistItem.Transcode = false;
|
||||||
playlistItem.FileFormat = Path.GetExtension(item.Path);
|
playlistItem.Container = Path.GetExtension(item.Path);
|
||||||
playlistItem.MimeType = directPlay.MimeType;
|
|
||||||
|
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
@ -131,25 +130,55 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
if (transcodingProfile != null)
|
if (transcodingProfile != null)
|
||||||
{
|
{
|
||||||
playlistItem.Transcode = true;
|
playlistItem.Transcode = true;
|
||||||
|
playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.');
|
||||||
playlistItem.FileFormat = "." + transcodingProfile.Container.TrimStart('.');
|
|
||||||
playlistItem.MimeType = transcodingProfile.MimeType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachMediaProfile(playlistItem, profile);
|
||||||
|
|
||||||
return playlistItem;
|
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)
|
private bool IsSupported(DirectPlayProfile profile, Photo item)
|
||||||
{
|
{
|
||||||
var mediaPath = item.Path;
|
var mediaPath = item.Path;
|
||||||
|
|
||||||
|
// Check container type
|
||||||
var mediaContainer = Path.GetExtension(mediaPath);
|
var mediaContainer = Path.GetExtension(mediaPath);
|
||||||
|
|
||||||
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check additional conditions
|
||||||
if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, null, null)))
|
if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, null, null)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -162,13 +191,14 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
{
|
{
|
||||||
var mediaPath = item.Path;
|
var mediaPath = item.Path;
|
||||||
|
|
||||||
|
// Check container type
|
||||||
var mediaContainer = Path.GetExtension(mediaPath);
|
var mediaContainer = Path.GetExtension(mediaPath);
|
||||||
|
|
||||||
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check additional conditions
|
||||||
if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, null, audioStream)))
|
if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, null, audioStream)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -186,13 +216,34 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
|
|
||||||
var mediaPath = item.Path;
|
var mediaPath = item.Path;
|
||||||
|
|
||||||
|
// Check container type
|
||||||
var mediaContainer = Path.GetExtension(mediaPath);
|
var mediaContainer = Path.GetExtension(mediaPath);
|
||||||
|
|
||||||
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check video codec
|
||||||
|
if (profile.VideoCodecs.Length > 0)
|
||||||
|
{
|
||||||
|
var videoCodec = videoStream == null ? null : videoStream.Codec;
|
||||||
|
if (string.IsNullOrWhiteSpace(videoCodec) || !profile.VideoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile.AudioCodecs.Length > 0)
|
||||||
|
{
|
||||||
|
// Check audio codecs
|
||||||
|
var audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||||
|
if (string.IsNullOrWhiteSpace(audioCodec) || !profile.AudioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check additional conditions
|
||||||
if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, videoStream, audioStream)))
|
if (!profile.Conditions.Any(i => IsConditionSatisfied(i, mediaPath, videoStream, audioStream)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -283,6 +334,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
return videoStream == null ? null : videoStream.Height;
|
return videoStream == null ? null : videoStream.Height;
|
||||||
case ProfileConditionValue.VideoWidth:
|
case ProfileConditionValue.VideoWidth:
|
||||||
return videoStream == null ? null : videoStream.Width;
|
return videoStream == null ? null : videoStream.Width;
|
||||||
|
case ProfileConditionValue.VideoLevel:
|
||||||
|
return videoStream == null ? null : ConvertToLong(videoStream.Level);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("Unexpected Property");
|
throw new InvalidOperationException("Unexpected Property");
|
||||||
}
|
}
|
||||||
@ -297,5 +350,15 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
{
|
{
|
||||||
return val.HasValue ? Convert.ToInt64(val.Value) : (long?)null;
|
return val.HasValue ? Convert.ToInt64(val.Value) : (long?)null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts to long.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="val">The value.</param>
|
||||||
|
/// <returns>System.Nullable{System.Int64}.</returns>
|
||||||
|
private long? ConvertToLong(double? val)
|
||||||
|
{
|
||||||
|
return val.HasValue ? Convert.ToInt64(val.Value) : (long?)null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,39 +24,39 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
|
|
||||||
var contentFeatures = string.Empty;
|
var contentFeatures = string.Empty;
|
||||||
|
|
||||||
if (string.Equals(item.FileFormat, "mp3", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(item.Container, "mp3", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=MP3";
|
contentFeatures = "DLNA.ORG_PN=MP3";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "wma", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "wma", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=WMABASE";
|
contentFeatures = "DLNA.ORG_PN=WMABASE";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "wmw", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "wmw", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=WMVMED_BASE";
|
contentFeatures = "DLNA.ORG_PN=WMVMED_BASE";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "asf", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "asf", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=WMVMED_BASE";
|
contentFeatures = "DLNA.ORG_PN=WMVMED_BASE";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "avi", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "avi", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=AVI";
|
contentFeatures = "DLNA.ORG_PN=AVI";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "mkv", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "mkv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=MATROSKA";
|
contentFeatures = "DLNA.ORG_PN=MATROSKA";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "mp4", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "mp4", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=AVC_MP4_MP_HD_720p_AAC";
|
contentFeatures = "DLNA.ORG_PN=AVC_MP4_MP_HD_720p_AAC";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "mpeg", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "mpeg", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL";
|
contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL";
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.FileFormat, "ts", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.Container, "ts", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL";
|
contentFeatures = "DLNA.ORG_PN=MPEG_PS_PAL";
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
internal static string GetAudioUrl(PlaylistItem item, string serverAddress)
|
internal static string GetAudioUrl(PlaylistItem item, string serverAddress)
|
||||||
{
|
{
|
||||||
if (!item.Transcode)
|
if (!item.Transcode)
|
||||||
return string.Format("{0}/audio/{1}/stream{2}?Static=True", serverAddress, item.ItemId, item.FileFormat);
|
return string.Format("{0}/audio/{1}/stream{2}?Static=True", serverAddress, item.ItemId, item.Container);
|
||||||
|
|
||||||
return string.Format("{0}/audio/{1}/stream.mp3?AudioCodec=Mp3", serverAddress, item.ItemId);
|
return string.Format("{0}/audio/{1}/stream.mp3?AudioCodec=Mp3", serverAddress, item.ItemId);
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
if (!item.Transcode)
|
if (!item.Transcode)
|
||||||
{
|
{
|
||||||
dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, !item.Transcode, null, null, null, null, null, null, null, null, null, null, item.MimeType);
|
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.FileFormat, dlnaCommand);
|
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 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 audiostream = streams.Where(m => m.Type == MediaStreamType.Audio).OrderBy(m => m.IsDefault).FirstOrDefault();
|
||||||
@ -129,7 +129,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, !item.Transcode, videoCodec, audioCodec, null, null, videoBitrate, audioChannels, audioBitrate, item.StartPositionTicks, "baseline", "3", item.MimeType);
|
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.FileFormat, dlnaCommand);
|
return string.Format("{0}/Videos/{1}/stream{2}?{3}", serverAddress, item.ItemId, item.Container, dlnaCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user