Пример #1
0
        public static byte[] Write(PtKeyFrameCollection info)
        {
            ByteBuffer buffer = new ByteBuffer();

            buffer.WriteInt32(info.FrameIdx);
            buffer.WriteInt32(info.KeyFrames.Count);
            for (int i = 0; i < info.KeyFrames.Count; ++i)
            {
                buffer.WriteBytes(FrameIdxInfo.Write(info.KeyFrames[i]));
            }
            return(buffer.Getbuffer());
        }
Пример #2
0
        public static PtKeyFrameCollection Read(byte[] bytes)
        {
            PtKeyFrameCollection info = new PtKeyFrameCollection();

            info.KeyFrames = new List <FrameIdxInfo>();
            ByteBuffer buffer = new ByteBuffer(bytes);

            info.FrameIdx = buffer.ReadInt32();
            int size = buffer.ReadInt32();

            for (int i = 0; i < size; ++i)
            {
                info.KeyFrames.Add(FrameIdxInfo.Read(buffer.ReadBytes()));
            }
            return(info);
        }
Пример #3
0
 public void AddKeyFramesRange(PtKeyFrameCollection targetCollection)
 {
     KeyFrames.AddRange(targetCollection.KeyFrames);
 }