[linux-dvb] dvb-apps lib, structs declared with bit fields

Oivind oivindg at gmail.com
Tue Jul 5 16:54:32 CEST 2005


Apologizes for the direct reply. 

On 7/5/05, DUBOST Brice <dubost at crans.ens-cachan.fr> wrote:
> Oivind wrote:
> > I notice that bit fields are used in many of the structs, as for
> > example from en50221_hlci.h;
> >
> > struct en50221_pmt_object {
> >         unsigned ca_pmt_tag: 24;
> >         uint8_t *asn_1_length;
> >         unsigned ca_pmt_list_mgmt: 8;
> >         unsigned program_number: 16;
> >         unsigned reserved_1: 2;
> >
> >         [...]
> >
> > };
> >
> >
> > What exactly is the benefit of this?
> >
> 
> Because the object come like this
> Dvb objct tries to use less data as possible.
> 
> For example
> http://www.bc.groteck.ru/pdf-standard-specifications/multiplexing/dvb-vbi/en301775.v1.2.1.pdf

Well, yes, an en50221 pmt object looks like that.

But no, that is not the reason, because that object is again decoded
and reassembled as a binary stream by the driver before it is sent to
the hardware. Using bit fields to create binary streams would be no
good because of endian and compiler differences.

Oivind




More information about the linux-dvb mailing list