--- mintv/mintv.cpp 2003/03/07 20:08:37 1.5 +++ mintv/mintv.cpp 2005/10/02 11:57:30 1.8 @@ -1,7 +1,7 @@ /* - * mintv.cpp - 50/60Hz video display using v4l and XVideo + * mintv.cpp - 50/60Hz noninterlaced video display using v4l and XVideo * - * Written in 2003 by Christian Bauer + * Written in 2003-2004 by Christian Bauer */ #include @@ -39,10 +39,10 @@ static int grab_width = -1, grab_height; static int image_width, image_height; static int win_width, win_height; -const int PAL_FPS = 50; -const int NTSC_FPS = 60; +const double PAL_FPS = 50.0; +const double NTSC_FPS = 59.94; -static int fps; +static double fps; static int brightness = 50, contrast = 50, color = 50; @@ -285,7 +285,7 @@ static Boolean work_proc(XtPointer clien now = GetTicks_usec(); uint64 elapsed = now - prev; - int64 delay = 1000000 / fps - (now - prev); + int64 delay = int64(1000000.0 / fps) - (now - prev); #if LOGGING fprintf(log, "elapsed %Ld usec, delay %Ld usec\n", elapsed, delay); #endif @@ -333,7 +333,7 @@ int main(int argc, char **argv) // Parse options for (;;) { int c; - if ((c = getopt_long(argc, argv, "hnp:w:", long_opts,NULL)) == -1) + if ((c = getopt_long(argc, argv, "hnp:w:", long_opts, NULL)) == -1) break; switch (c) { @@ -463,8 +463,6 @@ port_found: NULL ); XtRealizeWidget(app_shell); - Cursor null_cursor = XCreateFontCursor(dpy, XC_left_ptr); - XDefineCursor(dpy, XtWindow(app_shell), null_cursor); XtVaSetValues(app_shell, XtNtitle, "mintv", XtNinput, True, @@ -473,6 +471,16 @@ port_found: XSetWMProtocols(dpy, XtWindow(app_shell), &wm, 1); gc = XCreateGC(dpy, XtWindow(video), 0, NULL); + // Hide cursor + Colormap cmap = DefaultColormap(dpy, DefaultScreen(dpy)); + XColor black; + XParseColor(dpy, cmap, "#000000", &black); + XAllocColor(dpy, cmap, &black); + static char null_data[] = {0, 0, 0, 0, 0, 0, 0, 0}; + Pixmap null_pixmap = XCreateBitmapFromData(dpy, XtWindow(video), null_data, 8, 8); + Cursor null_cursor = XCreatePixmapCursor(dpy, null_pixmap, null_pixmap, &black, &black, 0, 0); + XDefineCursor(dpy, XtWindow(video), null_cursor); + // Set image format unsigned format = XV_FORMAT;