summaryrefslogtreecommitdiff
path: root/src/input/libdvdnav/nav_read.c
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2004-03-16 11:43:38 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2004-03-16 11:43:38 +0000
commit50a26e7dabcb36c002f8527c8364c67439adbb11 (patch)
treed79ee798b6681d0fc8e8a3c93c845d34cfdb92e4 /src/input/libdvdnav/nav_read.c
parentb323267b7a8f5592c66158376a1ce25e2bdfefd5 (diff)
downloadxine-lib-50a26e7dabcb36c002f8527c8364c67439adbb11.tar.gz
xine-lib-50a26e7dabcb36c002f8527c8364c67439adbb11.tar.bz2
sync to latest libdvdnav
* fixes a menu problem (German RC2 of "Anatomie", chapter menu) * addresses some compilation problems on Windows (Could someone try cygwin, mingw builds, please? It should work with the standalone libdvdnav, but who knows if the integration breaks anything...) * turns some abort()s into assert(0)s, where we really can try to continue CVS patchset: 6269 CVS date: 2004/03/16 11:43:38
Diffstat (limited to 'src/input/libdvdnav/nav_read.c')
-rw-r--r--src/input/libdvdnav/nav_read.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/input/libdvdnav/nav_read.c b/src/input/libdvdnav/nav_read.c
index c76aa55a8..421678c78 100644
--- a/src/input/libdvdnav/nav_read.c
+++ b/src/input/libdvdnav/nav_read.c
@@ -22,7 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
-#include <assert.h>
#include "bswap.h"
#include "nav_types.h"
@@ -36,13 +35,13 @@ typedef struct {
uint8_t byte;
} getbits_state_t;
-static int32_t getbits_init(getbits_state_t *state, uint8_t *start) {
- if ((state == NULL) || (start == NULL)) return -1;
+static int getbits_init(getbits_state_t *state, uint8_t *start) {
+ if ((state == NULL) || (start == NULL)) return 0;
state->start = start;
state->bit_position = 0;
state->byte_position = 0;
state->byte = start[0];
- return 0;
+ return 1;
}
/* Non-optimized getbits. */
@@ -78,7 +77,7 @@ static uint32_t getbits(getbits_state_t *state, uint32_t number_of_bits) {
number_of_bits = 0;
}
}
- if ((state->bit_position) == 0)
+ if ((state->bit_position) == 0) {
while (number_of_bits > 7) {
result = (result << 8) + state->byte;
state->byte_position++;
@@ -93,10 +92,13 @@ static uint32_t getbits(getbits_state_t *state, uint32_t number_of_bits) {
result = (result << number_of_bits) + byte;
number_of_bits = 0;
}
+ }
return result;
}
+#if 0 /* TODO: optimized versions not yet used */
+
/* WARNING: This function can only be used on a byte boundary.
No checks are made that we are in fact on a byte boundary.
*/
@@ -121,10 +123,12 @@ static uint32_t get32bits(getbits_state_t *state) {
return result;
}
+#endif
+
void navRead_PCI(pci_t *pci, unsigned char *buffer) {
int32_t i, j;
getbits_state_t state;
- if (getbits_init(&state, buffer)) abort(); /* Passed NULL pointers */
+ if (!getbits_init(&state, buffer)) abort(); /* Passed NULL pointers */
/* pci pci_gi */
pci->pci_gi.nv_pck_lbn = getbits(&state, 32 );
@@ -292,7 +296,7 @@ void navRead_PCI(pci_t *pci, unsigned char *buffer) {
void navRead_DSI(dsi_t *dsi, unsigned char *buffer) {
int i;
getbits_state_t state;
- if (getbits_init(&state, buffer)) abort(); /* Passed NULL pointers */
+ if (!getbits_init(&state, buffer)) abort(); /* Passed NULL pointers */
/* dsi dsi gi */
dsi->dsi_gi.nv_pck_scr = getbits(&state, 32 );