Advertisement
Guest User

Untitled

a guest
Dec 14th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <dvdnav/dvdnav.h>
  3. #include <dvdnav/dvdnav_events.h>
  4. #include <sys/types.h>
  5. #include <stdlib.h>
  6. int main(int argc, char **argv) {
  7. dvdnav_t *dvdnav;
  8. int finished, len, event;
  9. uint8_t buf[2050];
  10. /* Open the DVD */
  11. dvdnav_open(&dvdnav, "/mnt/iso");
  12. fprintf(stderr, "Reading...\n");
  13. finished = 0;
  14. while(!finished) {
  15. int result = dvdnav_get_next_block(dvdnav, buf,
  16. &event, &len);
  17. if(result == DVDNAV_STATUS_ERR) {
  18. fprintf(stderr, "Error getting next block (%s)\n",
  19. dvdnav_err_to_string(dvdnav));
  20. exit(1);
  21. }
  22. switch(event) {
  23. case DVDNAV_BLOCK_OK:
  24. /* Write output to stdout */
  25. fwrite(buf, len, 1, stdout);
  26. break;
  27. case DVDNAV_STILL_FRAME:
  28. {
  29. fprintf(stderr, "Skipping still frame\n");
  30. dvdnav_still_skip(dvdnav);
  31. }
  32. break;
  33. case DVDNAV_STOP:
  34. {
  35. finished = 1;
  36. }
  37. default:
  38. fprintf(stderr, "Unhandled event (%i)\n", event);
  39. finished = 1;
  40. break;
  41. }
  42. }
  43. dvdnav_close(dvdnav);
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement