# HG changeset patch # User nicodvb # Date 1210499028 0 # Node ID 3d8edef37c7ee34e900032a0e0e51c5a3caf69b6 # Parent 4cc7655e7b30244cffa0d01fcf3165d7eea341ad added read_pgci_srp() and removed another conditional bitfield diff -r 4cc7655e7b30 -r 3d8edef37c7e dvdread/ifo_read.c --- a/dvdread/ifo_read.c Sun May 11 09:27:42 2008 +0000 +++ b/dvdread/ifo_read.c Sun May 11 09:43:48 2008 +0000 @@ -214,6 +214,20 @@ uo->title_or_time_play = dvdread_getbits(&state, 1); } +static void read_pgci_srp(pgci_srp_t *ps) { + getbits_state_t state; + uint8_t buf[sizeof(pgci_srp_t)]; + + memcpy(buf, ps, sizeof(pgci_srp_t)); + if (!dvdread_getbits_init(&state, buf)) abort(); + ps->entry_id = dvdread_getbits(&state, 8); + ps->block_mode = dvdread_getbits(&state, 2); + ps->block_type = dvdread_getbits(&state, 2); + ps->unknown1 = dvdread_getbits(&state, 4); + ps->ptl_id_mask = dvdread_getbits(&state, 16); + ps->pgc_start_byte = dvdread_getbits(&state, 32); +} + ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { ifo_handle_t *ifofile; @@ -1752,8 +1766,7 @@ for(i = 0; i < pgcit->nr_of_pgci_srp; i++) { memcpy(&pgcit->pgci_srp[i], ptr, PGCI_SRP_SIZE); ptr += PGCI_SRP_SIZE; - B2N_16(pgcit->pgci_srp[i].ptl_id_mask); - B2N_32(pgcit->pgci_srp[i].pgc_start_byte); + read_pgci_srp(&pgcit->pgci_srp[i]); CHECK_VALUE(pgcit->pgci_srp[i].unknown1 == 0); } free(data); diff -r 4cc7655e7b30 -r 3d8edef37c7e dvdread/ifo_types.h --- a/dvdread/ifo_types.h Sun May 11 09:27:42 2008 +0000 +++ b/dvdread/ifo_types.h Sun May 11 09:43:48 2008 +0000 @@ -320,15 +320,9 @@ */ typedef struct { uint8_t entry_id; -#ifdef WORDS_BIGENDIAN unsigned int block_mode : 2; unsigned int block_type : 2; unsigned int unknown1 : 4; -#else - unsigned char unknown1 : 4; - unsigned char block_type : 2; - unsigned char block_mode : 2; -#endif uint16_t ptl_id_mask; uint32_t pgc_start_byte; pgc_t *pgc;