I want to create a class that represents an MPEG 2 Transport Stream packet. I want to have a class property that stores the 13 bit PID value? What would be the best data type? Would you use a mask to store this value? I'm thinking I should just convert the value to an int...that would be easiest solution right? How do you store different numbers of bits that are not a byte?
public class Mpeg2TransportPacket
{
byte SyncByte { get; set; }
bool TransportErrorIndicator { get; set; }
bool PayloadUnitStartIndicator { get; set; }
bool TransportPriority { get; set; }
int PID { get; set; }
}
For a single value like that I would think that System.Int16 would be fine.
If you need to mask out 13 bits you would use a mask and & operation