开发者

Decompress header of swf file (possible with qUncompress?)

I have some swf files generated with Adobe Flash. Does anybody know how can I decompress their headers in QT? I need their size (width and height) , frame rate and 开发者_高级运维frame count.

Thanks


It's not documented if qUncompress requires that all compressed data to be in the QByteArray to decompress it. From the wording of it, it seems to imply that. I would imagine loading some large SWF into memory just to get a few bytes in the header is not practical.

If you can live with loading the whole file into memory, just load the file starting at offset 4 into a QByteArray and flip the byte order of the 1st 4 (SWF is little-endian and qUncompress requires the length to be in big-endian). Subtract 4 from the flipped 32-bit integer. Then call qUncompress.

If loading the whole file is not ideal, you may be better off use the stream functions in zlib directly. That allows you to decompress data piece by piece.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜