Changeset 509
- Timestamp:
- 07/29/07 11:02:25 (16 years ago)
- Files:
-
- branches/echoaudio/src/bebob/bebob_avdevice.cpp (modified) (12 diffs)
- branches/echoaudio/src/bebob/bebob_avdevice.h (modified) (1 diff)
- branches/echoaudio/src/bebob/bebob_avdevice_subunit.cpp (modified) (6 diffs)
- branches/echoaudio/src/bebob/bebob_avdevice_subunit.h (modified) (5 diffs)
- branches/echoaudio/src/bebob/bebob_avplug.cpp (modified) (4 diffs)
- branches/echoaudio/src/bebob/bebob_functionblock.cpp (modified) (2 diffs)
- branches/echoaudio/src/debugmodule/debugmodule.cpp (modified) (6 diffs)
- branches/echoaudio/src/debugmodule/debugmodule.h (modified) (1 diff)
- branches/echoaudio/src/devicemanager.cpp (modified) (3 diffs)
- branches/echoaudio/src/ffadodevice.h (modified) (1 diff)
- branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.cpp (modified) (3 diffs)
- branches/echoaudio/src/libavc/general/avc_plug.cpp (modified) (3 diffs)
- branches/echoaudio/src/libavc/general/avc_plug.h (modified) (2 diffs)
- branches/echoaudio/src/libavc/general/avc_subunit.cpp (modified) (4 diffs)
- branches/echoaudio/src/libavc/general/avc_subunit.h (modified) (5 diffs)
- branches/echoaudio/src/libavc/general/avc_unit.cpp (modified) (3 diffs)
- branches/echoaudio/src/libavc/general/avc_unit.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/echoaudio/src/bebob/bebob_avdevice.cpp
r507 r509 75 75 int nodeId ) 76 76 : FFADODevice( configRom, ieee1394service, nodeId ) 77 , AVC::Unit( configRom, ieee1394service, nodeId)77 , AVC::Unit( ) 78 78 , m_model ( NULL ) 79 79 , m_Mixer ( NULL ) … … 92 92 delete m_Mixer; 93 93 } 94 95 for ( SubunitVector::iterator it = m_subunits.begin();96 it != m_subunits.end();97 ++it )98 {99 delete *it;100 }101 for ( PlugConnectionVector::iterator it = m_plugConnections.begin();102 it != m_plugConnections.end();103 ++it )104 {105 delete *it;106 }107 for ( PlugVector::iterator it = m_pcrPlugs.begin();108 it != m_pcrPlugs.end();109 ++it )110 {111 delete *it;112 }113 for ( PlugVector::iterator it = m_externalPlugs.begin();114 it != m_externalPlugs.end();115 ++it )116 {117 delete *it;118 }119 94 } 120 95 … … 125 100 126 101 FFADODevice::setVerboseLevel(l); 102 AVC::Unit::setVerboseLevel(l); 127 103 } 128 104 … … 143 119 } 144 120 } 145 146 121 return false; 147 122 } … … 191 166 // } 192 167 168 // bebob specific discovery procedure 193 169 if ( !discoverPlugs() ) { 194 170 debugError( "Detecting plugs failed\n" ); … … 234 210 235 211 bool 212 AvDevice::enumerateSubUnits() 213 { 214 SubUnitInfoCmd subUnitInfoCmd( get1394Service() ); 215 subUnitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 216 217 // NOTE: BeBoB has always exactly one audio and one music subunit. This 218 // means is fits into the first page of the SubUnitInfo command. 219 // So there is no need to do more than needed 220 221 subUnitInfoCmd.m_page = 0; 222 subUnitInfoCmd.setNodeId( getConfigRom().getNodeId() ); 223 subUnitInfoCmd.setVerbose( getDebugLevel() ); 224 if ( !subUnitInfoCmd.fire() ) { 225 debugError( "Subunit info command failed\n" ); 226 // shouldn't this be an error situation? 227 return false; 228 } 229 230 for ( int i = 0; i < subUnitInfoCmd.getNrOfValidEntries(); ++i ) { 231 subunit_type_t subunit_type 232 = subUnitInfoCmd.m_table[i].m_subunit_type; 233 234 unsigned int subunitId = getNrOfSubunits( subunit_type ); 235 236 debugOutput( DEBUG_LEVEL_VERBOSE, 237 "subunit_id = %2d, subunit_type = %2d (%s)\n", 238 subunitId, 239 subunit_type, 240 subunitTypeToString( subunit_type ) ); 241 242 AVC::Subunit* subunit = 0; 243 switch( subunit_type ) { 244 case eST_Audio: 245 subunit = new BeBoB::SubunitAudio( *this, 246 subunitId ); 247 if ( !subunit ) { 248 debugFatal( "Could not allocate SubunitAudio\n" ); 249 return false; 250 } 251 252 if ( !subunit->discover() ) { 253 debugError( "enumerateSubUnits: Could not discover " 254 "subunit_id = %2d, subunit_type = %2d (%s)\n", 255 subunitId, 256 subunit_type, 257 subunitTypeToString( subunit_type ) ); 258 delete subunit; 259 return false; 260 } else { 261 m_subunits.push_back( subunit ); 262 } 263 264 break; 265 case eST_Music: 266 subunit = new BeBoB::SubunitMusic( *this, 267 subunitId ); 268 if ( !subunit ) { 269 debugFatal( "Could not allocate SubunitMusic\n" ); 270 return false; 271 } 272 if ( !subunit->discover() ) { 273 debugError( "enumerateSubUnits: Could not discover " 274 "subunit_id = %2d, subunit_type = %2d (%s)\n", 275 subunitId, 276 subunit_type, 277 subunitTypeToString( subunit_type ) ); 278 delete subunit; 279 return false; 280 } else { 281 m_subunits.push_back( subunit ); 282 } 283 284 break; 285 default: 286 debugOutput( DEBUG_LEVEL_NORMAL, 287 "Unsupported subunit found, subunit_type = %d (%s)\n", 288 subunit_type, 289 subunitTypeToString( subunit_type ) ); 290 continue; 291 292 } 293 } 294 295 return true; 296 } 297 298 bool 236 299 AvDevice::discoverPlugs() 237 300 { 301 debugOutput( DEBUG_LEVEL_NORMAL, "Discovering plugs...\n"); 302 238 303 ////////////////////////////////////////////// 239 304 // Get number of available isochronous input … … 294 359 plug_id_t plugMaxId ) 295 360 { 361 debugOutput( DEBUG_LEVEL_NORMAL, "Discovering PCR plugs, direction %d...\n",plugDirection); 296 362 for ( int plugId = 0; 297 363 plugId < plugMaxId; … … 323 389 plug_id_t plugMaxId ) 324 390 { 391 debugOutput( DEBUG_LEVEL_NORMAL, "Discovering Externals plugs, direction %d...\n",plugDirection); 325 392 for ( int plugId = 0; 326 393 plugId < plugMaxId; … … 353 420 ++it ) 354 421 { 355 AVC::Plug* plug = *it; 422 BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 423 if(!plug) { 424 debugError("BUG: not a bebob plug\n"); 425 return false; 426 } 356 427 if ( !plug->discoverConnections() ) { 357 428 debugError( "Could not discover plug connections\n" ); … … 363 434 ++it ) 364 435 { 365 AVC::Plug* plug = *it; 436 BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 437 if(!plug) { 438 debugError("BUG: not a bebob plug\n"); 439 return false; 440 } 366 441 if ( !plug->discoverConnections() ) { 367 442 debugError( "Could not discover plug connections\n" ); … … 376 451 AvDevice::discoverSubUnitsPlugConnections() 377 452 { 378 // for ( SubunitVector::iterator it = m_subunits.begin(); 379 // it != m_subunits.end(); 380 // ++it ) 381 // { 382 // Subunit* subunit = *it; 383 // if ( !subunit->discoverConnections() ) { 384 // debugError( "Subunit '%s' plug connections failed\n", 385 // subunit->getName() ); 386 // return false; 387 // } 388 // } 453 for ( SubunitVector::iterator it = m_subunits.begin(); 454 it != m_subunits.end(); 455 ++it ) 456 { 457 BeBoB::Subunit* subunit = dynamic_cast<BeBoB::Subunit*>(*it); 458 if (subunit==NULL) { 459 debugError("BUG: subunit is not a BeBoB::Subunit\n"); 460 return false; 461 } 462 463 if ( !subunit->discoverConnections() ) { 464 debugError( "Subunit '%s' plug connections failed\n", 465 subunit->getName() ); 466 return false; 467 } 468 } 389 469 return true; 390 470 } … … 738 818 739 819 m_pPlugManager->showPlugs(); 820 flushDebugOutput(); 740 821 } 741 822 branches/echoaudio/src/bebob/bebob_avdevice.h
r507 r509 97 97 // redefinition to resolve ambiguity 98 98 Ieee1394Service& get1394Service() 99 { return *m_p1394Service; }99 { return FFADODevice::get1394Service(); }; 100 100 ConfigRom& getConfigRom() const 101 { return FFADODevice::getConfigRom();};102 101 { return FFADODevice::getConfigRom(); }; 102 103 103 protected: 104 105 bool enumerateSubUnits(); 104 106 105 107 bool discoverPlugs(); branches/echoaudio/src/bebob/bebob_avdevice_subunit.cpp
r507 r509 36 36 using namespace AVC; 37 37 38 IMPL_DEBUG_MODULE( BeBoB::Subunit, BeBoB::Subunit, DEBUG_LEVEL_VERBOSE ); 39 IMPL_DEBUG_MODULE( BeBoB::SubunitAudio, BeBoB::SubunitAudio, DEBUG_LEVEL_VERBOSE ); 40 IMPL_DEBUG_MODULE( BeBoB::SubunitMusic, BeBoB::SubunitMusic, DEBUG_LEVEL_VERBOSE ); 41 42 bool 43 BeBoB::Subunit::discover() 44 { 45 if ( !discoverPlugs() ) { 46 debugError( "plug discovering failed\n" ); 47 return false; 48 } 49 50 return true; 51 } 52 53 bool 54 BeBoB::Subunit::discoverPlugs() 55 { 56 PlugInfoCmd plugInfoCmd( getUnit().get1394Service(), 57 PlugInfoCmd::eSF_SerialBusIsochronousAndExternalPlug ); 58 plugInfoCmd.setNodeId( getUnit().getConfigRom().getNodeId() ); 59 plugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 60 plugInfoCmd.setSubunitType( getSubunitType() ); 61 plugInfoCmd.setSubunitId( getSubunitId() ); 62 plugInfoCmd.setVerbose( getDebugLevel() ); 63 64 if ( !plugInfoCmd.fire() ) { 65 debugError( "plug info command failed\n" ); 66 return false; 67 } 68 69 debugOutput( DEBUG_LEVEL_NORMAL, "number of source plugs = %d\n", 70 plugInfoCmd.m_sourcePlugs ); 71 debugOutput( DEBUG_LEVEL_NORMAL, "number of destination output " 72 "plugs = %d\n", plugInfoCmd.m_destinationPlugs ); 73 74 if ( !discoverPlugs( Plug::eAPD_Input, 75 plugInfoCmd.m_destinationPlugs ) ) 76 { 77 debugError( "destination plug discovering failed\n" ); 78 return false; 79 } 80 81 if ( !discoverPlugs( Plug::eAPD_Output, 82 plugInfoCmd.m_sourcePlugs ) ) 83 { 84 debugError( "source plug discovering failed\n" ); 85 return false; 86 } 87 88 return true; 89 } 90 91 bool 92 BeBoB::Subunit::discoverConnections() 93 { 94 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); 95 96 for ( PlugVector::iterator it = getPlugs().begin(); 97 it != getPlugs().end(); 98 ++it ) 99 { 100 BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 101 if(!plug) { 102 debugError("BUG: not a bebob plug\n"); 103 return false; 104 } 105 if ( !plug->discoverConnections() ) { 106 debugError( "plug connection discovering failed ('%s')\n", 107 plug->getName() ); 108 return false; 109 } 110 } 111 112 return true; 113 } 114 115 bool 116 BeBoB::Subunit::discoverPlugs(Plug::EPlugDirection plugDirection, 117 plug_id_t plugMaxId ) 118 { 119 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering plugs...\n"); 120 for ( int plugIdx = 0; 121 plugIdx < plugMaxId; 122 ++plugIdx ) 123 { 124 ESubunitType subunitType = 125 static_cast<ESubunitType>( getSubunitType() ); 126 BeBoB::Plug* plug = new BeBoB::Plug( &getUnit(), 127 &getSubunit(), 128 0xff, 129 0xff, 130 Plug::eAPA_SubunitPlug, 131 plugDirection, 132 plugIdx ); 133 if ( !plug ) { 134 debugError( "plug creation failed\n" ); 135 return false; 136 } 137 138 plug->setVerboseLevel(getDebugLevel()); 139 140 if ( !plug->discover() ) { 141 debugError( "plug discover failed\n" ); 142 return false; 143 } 144 145 debugOutput( DEBUG_LEVEL_NORMAL, "plug '%s' found\n", 146 plug->getName() ); 147 getPlugs().push_back( plug ); 148 } 149 return true; 150 } 151 152 153 ////////////////////////// 38 154 39 155 BeBoB::SubunitAudio::SubunitAudio( AVC::Unit& avDevice, 40 156 subunit_t id ) 41 157 : AVC::SubunitAudio( avDevice, id ) 158 , BeBoB::Subunit() 42 159 { 43 160 } … … 56 173 BeBoB::SubunitAudio::discover() 57 174 { 58 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering Audio Subunit...\n");175 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering %s...\n", getName()); 59 176 177 // discover the AV/C generic part 60 178 if ( !AVC::SubunitAudio::discover() ) { 61 179 return false; 62 180 } 63 181 182 // do BeBoB subunit specific discovery 183 if ( !BeBoB::Subunit::discover() ) { 184 return false; 185 } 186 187 // do the remaining BeBoB audio subunit discovery 64 188 if ( !discoverFunctionBlocks() ) { 65 189 debugError( "function block discovering failed\n" ); … … 74 198 { 75 199 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); 76 if ( ! Subunit::discoverConnections() ) {200 if ( !BeBoB::Subunit::discoverConnections() ) { 77 201 return false; 78 202 } … … 362 486 363 487 BeBoB::SubunitMusic::SubunitMusic( AVC::Unit& avDevice, 364 488 subunit_t id ) 365 489 : AVC::SubunitMusic( avDevice, id ) 490 , BeBoB::Subunit() 366 491 { 367 492 } … … 369 494 BeBoB::SubunitMusic::SubunitMusic() 370 495 : AVC::SubunitMusic() 496 , BeBoB::Subunit() 371 497 { 372 498 } … … 374 500 BeBoB::SubunitMusic::~SubunitMusic() 375 501 { 502 } 503 504 bool 505 BeBoB::SubunitMusic::discover() 506 { 507 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering %s...\n", getName()); 508 509 // discover the AV/C generic part 510 if ( !AVC::SubunitMusic::discover() ) { 511 return false; 512 } 513 514 // do BeBoB subunit specific discovery 515 if ( !BeBoB::Subunit::discover() ) { 516 return false; 517 } 518 519 // do the remaining BeBoB music subunit discovery 520 // which is nothing 521 522 return true; 376 523 } 377 524 branches/echoaudio/src/bebob/bebob_avdevice_subunit.h
r508 r509 44 44 ///////////////////////////// 45 45 46 class SubunitAudio: public AVC::SubunitAudio { 47 public: 46 class Subunit { 47 public: 48 Subunit() {}; 49 virtual ~Subunit() {}; 50 virtual bool discover(); 51 virtual bool discoverConnections(); 52 53 // required functions 54 // implemented by the derived class 55 virtual const char* getName() = 0; 56 virtual AVC::subunit_t getSubunitId() = 0; 57 virtual AVC::ESubunitType getSubunitType() = 0; 58 virtual AVC::Unit& getUnit() const = 0; 59 virtual AVC::Subunit& getSubunit() = 0; 60 virtual AVC::PlugVector& getPlugs() = 0; 61 62 protected: 63 bool discoverPlugs(); 64 bool discoverPlugs(Plug::EPlugDirection plugDirection, 65 AVC::plug_id_t plugMaxId ); 66 private: 67 DECLARE_DEBUG_MODULE; 68 }; 69 70 ///////////////////////////// 71 72 class SubunitAudio : public AVC::SubunitAudio 73 , public BeBoB::Subunit 74 { 75 public: 48 76 SubunitAudio( AVC::Unit& avDevice, 49 AVC::subunit_t id );77 AVC::subunit_t id ); 50 78 SubunitAudio(); 51 79 virtual ~SubunitAudio(); … … 54 82 virtual bool discoverConnections(); 55 83 84 // required interface for BeBoB::Subunit 56 85 virtual const char* getName(); 86 virtual AVC::subunit_t getSubunitId() 87 { return AVC::SubunitAudio::getSubunitId(); }; 88 virtual AVC::ESubunitType getSubunitType() 89 { return AVC::SubunitAudio::getSubunitType(); }; 90 virtual AVC::Unit& getUnit() const 91 { return AVC::SubunitAudio::getUnit(); }; 92 virtual AVC::Subunit& getSubunit() 93 { return *this; }; 94 virtual AVC::PlugVector& getPlugs() 95 { return AVC::SubunitAudio::getPlugs(); }; 57 96 58 FunctionBlockVector getFunctionBlocks() { return m_functions; };59 60 97 protected: 61 98 bool discoverFunctionBlocks(); … … 74 111 Util::IODeserialize& deser, 75 112 AVC::Unit& unit ); 76 77 protected: 78 FunctionBlockVector m_functions; 113 private: 114 DECLARE_DEBUG_MODULE; 79 115 }; 80 116 81 117 ///////////////////////////// 82 118 83 class SubunitMusic: public AVC::SubunitMusic { 119 class SubunitMusic : public AVC::SubunitMusic 120 , public BeBoB::Subunit 121 { 84 122 public: 85 123 SubunitMusic( AVC::Unit& avDevice, … … 88 126 virtual ~SubunitMusic(); 89 127 128 // required interface for BeBoB::Subunit 90 129 virtual const char* getName(); 130 virtual AVC::subunit_t getSubunitId() 131 { return AVC::SubunitMusic::getSubunitId(); }; 132 virtual AVC::ESubunitType getSubunitType() 133 { return AVC::SubunitMusic::getSubunitType(); }; 134 virtual AVC::Unit& getUnit() const 135 { return AVC::SubunitMusic::getUnit(); }; 136 virtual AVC::Subunit& getSubunit() 137 { return *this; }; 138 virtual AVC::PlugVector& getPlugs() 139 { return AVC::SubunitMusic::getPlugs(); }; 140 141 142 virtual bool discover(); 91 143 92 144 protected: … … 96 148 Util::IODeserialize& deser, 97 149 AVC::Unit& unit ); 150 private: 151 DECLARE_DEBUG_MODULE; 98 152 }; 99 153 branches/echoaudio/src/bebob/bebob_avplug.cpp
r507 r509 50 50 plugId ) 51 51 { 52 52 debugOutput( DEBUG_LEVEL_VERBOSE, 53 "nodeId = %d, subunitType = %d, " 54 "subunitId = %d, functionBlockType = %d, " 55 "functionBlockId = %d, addressType = %d, " 56 "direction = %d, id = %d\n", 57 unit->getConfigRom().getNodeId(), 58 getSubunitType(), 59 getSubunitId(), 60 functionBlockType, 61 functionBlockId, 62 plugAddressType, 63 plugDirection, 64 plugId ); 53 65 } 54 66 … … 56 68 : AVC::Plug( rhs ) 57 69 { 70 58 71 } 59 72 … … 600 613 601 614 if ( formatInfoIsValid ) { 615 flushDebugOutput(); 602 616 debugOutput( DEBUG_LEVEL_VERBOSE, 603 617 "[%s:%d] formatInfo[%d].m_samplingFrequency " … … 618 632 i, formatInfo.m_midiChannels ); 619 633 m_formatInfos.push_back( formatInfo ); 634 flushDebugOutput(); 620 635 } 621 636 } branches/echoaudio/src/bebob/bebob_functionblock.cpp
r507 r509 34 34 35 35 FunctionBlock::FunctionBlock( 36 Subunit& subunit,36 AVC::Subunit& subunit, 37 37 function_block_type_t type, 38 38 function_block_type_t subtype, … … 146 146 ++it ) 147 147 { 148 AVC::Plug* plug = *it; 148 BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 149 if(!plug) { 150 debugError("BUG: not a bebob plug\n"); 151 return false; 152 } 149 153 if ( !plug->discoverConnections() ) { 150 154 debugError( "Could not discover plug connections\n" ); branches/echoaudio/src/debugmodule/debugmodule.cpp
r499 r509 30 30 #include <iostream> 31 31 32 #define DO_MESSAGE_BUFFER_PRINT 32 #include <time.h> 33 34 //#define DO_MESSAGE_BUFFER_PRINT 33 35 34 36 using namespace std; … … 113 115 fname=f; 114 116 } 115 116 DebugModuleManager::instance()->print( "%s (%s)[%4d] %s: ", getPreSequence( level ), 117 118 // add a timing timestamp 119 struct timespec ts; 120 clock_gettime(CLOCK_MONOTONIC, &ts); 121 uint32_t ts_usec=(uint32_t)(ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL); 122 123 DebugModuleManager::instance()->print( "%010lu: %s (%s)[%4d] %s: ", 124 ts_usec, getPreSequence( level ), 117 125 fname, line, function ); 118 126 DebugModuleManager::instance()->va_print( format, arg ); … … 197 205 198 206 pthread_mutex_init(&mb_write_lock, NULL); 207 pthread_mutex_init(&mb_flush_lock, NULL); 199 208 pthread_cond_init(&mb_ready_cond, NULL); 200 209 … … 288 297 DebugModuleManager::flush() 289 298 { 290 mb_flush();299 // mb_flush(); 291 300 } 292 301 … … 295 304 { 296 305 /* called WITHOUT the mb_write_lock */ 306 307 /* the flush lock is to allow a flush from multiple threads 308 * this allows a code section that outputs a lot of debug messages 309 * and that can be blocked to flush the buffer itself such that it 310 * does not overflow. 311 */ 312 DebugModuleManager *m=DebugModuleManager::instance(); 313 pthread_mutex_lock(&m->mb_flush_lock); 297 314 while (mb_outbuffer != mb_inbuffer) { 298 315 fputs(mb_buffers[mb_outbuffer], stderr); 299 316 mb_outbuffer = MB_NEXT(mb_outbuffer); 300 317 } 318 pthread_mutex_unlock(&m->mb_flush_lock); 301 319 } 302 320 … … 376 394 return; 377 395 } 378 396 379 397 #ifdef DO_MESSAGE_BUFFER_PRINT 380 398 if (pthread_mutex_trylock(&mb_write_lock) == 0) { branches/echoaudio/src/debugmodule/debugmodule.h
r499 r509 230 230 pthread_t mb_writer_thread; 231 231 pthread_mutex_t mb_write_lock; 232 pthread_mutex_t mb_flush_lock; 232 233 pthread_cond_t mb_ready_cond; 233 234 branches/echoaudio/src/devicemanager.cpp
r500 r509 228 228 229 229 FFADODevice* avDevice = getDriverForDevice( configRom, 230 nodeId );230 nodeId ); 231 231 if ( avDevice ) { 232 232 debugOutput( DEBUG_LEVEL_NORMAL, … … 266 266 debugWarning("failed to register AvDevice at OSC server\n"); 267 267 } 268 269 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d done...\n", nodeId ); 268 270 269 271 } 270 272 } 273 274 debugOutput( DEBUG_LEVEL_NORMAL, "discovery finished...\n" ); 275 271 276 return true; 272 277 … … 313 318 314 319 m_avDevices.push_back( avDevice ); 315 } 320 321 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d done...\n", nodeId ); 322 } 323 324 debugOutput( DEBUG_LEVEL_NORMAL, "discovery finished...\n" ); 316 325 317 326 return true; branches/echoaudio/src/ffadodevice.h
r505 r509 54 54 virtual ~FFADODevice() {}; 55 55 56 /// Returns the 1394 service of the FFADO device 57 virtual Ieee1394Service& get1394Service() 58 { return *m_p1394Service; }; 56 59 /// Returns the ConfigRom object of the device node. 57 ConfigRom& getConfigRom() const;60 virtual ConfigRom& getConfigRom() const; 58 61 59 62 /** branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.cpp
r508 r509 60 60 SubunitAudio::discover() 61 61 { 62 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering Audio Subunit...\n");62 debugOutput(DEBUG_LEVEL_NORMAL, "Discovering %s...\n", getName()); 63 63 64 64 if ( !Subunit::discover() ) { … … 66 66 } 67 67 68 // if ( !discoverBeBoB::FunctionBlocks() ) {69 // debugError( "function block discovering failed\n" );70 // return false;71 // }72 73 68 return true; 74 69 } … … 78 73 SubunitAudio::getName() 79 74 { 80 return "A udioSubunit";75 return "AVC::AudioSubunit"; 81 76 } 82 77 branches/echoaudio/src/libavc/general/avc_plug.cpp
r507 r509 119 119 Plug::getSubunitId() const 120 120 { 121 return (m_subunit==NULL?eST_Unit:m_subunit->getSubunitId()); 122 } 123 124 /* 125 bool 126 Plug::discover() 127 { 128 if ( !discoverPlugType() ) { 129 debugError( "discover: Could not discover plug type (%d,%d,%d,%d,%d)\n", 130 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 131 return false; 132 } 133 134 if ( !discoverName() ) { 135 debugError( "Could not discover name (%d,%d,%d,%d,%d)\n", 136 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 137 return false; 138 } 139 140 if ( !discoverNoOfChannels() ) { 141 debugError( "Could not discover number of channels " 142 "(%d,%d,%d,%d,%d)\n", 143 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 144 return false; 145 } 146 147 if ( !discoverChannelPosition() ) { 148 debugError( "Could not discover channel positions " 149 "(%d,%d,%d,%d,%d)\n", 150 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 151 return false; 152 } 153 154 if ( !discoverChannelName() ) { 155 debugError( "Could not discover channel name " 156 "(%d,%d,%d,%d,%d)\n", 157 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 158 return false; 159 } 160 161 if ( !discoverClusterInfo() ) { 162 debugError( "Could not discover channel name " 163 "(%d,%d,%d,%d,%d)\n", 164 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 165 return false; 166 } 167 168 if ( !discoverStreamFormat() ) { 169 debugError( "Could not discover stream format " 170 "(%d,%d,%d,%d,%d)\n", 171 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 172 return false; 173 } 174 175 if ( !discoverSupportedStreamFormats() ) { 176 debugError( "Could not discover supported stream formats " 177 "(%d,%d,%d,%d,%d)\n", 178 m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 179 return false; 180 } 181 182 return unit->getPlugManager().addPlug( *this ); 183 } 184 185 bool 186 Plug::discoverConnections() 187 { 188 return discoverConnectionsInput() && discoverConnectionsOutput(); 189 } 190 */ 121 return (m_subunit==NULL?0xFF:m_subunit->getSubunitId()); 122 } 191 123 192 124 bool … … 527 459 debugOutput( DEBUG_LEVEL_VERBOSE, "\tNumber of Streams = %d\n", 528 460 getNrOfStreams() ); 461 flushDebugOutput(); 529 462 } 530 463 … … 948 881 PlugManager& plugManager ) 949 882 { 883 #warning FIXME: The derived class should be creating these 884 // FIXME: The derived class should be creating these, such that discover() can become pure virtual 885 950 886 Plug* pPlug = new Plug; 951 887 if ( !pPlug ) { branches/echoaudio/src/libavc/general/avc_plug.h
r507 r509 92 92 virtual bool discover() 93 93 {//FIXME: 94 #warning FIXME 95 };; 96 virtual bool discoverConnections() 97 {//FIXME: 98 #warning FIXME 99 };; 94 #warning FIXME i want to be pure!! 95 return true; 96 }; 100 97 101 98 bool inquireConnnection( Plug& plug ); … … 171 168 ClusterInfoVector& getClusterInfos() 172 169 { return m_clusterInfos; } 173 170 171 virtual void setVerboseLevel( int i ) 172 {setDebugLevel(i);}; 174 173 protected: 175 174 Plug(); branches/echoaudio/src/libavc/general/avc_subunit.cpp
r508 r509 36 36 #include <sstream> 37 37 38 #warning do we need this?39 #include "bebob/bebob_avplug.h"40 41 38 namespace AVC { 42 39 … … 73 70 { 74 71 // There is nothing we can discover for a generic subunit 75 // Maybe its plugs, but there are multiple ways of doing that. 72 // Maybe the plugs, but there are multiple ways of doing that. 73 // subclasses should implement this 76 74 return true; 77 75 } … … 118 116 Subunit* 119 117 Subunit::deserialize( Glib::ustring basePath, 120 121 118 Util::IODeserialize& deser, 119 Unit& unit ) 122 120 { 123 121 bool result; … … 126 124 127 125 Subunit* pSubunit = 0; 126 127 #warning FIXME: The derived class should be creating these 128 // FIXME: The derived class should be creating these, such that discover() can become pure virtual 128 129 switch( sbType ) { 129 130 case eST_Audio: branches/echoaudio/src/libavc/general/avc_subunit.h
r508 r509 51 51 52 52 virtual bool discover(); 53 virtual bool discoverConnections()54 {//FIXME:55 #warning FIXME56 };57 58 53 virtual const char* getName() = 0; 59 54 … … 63 58 { return m_sbType; } 64 59 60 Unit& getUnit() const 61 { return *m_unit; } 62 63 65 64 bool addPlug( Plug& plug ); 66 65 … … 68 67 { return m_plugs; } 69 68 Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId); 70 71 72 Unit& getUnit() const73 { return *m_unit; }74 69 75 70 … … 81 76 Subunit(); 82 77 83 // bool discoverPlugs();84 // bool discoverPlugs(Plug::EPlugDirection plugDirection,85 // plug_id_t plugMaxId );86 //87 78 virtual bool serializeChild( Glib::ustring basePath, 88 79 Util::IOSerialize& ser ) const = 0; … … 96 87 subunit_t m_sbId; 97 88 98 PlugVector 89 PlugVector m_plugs; 99 90 100 91 DECLARE_DEBUG_MODULE; branches/echoaudio/src/libavc/general/avc_unit.cpp
r507 r509 46 46 IMPL_DEBUG_MODULE( Unit, Unit, DEBUG_LEVEL_VERBOSE ); 47 47 48 Unit::Unit( std::auto_ptr< ConfigRom >( configRom ), 49 Ieee1394Service& ieee1394service, 50 int nodeId ) 48 Unit::Unit( ) 51 49 : m_pPlugManager( new PlugManager( ) ) 52 50 , m_activeSyncInfo( 0 ) 53 , m_puConfigRom( configRom ) 54 , m_pu1394Service( &ieee1394service ) 55 { 56 debugOutput( DEBUG_LEVEL_VERBOSE, "Created AVC::Unit (NodeID %d)\n", 57 nodeId ); 51 { 52 debugOutput( DEBUG_LEVEL_VERBOSE, "Created AVC::Unit\n" ); 58 53 } 59 54 … … 107 102 Unit::enumerateSubUnits() 108 103 { 109 SubUnitInfoCmd subUnitInfoCmd( *m_pu1394Service);104 SubUnitInfoCmd subUnitInfoCmd( get1394Service() ); 110 105 subUnitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 111 106 … … 117 112 118 113 subUnitInfoCmd.m_page = 0; 119 subUnitInfoCmd.setNodeId( m_puConfigRom->getNodeId() );114 subUnitInfoCmd.setNodeId( getConfigRom().getNodeId() ); 120 115 subUnitInfoCmd.setVerbose( getDebugLevel() ); 121 116 if ( !subUnitInfoCmd.fire() ) { branches/echoaudio/src/libavc/general/avc_unit.h
r508 r509 49 49 class Unit { 50 50 public: 51 Unit( std::auto_ptr<ConfigRom>( configRom ), 52 Ieee1394Service& ieee1394Service, 53 int nodeId ); 51 Unit( ); 54 52 virtual ~Unit(); 55 53 … … 57 55 virtual void showDevice(); 58 56 59 Ieee1394Service& get1394Service()60 { return *m_pu1394Service; }61 57 // these have to be implemented by the parent class 58 /// Returns the 1394 service 59 virtual Ieee1394Service& get1394Service() = 0; 62 60 /// Returns the ConfigRom 63 ConfigRom& getConfigRom() const 64 {return *m_puConfigRom;}; 61 virtual ConfigRom& getConfigRom() const = 0; 65 62 66 63 /// Discovers the unit's internals … … 150 147 151 148 private: 152 std::auto_ptr<ConfigRom>( m_puConfigRom );153 Ieee1394Service* m_pu1394Service;154 155 149 DECLARE_DEBUG_MODULE; 156 150