Re: [Dvd-devel] Forking of libdvdread

Mathieu Lacage <[email protected]> 07 May 2003 15:34:20 +0200
Newsgroups gmane.comp.video.ogle.devel
Message-ID <[email protected]>
Hi,

On Wed, 2003-05-07 at 14:56, HÃ¥kan Hjort wrote:
> 
> More specifically to 'getbits()', I feel that that should not be
> necessary, the IFO and NAV structures are almost exlucivly byte /
> short / word length data and at fixed offsets from some point that can
> be computed.  So I'd think it would be better to make it byte based,
> and only in those few cases where there are bit based fileds handle
> those with a bits based macro/function.  Though this is just details.


I completely agree. I even tend not to use any function/macro to extract
the bits from the data read. Here is sample code showing this.

m_parser also exports a Get16Bits and a Get32Bits which also trigger the
sector reads necessary from the device and reorder to convert to a
machine-specific 16 or 32 bit integer.

RMuint8 VMGM_EXST;
status = m_parser.Get8Bits (&VMGM_EXST);
TREAT_ERROR;
if ((VMGM_EXST>>7) == 0x1 &&
     VMGM_LCD == LCD) {
    // we found the VMGM_LU for given LCD.
    status = m_parser.Get32Bits (byteOffset);
    TREAT_ERROR;
    return RM_OK;
} else {
    status = m_parser.SkipBytes (4);
    TREAT_ERROR;
}

Mathieu
-- 
Mathieu Lacage <[email protected]>
#p: +33 1 41 24 29 56