ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mintv/mintv.cpp
(Generate patch)

Comparing mintv/mintv.cpp (file contents):
Revision 1.2 by cebix, 2003-02-25T21:10:35Z vs.
Revision 1.4 by cebix, 2003-03-07T18:17:09Z

# Line 31 | Line 31 | static bool ntsc = false;
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  
# Line 321 | Line 321 | int main(int argc, char **argv)
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  
# Line 328 | Line 329 | int main(int argc, char **argv)
329          log = fopen("log", "w");
330   #endif
331  
331        // Init X11
332        XtAppContext app_context;
333        app_shell = XtAppInitialize(&app_context, "mintv", NULL, 0, &argc, argv, NULL,  NULL, 0);
334        dpy = XtDisplay(app_shell);
335        XtAppAddActions(app_context,actionTable, sizeof(actionTable) / sizeof(XtActionsRec));
336        XtOverrideTranslations(app_shell, XtParseTranslationTable(
337                "<Message>WM_PROTOCOLS: quit()\n"
338                "<Key>q: quit()\n"
339                "<Key>1: select_channel_1()\n"
340                "<Key>2: select_channel_2()\n"
341                "<Key>KP_7: inc_brightness()\n"
342                "<Key>KP_4: reset_brightness()\n"
343                "<Key>KP_1: dec_brightness()\n"
344                "<Key>KP_8: inc_contrast()\n"
345                "<Key>KP_5: reset_contrast()\n"
346                "<Key>KP_2: dec_contrast()\n"
347                "<Key>KP_9: inc_color()\n"
348                "<Key>KP_6: reset_color()\n"
349                "<Key>KP_3: dec_color()"
350        ));
351        XtAddEventHandler(app_shell, StructureNotifyMask, True, resize_event, NULL);
352        wm = XInternAtom(XtDisplay(app_shell), "WM_DELETE_WINDOW", False);
353
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) {
# Line 366 | Line 344 | int main(int argc, char **argv)
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"
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"
# Line 386 | Line 368 | int main(int argc, char **argv)
368                  }
369          }
370  
371 +        // Init X11
372 +        XtAppContext app_context;
373 +        app_shell = XtAppInitialize(&app_context, "mintv", NULL, 0, &argc, argv, NULL,  NULL, 0);
374 +        dpy = XtDisplay(app_shell);
375 +        XtAppAddActions(app_context,actionTable, sizeof(actionTable) / sizeof(XtActionsRec));
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"
383 +                "<Key>KP_4: reset_brightness()\n"
384 +                "<Key>KP_1: dec_brightness()\n"
385 +                "<Key>KP_8: inc_contrast()\n"
386 +                "<Key>KP_5: reset_contrast()\n"
387 +                "<Key>KP_2: dec_contrast()\n"
388 +                "<Key>KP_9: inc_color()\n"
389 +                "<Key>KP_6: reset_color()\n"
390 +                "<Key>KP_3: dec_color()"
391 +        ));
392 +        XtAddEventHandler(app_shell, StructureNotifyMask, True, resize_event, NULL);
393 +        wm = XInternAtom(XtDisplay(app_shell), "WM_DELETE_WINDOW", False);
394 +
395          // Xvideo available?
396          unsigned ver, rel, req, ev, err, val;
397          if (XvQueryExtension(dpy, &ver, &rel, &req, &ev, &err) != Success) {
# Line 431 | Line 437 | port_found:
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          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines