Changeset 158
- Timestamp:
- 02/26/06 08:58:04 (18 years ago)
- Files:
-
- trunk/libfreebob/ChangeLog (modified) (1 diff)
- trunk/libfreebob/src/avdevice.cpp (modified) (14 diffs)
- trunk/libfreebob/src/avdevice.h (modified) (4 diffs)
- trunk/libfreebob/src/avdevicesubunit.cpp (modified) (2 diffs)
- trunk/libfreebob/src/avdevicesubunit.h (modified) (1 diff)
- trunk/libfreebob/src/avdevicexml.cpp (modified) (1 diff)
- trunk/libfreebob/src/avplug.cpp (modified) (11 diffs)
- trunk/libfreebob/src/avplug.h (modified) (3 diffs)
- trunk/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libfreebob/ChangeLog
r157 r158 1 2006-02-26 Daniel Wagner <wagi@monom.org> 2 3 * src/avdevice.cpp: Some more refactoring (m_isoInputPlugs and m_isoOutputPlugs 4 unified into m_isoPlugs). Discovering of unit external plugs. 5 * src/avdevice.h: Likewise. 6 * src/avdevicexml.cpp: Likewise. 7 * src/avdevicesubunit.cpp: Likewise. 8 * src/avdevicesubunit.h: Likewise. 9 * src/avplug.cpp: Likewise. 10 * src/avplug.h: Likewise. 11 12 * src/libfreebobavc/avc_extended_cmd_generic.h (class UnitPlugAddress): 13 ePT_Unknown enum added. 14 1 15 2006-02-22 Daniel Wagner <wagi@monom.org> 2 16 trunk/libfreebob/src/avdevice.cpp
r157 r158 65 65 delete *it; 66 66 } 67 for ( AvPlugVector::iterator it = m_iso InputPlugs.begin();68 it != m_iso InputPlugs.end();67 for ( AvPlugVector::iterator it = m_isoPlugs.begin(); 68 it != m_isoPlugs.end(); 69 69 ++it ) 70 70 { 71 71 delete *it; 72 72 } 73 for ( AvPlugVector::iterator it = m_isoOutputPlugs.begin(); 74 it != m_isoOutputPlugs.end(); 73 for ( AvPlugVector::iterator it = m_externalPlugs.begin(); 74 it != m_externalPlugs.end(); 75 ++it ) 76 { 77 delete *it; 78 } 79 for ( AvPlugVector::iterator it = m_syncPlugs.begin(); 80 it != m_syncPlugs.end(); 75 81 ++it ) 76 82 { … … 86 92 return false; 87 93 } 88 89 94 if ( !discoverPlugs() ) { 90 95 debugError( "discover: detecting plugs failed\n" ); 91 96 return false; 92 97 } 93 if ( !discoverPlugConnectionsInput() ) { 94 debugError( "discover: detecting input plug connections failed\n" ); 95 return false; 96 } 97 if ( !discoverPlugConnectionsOutput() ) { 98 debugError( "discover: detecting output plug connecions failed\n" ); 98 if ( !discoverPlugConnections() ) { 99 debugError( "discover: detecting plug connections failed\n" ); 99 100 return false; 100 101 } … … 119 120 120 121 if ( !plugInfoCmd.fire() ) { 121 debugError( "discoverPlugs: plug info command failed (step 1)\n" ); 122 return false; 123 } 124 122 debugError( "discoverPlugs: plug info command failed\n" ); 123 return false; 124 } 125 126 debugOutput( DEBUG_LEVEL_NORMAL, "\n" 127 "\tnumber of iso input plugs = %d\n" 128 "\tnumber of iso output plugs = %d\n" 129 "\tnumber of external input plugs = %d\n " 130 "\tnumber of external output plugs = %d\n", 131 plugInfoCmd.m_serialBusIsochronousInputPlugs, 132 plugInfoCmd.m_serialBusIsochronousOutputPlugs, 133 plugInfoCmd.m_externalInputPlugs, 134 plugInfoCmd.m_externalOutputPlugs ); 135 136 137 if ( !discoverPlugsIso( PlugAddress::ePD_Input, 138 plugInfoCmd.m_serialBusIsochronousInputPlugs ) ) 139 { 140 debugError( "discoverPlugs: iso input plug discovering failed\n" ); 141 return false; 142 } 143 144 if ( !discoverPlugsIso( PlugAddress::ePD_Output, 145 plugInfoCmd.m_serialBusIsochronousOutputPlugs ) ) 146 { 147 debugError( "discoverPlugs: iso output plug discovering failed\n" ); 148 return false; 149 } 150 151 if ( !discoverPlugsExternal( PlugAddress::ePD_Input, 152 plugInfoCmd.m_externalInputPlugs ) ) 153 { 154 debugError( "discoverPlugs: external input plug discovering failed\n" ); 155 return false; 156 } 157 158 if ( !discoverPlugsExternal( PlugAddress::ePD_Output, 159 plugInfoCmd.m_externalOutputPlugs ) ) 160 { 161 debugError( "discoverPlugs: external output plug discovering failed\n" ); 162 return false; 163 } 164 165 return true; 166 } 167 168 bool 169 AvDevice::discoverPlugsIso( PlugAddress::EPlugDirection plugDirection, 170 plug_id_t plugMaxId ) 171 { 125 172 for ( int plugId = 0; 126 plugId < plug InfoCmd.m_serialBusIsochronousInputPlugs;173 plugId < plugMaxId; 127 174 ++plugId ) 128 175 { … … 131 178 AVCCommand::eST_Unit, 132 179 0xff, 133 PlugAddress::ePD_Input, 180 AvPlug::eAP_PCR, 181 plugDirection, 134 182 plugId ); 135 183 if ( !plug || !plug->discover() ) { 136 debugError( "discoverPlugs : plug discovering failed\n" );184 debugError( "discoverPlugsIso: plug discovering failed\n" ); 137 185 return false; 138 186 } 139 187 140 m_isoInputPlugs.push_back( plug ); 141 } 142 188 debugOutput( DEBUG_LEVEL_NORMAL, "discoverPlugsIso: plug '%s' found\n", 189 plug->getName() ); 190 m_isoPlugs.push_back( plug ); 191 } 192 193 return true; 194 } 195 196 bool 197 AvDevice::discoverPlugsExternal( PlugAddress::EPlugDirection plugDirection, 198 plug_id_t plugMaxId ) 199 { 143 200 for ( int plugId = 0; 144 plugId < plug InfoCmd.m_serialBusIsochronousOutputPlugs;201 plugId < plugMaxId; 145 202 ++plugId ) 146 203 { … … 149 206 AVCCommand::eST_Unit, 150 207 0xff, 151 PlugAddress::ePD_Output, 208 AvPlug::eAP_ExternalPlug, 209 plugDirection, 152 210 plugId ); 153 211 if ( !plug || !plug->discover() ) { 154 debugError( "discover : plug discovering failed\n" );212 debugError( "discoverPlugsExternal: plug discovering failed\n" ); 155 213 return false; 156 214 } 157 215 158 m_isoOutputPlugs.push_back( plug ); 159 } 160 161 debugOutput( DEBUG_LEVEL_VERBOSE, 162 "number of iso input plugs = %d, " 163 "number of iso output plugs = %d\n", 164 plugInfoCmd.m_serialBusIsochronousInputPlugs, 165 plugInfoCmd.m_serialBusIsochronousOutputPlugs ); 166 167 return true; 168 } 169 170 bool 171 AvDevice::discoverPlugConnectionsInput() 172 { 173 ////////////////////////////////////////////// 174 // Step 2: For each ISO input plug: get internal 175 // output connections (data sink) of the ISO input plug 216 debugOutput( DEBUG_LEVEL_NORMAL, "discoverPlugsExternal: plug '%s' found\n", 217 plug->getName() ); 218 m_isoPlugs.push_back( plug ); 219 m_externalPlugs.push_back( plug ); 220 } 221 222 return true; 223 } 224 225 bool 226 AvDevice::discoverPlugConnections() 227 { 228 176 229 177 230 /* … … 275 328 } 276 329 330 /* 277 331 bool 278 332 AvDevice::discoverPlugConnectionsOutput() … … 282 336 // intput connections (data source) of the ISO output plug 283 337 284 /*285 338 for ( AvPlugVector::iterator it = m_isoOutputPlugs.begin(); 286 339 it != m_isoOutputPlugs.end(); … … 357 410 } 358 411 } 412 413 return true; 414 } 359 415 */ 360 return true; 361 } 416 362 417 363 418 bool … … 386 441 } 387 442 443 /* 388 444 bool 389 445 AvDevice::discoverPlugConnection( AvPlug& srcPlug, 390 446 SubunitPlugSpecificDataPlugAddress& subunitPlugAddress ) 391 447 { 392 /*393 448 AvDeviceSubunit* subunit = getSubunit( subunitPlugAddress.m_subunitType, 394 449 subunitPlugAddress.m_subunitId ); … … 426 481 "subunit -> ignored\n" ); 427 482 } 483 484 return true; 485 } 428 486 */ 429 487 430 return true;431 }432 488 433 489 bool … … 557 613 558 614 AvPlug* 559 AvDevice::getPlugById( AvPlugVector& plugs, int id )615 AvDevice::getPlugById( AvPlugVector& plugs, PlugAddress::EPlugDirection plugDirection, int id ) 560 616 { 561 617 for ( AvPlugVector::iterator it = plugs.begin(); … … 564 620 { 565 621 AvPlug* plug = *it; 566 if ( id == plug->getPlugId() ) { 622 if ( ( id == plug->getPlugId() ) 623 && ( plugDirection == plug->getPlugDirection() ) ) 624 { 567 625 return plug; 568 626 } … … 599 657 AvDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) 600 658 { 601 AvPlug* plug = getPlugById( m_iso InputPlugs, 0 );659 AvPlug* plug = getPlugById( m_isoPlugs, PlugAddress::ePD_Input, 0 ); 602 660 if ( !plug ) { 603 661 debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); … … 610 668 } 611 669 612 plug = getPlugById( m_iso OutputPlugs,0 );670 plug = getPlugById( m_isoPlugs, PlugAddress::ePD_Output, 0 ); 613 671 if ( !plug ) { 614 672 debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); trunk/libfreebob/src/avdevice.h
r157 r158 59 59 60 60 protected: 61 bool enumerateSubUnits(); 62 61 63 bool discoverPlugs(); 62 bool discoverPlugConnectionsInput(); 63 bool discoverPlugConnectionsOutput(); 64 bool discoverPlugsIso( PlugAddress::EPlugDirection plugDirection, 65 plug_id_t plugMaxId ); 66 bool discoverPlugsExternal( PlugAddress::EPlugDirection plugDirection, 67 plug_id_t plugMaxId ); 68 bool discoverPlugConnections(); 64 69 bool discoverSyncModes(); 65 70 66 bool discoverPlugConnection( AvPlug& srcPlug,67 SubunitPlugSpecificDataPlugAddress& subunitPlugAddress );68 69 bool enumerateSubUnits();70 71 71 72 AvDeviceSubunit* getSubunit( subunit_type_t subunitType, … … 77 78 AvPlug* getSyncPlug( int maxPlugId, PlugAddress::EPlugDirection ); 78 79 79 AvPlug* getPlugById( AvPlugVector& plugs, int id ); 80 AvPlug* getPlugById( AvPlugVector& plugs, 81 PlugAddress::EPlugDirection plugDireciton, 82 int id ); 80 83 81 84 bool setSamplingFrequencyPlug( AvPlug& plug, … … 87 90 int m_nodeId; 88 91 89 AvPlugVector m_isoInputPlugs; 90 AvPlugVector m_isoOutputPlugs; 92 AvPlugVector m_isoPlugs; 91 93 AvPlugVector m_externalPlugs; 92 93 94 AvPlugVector m_syncPlugs; 94 95 … … 97 98 AvDeviceSubunitVector m_subunits; 98 99 99 nr_of_plugs_t m_serialBusIsochronousInputPlugs;100 nr_of_plugs_t m_serialBusIsochronousOutputPlugs;101 102 100 DECLARE_DEBUG_MODULE; 103 101 }; trunk/libfreebob/src/avdevicesubunit.cpp
r157 r158 66 66 } 67 67 68 debugOutput( DEBUG_LEVEL_NORMAL, "\n" 69 "\tnumber of source plugs = %d\n " 70 "\tnumber of destination output plugs = %d\n", 71 plugInfoCmd.m_sourcePlugs, 72 plugInfoCmd.m_destinationPlugs ); 73 74 if ( !discoverPlugs( PlugAddress::ePD_Input, 75 plugInfoCmd.m_destinationPlugs ) ) 76 { 77 debugError( "discover: destination plug discovering failed\n" ); 78 return false; 79 } 80 81 if ( !discoverPlugs( PlugAddress::ePD_Output, 82 plugInfoCmd.m_sourcePlugs ) ) 83 { 84 debugError( "discover: source plug discovering failed\n" ); 85 return false; 86 } 87 88 return true; 89 } 90 91 bool 92 AvDeviceSubunit::discoverPlugs(PlugAddress::EPlugDirection plugDirection, 93 plug_id_t plugMaxId ) 94 { 68 95 for ( int plugIdx = 0; 69 plugIdx < plug InfoCmd.m_destinationPlugs;96 plugIdx < plugMaxId; 70 97 ++plugIdx ) 71 98 { … … 76 103 subunitType, 77 104 getSubunitId(), 78 PlugAddress::ePD_Input, 105 AvPlug::eAP_SubunitPlug, 106 plugDirection, 79 107 plugIdx ); 80 108 if ( !plug || !plug->discover() ) { 81 debugError( "discover : plug discover failed\n" );109 debugError( "discoverPlugs: plug discover failed\n" ); 82 110 return false; 83 111 } 84 112 113 debugOutput( DEBUG_LEVEL_NORMAL, "discoverPlugs: plug '%s' found\n", 114 plug->getName() ); 85 115 m_plugs.push_back( plug ); 86 116 } 87 88 for ( int plugIdx = 0;89 plugIdx < plugInfoCmd.m_sourcePlugs;90 ++plugIdx )91 {92 AVCCommand::ESubunitType subunitType =93 static_cast<AVCCommand::ESubunitType>( getSubunitType() );94 AvPlug* plug = new AvPlug( *m_avDevice->get1394Service(),95 m_avDevice->getNodeId(),96 subunitType,97 getSubunitId(),98 PlugAddress::ePD_Output,99 plugIdx );100 if ( !plug || !plug->discover() ) {101 debugError( "discover: plug discover failed\n" );102 return false;103 }104 105 m_plugs.push_back( plug );106 }107 108 117 return true; 109 118 } trunk/libfreebob/src/avdevicesubunit.h
r157 r158 48 48 49 49 protected: 50 bool discoverPlugs(PlugAddress::EPlugDirection plugDirection, 51 plug_id_t plugMaxId ); 52 53 protected: 50 54 AvDevice* m_avDevice; 51 55 AVCCommand::ESubunitType m_sbType; trunk/libfreebob/src/avdevicexml.cpp
r157 r158 45 45 // get plugs 46 46 47 AvPlug* inputPlug = getPlugById( m_iso InputPlugs, 0 );47 AvPlug* inputPlug = getPlugById( m_isoPlugs, PlugAddress::ePD_Input, 0 ); 48 48 if ( !inputPlug ) { 49 49 debugError( "addXmlDescription: No iso input plug found with id %d\n" ); 50 50 return false; 51 51 } 52 AvPlug* outputPlug = getPlugById( m_iso OutputPlugs, 0 );52 AvPlug* outputPlug = getPlugById( m_isoPlugs, PlugAddress::ePD_Output, 0 ); 53 53 if ( !outputPlug ) { 54 54 debugError( "addXmlDescription: No iso output plug found with id %d\n" ); trunk/libfreebob/src/avplug.cpp
r157 r158 25 25 26 26 27 IMPL_DEBUG_MODULE( AvPlug, AvPlug, DEBUG_LEVEL_ VERBOSE);27 IMPL_DEBUG_MODULE( AvPlug, AvPlug, DEBUG_LEVEL_NORMAL ); 28 28 29 29 AvPlug::AvPlug( Ieee1394Service& ieee1394Service, … … 31 31 AVCCommand::ESubunitType subunitType, 32 32 subunit_id_t subunitId, 33 EAvPlugType plugType, 33 34 PlugAddress::EPlugDirection plugDirection, 34 35 plug_id_t plugId ) … … 37 38 , m_subunitType( subunitType ) 38 39 , m_subunitId( subunitId ) 40 , m_type( plugType ) 39 41 , m_direction( plugDirection ) 40 42 , m_id( plugId ) 43 , m_infoPlugType( ExtendedPlugInfoPlugTypeSpecificData::eEPIPT_Unknown ) 44 , m_nrOfChannels( 0 ) 41 45 { 42 46 } … … 47 51 , m_subunitType( rhs.m_subunitType ) 48 52 , m_subunitId( rhs.m_subunitId ) 53 , m_type( rhs.m_type ) 49 54 , m_direction( rhs.m_direction ) 50 55 , m_id( rhs.m_id ) 56 , m_infoPlugType( rhs.m_infoPlugType ) 57 , m_nrOfChannels( rhs.m_nrOfChannels ) 58 , m_name( rhs.m_name ) 59 , m_clusterInfos( rhs.m_clusterInfos ) 60 , m_formatInfos( rhs.m_formatInfos ) 51 61 { 52 62 } … … 167 177 plugType, 168 178 extendedPlugInfoPlugTypeToString( plugType ) ); 169 m_ type = static_cast<ExtendedPlugInfoPlugTypeSpecificData::EExtendedPlugInfoPlugType>( plugType );179 m_infoPlugType = static_cast<ExtendedPlugInfoPlugTypeSpecificData::EExtendedPlugInfoPlugType>( plugType ); 170 180 } 171 181 … … 325 335 AvPlug::discoverClusterInfo() 326 336 { 327 if ( m_ type == ExtendedPlugInfoPlugTypeSpecificData::eEPIPT_Sync )337 if ( m_infoPlugType == ExtendedPlugInfoPlugTypeSpecificData::eEPIPT_Sync ) 328 338 { 329 339 // If the plug is of type sync it is either a normal 2 channel … … 402 412 debugOutput( DEBUG_LEVEL_VERBOSE, 403 413 "discoverStreamFormat: %s plug %d uses " 404 "sampling frequency %d \n",414 "sampling frequency %d, nr of stream infos = %d\n", 405 415 m_name.c_str(), 406 416 m_id, 407 m_samplingFrequency ); 417 m_samplingFrequency, 418 compoundStream->m_numberOfStreamFormatInfos ); 408 419 409 420 for ( int i = 1; … … 422 433 compoundStream->m_streamFormatInfos[ i - 1 ]; 423 434 435 debugOutput( DEBUG_LEVEL_VERBOSE, "discoverStreamFormat: " 436 "number of channels = %d, stream format = %d\n", 437 streamFormatInfo->m_numberOfChannels, 438 streamFormatInfo->m_streamFormat ); 439 424 440 int nrOfChannels = clusterInfo->m_nrOfChannels; 425 441 if ( streamFormatInfo->m_streamFormat == … … 430 446 } 431 447 // sanity checks 432 if ( nrOfChannels != 433 streamFormatInfo->m_numberOfChannels ) 448 if ( nrOfChannels != streamFormatInfo->m_numberOfChannels ) 434 449 { 435 450 debugError( "discoverStreamFormat: Number of channels " 436 "mismatch: %splug %d discovering reported "451 "mismatch: '%s' plug %d discovering reported " 437 452 "%d channels for cluster '%s', while stream " 438 453 "format reported %d\n", … … 571 586 case AVCCommand::eST_Unit: 572 587 { 573 UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 588 UnitPlugAddress::EPlugType ePlugType = UnitPlugAddress::ePT_Unknown; 589 switch ( m_type ) { 590 case eAP_PCR: 591 ePlugType = UnitPlugAddress::ePT_PCR; 592 break; 593 case eAP_ExternalPlug: 594 ePlugType = UnitPlugAddress::ePT_ExternalPlug; 595 break; 596 case eAP_AsynchronousPlug: 597 ePlugType = UnitPlugAddress::ePT_AsynchronousPlug; 598 break; 599 default: 600 ePlugType = UnitPlugAddress::ePT_Unknown; 601 } 602 UnitPlugAddress unitPlugAddress( ePlugType, 574 603 m_id ); 575 604 extPlugInfoCmd.setPlugAddress( PlugAddress( m_direction, … … 606 635 case AVCCommand::eST_Unit: 607 636 { 608 UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 637 UnitPlugAddress::EPlugType ePlugType = UnitPlugAddress::ePT_Unknown; 638 switch ( m_type ) { 639 case eAP_PCR: 640 ePlugType = UnitPlugAddress::ePT_PCR; 641 break; 642 case eAP_ExternalPlug: 643 ePlugType = UnitPlugAddress::ePT_ExternalPlug; 644 break; 645 case eAP_AsynchronousPlug: 646 ePlugType = UnitPlugAddress::ePT_AsynchronousPlug; 647 break; 648 default: 649 ePlugType = UnitPlugAddress::ePT_Unknown; 650 } 651 UnitPlugAddress unitPlugAddress( ePlugType, 609 652 m_id ); 610 653 extStreamFormatInfoCmd.setPlugAddress( PlugAddress( m_direction, trunk/libfreebob/src/avplug.h
r157 r158 35 35 class AvPlug { 36 36 public: 37 38 enum EAvPlugType { 39 eAP_PCR, 40 eAP_ExternalPlug, 41 eAP_AsynchronousPlug, 42 eAP_SubunitPlug, 43 }; 44 37 45 AvPlug( Ieee1394Service& ieee1394Service, 38 46 int m_nodeId, 39 47 AVCCommand::ESubunitType subunitType, 40 48 subunit_id_t subunitId, 49 EAvPlugType plugType, 41 50 PlugAddress::EPlugDirection plugDirection, 42 51 plug_id_t plugId ); … … 46 55 bool discover(); 47 56 48 ExtendedPlugInfoPlugTypeSpecificData::EExtendedPlugInfoPlugType49 getPlugType()50 { return m_type; }51 57 plug_id_t getPlugId() 52 58 { return m_id; } … … 92 98 AVCCommand::ESubunitType m_subunitType; 93 99 subunit_id_t m_subunitId; 100 EAvPlugType m_type; 94 101 PlugAddress::EPlugDirection m_direction; 95 102 plug_id_t m_id; 96 103 97 // Plug type98 ExtendedPlugInfoPlugTypeSpecificData::EExtendedPlugInfoPlugType m_ type;104 // Info plug type 105 ExtendedPlugInfoPlugTypeSpecificData::EExtendedPlugInfoPlugType m_infoPlugType; 99 106 100 107 // Number of channels trunk/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.h
r125 r158 38 38 ePT_ExternalPlug = 0x01, 39 39 ePT_AsynchronousPlug = 0x02, 40 ePT_Unknown = 0xff, 40 41 }; 41 42