31 |
|
|
32 |
|
const int PAL_WIDTH = 384; |
33 |
|
const int PAL_HEIGHT = 288; |
34 |
< |
const int NTSC_WIDTH = 320; |
34 |
> |
const int NTSC_WIDTH = 360; |
35 |
|
const int NTSC_HEIGHT = 240; |
36 |
|
|
37 |
< |
static int grab_width, grab_height; |
37 |
> |
static int grab_width = -1, grab_height; |
38 |
|
static int image_width, image_height; |
39 |
|
static int win_width, win_height; |
40 |
|
|
321 |
|
{"help", 0, 0, 'h'}, |
322 |
|
{"ntsc", 0, 0, 'n'}, |
323 |
|
{"port", 1, 0, 'p'}, |
324 |
+ |
{"width", 1, 0, 'w'}, |
325 |
|
{NULL, 0, 0, 0} |
326 |
|
}; |
327 |
|
|
332 |
|
// Parse options |
333 |
|
for (;;) { |
334 |
|
int c; |
335 |
< |
if ((c = getopt_long(argc, argv, "hnp:", long_opts,NULL)) == -1) |
335 |
> |
if ((c = getopt_long(argc, argv, "hnp:w:", long_opts,NULL)) == -1) |
336 |
|
break; |
337 |
|
|
338 |
|
switch (c) { |
344 |
|
case 'p': |
345 |
|
port = atoi(optarg); |
346 |
|
break; |
347 |
+ |
case 'w': |
348 |
+ |
grab_width = atoi(optarg); |
349 |
+ |
break; |
350 |
|
case 'h': |
351 |
|
default: |
352 |
|
fprintf(stderr, |
353 |
|
"50/60Hz video display application\n\n" |
354 |
|
"Options:\n" |
355 |
< |
" -h | --help this text\n" |
356 |
< |
" -n | --ntsc NTSC mode\n" |
357 |
< |
" -p | --port n Xv output port\n\n" |
355 |
> |
" -h | --help this text\n" |
356 |
> |
" -n | --ntsc NTSC mode\n" |
357 |
> |
" -p | --port n Xv output port\n" |
358 |
> |
" -w | --width n image width\n\n" |
359 |
|
"Keyboard commands:\n" |
360 |
|
" q quit\n" |
361 |
|
" 1/2 select channel\n" |
376 |
|
XtOverrideTranslations(app_shell, XtParseTranslationTable( |
377 |
|
"<Message>WM_PROTOCOLS: quit()\n" |
378 |
|
"<Key>q: quit()\n" |
379 |
+ |
"<Key>Escape: quit()\n" |
380 |
|
"<Key>1: select_channel_1()\n" |
381 |
|
"<Key>2: select_channel_2()\n" |
382 |
|
"<Key>KP_7: inc_brightness()\n" |
437 |
|
|
438 |
|
// Set grab and window dimensions |
439 |
|
if (ntsc) { |
440 |
< |
grab_width = NTSC_WIDTH; |
440 |
> |
if (grab_width == -1) |
441 |
> |
grab_width = NTSC_WIDTH; |
442 |
|
grab_height = NTSC_HEIGHT; |
443 |
|
fps = NTSC_FPS; |
444 |
|
} else { |
445 |
< |
grab_width = PAL_WIDTH; |
445 |
> |
if (grab_width == -1) |
446 |
> |
grab_width = PAL_WIDTH; |
447 |
|
grab_height = PAL_HEIGHT; |
448 |
|
fps = PAL_FPS; |
449 |
|
} |