|
|
|
@ -140,6 +140,7 @@ void VideoDev::SetConfig(std::string dev, int w, int h, std::string format, std:
|
|
|
|
|
#define CYCLETIME 0.050
|
|
|
|
|
void VideoDev::ThreadProcess() {
|
|
|
|
|
struct timeval cycle_timestamp;
|
|
|
|
|
int numframes = 0;
|
|
|
|
|
int lastsec = 0;
|
|
|
|
|
float cycle_time = 0.0;
|
|
|
|
|
float cycle_wait = 0.0;
|
|
|
|
@ -178,6 +179,7 @@ void VideoDev::ThreadProcess() {
|
|
|
|
|
Convert(&cdata, &threaddata.vf, threaddata.vfr.data, threaddata.vfr.size, threaddata.vfr.pixfmt, threaddata.vfr.w, threaddata.vfr.h);
|
|
|
|
|
switch (i) {
|
|
|
|
|
case VDEV_STATUS_OK:
|
|
|
|
|
numframes++;
|
|
|
|
|
if (callback) gdk_threads_add_idle(callback, &threaddata);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -193,8 +195,9 @@ void VideoDev::ThreadProcess() {
|
|
|
|
|
cycle_time = get_cycletime(&cycle_timestamp);
|
|
|
|
|
cycle_wait = (CYCLETIME - cycle_time) + cycle_wait;
|
|
|
|
|
if (lastsec != cycle_timestamp.tv_sec) {
|
|
|
|
|
printf ("%s:%d %s cycle_time:%f Freq:%f Hz \r", __FILE__, __LINE__, __FUNCTION__, cycle_time, (1.0/cycle_time));
|
|
|
|
|
printf ("%s:%d %s Loop: cycle_time:%f Freq:%f Hz Frames:%d \r", __FILE__, __LINE__, __FUNCTION__, cycle_time, (1.0/cycle_time), numframes);
|
|
|
|
|
lastsec = cycle_timestamp.tv_sec;
|
|
|
|
|
numframes = 0;
|
|
|
|
|
}
|
|
|
|
|
if (cycle_wait > 0.0 && cycle_wait < 1.0 ) usleep ((int)(cycle_wait * 1000000.0));
|
|
|
|
|
}
|
|
|
|
|