Exemplo n.º 1
0
        public CmdConnect(byte[] payload)
        {
            int    payloadLen = payload.Length;
            double result     = 0;

            if (!ArrayUtil.AMF0Number(payload, posID, ref result))
            {
                return;
            }

            TransactionID = result;

            var posConnObjEnd = ArrayUtil.FindPattern(payload, objectEnd, 20);

            if (posConnObjEnd < 0)
            {
                return;
            }

            var connObjectData = ArrayUtil.Mid(payload, 20, posConnObjEnd - 20);

            connObject = new AMFObject(connObjectData);



            AudioCodecs = new Dictionary <AudioCodec, bool>();
            VideoCodecs = new Dictionary <VideoCodec, bool>();
            var audioCodecs = new AudioCodec[] {
                AudioCodec.Raw,
                AudioCodec.ADPCM,
                AudioCodec.MP3,
                AudioCodec.NotUsed1,
                AudioCodec.NotUsed2,
                AudioCodec.NellyMoser8KHz,
                AudioCodec.NellyMoser44KHz,
                AudioCodec.G711A,
                AudioCodec.G711U,
                AudioCodec.NellyMoser16KHz,
                AudioCodec.AAC,
                AudioCodec.Speex,
                AudioCodec.All
            };
            var videoCodecs = new VideoCodec[] {
                VideoCodec.Obsolete1,
                VideoCodec.Obsolete2,
                VideoCodec.FlashVideo,
                VideoCodec.V1ScrSharing,
                VideoCodec.VP6,
                VideoCodec.VP6Alpha,
                VideoCodec.HomeBrewV,
                VideoCodec.H264,
                VideoCodec.All
            };

            foreach (var codec in audioCodecs)
            {
                AudioCodecs.Add(codec, false);
            }

            foreach (var codec in videoCodecs)
            {
                VideoCodecs.Add(codec, false);
            }
        }