JvDecoder::JvDecoder() : inq_(20), inw_(0), inh_(0), rw_(-1), rh_(-1), decompressing_(0), qh_(0), qt_(0) { /* * Open server connection. Note that we * create one connection per video window. * We need to do this because the J-Video * server caches the decoding state on * a per socket basis. For instance, the * server automatically reprograms the * hardware scaling unit each time we issue * a decompression request on a different socket. */ server_ = JvsOpen("", jvport()); if (server_ < 0) return; /*XXX width/height bogus*/ allocdma(pbase_[0].db, JVS_JPEG, 640, 480); allocdma(pbase_[1].db, JVS_JPEG, 640, 480); allocdma(pbase_[2].db, JVS_JPEG, 640, 480); pbase_[0].next = 0; pbase_[1].next = &pbase_[0]; pf_ = &pbase_[1]; pi_ = &pbase_[2]; /* * If jvdriver already has an installed colormap, use those * colors. Otherwise, set our default. */ if (setcolors(0) == 0) setcolors(atoi(Tcl::instance().attr("jvColors"))); link(server_, TK_READABLE); }
nemo_main() { permanent bool first=TRUE; int argc = 1; static char *argv[] = {"snaps2plot", NULL}; float size = 1.0; extern string yapp_string; setparams(); /* also: check env var S2PLOT_DEV */ #if 0 s2opend("/?", argc, argv); #else s2opendo(yapp_string); #endif s2swin((float)xrange[0], (float)xrange[1], (float)yrange[0], (float)yrange[1], (float)zrange[0], (float)zrange[1]); s2box(s2box_opt,0,0,s2box_opt,0,0,s2box_opt,0,0); s2lab(xlabel,ylabel,zlabel,input); instr = stropen(input, "r"); get_history(instr); compfuncs(); #ifdef COLOR setcolors(); #endif while (scansnap()) { if (! trakflag) { if (first) { first = FALSE; } else { sleep(FRAMEDELAY); plframe(); } } plotsnap(); warning("Can only do first selected snapshot"); s2show(1); /* how to clear and advance to next snapshot */ } }
int main() { struct tsdev *ts; int fd; calibration cal; int cal_fd; char cal_buffer[256]; char *tsdevice = NULL; char *calfile = NULL; int i; signal(SIGSEGV, sig); signal(SIGINT, sig); signal(SIGTERM, sig); if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) { ts = ts_open(tsdevice,0); } else { #if 0 #ifdef USE_INPUT_API ts = ts_open("/dev/input/event0", 0); #else ts = ts_open("/dev/touchscreen/ucb1x00", 0); #endif /* USE_INPUT_API */ #else ts = ts_open("/dev/input/event2", 0); #endif } if (!ts) { perror("ts_open"); exit(1); } #if 0 if (ts_config(ts)) { perror("ts_config"); exit(1); } #endif if (open_framebuffer()) { close_framebuffer(); exit(1); } close_framebuffer(); if (open_framebuffer()) { close_framebuffer(); exit(1); } setcolors(0x48ff48,0x880000); put_string(xres/2,yres/4,"TSLIB calibration utility",1); put_string(xres/2,yres/4 + 20,"Touch crosshair to calibrate",1); printf("xres = %d, yres = %d\n",xres,yres); // Read a touchscreen event to clear the buffer //getxy(ts, 0, 0); // Now paint a crosshair on the upper left and start taking calibration // data put_cross(50,50,1); getxy(ts, &cal.x[0], &cal.y[0]); put_cross(50,50,0); cal.xfb[0] = 50; cal.yfb[0] = 50; printf("Top left : X = %4d Y = %4d\n", cal.x[0], cal.y[0]); put_cross(xres - 50, 50, 1); getxy(ts, &cal.x[1], &cal.y[1]); put_cross(xres - 50, 50, 0); cal.xfb[1] = xres-50; cal.yfb[1] = 50; printf("Top right: X = %4d Y = %4d\n", cal.x[1], cal.y[1]); put_cross(xres - 50, yres - 50, 1); getxy(ts, &cal.x[2], &cal.y[2]); put_cross(xres - 50, yres - 50, 0); cal.xfb[2] = xres-50; cal.yfb[2] = yres-50; printf("Bot right: X = %4d Y = %4d\n", cal.x[2], cal.y[2]); put_cross(50, yres - 50, 1); getxy(ts, &cal.x[3], &cal.y[3]); put_cross(50, yres - 50, 0); cal.xfb[3] = 50; cal.yfb[3] = yres-50; printf("Bot left : X = %4d Y = %4d\n", cal.x[3], cal.y[3]); put_cross(xres/2, yres/2, 1); getxy(ts, &cal.x[4], &cal.y[4]); put_cross(xres/2, yres/2, 0); cal.xfb[4] = xres/2; cal.yfb[4] = yres/2; printf("Middle: X = %4d Y = %4d\n", cal.x[4], cal.y[4]); if(perform_calibration(&cal)) { printf("Calibration constants: "); for(i=0;i<7;i++) printf("%d ",cal.a[i]); printf("\n"); if( (calfile = getenv("TSLIB_CALIBFILE")) != NULL) { cal_fd = open(calfile,O_CREAT|O_RDWR); } else { cal_fd = open("/etc/pointercal",O_CREAT|O_RDWR); } sprintf(cal_buffer,"%d %d %d %d %d %d %d\n",cal.a[1],cal.a[2],cal.a[0],cal.a[4],cal.a[5],cal.a[3],cal.a[6]); write(cal_fd,cal_buffer,strlen(cal_buffer)+1); close(cal_fd); } else { printf("Calibration failed.\n"); } // while (1) { // struct ts_sample samp; // // if (ts_read_raw(ts, &samp, 1) < 0) { // perror("ts_read"); // exit(1); // } // // printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, // samp.x, samp.y, samp.pressure); // } close_framebuffer(); }