Пример #1
0
        /// <summary>
        /// Get dditional format information for a given itag.
        /// </summary>
        public static FormatProfile getFormatProfile(string ITagRaw)
        {
            int itag = Convert.ToInt32(ITagRaw);

            FormatProfile profile = new FormatProfile();

            if (ITAGS.ContainsKey(itag))
            {
                Tuple <string, string> data = ITAGS[itag];
                profile.resolution = data.Item1;
                profile.bitrate    = data.Item2;
            }

            profile.isLive = LIVE.Contains(itag);
            profile.is3D   = _3D.Contains(itag);
            profile.fps    = _60FPS.Contains(itag) ? 60 : 30;

            return(profile);
        }
Пример #2
0
        /// <summary>
        /// Decodes stream data found in the specified raw container into an object.
        /// </summary>
        internal Stream(ObscuredContainer streamContainer)
        {
            stream = streamContainer;

            // Read parameters ITag, abr and URL
            ReadAttributeValues(stream);

            // Read format information from tables using ITag
            format = ITags.getFormatProfile(ITag);

            // 'video/webm; codecs="vp8, vorbis"' -> 'video/webm', 'vp8, vorbis'
            Tuple <string, string> typeSplit = Extract.splitType(type);

            // Seperate type info
            mimeType = typeSplit.Item1;
            string[] typeInfo = mimeType.Split('/');
            type    = typeInfo[0];
            subType = typeInfo[1];

            // Read and parse codecs (seperate audio and video)
            codecs     = typeSplit.Item2.Split(',').Select(c => c.Trim()).ToList();
            videoCodec = isProgressive ? codecs[0] : (type == "video" ? codecs[0] : null);
            audioCodec = isProgressive ? codecs[1] : (type == "audio" ? codecs[0] : null);
        }