fork from http://www.cinecert.com/asdcplib/