示例#1
0
        public static TsStreamType FindStreamType(byte streamType)
        {
            TsStreamType tsStreamType;

            if (TsStreamType.Types.TryGetValue(streamType, out tsStreamType))
            {
                return(tsStreamType);
            }
            bool lockTaken = false;
            Dictionary <byte, TsStreamType> dictionary = null;

            try
            {
                Monitor.Enter((object)(dictionary = TsStreamType.UnknownTypes), ref lockTaken);
                if (!TsStreamType.UnknownTypes.TryGetValue(streamType, out tsStreamType))
                {
                    TsStreamType.StreamContents contents = TsStreamType.StreamContents.Unknown;
                    if ((int)streamType >= 128)
                    {
                        contents = TsStreamType.StreamContents.Private;
                    }
                    else if ((int)streamType >= 32 && (int)streamType <= 126)
                    {
                        contents = TsStreamType.StreamContents.Reserved;
                    }
                    tsStreamType = new TsStreamType(streamType, contents, string.Format("Stream type {0:X2} ({1})", new object[2]
                    {
                        (object)streamType,
                        (object)contents
                    }));
                    TsStreamType.UnknownTypes[streamType] = tsStreamType;
                }
            }
            finally
            {
                if (lockTaken)
                {
                    Monitor.Exit((object)dictionary);
                }
            }
            return(tsStreamType);
        }
示例#2
0
 public TsStreamType(byte streamType, TsStreamType.StreamContents contents, string description)
 {
     this.StreamType  = streamType;
     this.Contents    = contents;
     this.Description = description;
 }
示例#3
0
 public TsStreamType(byte streamType, TsStreamType.StreamContents contents, string description);