Changeset 4479
- Timestamp:
- 08/04/04 16:30:15 (20 years ago)
- Location:
- trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/amcframegrabber.cpp
r3401 r4479 7 7 { 8 8 m_pMutex = new QMutex(); 9 m_zActive = false; 9 10 10 11 m_iOffset = 0; … … 89 90 AMCFrameGrabber::~AMCFrameGrabber() 90 91 { 92 delete m_pMutex; 91 93 //closing the device and freeing allocated memory. 92 94 close(m_iVid); … … 100 102 int AMCFrameGrabber::grabFrame(u_char *data) 101 103 { 104 m_pMutex->lock(); 105 m_zActive = true; 106 m_pMutex->unlock(); 107 102 108 fd_set rfds; 103 109 FD_ZERO(&rfds); … … 107 113 tv.tv_usec = 1000; 108 114 int retval = select(m_iVid+1, &rfds, NULL, NULL, &tv); 109 if( ! retval )110 qDebug("Timed out waiting for frame");115 // if( ! retval ) 116 // qDebug("Timed out waiting for frame"); 111 117 112 118 int n; … … 115 121 //one can do a tricky thing with pointers. 116 122 123 m_pMutex->lock(); 124 m_zActive = false; 125 m_pMutex->unlock(); 126 117 127 if (n < 0) 118 128 { … … 277 287 return stCtrl.value; 278 288 } 289 290 /** 291 * If we are still grabbing a video frame, wait until we are done. 292 * In case we are active in grabbing a frame we sleep for 20ms (should be 293 * enough time to grab an NTSC frame) to unload the system. 294 */ 295 void AMCFrameGrabber::waitTillInactive() 296 { 297 for(;;) 298 { 299 m_pMutex->lock(); 300 if( ! m_zActive ) 301 { 302 m_pMutex->unlock(); 303 return; 304 } 305 m_pMutex->unlock(); 306 usleep(20000); 307 } 308 return; 309 } -
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/amcframegrabber.h
r3401 r4479 78 78 /** */ 79 79 virtual QMutex* getMutex() { return( m_pMutex ); }; 80 /** No descriptions */ 81 void waitTillInactive(); 80 82 81 83 protected: // Protected methods … … 125 127 struct v4l2_standard m_stStdNTSC; 126 128 QMutex* m_pMutex; 129 bool m_zActive; 127 130 }; 128 131
Note:
See TracChangeset
for help on using the changeset viewer.