[DVDnav-discuss] r1040 - in trunk/libdvdnav/src/dvdread: ifo_read.c ifo_types.h

nicodvb subversion at mplayerhq.hu
Sun May 11 21:07:25 CEST 2008


Author: nicodvb
Date: Sun May 11 21:07:25 2008
New Revision: 1040

Log:
read_cell_playback() removes another conditional bitfield.
We're almost there!


Modified:
   trunk/libdvdnav/src/dvdread/ifo_read.c
   trunk/libdvdnav/src/dvdread/ifo_types.h

Modified: trunk/libdvdnav/src/dvdread/ifo_read.c
==============================================================================
--- trunk/libdvdnav/src/dvdread/ifo_read.c	(original)
+++ trunk/libdvdnav/src/dvdread/ifo_read.c	Sun May 11 21:07:25 2008
@@ -228,6 +228,35 @@ static void read_pgci_srp(pgci_srp_t *ps
   ps->pgc_start_byte                 = dvdread_getbits(&state, 32);
 }
 
+static void read_cell_playback(cell_playback_t *cp) {
+  getbits_state_t state;
+  uint8_t buf[sizeof(cell_playback_t)];
+  
+  memcpy(buf, cp, sizeof(cell_playback_t));
+  if (!dvdread_getbits_init(&state, buf)) abort();
+  cp->block_mode                      = dvdread_getbits(&state, 2);
+  cp->block_type                      = dvdread_getbits(&state, 2);
+  cp->seamless_play                   = dvdread_getbits(&state, 1);
+  cp->interleaved                     = dvdread_getbits(&state, 1);
+  cp->stc_discontinuity               = dvdread_getbits(&state, 1);
+  cp->seamless_angle                  = dvdread_getbits(&state, 1);
+  cp->playback_mode                   = dvdread_getbits(&state, 1);
+  cp->restricted                      = dvdread_getbits(&state, 1);
+  cp->unknown2                        = dvdread_getbits(&state, 6);
+  cp->still_time                      = dvdread_getbits(&state, 8);
+  cp->cell_cmd_nr                     = dvdread_getbits(&state, 8);
+  
+  cp->playback_time.hour              = dvdread_getbits(&state, 8);
+  cp->playback_time.minute            = dvdread_getbits(&state, 8);
+  cp->playback_time.second            = dvdread_getbits(&state, 8);
+  cp->playback_time.frame_u           = dvdread_getbits(&state, 8);
+  
+  cp->first_sector                    = dvdread_getbits(&state, 32);
+  cp->first_ilvu_end_sector           = dvdread_getbits(&state, 32);
+  cp->last_vobu_start_sector          = dvdread_getbits(&state, 32);
+  cp->last_sector                     = dvdread_getbits(&state, 32);
+}
+
 ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
   ifo_handle_t *ifofile;
 
@@ -724,11 +753,7 @@ static int ifoRead_CELL_PLAYBACK_TBL(ifo
     return 0;
 
   for(i = 0; i < nr; i++) {
-    B2N_32(cell_playback[i].first_sector);
-    B2N_32(cell_playback[i].first_ilvu_end_sector);
-    B2N_32(cell_playback[i].last_vobu_start_sector);
-    B2N_32(cell_playback[i].last_sector);
-    
+    read_cell_playback(&cell_playback[i]);
     /* Changed < to <= because this was false in the movie 'Pi'. */
     CHECK_VALUE(cell_playback[i].last_vobu_start_sector <= 
            cell_playback[i].last_sector);

Modified: trunk/libdvdnav/src/dvdread/ifo_types.h
==============================================================================
--- trunk/libdvdnav/src/dvdread/ifo_types.h	(original)
+++ trunk/libdvdnav/src/dvdread/ifo_types.h	Sun May 11 21:07:25 2008
@@ -203,29 +203,15 @@ typedef uint8_t pgc_program_map_t; 
  * Cell Playback Information.
  */
 typedef struct {
-#ifdef WORDS_BIGENDIAN
   unsigned int block_mode       : 2;
   unsigned int block_type       : 2;
   unsigned int seamless_play    : 1;
   unsigned int interleaved      : 1;
   unsigned int stc_discontinuity: 1;
   unsigned int seamless_angle   : 1;
-  
   unsigned int playback_mode    : 1;  /**< When set, enter StillMode after each VOBU */
   unsigned int restricted       : 1;  /**< ?? drop out of fastforward? */
   unsigned int unknown2         : 6;
-#else
-  unsigned char seamless_angle   : 1;
-  unsigned char stc_discontinuity: 1;
-  unsigned char interleaved      : 1;
-  unsigned char seamless_play    : 1;
-  unsigned char block_type       : 2;
-  unsigned char block_mode       : 2;
-  
-  unsigned char unknown2         : 6;
-  unsigned char restricted       : 1;
-  unsigned char playback_mode    : 1;
-#endif
   uint8_t still_time;
   uint8_t cell_cmd_nr;
   dvd_time_t playback_time;



More information about the DVDnav-discuss mailing list