changeset 362:3d8edef37c7e src

added read_pgci_srp() and removed another conditional bitfield
author nicodvb
date Sun, 11 May 2008 09:43:48 +0000
parents 4cc7655e7b30
children abca84921371
files dvdread/ifo_read.c dvdread/ifo_types.h
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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;