/* add a jpeg frame to an AVI file */ public void avi_add(u8[] buf, uint size) { lock (locker) { uint osize = size; Console.WriteLine(DateTime.Now.Millisecond + " avi frame"); db_head db = new db_head { db = "00dc".ToCharArray(), size = size }; fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db)); uint offset = (uint)fd.Position; fd.Write(buf, 0, (int)size); indexs.Add(new AVIINDEXENTRY() { ckid = "00dc".ToCharArray(), dwChunkLength = size, dwChunkOffset = (offset - 8212 + 4), dwFlags = 0x10 }); while (fd.Position % 2 != 0) { size++; fd.WriteByte(0); //fd.Seek(1, SeekOrigin.Current); } nframes++; totalsize += size; if (((DateTime.Now - start).TotalSeconds * targetfps) > nframes) { avi_add(buf, osize); Console.WriteLine("Extra frame"); } } }
/* add a jpeg frame to an AVI file */ public void avi_add(u8[] buf, uint size) { uint osize = size; Console.WriteLine(DateTime.Now.Millisecond + " avi frame"); db_head db = new db_head { db = "00dc".ToCharArray(), size = size }; fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db)); fd.Write(buf, 0, (int)size); if (size % 2 == 1) { size++; fd.Seek(1, SeekOrigin.Current); } nframes++; totalsize += size; if (((DateTime.Now - start).TotalSeconds * targetfps) > nframes) { avi_add(buf, osize); Console.WriteLine("Extra frame"); } }
/* add a jpeg frame to an AVI file */ public void avi_add(u8[] buf, uint size) { uint osize = size; Console.WriteLine(DateTime.Now.Millisecond + " avi frame"); db_head db = new db_head { db = "00dc".ToCharArray(), size = size }; fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db)); uint offset = (uint)fd.Position; fd.Write(buf, 0, (int)size); indexs.Add(new AVIINDEXENTRY() { ckid = "00dc".ToCharArray(), dwChunkLength = size, dwChunkOffset = (offset - 8212 + 4), dwFlags = 0x10 }); while (fd.Position % 2 != 0) { size++; fd.WriteByte(0); //fd.Seek(1, SeekOrigin.Current); } nframes++; totalsize += size; if (((DateTime.Now - start).TotalSeconds * targetfps) > nframes) { avi_add(buf, osize); Console.WriteLine("Extra frame"); } }
/* add a jpeg frame to an AVI file */ public void avi_add(u8[] buf, uint size) { Console.WriteLine(DateTime.Now.Millisecond + "avi frame"); db_head db = new db_head { db = "00dc".ToCharArray(), size = size }; fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db)); fd.Write(buf, 0, (int)size); if (size % 2 == 1) { size++; fd.Seek(1, SeekOrigin.Current); } nframes++; totalsize += size; }
public void writeindexs() { //fd.Seek(-(fd.Position % 2), SeekOrigin.End); // is either 0 or -1 fd.Seek(0, SeekOrigin.End); db_head idx1 = new db_head() { db = "idx1".ToCharArray(), size = (uint)(indexs.Count * 16) }; fd.Write(StructureToByteArray(idx1), 0, Marshal.SizeOf(idx1)); foreach (AVIINDEXENTRY index in indexs) { fd.Write(StructureToByteArray(index), 0, Marshal.SizeOf(index)); } }
/* add a jpeg frame to an AVI file */ public void avi_add(u8[] buf, uint size) { Console.WriteLine(DateTime.Now.Millisecond + "avi frame"); db_head db = new db_head { db = "00dc".ToCharArray(), size = size }; fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db)); fd.Write(buf, 0, (int)size); if (size % 2 == 1) { size++; fd.Seek(1, SeekOrigin.Current); } nframes++; totalsize += size; lista_tams.Add(size); if (size > max_buff_size) { max_buff_size = size; } }