update live tv data transfer

This commit is contained in:
Luke Pulverenti
2017-08-19 15:43:35 -04:00
parent bd31c0175d
commit 1ad990ad72
175 changed files with 997 additions and 1351 deletions

View File

@@ -7,33 +7,33 @@ namespace MediaBrowser.Model.Dlna
{
public class MediaFormatProfileResolver
{
public List<MediaFormatProfile> ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
public MediaFormatProfile[] ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
if (StringHelper.EqualsIgnoreCase(container, "asf"))
{
MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);
return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[]{};
}
if (StringHelper.EqualsIgnoreCase(container, "mp4"))
{
MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);
return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
if (StringHelper.EqualsIgnoreCase(container, "avi"))
return new List<MediaFormatProfile> { MediaFormatProfile.AVI };
return new MediaFormatProfile[] { MediaFormatProfile.AVI };
if (StringHelper.EqualsIgnoreCase(container, "mkv"))
return new List<MediaFormatProfile> { MediaFormatProfile.MATROSKA };
return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") ||
StringHelper.EqualsIgnoreCase(container, "ts"))
return new List<MediaFormatProfile> { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
if (StringHelper.EqualsIgnoreCase(container, "mpeg1video"))
return new List<MediaFormatProfile> { MediaFormatProfile.MPEG1 };
return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") ||
StringHelper.EqualsIgnoreCase(container, "mpegts") ||
@@ -44,24 +44,24 @@ namespace MediaBrowser.Model.Dlna
}
if (StringHelper.EqualsIgnoreCase(container, "flv"))
return new List<MediaFormatProfile> { MediaFormatProfile.FLV };
return new MediaFormatProfile[] { MediaFormatProfile.FLV };
if (StringHelper.EqualsIgnoreCase(container, "wtv"))
return new List<MediaFormatProfile> { MediaFormatProfile.WTV };
return new MediaFormatProfile[] { MediaFormatProfile.WTV };
if (StringHelper.EqualsIgnoreCase(container, "3gp"))
{
MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);
return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
}
if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg"))
return new List<MediaFormatProfile> { MediaFormatProfile.OGV };
return new MediaFormatProfile[] { MediaFormatProfile.OGV };
return new List<MediaFormatProfile>();
return new MediaFormatProfile[] { };
}
private List<MediaFormatProfile> ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
string suffix = "";
@@ -93,41 +93,41 @@ namespace MediaBrowser.Model.Dlna
{
list.Add(MediaFormatProfile.MPEG_TS_JP_T);
}
return list;
return list.ToArray(list.Count);
}
if (StringHelper.EqualsIgnoreCase(videoCodec, "h264"))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
if (timestampType == TransportStreamTimestamp.None)
{
return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
}
return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_T };
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
{
if (timestampType == TransportStreamTimestamp.None)
{
return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
}
return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
if (string.IsNullOrEmpty(audioCodec) ||
StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
{
@@ -135,31 +135,31 @@ namespace MediaBrowser.Model.Dlna
{
if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576))
{
return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };
}
return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T";
return new List<MediaFormatProfile> { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };
}
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") || StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4"))
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
}
return new List<MediaFormatProfile>();
return new MediaFormatProfile[]{};
}
private MediaFormatProfile ValueOf(string value)