예제 #1
0
파일: AviWriter.cs 프로젝트: 894880010/MP
    /* 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");
            }
        }
    }
예제 #2
0
    /* 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");
        }
    }
예제 #3
0
    /* 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");
        }
    }
예제 #4
0
 /* 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;
 }
예제 #5
0
파일: AviWriter.cs 프로젝트: 894880010/MP
    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));
        }
    }
예제 #6
0
    /* 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;
        }
    }
예제 #7
0
    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));
        }
    }