# HG changeset patch # User paulo@thepaulopc # Date 1258098227 28800 # Node ID cfe5048cc182cba94862db849561c5755839e8ae # Parent 7e8d91fad6c7304f5a8e8dae98c3df752ed8fdea add my initial changes (use O_APPEND, add "skip title" option) diff -r 7e8d91fad6c7 -r cfe5048cc182 menus.c --- a/menus.c Thu Nov 12 23:26:25 2009 -0800 +++ b/menus.c Thu Nov 12 23:43:47 2009 -0800 @@ -49,7 +49,7 @@ uint8_t mem[DVD_VIDEO_LB_LEN]; int finished = 0; int output_fd = 0; - int dump = 0, tt_dump = 0; + int dump = 0, tt_dump = 0, tt_skip = 0; /* open dvdnav handle */ printf("Opening DVD...\n"); @@ -105,9 +105,9 @@ * A real player application would now pass this block through demuxing * and decoding. We simply write it to disc here. */ - if (!output_fd) { + if (!output_fd && (dump || tt_dump)) { printf("Opening output...\n"); - output_fd = open("libdvdnav.mpg", O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG); + output_fd = open("libdvdnav.mpg", O_CREAT | O_WRONLY | O_APPEND, S_IRWXU | S_IRWXG); if (output_fd == -1) { printf("Error opening output\n"); return 4; @@ -189,10 +189,18 @@ if (tt_dump && tt != tt_dump) tt_dump = 0; - if (!dump && !tt_dump) { + if (tt_skip && tt != tt_skip) + tt_skip = 0; + + if (output_fd && !tt_dump) { + printf("Closing output...\n"); + output_fd = close(output_fd); + } + + if (!dump && !tt_dump && !tt_skip) { fflush(stdin); - while ((input != 'a') && (input != 's') && (input != 'q') && (input != 't')) { - printf("(a)ppend cell to output\n(s)kip cell\nappend until end of (t)itle\n(q)uit\n"); + while ((input != 'a') && (input != 's') && (input != 'q') && (input != 't') && (input != 'l')) { + printf("(a)ppend cell to output\n(s)kip cell\nappend until end of (t)itle\nskip tit(l)e\n(q)uit\n"); scanf("%c", &input); } @@ -203,6 +211,9 @@ case 't': tt_dump = tt; break; + case 'l': + tt_skip = tt; + break; case 'q': finished = 1; }