public int ReadFrame(byte[] buffer, int frame) { int n = (int)video_index[frame].len; AviStream.Seek(video_index[frame].pos, SeekOrigin.Begin); if (AviStream.Read(buffer, 0, n) != n) { throw new AviException("Read Error."); } return(n); }
private void avi_add_chunk(byte[] tag, byte[] data, int length) { byte[] c = new byte[8]; /* Copy tag and length int c, so that we need only 1 write system call * for these two values */ Array.Copy(tag, c, 4); long2str(c, 4, length); /* Output tag, length and data, restore previous position * if the write fails */ length = pad_even(length); AviStream.Write(c, 0, 8); AviStream.Write(data, 0, length); /* Update file position */ pos += 8 + length; //return 0; }