|
|
|
@ -32,18 +32,25 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.AVI };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "mkv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "mpeg2ps", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(container, "ts", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "mpeg1video", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "mpeg2ts", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(container, "mpegts", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
@ -54,10 +61,14 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "flv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.FLV };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "wtv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.WTV };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
@ -66,7 +77,9 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.OGV };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Array.Empty<MediaFormatProfile>();
|
|
|
|
|
}
|
|
|
|
@ -111,7 +124,9 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "dts", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
@ -134,14 +149,20 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(audioCodec) ||
|
|
|
|
|
string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(videoCodec, "vc1", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
@ -165,13 +186,24 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "mp2", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new MediaFormatProfile[] { };
|
|
|
|
@ -187,7 +219,9 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.AVC_MP4_LPCM;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(audioCodec) ||
|
|
|
|
|
string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
@ -204,12 +238,16 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if ((width.Value <= 720) && (height.Value <= 576))
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.AVC_MP4_MP_SD_AAC_MULT5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ((width.Value <= 1280) && (height.Value <= 720))
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.AVC_MP4_MP_HD_720p_AAC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ((width.Value <= 1920) && (height.Value <= 1080))
|
|
|
|
|
{
|
|
|
|
@ -226,7 +264,9 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (width.HasValue && height.HasValue && width.Value <= 720 && height.Value <= 576)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.MPEG4_P2_MP4_ASP_AAC;
|
|
|
|
|
}
|
|
|
|
|
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase) || string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.MPEG4_P2_MP4_NDSD;
|
|
|
|
@ -250,15 +290,22 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.AVC_3GPP_BL_QCIF15_AAC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AAC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AMR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(videoCodec, "h263", StringComparison.OrdinalIgnoreCase) && string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
@ -300,11 +347,19 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (width.HasValue && height.HasValue)
|
|
|
|
|
{
|
|
|
|
|
if ((width.Value <= 720) && (height.Value <= 576))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.VC1_ASF_AP_L1_WMA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((width.Value <= 1280) && (height.Value <= 720))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.VC1_ASF_AP_L2_WMA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((width.Value <= 1920) && (height.Value <= 1080))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.VC1_ASF_AP_L3_WMA;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
|
|
|
|
@ -318,27 +373,41 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
public MediaFormatProfile? ResolveAudioFormat(string container, int? bitrate, int? frequency, int? channels)
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ResolveAudioASFFormat(bitrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "mp3", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.MP3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "lpcm", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ResolveAudioLPCMFormat(frequency, channels);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(container, "aac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ResolveAudioMP4Format(bitrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "adts", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ResolveAudioADTSFormat(bitrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "flac", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.FLAC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "oga", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
|
string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.OGG;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -410,13 +479,19 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
return ResolveImageJPGFormat(width, height);
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "png", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ResolveImagePNGFormat(width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "gif", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.GIF_LRG;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(container, "raw", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.RAW;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -426,10 +501,14 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (width.HasValue && height.HasValue)
|
|
|
|
|
{
|
|
|
|
|
if ((width.Value <= 160) && (height.Value <= 160))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.JPEG_TN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((width.Value <= 640) && (height.Value <= 480))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.JPEG_SM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((width.Value <= 1024) && (height.Value <= 768))
|
|
|
|
|
{
|
|
|
|
@ -447,7 +526,9 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
if (width.HasValue && height.HasValue)
|
|
|
|
|
{
|
|
|
|
|
if ((width.Value <= 160) && (height.Value <= 160))
|
|
|
|
|
{
|
|
|
|
|
return MediaFormatProfile.PNG_TN;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return MediaFormatProfile.PNG_LRG;
|
|
|
|
|