I’m reading some MPEG Transport Stream protocol over UDP and it has some funky bitfields in it (length 13 for example). I’m using the ‘struct’ library to do the broad unpacking, but is there a simple way to say ‘Grab the next 13 bits’ rather than have to hand-tweak the bit manipulation? I’d like something like the way C does bit fields (without having to revert to C).
Suggestions?
It’s an often-asked question. There’s an ASPN Cookbook entry on it that has served me in the past.
And there is an extensive page of requirements one person would like to see from a module doing this.