On 10/05/2012 10:58 AM, Vincent Povirk wrote:
You should take a look at the PNG format spec, particularly the part about chunks: http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
I believe what's needed here is to return all ancillary chunks.
First, thank you for the pointer to the HTML version of the PNG spec. I had the PDF one already, but the cross references make it a lot easier to use.
Beyond that, I am not sure what you are talking about. The value to be returned (at the address specified by the 2nd parameter) is an unsigned integer. There is no place to return 'chunks'; only a place to return a count.
In order to get that count, each and every one of the chunks needs to be scanned and validated. During the scanning process, it would make sense to store the location of chunks in an indexed data structure. That would nominally be an array, but a linked list or tree would also work.
For a general WIC design, there needs to be at least three layers with indexes built into at least two of the layers.
The top layer is the entire file. The next layer is the set of frames in the file. PNG only allows one frame per file, but other formats can have several (even many) frames. The next layer is the set of blocks (in this case "chunks") in each frame. In some cases there might be a need for additional layers.
All this means I need to dig out the 'class' structure of IWIC, but it would help if someone can confirm that I have not gone off the deep end yet.