Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

is there a way to do this? because I am trying to read the header of a swf file and there is a part in it that is never the same length in bits. it use the RECT data format

RECT
Field Type Comment
Nbits: UB[5] //Bits in each rect value field
Xmin: SB[Nbits] //x minimum position for rect
Xmax: SB[Nbits]// x maximum position for rect
Ymin: SB[Nbits] //y minimum position for rect
Ymax: SB[Nbits]// y maximum position for rect

this come from the macromedia website:

http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf

since it use a number of bit, I cant just take the byte, and what is worst is that the number of bits varie for the last 4 data depending on the first value, so is ther anyway to use the reader to read 5 bits, then read xbits(the number in the previous reader)4 time

or is there any workaround?

  • Leaders
Posted
You will probably have to read bytes and process their individual bits yourself. You might want to consider using something like the System.Collections.Specialized.BitVector32 class, which treats four bytes like an array of 32 bits. If you are lucky, maybe someone can provide you with a class that can handle binary data as an array of bits.
[sIGPIC]e[/sIGPIC]
Posted
Writing a BitStream class is no big deal. It took me less than an hour. I'd post it, but I don't own the code. :( But feel free to ask any questions.
"Who is John Galt?"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...