44 #ifdef LIBVNCSERVER_HAVE_GETTIMEOFDAY
48 #if !defined LIBVNCSERVER_HAVE_GETTIMEOFDAY && defined WIN32
51 #include <sys/timeb.h>
53 static void gettimeofday(
struct timeval* tv,
char* dummy)
57 tv->tv_sec=t.wHour*3600+t.wMinute*60+t.wSecond;
58 tv->tv_usec=t.wMilliseconds*1000;
68 #define PICTURE_TIMEOUT (1.0/15.0)
75 static struct timeval now={0,0}, then={0,0};
76 double elapsed, dnow, dthen;
78 gettimeofday(&now,NULL);
80 dnow = now.tv_sec + (now.tv_usec /1000000.0);
81 dthen = then.tv_sec + (then.tv_usec/1000000.0);
82 elapsed = dnow - dthen;
85 memcpy((
char *)&then, (
char *)&now,
sizeof(
struct timeval));
96 static int last_line=0, fps=0, fcount=0;
106 for(i=0;i<
WIDTH;++i) {
122 gettimeofday(&now,NULL);
123 line = now.tv_usec / (1000000/
HEIGHT);
129 if (last_line > line) {
134 fprintf(stderr,
"%03d/%03d Picture (%03d fps)\r", line,
HEIGHT, fps);
155 server->desktopName =
"Live Video Feed Example";
157 server->alwaysShared=(1==1);
165 if (
TakePicture((
unsigned char *)server->frameBuffer))
168 usec = server->deferUpdateTime*1000;
int TakePicture(unsigned char *buffer)
int main(int argc, char **argv)
void rfbInitServer(rfbScreenInfoPtr rfbScreen)
void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2)
rfbScreenInfoPtr rfbGetScreen(int *argc, char **argv, int width, int height, int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo)
rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo, long usec)