public static Stream Parse(string s, LogItem _log) { //EVO, 1 video track, 1 audio track, 3 subtitle tracks, 1:43:54 //"director" ///////////////////////////////////////////////////////////////// //////// input file /* * M2TS, 1 video track, 1 audio track, 0:00:11, 60i /1.001 * 1: h264/AVC, 1080i60 /1.001 (16:9) * 2: AC3, 5.1 channels, 640kbps, 48khz */ if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); } string strIdentifier = s.Split(',')[0]; Stream stream = null; if (strIdentifier.Contains("AVC") || strIdentifier.Contains("MVC") || strIdentifier.Contains("VC-1") || strIdentifier.Contains("MPEG") || strIdentifier.Contains("DIRAC") || strIdentifier.Contains("THEORA") || strIdentifier.Contains("HEVC")) { stream = VideoStream.Parse(s, _log); } else if (strIdentifier.Contains("AC3") || strIdentifier.Contains("TrueHD") || strIdentifier.Contains("DTS") || strIdentifier.Contains("RAW") || strIdentifier.Contains("PCM") || strIdentifier.Contains("MP") || strIdentifier.Contains("AAC") || strIdentifier.Contains("FLAC") || strIdentifier.Contains("WAVPACK") || strIdentifier.Contains("TTA") || strIdentifier.Contains("VORBIS")) { stream = AudioStream.Parse(s, _log); } else if (strIdentifier.Contains("Subtitle")) { stream = SubtitleStream.Parse(s, _log); } else if (strIdentifier.Contains("Chapters")) { stream = ChapterStream.Parse(s, _log); } else if (strIdentifier.Contains("Joined")) { stream = JoinStream.Parse(s, _log); } else { stream = new UnknownStream(s, _log); } if ((stream is AudioStream && ((AudioStream)stream).AudioType == AudioStreamType.UNKNOWN) || (stream is SubtitleStream && ((SubtitleStream)stream).SubtitleType == SubtitleStreamType.UNKNOWN) || (stream is VideoStream && ((VideoStream)stream).VideoType == VideoStreamType.UNKNOWN)) { stream = new UnknownStream(s, _log); } return(stream); }
public static Stream Parse(string s) { //EVO, 1 video track, 1 audio track, 3 subtitle tracks, 1:43:54 //"director" ///////////////////////////////////////////////////////////////// //////// input file /* * M2TS, 1 video track, 1 audio track, 0:00:11, 60i /1.001 * 1: h264/AVC, 1080i60 /1.001 (16:9) * 2: AC3, 5.1 channels, 640kbps, 48khz */ if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); } Stream stream = null; if (s.Contains("AVC") || s.Contains("VC-1") || s.Contains("MPEG") || s.Contains("DIRAC") || s.Contains("THEORA")) { stream = VideoStream.Parse(s); } else if (s.Contains("AC3") || s.Contains("TrueHD") || s.Contains("DTS") || s.Contains("RAW") || s.Contains("PCM") || s.Contains("MP") || s.Contains("AAC") || s.Contains("FLAC") || s.Contains("WAVPACK") || s.Contains("TTA") || s.Contains("VORBIS")) { stream = AudioStream.Parse(s); } else if (s.Contains("Subtitle")) { stream = SubtitleStream.Parse(s); } else if (s.Contains("Chapters")) { stream = ChapterStream.Parse(s); } else if (s.Contains("Joined")) { stream = JoinStream.Parse(s); } return(stream); }
new public static Stream Parse(string s) { //5: Subtitle, English, "SDH" //6: Subtitle, French //7: Subtitle, Spanish if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); } SubtitleStream subtitleStream = new SubtitleStream(s); subtitleStream.Language = (s.IndexOf(',') == s.LastIndexOf(',')) ? s.Substring(s.IndexOf(',') + 1).Trim() : s.Substring(s.IndexOf(',') + 1, s.LastIndexOf(',') - s.IndexOf(',') - 1).Trim(); subtitleStream.IsSDH = s.Contains("\"SDH\"") ? true : false; return(new SubtitleStream(s)); }
new public static Stream Parse(string s) { //5: Subtitle, English, "SDH" //6: Subtitle, French //7: Subtitle, Spanish if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); } SubtitleStream subtitleStream = new SubtitleStream(s); switch (subtitleStream.Description.ToUpper().Substring(subtitleStream.Description.IndexOf('(') + 1, 3)) { case "ASS": subtitleStream.SubtitleType = SubtitleStreamType.ASS; break; case "SSA": subtitleStream.SubtitleType = SubtitleStreamType.SSA; break; case "SRT": subtitleStream.SubtitleType = SubtitleStreamType.SRT; break; case "VOB": subtitleStream.SubtitleType = SubtitleStreamType.SUB; break; case "SUP": default: subtitleStream.SubtitleType = SubtitleStreamType.SUP; break; } subtitleStream.Language = (s.IndexOf(',') == s.LastIndexOf(',')) ? s.Substring(s.IndexOf(',') + 1).Trim() : s.Substring(s.IndexOf(',') + 1, s.LastIndexOf(',') - s.IndexOf(',') - 1).Trim(); subtitleStream.IsSDH = s.Contains("\"SDH\""); return(subtitleStream); }
new public static Stream Parse(string s, LogItem _log) { //5: Subtitle, English, "SDH" //6: Subtitle, French //7: Subtitle, Spanish if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); } string type = s.Substring(s.IndexOf(":") + 12, 3).Trim(); SubtitleStream subtitleStream = new SubtitleStream(s, _log); switch (type.ToUpperInvariant()) { case "ASS": subtitleStream.SubtitleType = SubtitleStreamType.ASS; break; case "SSA": subtitleStream.SubtitleType = SubtitleStreamType.SSA; break; case "SRT": subtitleStream.SubtitleType = SubtitleStreamType.SRT; break; case "PGS": subtitleStream.SubtitleType = SubtitleStreamType.SUP; break; case "VOB": subtitleStream.SubtitleType = SubtitleStreamType.UNKNOWN; break; default: _log.Warn("\"" + type + "\" is not known. " + s); subtitleStream.SubtitleType = SubtitleStreamType.UNKNOWN; break; } subtitleStream.IsSDH = s.Contains("\"SDH\"") ? true : false; return(subtitleStream); }
public static Stream Parse(string s) { //EVO, 1 video track, 1 audio track, 3 subtitle tracks, 1:43:54 //"director" if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); } Stream stream = null; if (s.Contains("AVC") || s.Contains("VC-1") || s.Contains("MPEG") || s.Contains("DIRAC") || s.Contains("THEORA")) { stream = VideoStream.Parse(s); } else if (s.Contains("AC3") || s.Contains("TrueHD") || s.Contains("DTS") || s.Contains("RAW") || s.Contains("PCM") || s.Contains("MP") || s.Contains("AAC") || s.Contains("FLAC") || s.Contains("WAVPACK") || s.Contains("TTA") || s.Contains("VORBIS")) { stream = AudioStream.Parse(s); } else if (s.Contains("Subtitle")) { stream = SubtitleStream.Parse(s); } else if (s.Contains("Chapters")) { stream = ChapterStream.Parse(s); } else if (s.Contains("Joined")) { stream = JoinStream.Parse(s); } return(stream); }
public static new Stream Parse(string s) { //5: Subtitle, English, "SDH" //6: Subtitle, French //7: Subtitle, Spanish if (string.IsNullOrEmpty(s)) throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); SubtitleStream subtitleStream = new SubtitleStream(s); switch (subtitleStream.Description.ToUpper().Substring(subtitleStream.Description.IndexOf('(') + 1, 3)) { case "ASS": subtitleStream.SubtitleType = SubtitleStreamType.ASS; break; case "SSA": subtitleStream.SubtitleType = SubtitleStreamType.SSA; break; case "SRT": subtitleStream.SubtitleType = SubtitleStreamType.SRT; break; case "VOB": subtitleStream.SubtitleType = SubtitleStreamType.SUB; break; case "SUP": default: subtitleStream.SubtitleType = SubtitleStreamType.SUP; break; } subtitleStream.Language = (s.IndexOf(',') == s.LastIndexOf(',')) ? s.Substring(s.IndexOf(',') + 1).Trim() : s.Substring(s.IndexOf(',') + 1, s.LastIndexOf(',') - s.IndexOf(',') - 1).Trim(); subtitleStream.IsSDH = s.Contains("\"SDH\""); return subtitleStream; }
public static new Stream Parse(string s) { //5: Subtitle, English, "SDH" //6: Subtitle, French //7: Subtitle, Spanish if (string.IsNullOrEmpty(s)) throw new ArgumentNullException("s", "The string 's' cannot be null or empty."); SubtitleStream subtitleStream = new SubtitleStream(s); subtitleStream.Language = (s.IndexOf(',') == s.LastIndexOf(',')) ? s.Substring(s.IndexOf(',') + 1).Trim() : s.Substring(s.IndexOf(',') + 1, s.LastIndexOf(',') - s.IndexOf(',') - 1).Trim(); subtitleStream.IsSDH = s.Contains("\"SDH\"") ? true : false; return new SubtitleStream(s); }