Changeset 426
- Timestamp:
- 02/28/07 05:15:40 (17 years ago)
- Files:
-
- branches/streaming-rework/src/bebob/bebob_avdevice.cpp (modified) (6 diffs)
- branches/streaming-rework/src/bebob/bebob_avdevice.h (modified) (6 diffs)
- branches/streaming-rework/src/bebob/bebob_avdevice_xml.cpp (modified) (1 diff)
- branches/streaming-rework/src/bounce/bounce_avdevice.cpp (modified) (5 diffs)
- branches/streaming-rework/src/bounce/bounce_avdevice.h (modified) (4 diffs)
- branches/streaming-rework/src/bounce/bounce_slave_avdevice.cpp (modified) (2 diffs)
- branches/streaming-rework/src/bounce/bounce_slave_avdevice.h (modified) (2 diffs)
- branches/streaming-rework/src/devicemanager.cpp (modified) (13 diffs)
- branches/streaming-rework/src/devicemanager.h (modified) (1 diff)
- branches/streaming-rework/src/dice/dice_avdevice.cpp (modified) (5 diffs)
- branches/streaming-rework/src/dice/dice_avdevice.h (modified) (4 diffs)
- branches/streaming-rework/src/iavdevice.cpp (added)
- branches/streaming-rework/src/iavdevice.h (modified) (5 diffs)
- branches/streaming-rework/src/Makefile.am (modified) (1 diff)
- branches/streaming-rework/src/maudio/maudio_avdevice.cpp (modified) (2 diffs)
- branches/streaming-rework/src/maudio/maudio_avdevice.h (modified) (3 diffs)
- branches/streaming-rework/src/metrichalo/mh_avdevice.cpp (modified) (5 diffs)
- branches/streaming-rework/src/metrichalo/mh_avdevice.h (modified) (2 diffs)
- branches/streaming-rework/src/motu/motu_avdevice.cpp (modified) (6 diffs)
- branches/streaming-rework/src/motu/motu_avdevice.h (modified) (4 diffs)
- branches/streaming-rework/src/rme/rme_avdevice.cpp (modified) (5 diffs)
- branches/streaming-rework/src/rme/rme_avdevice.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/streaming-rework/src/bebob/bebob_avdevice.cpp
r424 r426 39 39 namespace BeBoB { 40 40 41 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_NORMAL );42 43 41 static VendorModelEntry supportedDeviceList[] = 44 42 { … … 64 62 }; 65 63 66 67 64 AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), 68 65 Ieee1394Service& ieee1394service, 69 int nodeId, 70 int verboseLevel ) 71 : m_pConfigRom( configRom ) 72 , m_p1394Service( &ieee1394service ) 73 , m_verboseLevel( verboseLevel ) 74 , m_pPlugManager( new AvPlugManager( verboseLevel ) ) 66 int nodeId ) 67 : IAvDevice( configRom, ieee1394service, nodeId ) 68 , m_pPlugManager( new AvPlugManager( DEBUG_LEVEL_NORMAL ) ) 75 69 , m_activeSyncInfo( 0 ) 76 70 , m_model ( NULL ) 77 , m_nodeId ( nodeId ) 78 { 79 setDebugLevel( verboseLevel ); 71 { 80 72 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::AvDevice (NodeID %d)\n", 81 73 nodeId ); 82 74 addOption(Util::OptionContainer::Option("snoopMode",false)); 83 addOption(Util::OptionContainer::Option("id",std::string("dev?")));84 }85 86 AvDevice::AvDevice()87 : m_pConfigRom( 0 )88 , m_p1394Service( 0 )89 , m_verboseLevel( 0 )90 , m_pPlugManager( 0 )91 , m_activeSyncInfo( 0 )92 , m_model ( NULL )93 , m_nodeId ( -1 )94 {95 addOption(Util::OptionContainer::Option("snoopMode",false));96 addOption(Util::OptionContainer::Option("id",std::string("dev?")));97 75 } 98 76 … … 126 104 } 127 105 128 ConfigRom& 129 AvDevice::getConfigRom() const 130 { 131 return *m_pConfigRom; 106 void 107 AvDevice::setVerboseLevel(int l) 108 { 109 // m_pPlugManager->setVerboseLevel(l); 110 111 IAvDevice::setVerboseLevel(l); 132 112 } 133 113 … … 954 934 { 955 935 return syncInfo.m_source->setConnection( *syncInfo.m_destination ); 956 }957 958 bool AvDevice::setId( unsigned int id)959 {960 // FIXME: decent ID system nescessary961 std::ostringstream idstr;962 963 idstr << "dev" << id;964 965 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());966 967 return setOption("id",idstr.str());968 936 } 969 937 … … 1480 1448 Ieee1394Service& ieee1394Service ) 1481 1449 { 1482 AvDevice* pDev = new AvDevice; 1450 1451 ConfigRom *configRom = 1452 ConfigRom::deserialize( basePath + "m_pConfigRom/", deser, ieee1394Service ); 1453 1454 if ( !configRom ) { 1455 return NULL; 1456 } 1457 1458 AvDevice* pDev = new AvDevice( 1459 std::auto_ptr<ConfigRom>(configRom), 1460 ieee1394Service, configRom->getNodeId()); 1483 1461 1484 1462 if ( pDev ) { 1485 pDev->m_pConfigRom = std::auto_ptr<ConfigRom> (1486 ConfigRom::deserialize( basePath + "m_pConfigRom/", deser, ieee1394Service )1487 );1488 if ( !pDev->m_pConfigRom.get() ) {1489 delete pDev;1490 return 0;1491 }1492 1493 pDev->m_p1394Service = &ieee1394Service;1494 1463 bool result; 1495 1464 result = deser.read( basePath + "m_verboseLevel", pDev->m_verboseLevel ); 1465 1466 if (pDev->m_pPlugManager) delete pDev->m_pPlugManager; 1496 1467 pDev->m_pPlugManager = AvPlugManager::deserialize( basePath + "AvPlug", deser, *pDev ); 1497 1468 if ( !pDev->m_pPlugManager ) { … … 1515 1486 1516 1487 result &= deserializeOptions( basePath + "Options", deser, *pDev ); 1517 1518 1488 } 1519 1489 branches/streaming-rework/src/bebob/bebob_avdevice.h
r420 r426 59 59 AvDevice( std::auto_ptr<ConfigRom>( configRom ), 60 60 Ieee1394Service& ieee1394Service, 61 int nodeId, 62 int verboseLevel ); 61 int nodeId ); 63 62 virtual ~AvDevice(); 63 64 void setVerboseLevel(int l); 64 65 65 66 static bool probe( ConfigRom& configRom ); 66 67 virtual bool discover(); 67 virtual ConfigRom& getConfigRom() const;68 68 69 69 virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); … … 80 80 bool stopStreamByIndex(int i); 81 81 82 virtual bool addXmlDescription( xmlNodePtr deviceNode );83 82 virtual void showDevice() const; 84 virtual bool setId(unsigned int id);85 83 86 84 Ieee1394Service& get1394Service() … … 119 117 Util::IODeserialize& deser, 120 118 Ieee1394Service& ieee1394Service ); 121 122 119 protected: 123 AvDevice();124 120 125 121 bool enumerateSubUnits(); … … 170 166 SyncInfoVector& vec ); 171 167 protected: 172 std::auto_ptr<ConfigRom>( m_pConfigRom );173 Ieee1394Service* m_p1394Service;174 int m_verboseLevel;175 168 AvPlugVector m_pcrPlugs; 176 169 AvPlugVector m_externalPlugs; … … 181 174 SyncInfo* m_activeSyncInfo; 182 175 struct VendorModelEntry* m_model; 183 int m_nodeId;184 176 185 177 // streaming stuff … … 187 179 StreamProcessorVector m_receiveProcessors; 188 180 StreamProcessorVector m_transmitProcessors; 189 190 DECLARE_DEBUG_MODULE;191 181 }; 192 182 branches/streaming-rework/src/bebob/bebob_avdevice_xml.cpp
r413 r426 27 27 namespace BeBoB { 28 28 29 bool30 AvDevice::addXmlDescription( xmlNodePtr deviceNode )31 {32 // connection set33 // direction34 // connection35 // id36 // port37 // node38 // plug39 // dimension40 // samplerate41 // streams42 // stream43 44 45 ///////////46 // get plugs47 48 AvPlug* inputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Input, 0 );49 if ( !inputPlug ) {50 debugError( "addXmlDescription: No iso input plug found with id 0\n" );51 return false;52 }53 AvPlug* outputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Output, 0 );54 if ( !outputPlug ) {55 debugError( "addXmlDescription: No iso output plug found with id 0\n" );56 return false;57 }58 59 ///////////60 // add connection set output61 62 xmlNodePtr connectionSet = xmlNewChild( deviceNode, 0,63 BAD_CAST "ConnectionSet", 0 );64 if ( !connectionSet ) {65 debugError( "addXmlDescription:: Could not create 'ConnnectionSet' node for "66 "direction 1 (playback)\n" );67 return false;68 }69 70 if ( !inputPlug->addXmlDescription( connectionSet ) ) {71 debugError( "addXmlDescription: Could not add iso input plug 0 to XML description\n" );72 return false;73 }74 75 // add connection set input76 77 connectionSet = xmlNewChild( deviceNode, 0,78 BAD_CAST "ConnectionSet", 0 );79 if ( !connectionSet ) {80 debugError( "addXmlDescription: Couldn't create 'ConnectionSet' node for "81 "direction 0 (recorder)\n" );82 return false;83 }84 85 if ( !outputPlug->addXmlDescription( connectionSet ) ) {86 debugError( "addXmlDescription: Could not add iso output plug 0 to XML description\n" );87 return false;88 }89 90 ////////////91 // add stream format92 93 xmlNodePtr streamFormatNode = xmlNewChild( deviceNode, 0,94 BAD_CAST "StreamFormats", 0 );95 if ( !streamFormatNode ) {96 debugError( "addXmlDescription: Could not create 'StreamFormats' node\n" );97 return false;98 }99 100 if ( !inputPlug->addXmlDescriptionStreamFormats( streamFormatNode ) ) {101 debugError( "addXmlDescription:: Could not add stream format info\n" );102 return false;103 }104 105 streamFormatNode= xmlNewChild( deviceNode, 0,106 BAD_CAST "StreamFormats", 0 );107 if ( !streamFormatNode ) {108 debugError( "addXmlDescription: Could not create 'StreamFormat' node\n" );109 return false;110 }111 112 if ( !outputPlug->addXmlDescriptionStreamFormats( streamFormatNode ) ) {113 debugError( "addXmlDescription:: Could not add stream format info\n" );114 return false;115 }116 117 return true;118 }119 29 120 30 } branches/streaming-rework/src/bounce/bounce_avdevice.cpp
r424 r426 48 48 }; 49 49 50 IMPL_DEBUG_MODULE( BounceDevice, BounceDevice, DEBUG_LEVEL_VERBOSE );51 52 53 50 BounceDevice::BounceDevice( std::auto_ptr< ConfigRom >( configRom ), 54 51 Ieee1394Service& ieee1394service, 55 int nodeId, 56 int verboseLevel ) 57 : m_configRom( configRom ) 58 , m_p1394Service( &ieee1394service ) 59 , m_nodeId( nodeId ) 60 // , m_verboseLevel( verboseLevel ) 61 , m_verboseLevel( DEBUG_LEVEL_VERBOSE ) 52 int nodeId ) 53 : IAvDevice( configRom, ieee1394service, nodeId ) 62 54 , m_samplerate (44100) 63 55 , m_model( NULL ) 64 56 , m_Notifier ( NULL ) 65 57 { 66 setDebugLevel( verboseLevel );67 68 58 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", 69 59 nodeId ); 70 60 addOption(Util::OptionContainer::Option("snoopMode",false)); 71 addOption(Util::OptionContainer::Option("id",std::string("dev?")));72 61 } 73 62 … … 75 64 { 76 65 77 }78 79 ConfigRom&80 BounceDevice::getConfigRom() const81 {82 return *m_configRom;83 66 } 84 67 … … 116 99 m_nodeId ); 117 100 118 // unsigned int vendorId = m_ configRom->getNodeVendorId();119 unsigned int modelId = m_ configRom->getModelId();120 unsigned int unitSpecifierId = m_ configRom->getUnitSpecifierId();101 // unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 102 unsigned int modelId = m_pConfigRom->getModelId(); 103 unsigned int unitSpecifierId = m_pConfigRom->getUnitSpecifierId(); 121 104 122 105 for ( unsigned int i = 0; … … 153 136 } 154 137 155 bool BounceDevice::setId( unsigned int id) {156 // FIXME: decent ID system nescessary157 std::ostringstream idstr;158 159 idstr << "dev" << id;160 161 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());162 163 return setOption("id",idstr.str());164 }165 166 138 bool 167 139 BounceDevice::lock() { … … 181 153 { 182 154 debugOutput(DEBUG_LEVEL_NORMAL, "\nI am the bouncedevice, the bouncedevice I am...\n" ); 183 debugOutput(DEBUG_LEVEL_NORMAL, "Vendor : %s\n", m_ configRom->getVendorName().c_str());184 debugOutput(DEBUG_LEVEL_NORMAL, "Model : %s\n", m_ configRom->getModelName().c_str());155 debugOutput(DEBUG_LEVEL_NORMAL, "Vendor : %s\n", m_pConfigRom->getVendorName().c_str()); 156 debugOutput(DEBUG_LEVEL_NORMAL, "Model : %s\n", m_pConfigRom->getModelName().c_str()); 185 157 debugOutput(DEBUG_LEVEL_NORMAL, "Vendor Name : %s\n", m_model->vendor_name); 186 158 debugOutput(DEBUG_LEVEL_NORMAL, "Model Name : %s\n", m_model->model_name); 187 159 debugOutput(DEBUG_LEVEL_NORMAL, "Node : %d\n", m_nodeId); 188 debugOutput(DEBUG_LEVEL_NORMAL, "GUID : 0x%016llX\n", m_ configRom->getGuid());160 debugOutput(DEBUG_LEVEL_NORMAL, "GUID : 0x%016llX\n", m_pConfigRom->getGuid()); 189 161 debugOutput(DEBUG_LEVEL_NORMAL, "\n" ); 190 }191 192 bool193 BounceDevice::addXmlDescription( xmlNodePtr deviceNode )194 {195 196 return false;197 198 162 } 199 163 branches/streaming-rework/src/bounce/bounce_avdevice.h
r424 r426 64 64 BounceDevice( std::auto_ptr<ConfigRom>( configRom ), 65 65 Ieee1394Service& ieee1394Service, 66 int nodeId, 67 int verboseLevel ); 66 int nodeId ); 68 67 virtual ~BounceDevice(); 69 68 70 69 static bool probe( ConfigRom& configRom ); 71 70 bool discover(); 72 ConfigRom& getConfigRom() const;73 74 bool addXmlDescription( xmlNodePtr deviceNode );75 71 76 72 bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); … … 89 85 90 86 void showDevice() const; 91 bool setId(unsigned int id);92 87 93 88 protected: 94 std::auto_ptr<ConfigRom>( m_configRom );95 Ieee1394Service* m_p1394Service;96 int m_nodeId;97 int m_verboseLevel;98 99 std::string xmlDescription;100 101 89 unsigned int m_samplerate; 102 90 struct VendorModelEntry* m_model; … … 110 98 Streaming::StreamProcessor *processor, 111 99 Streaming::Port::E_Direction direction); 112 113 DECLARE_DEBUG_MODULE;114 100 115 101 private: // generic helpers … … 127 113 BounceNotifier *m_Notifier; 128 114 /** 129 * this class reacts on the o hter side writing to the115 * this class reacts on the other side writing to the 130 116 * hosts address space 131 117 */ branches/streaming-rework/src/bounce/bounce_slave_avdevice.cpp
r424 r426 43 43 }; 44 44 45 IMPL_DEBUG_MODULE( BounceSlaveDevice, BounceSlaveDevice, DEBUG_LEVEL_VERBOSE );46 47 45 BounceSlaveDevice::BounceSlaveDevice( std::auto_ptr< ConfigRom >( configRom ), 48 Ieee1394Service& ieee1394service, 49 int verboseLevel ) 46 Ieee1394Service& ieee1394service ) 50 47 : BounceDevice( configRom, 51 48 ieee1394service, 52 ieee1394service.getLocalNodeId(), 53 // verboseLevel ) 54 DEBUG_LEVEL_VERBOSE ) 49 ieee1394service.getLocalNodeId() ) 55 50 { 56 51 addOption(Util::OptionContainer::Option("isoTimeoutSecs",(int64_t)120)); … … 104 99 105 100 // refresh our config rom cache 106 if ( !m_ configRom->initialize() ) {101 if ( !m_pConfigRom->initialize() ) { 107 102 // \todo If a PHY on the bus is in power safe mode then 108 103 // the config rom is missing. So this might be just branches/streaming-rework/src/bounce/bounce_slave_avdevice.h
r424 r426 39 39 40 40 BounceSlaveDevice( std::auto_ptr<ConfigRom>( configRom ), 41 Ieee1394Service& ieee1394Service, 42 int verboseLevel ); 41 Ieee1394Service& ieee1394Service ); 43 42 virtual ~BounceSlaveDevice(); 44 43 … … 51 50 bool startStreamByIndex(int i); 52 51 bool stopStreamByIndex(int i); 53 54 52 55 protected:56 DECLARE_DEBUG_MODULE;57 53 private: 58 54 bool waitForRegisterNotEqualTo(nodeaddr_t offset, fb_quadlet_t v); branches/streaming-rework/src/devicemanager.cpp
r424 r426 156 156 157 157 IAvDevice* avDevice = getDriverForDevice( configRom, 158 nodeId, 159 verboseLevel ); 158 nodeId ); 160 159 if ( avDevice ) { 161 160 debugOutput( DEBUG_LEVEL_NORMAL, … … 163 162 nodeId ); 164 163 164 avDevice->setVerboseLevel( verboseLevel ); 165 165 166 if ( !avDevice->discover() ) { 166 167 debugError( "discover: could not discover device\n" ); … … 178 179 179 180 if(!avDevice->setOption("snoopMode", snoopMode)) { 180 debugWarning("Could not set snoop mode for device on node %d\n", nodeId);181 debugWarning("Could not set snoop mode for device on node %d\n", nodeId); 181 182 delete avDevice; 182 183 continue; 183 184 } 184 185 } 185 186 avDevice->setVerboseLevel( verboseLevel );187 186 188 187 if ( verboseLevel ) { … … 215 214 } 216 215 217 IAvDevice* avDevice = getSlaveDriver( configRom , verboseLevel);216 IAvDevice* avDevice = getSlaveDriver( configRom ); 218 217 if ( avDevice ) { 219 218 debugOutput( DEBUG_LEVEL_NORMAL, 220 219 "discover: driver found for device %d\n", 221 220 nodeId ); 221 222 avDevice->setVerboseLevel( verboseLevel ); 222 223 223 224 if ( !avDevice->discover() ) { … … 233 234 avDevice->showDevice(); 234 235 } 236 235 237 236 238 m_avDevices.push_back( avDevice ); … … 244 246 IAvDevice* 245 247 DeviceManager::getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 246 int id , int level)248 int id ) 247 249 { 248 250 #ifdef ENABLE_BEBOB 249 251 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying BeBoB...\n" ); 250 252 if ( BeBoB::AvDevice::probe( *configRom.get() ) ) { 251 return new BeBoB::AvDevice( configRom, *m_1394Service, id , level);253 return new BeBoB::AvDevice( configRom, *m_1394Service, id ); 252 254 } 253 255 #endif … … 256 258 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying M-Audio...\n" ); 257 259 if ( MAudio::AvDevice::probe( *configRom.get() ) ) { 258 return new MAudio::AvDevice( configRom, *m_1394Service, id , level);260 return new MAudio::AvDevice( configRom, *m_1394Service, id ); 259 261 } 260 262 #endif … … 263 265 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Motu...\n" ); 264 266 if ( Motu::MotuDevice::probe( *configRom.get() ) ) { 265 return new Motu::MotuDevice( configRom, *m_1394Service, id , level);267 return new Motu::MotuDevice( configRom, *m_1394Service, id ); 266 268 } 267 269 #endif … … 270 272 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Dice...\n" ); 271 273 if ( Dice::DiceAvDevice::probe( *configRom.get() ) ) { 272 return new Dice::DiceAvDevice( configRom, *m_1394Service, id , level);274 return new Dice::DiceAvDevice( configRom, *m_1394Service, id ); 273 275 } 274 276 #endif … … 277 279 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Metric Halo...\n" ); 278 280 if ( MetricHalo::MHAvDevice::probe( *configRom.get() ) ) { 279 return new MetricHalo::MHAvDevice( configRom, *m_1394Service, id , level);281 return new MetricHalo::MHAvDevice( configRom, *m_1394Service, id ); 280 282 } 281 283 #endif … … 284 286 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying RME...\n" ); 285 287 if ( Rme::RmeDevice::probe( *configRom.get() ) ) { 286 return new Rme::RmeDevice( configRom, *m_1394Service, id , level);288 return new Rme::RmeDevice( configRom, *m_1394Service, id ); 287 289 } 288 290 #endif … … 291 293 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Bounce...\n" ); 292 294 if ( Bounce::BounceDevice::probe( *configRom.get() ) ) { 293 return new Bounce::BounceDevice( configRom, *m_1394Service, id , level);295 return new Bounce::BounceDevice( configRom, *m_1394Service, id ); 294 296 } 295 297 #endif … … 299 301 300 302 IAvDevice* 301 DeviceManager::getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) , int level)303 DeviceManager::getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) ) 302 304 { 303 305 304 306 #ifdef ENABLE_BOUNCE 305 307 if ( Bounce::BounceSlaveDevice::probe( *configRom.get() ) ) { 306 return new Bounce::BounceSlaveDevice( configRom, *m_1394Service , level);308 return new Bounce::BounceSlaveDevice( configRom, *m_1394Service ); 307 309 } 308 310 #endif branches/streaming-rework/src/devicemanager.h
r424 r426 70 70 protected: 71 71 IAvDevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 72 int id, 73 int level ); 74 IAvDevice* getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ), 75 int level ); 72 int id ); 73 IAvDevice* getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) ); 76 74 77 75 protected: branches/streaming-rework/src/dice/dice_avdevice.cpp
r419 r426 39 39 namespace Dice { 40 40 41 IMPL_DEBUG_MODULE( DiceAvDevice, DiceAvDevice, DEBUG_LEVEL_VERBOSE );42 43 41 // to define the supported devices 44 42 static VendorModelEntry supportedDeviceList[] = … … 49 47 DiceAvDevice::DiceAvDevice( std::auto_ptr< ConfigRom >( configRom ), 50 48 Ieee1394Service& ieee1394service, 51 int nodeId, 52 int verboseLevel ) 53 : m_configRom( configRom ) 54 , m_1394Service( &ieee1394service ) 49 int nodeId ) 50 : IAvDevice( configRom, ieee1394service, nodeId ) 55 51 , m_model( NULL ) 56 , m_nodeId( nodeId )57 , m_verboseLevel( verboseLevel )58 , m_id(0)59 52 , m_iso_recv_channel ( -1 ) 60 53 , m_iso_send_channel ( -1 ) 61 54 { 62 setDebugLevel( verboseLevel );63 64 55 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Dice::DiceAvDevice (NodeID %d)\n", 65 56 nodeId ); … … 70 61 { 71 62 72 }73 74 ConfigRom&75 DiceAvDevice::getConfigRom() const76 {77 return *m_configRom;78 63 } 79 64 … … 102 87 DiceAvDevice::discover() 103 88 { 104 unsigned int vendorId = m_ configRom->getNodeVendorId();105 unsigned int modelId = m_ configRom->getModelId();89 unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 90 unsigned int modelId = m_pConfigRom->getModelId(); 106 91 107 92 for ( unsigned int i = 0; … … 138 123 } 139 124 140 bool DiceAvDevice::setId( unsigned int id) {141 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %d...\n", id);142 m_id=id;143 return true;144 }145 146 125 void 147 126 DiceAvDevice::showDevice() const branches/streaming-rework/src/dice/dice_avdevice.h
r420 r426 46 46 DiceAvDevice( std::auto_ptr<ConfigRom>( configRom ), 47 47 Ieee1394Service& ieee1394Service, 48 int nodeId, 49 int verboseLevel ); 48 int nodeId); 50 49 ~DiceAvDevice(); 51 50 52 51 static bool probe( ConfigRom& configRom ); 53 52 bool discover(); 54 ConfigRom& getConfigRom() const;55 56 // obsolete, will be removed soon, unused57 bool addXmlDescription( xmlNodePtr deviceNode ) {return true;};58 53 59 54 void showDevice() const; … … 61 56 bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 62 57 int getSamplingFrequency( ); 63 64 bool setId(unsigned int id);65 58 66 59 int getStreamCount(); … … 79 72 80 73 protected: 81 std::auto_ptr<ConfigRom>( m_configRom );82 Ieee1394Service* m_1394Service;83 84 74 struct VendorModelEntry *m_model; 85 75 86 int m_nodeId;87 int m_verboseLevel;88 signed int m_id;89 76 signed int m_iso_recv_channel, m_iso_send_channel; 90 77 … … 92 79 Streaming::AmdtpTransmitStreamProcessor *m_transmitProcessor; 93 80 94 private:95 // debug support96 DECLARE_DEBUG_MODULE;97 81 }; 98 82 branches/streaming-rework/src/iavdevice.h
r424 r426 33 33 } 34 34 /*! 35 @brief Interface that is to be implemented to support a device.36 37 This interface should be used to implement freebob support35 @brief Base class for device support 36 37 This class should be subclassed to implement freebob support 38 38 for a specific device. 39 39 … … 41 41 class IAvDevice : public Util::OptionContainer { 42 42 public: 43 virtual ~IAvDevice() {} 43 IAvDevice( std::auto_ptr< ConfigRom >( configRom ), 44 Ieee1394Service& ieee1394service, 45 int nodeId ); 46 47 virtual ~IAvDevice() {}; 44 48 45 49 /// Returns the ConfigRom object of the device node. 46 virtual ConfigRom& getConfigRom() const = 0;50 ConfigRom& getConfigRom() const; 47 51 48 52 /** … … 93 97 * @return true if successful 94 98 */ 95 virtual bool setId(unsigned int id) = 0;99 bool setId(unsigned int id); 96 100 97 101 /** … … 105 109 * @return true if successful, false if not 106 110 */ 107 virtual bool addXmlDescription( xmlNodePtr deviceNode ) = 0;111 bool addXmlDescription( xmlNodePtr deviceNode ) {return true;}; 108 112 109 113 /** … … 219 223 * set verbosity level 220 224 */ 221 virtual void setVerboseLevel(int l) {setDebugLevel(l);}; 225 virtual void setVerboseLevel(int l); 226 227 protected: 228 std::auto_ptr<ConfigRom>( m_pConfigRom ); 229 Ieee1394Service* m_p1394Service; 230 int m_verboseLevel; 231 int m_nodeId; 232 233 DECLARE_DEBUG_MODULE; 222 234 }; 223 235 branches/streaming-rework/src/Makefile.am
r424 r426 65 65 freebob.cpp \ 66 66 freebob_streaming.cpp \ 67 iavdevice.cpp \ 67 68 xmlparser.c \ 68 69 debugmodule/debugmodule.cpp \ branches/streaming-rework/src/maudio/maudio_avdevice.cpp
r420 r426 36 36 namespace MAudio { 37 37 38 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_NORMAL );39 40 38 AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), 41 39 Ieee1394Service& ieee1394service, 42 int iNodeId, 43 int iVerboseLevel ) 40 int iNodeId ) 44 41 : BeBoB::AvDevice( configRom, 45 42 ieee1394service, 46 iNodeId, 47 iVerboseLevel ) 43 iNodeId ) 48 44 , m_model ( NULL ) 49 45 { … … 128 124 129 125 bool 130 AvDevice::addXmlDescription( xmlNodePtr pDeviceNode )131 {132 char* pFilename;133 if ( asprintf( &pFilename, "%s/libfreebob/maudio/%s", DATADIR, m_model->filename ) < 0 ) {134 debugError( "addXmlDescription: Could not create filename string\n" );135 return false;136 }137 138 xmlDocPtr pDoc = xmlParseFile( pFilename );139 140 if ( !pDoc ) {141 debugError( "addXmlDescription: No file '%s' found'\n", pFilename );142 free( pFilename );143 return false;;144 }145 146 xmlNodePtr pCur = xmlDocGetRootElement( pDoc );147 if ( !pCur ) {148 debugError( "addXmlDescription: Document '%s' has not root element\n", pFilename );149 xmlFreeDoc( pDoc );150 free( pFilename );151 return false;152 }153 154 if ( xmlStrcmp( pCur->name, ( const xmlChar * ) "FreeBoBConnectionInfo" ) ) {155 debugError( "addXmlDescription: No node 'FreeBoBConnectionInfo' found\n" );156 xmlFreeDoc( pDoc );157 free( pFilename );158 return false;159 }160 161 pCur = pCur->xmlChildrenNode;162 while ( pCur ) {163 if ( !xmlStrcmp( pCur->name, ( const xmlChar * ) "Device" ) ) {164 break;165 }166 pCur = pCur->next;167 }168 169 if ( pCur ) {170 pCur = pCur->xmlChildrenNode;171 while ( pCur ) {172 if ( ( !xmlStrcmp( pCur->name, ( const xmlChar * ) "ConnectionSet" ) ) ) {173 xmlNodePtr pDevDesc = xmlCopyNode( pCur, 1 );174 if ( !pDevDesc ) {175 debugError( "addXmlDescription: Could not copy node 'ConnectionSet'\n" );176 xmlFreeDoc( pDoc );177 free( pFilename );178 return false;179 }180 181 // set correct node id182 for ( xmlNodePtr pNode = pDevDesc->xmlChildrenNode; pNode; pNode = pNode->next ) {183 if ( ( !xmlStrcmp( pNode->name, ( const xmlChar * ) "Connection" ) ) ) {184 for ( xmlNodePtr pSubNode = pNode->xmlChildrenNode; pSubNode; pSubNode = pSubNode->next ) {185 if ( ( !xmlStrcmp( pSubNode->name, ( const xmlChar * ) "Node" ) ) ) {186 char* result;187 asprintf( &result, "%d", m_nodeId );188 xmlNodeSetContent( pSubNode, BAD_CAST result );189 free( result );190 }191 }192 }193 }194 195 xmlAddChild( pDeviceNode, pDevDesc );196 }197 if ( ( !xmlStrcmp( pCur->name, ( const xmlChar * ) "StreamFormats" ) ) ) {198 xmlNodePtr pDevDesc = xmlCopyNode( pCur, 1 );199 if ( !pDevDesc ) {200 debugError( "addXmlDescription: Could not copy node 'StreamFormats'\n" );201 xmlFreeDoc( pDoc );202 free( pFilename );203 return false;204 }205 xmlAddChild( pDeviceNode, pDevDesc );206 }207 208 pCur = pCur->next;209 }210 }211 212 xmlFreeDoc( pDoc );213 free( pFilename );214 215 return true;216 }217 218 bool219 126 AvDevice::prepare() { 220 127 branches/streaming-rework/src/maudio/maudio_avdevice.h
r420 r426 52 52 AvDevice( std::auto_ptr<ConfigRom>( configRom ), 53 53 Ieee1394Service& ieee1394Service, 54 int nodeId, 55 int verboseLevel ); 54 int nodeId ); 56 55 virtual ~AvDevice(); 57 56 … … 59 58 bool discover(); 60 59 61 bool addXmlDescription( xmlNodePtr pDeviceNode );62 60 void showDevice() const; 63 61 … … 69 67 protected: 70 68 struct VendorModelEntry* m_model; 71 72 DECLARE_DEBUG_MODULE; 69 73 70 }; 74 71 branches/streaming-rework/src/metrichalo/mh_avdevice.cpp
r420 r426 41 41 namespace MetricHalo { 42 42 43 IMPL_DEBUG_MODULE( MHAvDevice, MHAvDevice, DEBUG_LEVEL_NORMAL );44 45 43 // to define the supported devices 46 44 static VendorModelEntry supportedDeviceList[] = … … 51 49 MHAvDevice::MHAvDevice( std::auto_ptr< ConfigRom >( configRom ), 52 50 Ieee1394Service& ieee1394service, 53 int nodeId, 54 int verboseLevel ) 55 : m_configRom( configRom ) 56 , m_p1394Service( &ieee1394service ) 51 int nodeId ) 52 : IAvDevice( configRom, ieee1394service, nodeId ) 57 53 , m_model( NULL ) 58 , m_nodeId( nodeId )59 , m_verboseLevel( verboseLevel )60 54 61 55 { 62 setDebugLevel( verboseLevel );63 64 56 debugOutput( DEBUG_LEVEL_VERBOSE, "Created MetricHalo::MHAvDevice (NodeID %d)\n", 65 57 nodeId ); 66 addOption(Util::OptionContainer::Option("id",std::string("dev?")));67 68 58 } 69 59 … … 71 61 { 72 62 73 }74 75 ConfigRom&76 MHAvDevice::getConfigRom() const77 {78 return *m_configRom;79 63 } 80 64 … … 103 87 MHAvDevice::discover() 104 88 { 105 unsigned int vendorId = m_ configRom->getNodeVendorId();106 unsigned int modelId = m_ configRom->getModelId();89 unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 90 unsigned int modelId = m_pConfigRom->getModelId(); 107 91 108 92 for ( unsigned int i = 0; … … 137 121 138 122 return false; 139 }140 141 bool MHAvDevice::setId( unsigned int id) {142 // FIXME: decent ID system nescessary143 std::ostringstream idstr;144 145 idstr << "dev" << id;146 147 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());148 149 return setOption("id",idstr.str());150 123 } 151 124 branches/streaming-rework/src/metrichalo/mh_avdevice.h
r420 r426 47 47 MHAvDevice( std::auto_ptr<ConfigRom>( configRom ), 48 48 Ieee1394Service& ieee1394Service, 49 int nodeId, 50 int verboseLevel ); 49 int nodeId ); 51 50 virtual ~MHAvDevice(); 52 51 53 52 static bool probe( ConfigRom& configRom ); 54 virtual bool discover(); 55 virtual ConfigRom& getConfigRom() const; 53 bool discover(); 56 54 57 // obsolete, will be removed soon, unused 58 virtual bool addXmlDescription( xmlNodePtr deviceNode ) {return true;}; 55 void showDevice() const; 59 56 60 virtual void showDevice() const; 57 bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 58 int getSamplingFrequency( ); 61 59 62 virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency);63 virtual int getSamplingFrequency();60 int getStreamCount(); 61 Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 64 62 65 virtual bool setId(unsigned int id); 66 67 virtual int getStreamCount(); 68 virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 69 70 virtual bool prepare(); 63 bool prepare(); 71 64 bool lock(); 72 65 bool unlock(); … … 79 72 80 73 protected: 81 std::auto_ptr<ConfigRom>( m_configRom );82 Ieee1394Service* m_p1394Service;83 84 74 struct VendorModelEntry *m_model; 85 86 int m_nodeId;87 int m_verboseLevel;88 75 89 private:90 // debug support91 DECLARE_DEBUG_MODULE;92 76 }; 93 77 branches/streaming-rework/src/motu/motu_avdevice.cpp
r420 r426 44 44 namespace Motu { 45 45 46 IMPL_DEBUG_MODULE( MotuDevice, MotuDevice, DEBUG_LEVEL_NORMAL );47 48 46 // to define the supported devices 49 47 static VendorModelEntry supportedDeviceList[] = … … 56 54 MotuDevice::MotuDevice( std::auto_ptr< ConfigRom >( configRom ), 57 55 Ieee1394Service& ieee1394service, 58 int nodeId, 59 int verboseLevel ) 60 : m_configRom( configRom ) 61 , m_p1394Service( &ieee1394service ) 56 int nodeId) 57 : IAvDevice( configRom, ieee1394service, nodeId ) 62 58 , m_motu_model( MOTUFW_MODEL_NONE ) 63 , m_nodeId( nodeId )64 , m_verboseLevel( verboseLevel )65 59 , m_iso_recv_channel ( -1 ) 66 60 , m_iso_send_channel ( -1 ) … … 70 64 71 65 { 72 setDebugLevel( verboseLevel );73 74 66 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Motu::MotuDevice (NodeID %d)\n", 75 67 nodeId ); … … 92 84 } 93 85 94 ConfigRom&95 MotuDevice::getConfigRom() const96 {97 return *m_configRom;98 }99 100 86 bool 101 87 MotuDevice::probe( ConfigRom& configRom ) … … 126 112 MotuDevice::discover() 127 113 { 128 unsigned int vendorId = m_ configRom->getNodeVendorId();129 // unsigned int modelId = m_ configRom->getModelId();130 unsigned int unitVersion = m_ configRom->getUnitVersion();131 unsigned int unitSpecifierId = m_ configRom->getUnitSpecifierId();114 unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 115 // unsigned int modelId = m_pConfigRom->getModelId(); 116 unsigned int unitVersion = m_pConfigRom->getUnitVersion(); 117 unsigned int unitSpecifierId = m_pConfigRom->getUnitSpecifierId(); 132 118 133 119 for ( unsigned int i = 0; … … 304 290 } 305 291 306 bool MotuDevice::setId( unsigned int id) {307 // FIXME: decent ID system nescessary308 std::ostringstream idstr;309 310 idstr << "dev" << id;311 312 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());313 314 return setOption("id",idstr.str());315 }316 317 292 bool 318 293 MotuDevice::lock() { branches/streaming-rework/src/motu/motu_avdevice.h
r420 r426 94 94 MotuDevice( std::auto_ptr<ConfigRom>( configRom ), 95 95 Ieee1394Service& ieee1394Service, 96 int nodeId, 97 int verboseLevel ); 96 int nodeId ); 98 97 virtual ~MotuDevice(); 99 98 100 99 static bool probe( ConfigRom& configRom ); 101 100 virtual bool discover(); 102 virtual ConfigRom& getConfigRom() const;103 104 // obsolete, will be removed soon, unused105 virtual bool addXmlDescription( xmlNodePtr deviceNode ) {return true;};106 101 107 102 virtual void showDevice() const; … … 109 104 virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 110 105 virtual int getSamplingFrequency( ); 111 112 virtual bool setId(unsigned int id);113 106 114 107 virtual int getStreamCount(); … … 130 123 131 124 protected: 132 std::auto_ptr<ConfigRom>( m_configRom );133 Ieee1394Service* m_p1394Service;134 135 125 signed int m_motu_model; 136 126 struct VendorModelEntry * m_model; 137 int m_nodeId;138 int m_verboseLevel;139 127 signed int m_iso_recv_channel, m_iso_send_channel; 140 128 signed int m_bandwidth; … … 155 143 signed int WriteRegister(unsigned int reg, quadlet_t data); 156 144 157 // debug support158 DECLARE_DEBUG_MODULE;159 145 }; 160 146 branches/streaming-rework/src/rme/rme_avdevice.cpp
r419 r426 40 40 namespace Rme { 41 41 42 IMPL_DEBUG_MODULE( RmeDevice, RmeDevice, DEBUG_LEVEL_NORMAL );43 44 42 // to define the supported devices 45 43 static VendorModelEntry supportedDeviceList[] = … … 50 48 RmeDevice::RmeDevice( std::auto_ptr< ConfigRom >( configRom ), 51 49 Ieee1394Service& ieee1394service, 52 int nodeId, 53 int verboseLevel ) 54 : m_configRom( configRom ) 55 , m_p1394Service( &ieee1394service ) 50 int nodeId ) 51 : IAvDevice( configRom, ieee1394service, nodeId ) 56 52 , m_model( NULL ) 57 , m_nodeId( nodeId )58 , m_verboseLevel( verboseLevel )59 60 53 { 61 setDebugLevel( verboseLevel );62 63 54 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n", 64 55 nodeId ); 65 66 56 } 67 57 … … 69 59 { 70 60 71 }72 73 ConfigRom&74 RmeDevice::getConfigRom() const75 {76 return *m_configRom;77 61 } 78 62 … … 101 85 RmeDevice::discover() 102 86 { 103 unsigned int vendorId = m_ configRom->getNodeVendorId();104 unsigned int modelId = m_ configRom->getModelId();87 unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 88 unsigned int modelId = m_pConfigRom->getModelId(); 105 89 106 90 for ( unsigned int i = 0; … … 142 126 return true; 143 127 return false; 144 }145 146 bool RmeDevice::setId( unsigned int id) {147 // FIXME: decent ID system nescessary148 std::ostringstream idstr;149 150 idstr << "dev" << id;151 152 debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());153 154 return setOption("id",idstr.str());155 128 } 156 129 branches/streaming-rework/src/rme/rme_avdevice.h
r420 r426 48 48 RmeDevice( std::auto_ptr<ConfigRom>( configRom ), 49 49 Ieee1394Service& ieee1394Service, 50 int nodeId, 51 int verboseLevel ); 50 int nodeId ); 52 51 virtual ~RmeDevice(); 53 52 54 53 static bool probe( ConfigRom& configRom ); 55 virtual bool discover(); 56 virtual ConfigRom& getConfigRom() const; 54 bool discover(); 57 55 58 // obsolete, will be removed soon, unused 59 virtual bool addXmlDescription( xmlNodePtr deviceNode ) {return true;}; 56 void showDevice() const; 60 57 61 virtual void showDevice() const; 58 bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 59 int getSamplingFrequency( ); 62 60 63 virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency);64 virtual int getSamplingFrequency();61 int getStreamCount(); 62 Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 65 63 66 virtual bool setId(unsigned int id); 67 68 virtual int getStreamCount(); 69 virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 70 71 virtual bool prepare(); 64 bool prepare(); 72 65 bool lock(); 73 66 bool unlock(); … … 75 68 bool startStreamByIndex(int i); 76 69 bool stopStreamByIndex(int i); 77 70 78 71 protected: 79 std::auto_ptr<ConfigRom>( m_configRom );80 Ieee1394Service* m_p1394Service;81 82 72 struct VendorModelEntry *m_model; 83 84 int m_nodeId;85 int m_verboseLevel;86 87 private:88 89 // debug support90 DECLARE_DEBUG_MODULE;91 73 }; 92 74