Mercurial > hg > index.fcgi > dvdnav-rip > dvdnav-rip-1pba
diff menus.c @ 1:cfe5048cc182
add my initial changes (use O_APPEND, add "skip title" option)
author | paulo@thepaulopc |
---|---|
date | Thu, 12 Nov 2009 23:43:47 -0800 |
parents | 7e8d91fad6c7 |
children | 399518436fcf |
line diff
1.1 --- a/menus.c Thu Nov 12 23:26:25 2009 -0800 1.2 +++ b/menus.c Thu Nov 12 23:43:47 2009 -0800 1.3 @@ -49,7 +49,7 @@ 1.4 uint8_t mem[DVD_VIDEO_LB_LEN]; 1.5 int finished = 0; 1.6 int output_fd = 0; 1.7 - int dump = 0, tt_dump = 0; 1.8 + int dump = 0, tt_dump = 0, tt_skip = 0; 1.9 1.10 /* open dvdnav handle */ 1.11 printf("Opening DVD...\n"); 1.12 @@ -105,9 +105,9 @@ 1.13 * A real player application would now pass this block through demuxing 1.14 * and decoding. We simply write it to disc here. */ 1.15 1.16 - if (!output_fd) { 1.17 + if (!output_fd && (dump || tt_dump)) { 1.18 printf("Opening output...\n"); 1.19 - output_fd = open("libdvdnav.mpg", O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG); 1.20 + output_fd = open("libdvdnav.mpg", O_CREAT | O_WRONLY | O_APPEND, S_IRWXU | S_IRWXG); 1.21 if (output_fd == -1) { 1.22 printf("Error opening output\n"); 1.23 return 4; 1.24 @@ -189,10 +189,18 @@ 1.25 if (tt_dump && tt != tt_dump) 1.26 tt_dump = 0; 1.27 1.28 - if (!dump && !tt_dump) { 1.29 + if (tt_skip && tt != tt_skip) 1.30 + tt_skip = 0; 1.31 + 1.32 + if (output_fd && !tt_dump) { 1.33 + printf("Closing output...\n"); 1.34 + output_fd = close(output_fd); 1.35 + } 1.36 + 1.37 + if (!dump && !tt_dump && !tt_skip) { 1.38 fflush(stdin); 1.39 - while ((input != 'a') && (input != 's') && (input != 'q') && (input != 't')) { 1.40 - printf("(a)ppend cell to output\n(s)kip cell\nappend until end of (t)itle\n(q)uit\n"); 1.41 + while ((input != 'a') && (input != 's') && (input != 'q') && (input != 't') && (input != 'l')) { 1.42 + printf("(a)ppend cell to output\n(s)kip cell\nappend until end of (t)itle\nskip tit(l)e\n(q)uit\n"); 1.43 scanf("%c", &input); 1.44 } 1.45 1.46 @@ -203,6 +211,9 @@ 1.47 case 't': 1.48 tt_dump = tt; 1.49 break; 1.50 + case 'l': 1.51 + tt_skip = tt; 1.52 + break; 1.53 case 'q': 1.54 finished = 1; 1.55 }