[Sumover-dev] [svn commit] r4152 - in vic/branches/mpeg4: codec rtp video

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Fri May 23 17:26:58 BST 2008


Author: piers
Date: Fri May 23 17:26:57 2008
New Revision: 4152

Modified:
   vic/branches/mpeg4/codec/decoder.cpp
   vic/branches/mpeg4/codec/decoder.h
   vic/branches/mpeg4/rtp/transmitter.cpp
   vic/branches/mpeg4/timer.cpp
   vic/branches/mpeg4/timer.h
   vic/branches/mpeg4/video/grabber-jv.cpp
   vic/branches/mpeg4/video/grabber-mme.cpp
   vic/branches/mpeg4/video/grabber-rtvc.cpp
   vic/branches/mpeg4/video/grabber-still.cpp
   vic/branches/mpeg4/video/grabber-sunrise.cpp
   vic/branches/mpeg4/video/grabber-xil.cpp
   vic/branches/mpeg4/video/grabber.cpp

Log:
Renamed gettimeofday() functions with an appropriate suffix according to
whether they return seconds (secs) or microseconds (usecs).


Modified: vic/branches/mpeg4/codec/decoder.cpp
==============================================================================
--- vic/branches/mpeg4/codec/decoder.cpp	(original)
+++ vic/branches/mpeg4/codec/decoder.cpp	Fri May 23 17:26:57 2008
@@ -198,7 +198,7 @@
 /*
  * Return time of day in microseconds.
  */
-double Decoder::gettimeofday()
+double Decoder::gettimeofday_usecs()
 {
 	timeval tv;
 	::gettimeofday(&tv, 0);

Modified: vic/branches/mpeg4/codec/decoder.h
==============================================================================
--- vic/branches/mpeg4/codec/decoder.h	(original)
+++ vic/branches/mpeg4/codec/decoder.h	Fri May 23 17:26:57 2008
@@ -82,7 +82,7 @@
 
 	static void allocshm(dmabuf&, int, int flag = 0);
 	static void freeshm(dmabuf&);
-	static double gettimeofday();
+	static double gettimeofday_usecs();
 
 	virtual int command(int argc, const char*const* argv);
 

Modified: vic/branches/mpeg4/rtp/transmitter.cpp
==============================================================================
--- vic/branches/mpeg4/rtp/transmitter.cpp	(original)
+++ vic/branches/mpeg4/rtp/transmitter.cpp	Fri May 23 17:26:57 2008
@@ -94,7 +94,8 @@
 	mh_.msg_iovlen = 2;
 }
 
-inline double Transmitter::gettimeofday() const
+/* Return time of day in seconds */
+inline double Transmitter::gettimeofday_secs() const
 {
 	timeval tv;
 	::gettimeofday(&tv, 0);
@@ -210,7 +211,7 @@
 {
 	if (!busy_) {
 		double delay = txtime(pb);
-		nextpkttime_ = gettimeofday() + delay;
+		nextpkttime_ = gettimeofday_secs() + delay;
 		output(pb);
 		/*
 		 * emulate a transmit interrupt --
@@ -230,7 +231,7 @@
 
 void Transmitter::timeout()
 {
-	double now = gettimeofday();
+	double now = gettimeofday_secs();
 	for (;;) {
 		pktbuf* p = head_;
 		if (p != 0) {

Modified: vic/branches/mpeg4/timer.cpp
==============================================================================
--- vic/branches/mpeg4/timer.cpp	(original)
+++ vic/branches/mpeg4/timer.cpp	Fri May 23 17:26:57 2008
@@ -68,7 +68,7 @@
 	}
 }
 
-double Timer::gettimeofday() const
+double Timer::gettimeofday_usecs() const
 {
 	timeval tv;
 	::gettimeofday(&tv, 0);

Modified: vic/branches/mpeg4/timer.h
==============================================================================
--- vic/branches/mpeg4/timer.h	(original)
+++ vic/branches/mpeg4/timer.h	Fri May 23 17:26:57 2008
@@ -50,7 +50,7 @@
 	inline void usched(double usec) { msched((int)(usec / 1000.)); }
 	inline void ssched(int seconds) { msched(1000 * seconds); }
 	void cancel();
-	double gettimeofday() const;
+	double gettimeofday_usecs() const;
 protected:
 	virtual void timeout() = 0;
 private:

Modified: vic/branches/mpeg4/video/grabber-jv.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-jv.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-jv.cpp	Fri May 23 17:26:57 2008
@@ -269,7 +269,7 @@
 void JvGrabber::start()
 {
 	link(server_, TK_READABLE);
-	frameclock_ = gettimeofday();
+	frameclock_ = gettimeofday_usecs();
 	kick();
 }
 

Modified: vic/branches/mpeg4/video/grabber-mme.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-mme.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-mme.cpp	Fri May 23 17:26:57 2008
@@ -469,7 +469,7 @@
 	if (mme_error(s, "couldn't start mme video stream\n"))
 		return;
 	running_ = 1;
-	frameclock_ = gettimeofday();
+	frameclock_ = gettimeofday_usecs();
 
 	outstanding_ = 0;
 	last_grab_ = 0;

Modified: vic/branches/mpeg4/video/grabber-rtvc.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-rtvc.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-rtvc.cpp	Fri May 23 17:26:57 2008
@@ -679,7 +679,7 @@
 {
 	setsize();
 	link(fd_, TK_READABLE);
-	double now = gettimeofday();
+	double now = gettimeofday_usecs();
 	frameclock_ = now;
 	nextframetime_ = now + tick(grab());
 }
@@ -698,7 +698,7 @@
 
 void RTVCGrabber::dispatch(int)
 {
-	double now = gettimeofday();
+	double now = gettimeofday_usecs();
 	if (nextframetime_ > now) {
 		/*
 		 * the frame is too early & we want to flush it.

Modified: vic/branches/mpeg4/video/grabber-still.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-still.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-still.cpp	Fri May 23 17:26:57 2008
@@ -186,7 +186,7 @@
 
 void StillGrabber::start()
 {
-    frameclock_ = gettimeofday();
+    frameclock_ = gettimeofday_usecs();
 
     timeout();
 }

Modified: vic/branches/mpeg4/video/grabber-sunrise.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-sunrise.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-sunrise.cpp	Fri May 23 17:26:57 2008
@@ -541,7 +541,7 @@
 	return;
     }
 
-    frameclock_ = gettimeofday();
+    frameclock_ = gettimeofday_usecs();
 
     /*
      * This sleep is VERY IMPORTANT. It lets the capture card
@@ -880,7 +880,7 @@
     }
 
     running_ = 1;
-    frameclock_ = gettimeofday();
+    frameclock_ = gettimeofday_usecs();
     timeout();
 }
 

Modified: vic/branches/mpeg4/video/grabber-xil.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-xil.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-xil.cpp	Fri May 23 17:26:57 2008
@@ -470,7 +470,7 @@
 //	return ;
 
 	//link(fd_, TK_READABLE);
-	double now = gettimeofday();
+	double now = gettimeofday_usecs();
 	frameclock_ = now;
 	nextframetime_ = now + tick(grab());
 }
@@ -484,7 +484,7 @@
 void XILGrabber::dispatch(int mask)
 {
 	UNUSED(mask);
-	double now = gettimeofday();
+	double now = gettimeofday_usecs();
 	if (nextframetime_ > now) {
 #if 0
 		if (fd_) {

Modified: vic/branches/mpeg4/video/grabber.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber.cpp	(original)
+++ vic/branches/mpeg4/video/grabber.cpp	Fri May 23 17:26:57 2008
@@ -202,9 +202,9 @@
  * 200ms behind (e.g., the cpu is saturated or we've been
  * suspended), give up and reset the frame clock.
  */
-double Grabber::tick(int n)
+double Grabber::tick(int frameSize)
 {
-	double frametime = 8e6 * double(n) / double(bps_);
+	double frametime = 8e6 * double(frameSize) / double(bps_); // uSecs
 	if (frametime < frametime_) {
 		if (frametime * 2. < frametime_)
 			delta_ += (frametime - delta_) * .25;
@@ -215,7 +215,7 @@
 		delta_ = frametime;
 
 	frameclock_ += frametime;
-	double now = gettimeofday();
+	double now = gettimeofday_usecs();
 	double delta = frameclock_ - now;
 	if (delta < -0.2e6) {
 		delta = frametime;
@@ -232,7 +232,7 @@
 
 void Grabber::start()
 {
-	frameclock_ = gettimeofday();
+	frameclock_ = gettimeofday_usecs();
 #ifndef WIN32
 	timeout();
 #endif



More information about the Sumover-dev mailing list