Created
August 3, 2010 10:12
-
-
Save engleek/506145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssize_t | |
DVDDiskNode::ReadAt(off_t pos, void *buffer, size_t size) | |
{ | |
printf("DVD::ReadAt(%i, %lu)\n", (int)pos, (unsigned long)size); | |
int blockCount = ceil(size / DVD_VIDEO_LB_LEN); | |
uint8_t *buf = (uint8_t *) buffer; | |
buf = new uint8_t[blockCount * DVD_VIDEO_LB_LEN]; | |
for (int i = 0; i < blockCount; i++) { | |
fResult = dvdnav_get_next_block(fDVDNav, buf + i * DVD_VIDEO_LB_LEN, &fEvent, &fLen); | |
if (fResult == DVDNAV_STATUS_ERR) { | |
printf("DVD: Error getting next block: %s\n", dvdnav_err_to_string(fDVDNav)); | |
return B_ERROR; | |
} | |
while (fEvent != DVDNAV_BLOCK_OK) { | |
fResult = dvdnav_get_next_block(fDVDNav, buf + i * DVD_VIDEO_LB_LEN, &fEvent, &fLen); | |
if (fResult == DVDNAV_STATUS_ERR) { | |
printf("DVD: Error getting next block: %s\n", dvdnav_err_to_string(fDVDNav)); | |
return B_ERROR; | |
} | |
} | |
} | |
return blockCount * DVD_VIDEO_LB_LEN; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment