#include <ieee1394io.h>
Public Member Functions | |
| IEEE1394Writer () | |
| virtual | ~IEEE1394Writer () |
| void | StartThread () |
| void | StopThread () |
| int | WaitForAction (bool isBlocking, int seconds=1) |
| void | TriggerAction () |
| virtual bool | SendFrame (Frame &frame, bool isBlocking=true)=0 |
| virtual bool | isValid ()=0 |
| virtual void * | Thread ()=0 |
Protected Attributes | |
| bool | m_isInitialised |
| unsigned int | m_channel |
| unsigned int | m_nBuffers |
| deque< Frame * > | m_deque |
| pthread_t | m_thread |
| pthread_mutex_t | m_dequeMutex |
| this mutex protects capture related variables that could possibly accessed from two threads at the same time | |
| pthread_mutex_t | m_conditionMutex |
| This condition and mutex are used to indicate when new frames are received. | |
| pthread_cond_t | m_condition |
| bool | m_isRunning |
| A state variable for starting and stopping thread. | |
Static Private Member Functions | |
| static void * | ThreadProxy (void *arg) |
|
|
Definition at line 1210 of file ieee1394io.cc. References m_condition, m_conditionMutex, and m_dequeMutex. 01210 : 01211 m_isInitialised( false ), m_isRunning( false ) 01212 { 01213 pthread_mutex_init( &m_dequeMutex, NULL ); 01214 pthread_mutex_init( &m_conditionMutex, NULL ); 01215 pthread_cond_init( &m_condition, NULL ); 01216 }
|
|
|
Definition at line 1218 of file ieee1394io.cc. References GetFramePool(), m_condition, m_conditionMutex, m_deque, and m_dequeMutex. 01219 {
01220 for ( int i = m_deque.size(); i > 0; --i )
01221 {
01222 Frame* frame = m_deque[ 0 ];
01223 m_deque.pop_front();
01224 GetFramePool()->DoneWithFrame( frame );
01225 }
01226 pthread_mutex_destroy( &m_conditionMutex );
01227 pthread_cond_destroy( &m_condition );
01228 pthread_mutex_destroy( &m_dequeMutex );
01229 }
|
|
|
Referenced by Export1394::start(). |
|
||||||||||||
|
Referenced by readThread(), PageTrim::showFrame(), and PageEditor::showFrame(). |
|
|
Definition at line 1231 of file ieee1394io.cc. References m_isRunning, m_thread, and ThreadProxy(). 01232 {
01233 if ( m_isRunning )
01234 return;
01235 pthread_create( &m_thread, NULL, ThreadProxy, this );
01236 }
|
|
|
Definition at line 1238 of file ieee1394io.cc. References m_isRunning, and m_thread. 01239 {
01240 if ( m_isRunning )
01241 {
01242 m_isRunning = false;
01243 pthread_join( m_thread, NULL );
01244 }
01245 }
|
|
|
|
|
|
Definition at line 1301 of file ieee1394io.cc. Referenced by StartThread(). 01302 {
01303 IEEE1394Writer* self = static_cast< IEEE1394Writer* >( arg );
01304 return self->Thread();
01305 }
|
|
|
Definition at line 1294 of file ieee1394io.cc. References m_condition, and m_conditionMutex. 01295 {
01296 pthread_mutex_lock( &m_conditionMutex );
01297 pthread_cond_signal( &m_condition );
01298 pthread_mutex_unlock( &m_conditionMutex );
01299 }
|
|
||||||||||||
|
Definition at line 1247 of file ieee1394io.cc. References m_condition, m_conditionMutex, m_deque, m_dequeMutex, and m_nBuffers. 01248 {
01249 pthread_mutex_lock( &m_dequeMutex );
01250 int size = m_deque.size( );
01251 pthread_mutex_unlock( &m_dequeMutex );
01252
01253 if ( ( unsigned int )size >= m_nBuffers )
01254 {
01255 if ( isBlocking )
01256 {
01257 pthread_mutex_lock( &m_conditionMutex );
01258 if ( seconds == 0 )
01259 {
01260 pthread_cond_wait( &m_condition, &m_conditionMutex );
01261 pthread_mutex_unlock( &m_conditionMutex );
01262 pthread_mutex_lock( &m_dequeMutex );
01263 size = m_deque.size( );
01264 }
01265 else
01266 {
01267 struct timeval tp;
01268 struct timespec ts;
01269 int result;
01270
01271 gettimeofday( &tp, NULL );
01272 ts.tv_sec = tp.tv_sec + seconds;
01273 ts.tv_nsec = tp.tv_usec * 1000;
01274
01275 result = pthread_cond_timedwait( &m_condition, &m_conditionMutex, &ts );
01276 pthread_mutex_unlock( &m_conditionMutex );
01277 pthread_mutex_lock( &m_dequeMutex );
01278
01279 size = m_deque.size();
01280 if ( ( unsigned int )size >= m_nBuffers )
01281 size = -size;
01282 }
01283 pthread_mutex_unlock( &m_dequeMutex );
01284 }
01285 else
01286 {
01287 size = -size;
01288 }
01289 }
01290
01291 return size;
01292 }
|
|
|
Definition at line 223 of file ieee1394io.h. |
|
|
Definition at line 235 of file ieee1394io.h. Referenced by IEEE1394Writer(), TriggerAction(), WaitForAction(), and ~IEEE1394Writer(). |
|
|
This condition and mutex are used to indicate when new frames are received.
Definition at line 234 of file ieee1394io.h. Referenced by IEEE1394Writer(), TriggerAction(), WaitForAction(), and ~IEEE1394Writer(). |
|
|
Definition at line 225 of file ieee1394io.h. Referenced by WaitForAction(), and ~IEEE1394Writer(). |
|
|
this mutex protects capture related variables that could possibly accessed from two threads at the same time
Definition at line 230 of file ieee1394io.h. Referenced by IEEE1394Writer(), WaitForAction(), and ~IEEE1394Writer(). |
|
|
Definition at line 222 of file ieee1394io.h. |
|
|
A state variable for starting and stopping thread.
Definition at line 238 of file ieee1394io.h. Referenced by StartThread(), and StopThread(). |
|
|
Definition at line 224 of file ieee1394io.h. Referenced by WaitForAction(). |
|
|
Definition at line 226 of file ieee1394io.h. Referenced by StartThread(), and StopThread(). |
1.4.2