[DVDnav-discuss] r1027 - in trunk/libdvdnav/src/dvdread: ifo_read.c ifo_types.h
nicodvb
subversion at mplayerhq.hu
Sat May 3 10:04:34 CEST 2008
Author: nicodvb
Date: Sat May 3 10:04:34 2008
New Revision: 1027
Log:
read_multichannel_ext() uses getbits() instead of relying on endianness-specific bitfields
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 Sat May 3 10:04:34 2008
@@ -139,6 +139,34 @@ static void read_audio_attr(audio_attr_t
fprintf(stderr, "\r\nLANG: %c%c, x: %x\r\n", aa->lang_code>>8, aa->lang_code&0xFF, aa->lang_code);
}
+static void read_multichannel_ext(multichannel_ext_t *me) {
+ getbits_state_t state;
+ uint8_t buf[sizeof(multichannel_ext_t)];
+
+ memcpy(buf, me, sizeof(multichannel_ext_t));
+ if (!dvdread_getbits_init(&state, buf)) abort();
+ me->zero1 = dvdread_getbits(&state, 7);
+ me->ach0_gme = dvdread_getbits(&state, 1);
+ me->zero2 = dvdread_getbits(&state, 7);
+ me->ach1_gme = dvdread_getbits(&state, 1);
+ me->zero3 = dvdread_getbits(&state, 4);
+ me->ach2_gv1e = dvdread_getbits(&state, 1);
+ me->ach2_gv2e = dvdread_getbits(&state, 1);
+ me->ach2_gm1e = dvdread_getbits(&state, 1);
+ me->ach2_gm2e = dvdread_getbits(&state, 1);
+ me->zero4 = dvdread_getbits(&state, 4);
+ me->ach3_gv1e = dvdread_getbits(&state, 1);
+ me->ach3_gv2e = dvdread_getbits(&state, 1);
+ me->ach3_gmAe = dvdread_getbits(&state, 1);
+ me->ach3_se2e = dvdread_getbits(&state, 1);
+ me->zero5 = dvdread_getbits(&state, 4);
+ me->ach4_gv1e = dvdread_getbits(&state, 1);
+ me->ach4_gv2e = dvdread_getbits(&state, 1);
+ me->ach4_gmBe = dvdread_getbits(&state, 1);
+ me->ach4_seBe = dvdread_getbits(&state, 1);
+}
+
+
ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
ifo_handle_t *ifofile;
@@ -510,6 +538,7 @@ static int ifoRead_VTS(ifo_handle_t *ifo
CHECK_ZERO(vtsi_mat->vts_subp_attr[i]);
for(i = 0; i < 8; i++) {
+ read_multichannel_ext(&vtsi_mat->vts_mu_audio_attr[i]);
CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero1);
CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero2);
CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero3);
Modified: trunk/libdvdnav/src/dvdread/ifo_types.h
==============================================================================
--- trunk/libdvdnav/src/dvdread/ifo_types.h (original)
+++ trunk/libdvdnav/src/dvdread/ifo_types.h Sat May 3 10:04:34 2008
@@ -128,7 +128,6 @@ typedef struct {
* MultiChannel Extension
*/
typedef struct {
-#ifdef WORDS_BIGENDIAN
unsigned int zero1 : 7;
unsigned int ach0_gme : 1;
@@ -152,31 +151,6 @@ typedef struct {
unsigned int ach4_gv2e : 1;
unsigned int ach4_gmBe : 1;
unsigned int ach4_seBe : 1;
-#else
- unsigned char ach0_gme : 1;
- unsigned char zero1 : 7;
-
- unsigned char ach1_gme : 1;
- unsigned char zero2 : 7;
-
- unsigned char ach2_gm2e : 1;
- unsigned char ach2_gm1e : 1;
- unsigned char ach2_gv2e : 1;
- unsigned char ach2_gv1e : 1;
- unsigned char zero3 : 4;
-
- unsigned char ach3_se2e : 1;
- unsigned char ach3_gmAe : 1;
- unsigned char ach3_gv2e : 1;
- unsigned char ach3_gv1e : 1;
- unsigned char zero4 : 4;
-
- unsigned char ach4_seBe : 1;
- unsigned char ach4_gmBe : 1;
- unsigned char ach4_gv2e : 1;
- unsigned char ach4_gv1e : 1;
- unsigned char zero5 : 4;
-#endif
uint8_t zero6[19];
} ATTRIBUTE_PACKED multichannel_ext_t;
More information about the DVDnav-discuss
mailing list