Changeset 1132
- Timestamp:
- 05/07/08 13:39:26 (16 years ago)
- Files:
-
- trunk/libffado/src/ffadodevice.cpp (modified) (3 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (32 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/ffadodevice.cpp
r1063 r1132 147 147 FFADODevice::setId( unsigned int id) 148 148 { 149 m_DeviceMutex.Lock();149 Util::MutexLockHelper lock(m_DeviceMutex); 150 150 bool retval; 151 151 // FIXME: decent ID system nescessary … … 155 155 156 156 retval=setOption("id",idstr.str()); 157 m_DeviceMutex.Unlock();158 157 return retval; 159 158 } … … 179 178 sleep(1); 180 179 181 m_DeviceMutex.Lock();180 Util::MutexLockHelper lock(m_DeviceMutex); 182 181 getConfigRom().setVerboseLevel(getDebugLevel()); 183 182 getConfigRom().updatedNodeId(); 184 m_DeviceMutex.Unlock();185 183 } 186 184 trunk/libffado/src/genericavc/avc_avdevice.cpp
r1131 r1132 98 98 AvDevice::discover() 99 99 { 100 m_DeviceMutex.Lock();100 Util::MutexLockHelper lock(m_DeviceMutex); 101 101 // check if we already have a valid VendorModel entry 102 102 // e.g. because a subclass called this function … … 111 111 112 112 if (!GenericAVC::VendorModel::isValid(m_model)) { 113 m_DeviceMutex.Unlock();114 113 return false; 115 114 } … … 120 119 if ( !Unit::discover() ) { 121 120 debugError( "Could not discover unit\n" ); 122 m_DeviceMutex.Unlock();123 121 return false; 124 122 } … … 126 124 if((getAudioSubunit( 0 ) == NULL)) { 127 125 debugError( "Unit doesn't have an Audio subunit.\n"); 128 m_DeviceMutex.Unlock();129 126 return false; 130 127 } 131 128 if((getMusicSubunit( 0 ) == NULL)) { 132 129 debugError( "Unit doesn't have a Music subunit.\n"); 133 m_DeviceMutex.Unlock(); 134 return false; 135 } 136 m_DeviceMutex.Unlock(); 130 return false; 131 } 137 132 138 133 return true; … … 142 137 AvDevice::setVerboseLevel(int l) 143 138 { 144 m_DeviceMutex.Lock();139 Util::MutexLockHelper lock(m_DeviceMutex); 145 140 setDebugLevel(l); 146 141 m_pPlugManager->setVerboseLevel(l); … … 148 143 AVC::Unit::setVerboseLevel(l); 149 144 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 150 m_DeviceMutex.Unlock();151 145 } 152 146 … … 176 170 AvDevice::setSamplingFrequency( int s ) 177 171 { 178 m_DeviceMutex.Lock();172 Util::MutexLockHelper lock(m_DeviceMutex); 179 173 bool snoopMode=false; 180 174 if(!getOption("snoopMode", snoopMode)) { … … 187 181 debugError("In snoop mode it is impossible to set the sample rate.\n"); 188 182 debugError("Please start the client with the correct setting.\n"); 189 m_DeviceMutex.Unlock(); 190 return false; 191 } 192 m_DeviceMutex.Unlock(); 183 return false; 184 } 193 185 return true; 194 186 } else { … … 196 188 if ( !plug ) { 197 189 debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 198 m_DeviceMutex.Unlock();199 190 return false; 200 191 } … … 203 194 { 204 195 debugError( "setSampleRate: Setting sample rate failed\n" ); 205 m_DeviceMutex.Unlock();206 196 return false; 207 197 } … … 210 200 if ( !plug ) { 211 201 debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 212 m_DeviceMutex.Unlock();213 202 return false; 214 203 } … … 217 206 { 218 207 debugError( "setSampleRate: Setting sample rate failed\n" ); 219 m_DeviceMutex.Unlock();220 208 return false; 221 209 } … … 224 212 "setSampleRate: Set sample rate to %d\n", 225 213 s ); 226 m_DeviceMutex.Unlock();227 214 return true; 228 215 } 229 216 // not executable 230 m_DeviceMutex.Unlock();231 217 return false; 232 218 … … 237 223 FFADODevice::ClockSourceVector r; 238 224 239 m_DeviceMutex.Lock();225 Util::MutexLockHelper lock(m_DeviceMutex); 240 226 241 227 PlugVector syncMSUInputPlugs = m_pPlugManager->getPlugsByType( … … 275 261 } 276 262 } 277 278 m_DeviceMutex.Unlock();279 263 return r; 280 264 } … … 288 272 } 289 273 290 m_DeviceMutex.Lock();274 Util::MutexLockHelper lock(m_DeviceMutex); 291 275 for ( SyncInfoVector::const_iterator it 292 276 = getSyncInfos().begin(); … … 297 281 298 282 if (si.m_source==src) { 299 m_DeviceMutex.Unlock();300 283 return setActiveSync(si); 301 284 } 302 285 } 303 m_DeviceMutex.Unlock();304 305 286 return false; 306 287 } … … 392 373 AvDevice::lock() { 393 374 bool snoopMode=false; 394 m_DeviceMutex.Lock();375 Util::MutexLockHelper lock(m_DeviceMutex); 395 376 if(!getOption("snoopMode", snoopMode)) { 396 377 debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); … … 402 383 // return Unit::reserve(4); 403 384 } 404 m_DeviceMutex.Unlock();405 385 406 386 return true; … … 410 390 AvDevice::unlock() { 411 391 bool snoopMode=false; 412 m_DeviceMutex.Lock();392 Util::MutexLockHelper lock(m_DeviceMutex); 413 393 if(!getOption("snoopMode", snoopMode)) { 414 394 debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); … … 420 400 // return Unit::reserve(0); 421 401 } 422 m_DeviceMutex.Unlock();423 402 return true; 424 403 } … … 436 415 AvDevice::prepare() { 437 416 bool snoopMode=false; 438 m_DeviceMutex.Lock();417 Util::MutexLockHelper lock(m_DeviceMutex); 439 418 if(!getOption("snoopMode", snoopMode)) { 440 419 debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); … … 447 426 if ( !inputPlug ) { 448 427 debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 449 m_DeviceMutex.Unlock();450 428 return false; 451 429 } … … 453 431 if ( !outputPlug ) { 454 432 debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 455 m_DeviceMutex.Unlock();456 433 return false; 457 434 } … … 463 440 if ( outputPlug->getNrOfChannels() == 0 ) { 464 441 debugError("Receive plug has no channels\n"); 465 m_DeviceMutex.Unlock();466 442 return false; 467 443 } … … 472 448 debugFatal("Could not initialize receive processor!\n"); 473 449 delete p; 474 m_DeviceMutex.Unlock();475 450 return false; 476 451 } … … 480 455 debugFatal("Could not add plug to processor!\n"); 481 456 delete p; 482 m_DeviceMutex.Unlock();483 457 return false; 484 458 } … … 508 482 (snoopMode?" in snoop mode":"")); 509 483 delete p; 510 m_DeviceMutex.Unlock();511 484 return false; 512 485 } … … 516 489 Streaming::Port::E_Capture)) { 517 490 debugFatal("Could not add plug to processor!\n"); 518 m_DeviceMutex.Unlock();519 491 return false; 520 492 } … … 523 495 Streaming::Port::E_Playback)) { 524 496 debugFatal("Could not add plug to processor!\n"); 525 m_DeviceMutex.Unlock();526 497 return false; 527 498 } … … 534 505 m_transmitProcessors.push_back(p); 535 506 536 m_DeviceMutex.Unlock();537 507 return true; 538 508 } … … 637 607 AvDevice::getStreamCount() { 638 608 int retval; 639 m_DeviceMutex.Lock();609 Util::MutexLockHelper lock(m_DeviceMutex); 640 610 retval = m_receiveProcessors.size() + m_transmitProcessors.size(); 641 m_DeviceMutex.Unlock();642 611 return retval; 643 //return 1;644 612 } 645 613