Ejemplo n.º 1
0
        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)
        {
            //2: AC3, English, 2.0 channels, 192kbps, 48khz, dialnorm: -27dB, -8ms
            //3: TrueHD/AC3, English, 5.1 channels, 48khz, dialnorm: -27dB
            //4: TrueHD, English, 5.1 channels, 48khz, dialnorm: -27dB

            if (string.IsNullOrEmpty(s))
                throw new ArgumentNullException("s", "The string 's' cannot be null or empty.");

            AudioStream audioStream = new AudioStream(s);

            switch (audioStream.Name.ToUpper())
            {
                case "AC3":
                case "AC3 EX":
                case "AC3 SURROUND":
                    audioStream.AudioType = AudioStreamType.AC3;
                    break;
                case "DTS":
                case "DTS-ES":
                case "DTS MASTER AUDIO":
                case "DTS HI-RES":
                    audioStream.AudioType = AudioStreamType.DTS;
                    break;
                case "E-AC3":
                    audioStream.AudioType = AudioStreamType.EAC3;
                    break;
                case "TRUEHD":
                    audioStream.AudioType = AudioStreamType.TrueHD;
                    break;
                case "TRUEHD/AC3":
                    audioStream.AudioType = AudioStreamType.TrueHD | AudioStreamType.AC3;
                    break;
                case "PCM":
                    audioStream.AudioType = AudioStreamType.PCM;
                    break;
                case "WAV":
                    audioStream.AudioType = AudioStreamType.WAV;
                    break;
                case "WAVS":
                    audioStream.AudioType = AudioStreamType.WAVS;
                    break;
                case "MP2":
                    audioStream.AudioType = AudioStreamType.MP2;
                    break;
                case "MP3":
                    audioStream.AudioType = AudioStreamType.MP3;
                    break;
                case "AAC":
                    audioStream.AudioType = AudioStreamType.AAC;
                    break;
                case "FLAC":
                    audioStream.AudioType = AudioStreamType.FLAC;
                    break;
                case "TTA1":
                    audioStream.AudioType = AudioStreamType.TTA;
                    break;
                case "WAVPACK4":
                    audioStream.AudioType = AudioStreamType.WAVPACK;
                    break;
                case "VORBIS":
                    audioStream.AudioType = AudioStreamType.VORBIS;
                    break;
                case "RAW/PCM":
                    audioStream.AudioType = AudioStreamType.RAW | AudioStreamType.PCM;
                    break;
                case "RAW":
                default:
                    audioStream.AudioType = AudioStreamType.RAW;
                    break;
            }

            return audioStream;
        }
Ejemplo n.º 3
0
        new public static Stream Parse(string s)
        {
            //2: AC3, English, 2.0 channels, 192kbps, 48khz, dialnorm: -27dB, -8ms
            //3: TrueHD/AC3, English, 5.1 channels, 48khz, dialnorm: -27dB
            //4: TrueHD, English, 5.1 channels, 48khz, dialnorm: -27dB

            if (string.IsNullOrEmpty(s))
            {
                throw new ArgumentNullException("s", "The string 's' cannot be null or empty.");
            }

            AudioStream audioStream = new AudioStream(s);

            switch (audioStream.Name.ToUpper())
            {
            case "AC3":
            case "AC3 EX":
            case "AC3 SURROUND":
                audioStream.AudioType = AudioStreamType.AC3;
                break;

            case "DTS":
            case "DTS-ES":
            case "DTS MASTER AUDIO":
            case "DTS HI-RES":
                audioStream.AudioType = AudioStreamType.DTS;
                break;

            case "E-AC3":
                audioStream.AudioType = AudioStreamType.EAC3;
                break;

            case "TRUEHD":
                audioStream.AudioType = AudioStreamType.TrueHD;
                break;

            case "TRUEHD/AC3":
                audioStream.AudioType = AudioStreamType.TrueHD | AudioStreamType.AC3;
                break;

            case "PCM":
                audioStream.AudioType = AudioStreamType.PCM;
                break;

            case "WAV":
                audioStream.AudioType = AudioStreamType.WAV;
                break;

            case "WAVS":
                audioStream.AudioType = AudioStreamType.WAVS;
                break;

            case "MP2":
                audioStream.AudioType = AudioStreamType.MP2;
                break;

            case "MP3":
                audioStream.AudioType = AudioStreamType.MP3;
                break;

            case "AAC":
                audioStream.AudioType = AudioStreamType.AAC;
                break;

            case "FLAC":
                audioStream.AudioType = AudioStreamType.FLAC;
                break;

            case "TTA1":
                audioStream.AudioType = AudioStreamType.TTA;
                break;

            case "WAVPACK4":
                audioStream.AudioType = AudioStreamType.WAVPACK;
                break;

            case "VORBIS":
                audioStream.AudioType = AudioStreamType.VORBIS;
                break;

            case "RAW/PCM":
                audioStream.AudioType = AudioStreamType.RAW | AudioStreamType.PCM;
                break;

            case "RAW":
            default:
                audioStream.AudioType = AudioStreamType.RAW;
                break;
            }

            return(audioStream);
        }
Ejemplo n.º 4
0
        new public static Stream Parse(string s)
        {
            //2: AC3, English, 2.0 channels, 192kbps, 48khz, dialnorm: -27dB, -8ms
            //4: TrueHD, English, 5.1 channels, 48khz, dialnorm: -27dB

            if (string.IsNullOrEmpty(s))
            {
                throw new ArgumentNullException("s", "The string 's' cannot be null or empty.");
            }

            AudioStream audioStream = new AudioStream(s);

            switch (audioStream.Name.ToUpper(System.Globalization.CultureInfo.InvariantCulture))
            {
            case "AC3":
            case "AC3 EX":
            case "AC3 SURROUND":
                audioStream.AudioType = AudioStreamType.AC3;
                break;

            case "DTS":
            case "DTS-ES":
            case "DTS MASTER AUDIO":
            case "DTS HI-RES":
                audioStream.AudioType = AudioStreamType.DTS;
                break;

            case "E-AC3":
                audioStream.AudioType = AudioStreamType.EAC3;
                break;

            case "TRUEHD":
                audioStream.AudioType = AudioStreamType.TrueHD;
                break;

            case "TRUEHD/AC3":
                audioStream.AudioType = AudioStreamType.TrueHD | AudioStreamType.AC3;
                break;

            case "PCM":
                audioStream.AudioType = AudioStreamType.PCM;
                break;

            case "WAV":
                audioStream.AudioType = AudioStreamType.WAV;
                break;

            case "WAVS":
                audioStream.AudioType = AudioStreamType.WAVS;
                break;

            case "MP2":
                audioStream.AudioType = AudioStreamType.MP2;
                break;

            case "MP3":
                audioStream.AudioType = AudioStreamType.MP3;
                break;

            case "AAC":
                audioStream.AudioType = AudioStreamType.AAC;
                break;

            case "FLAC":
                audioStream.AudioType = AudioStreamType.FLAC;
                break;

            case "TTA1":
                audioStream.AudioType = AudioStreamType.TTA;
                break;

            case "WAVPACK4":
                audioStream.AudioType = AudioStreamType.WAVPACK;
                break;

            case "VORBIS":
                audioStream.AudioType = AudioStreamType.VORBIS;
                break;

            case "RAW":
            default:
                audioStream.AudioType = AudioStreamType.RAW;
                break;
            }
            audioStream.Language = (s.IndexOf(',') == s.LastIndexOf(',')) ? s.Substring(s.IndexOf(',') + 1).Trim() : s.Substring(s.IndexOf(',') + 1, s.LastIndexOf(',') - s.IndexOf(',') - 1).Trim();

            return(audioStream);
        }
Ejemplo n.º 5
0
        new public static Stream Parse(string s, LogItem _log)
        {
            //2: AC3, English, 2.0 channels, 192kbps, 48khz, dialnorm: -27dB, -8ms
            //4: TrueHD, English, 5.1 channels, 48khz, dialnorm: -27dB

            if (string.IsNullOrEmpty(s))
            {
                throw new ArgumentNullException("s", "The string 's' cannot be null or empty.");
            }

            AudioStream audioStream = new AudioStream(s, _log);

            string type = s.Substring(s.IndexOf(":") + 1, s.IndexOf(',') - s.IndexOf(":") - 1).Trim();

            switch (type.ToUpperInvariant())
            {
            case "AC3":
            case "AC3 EX":
            case "AC3 SURROUND":
                audioStream.AudioType = AudioStreamType.AC3;
                break;

            case "DTS":
            case "DTS-ES":
            case "DTS EXPRESS":
            case "DTS MASTER AUDIO":
            case "DTS HI-RES":
                audioStream.AudioType = AudioStreamType.DTS;
                break;

            case "EAC3":
            case "E-AC3":
            case "E-AC3 EX":
            case "E-AC3 SURROUND":
                audioStream.AudioType = AudioStreamType.EAC3;
                break;

            case "TRUEHD":
            case "TRUEHD (ATMOS)":
            case "TRUEHD/AC3":
            case "TRUEHD/AC3 (ATMOS)":
                audioStream.AudioType = AudioStreamType.TrueHD;
                break;

            case "PCM":
                audioStream.AudioType = AudioStreamType.PCM;
                break;

            case "WAV":
                audioStream.AudioType = AudioStreamType.WAV;
                break;

            case "WAVS":
                audioStream.AudioType = AudioStreamType.WAVS;
                break;

            case "MP2":
                audioStream.AudioType = AudioStreamType.MP2;
                break;

            case "MP3":
                audioStream.AudioType = AudioStreamType.MP3;
                break;

            case "AAC":
                audioStream.AudioType = AudioStreamType.AAC;
                break;

            case "FLAC":
                audioStream.AudioType = AudioStreamType.FLAC;
                break;

            case "TTA1":
                audioStream.AudioType = AudioStreamType.TTA;
                break;

            case "WAVPACK4":
                audioStream.AudioType = AudioStreamType.WAVPACK;
                break;

            case "VORBIS":
                audioStream.AudioType = AudioStreamType.VORBIS;
                break;

            case "RAW/PCM":
            case "RAW":
                audioStream.AudioType = AudioStreamType.RAW;
                break;

            default:
                _log.Warn("\"" + type + "\" is not known. " + s);
                audioStream.AudioType = AudioStreamType.UNKNOWN;
                break;
            }

            if (s.ToLowerInvariant().EndsWith(", unknown parameters"))
            {
                audioStream.ParsingFailed = true;
            }

            return(audioStream);
        }