Changeset 548

Show
Ignore:
Timestamp:
08/21/07 10:12:58 (16 years ago)
Author:
ppalmers
Message:

- make the BeBoB AvDevice? a child class of the GenericAVC AvDevice?. This
avoids a lot of code duplication.
- fix inconsistency in position/location numbering between ext pluginfo
cmd and descriptor.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/echoaudio/src/bebob/bebob_avdevice.cpp

    r543 r548  
    4545namespace BeBoB { 
    4646 
    47 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_VERBOSE ); 
    48  
    49 static VendorModelEntry supportedDeviceList[] = 
     47static GenericAVC::VendorModelEntry supportedDeviceList[] = 
    5048{ 
    5149    {0x00000f, 0x00010065, "Mackie", "Onyx Firewire"}, 
     
    7472                    Ieee1394Service& ieee1394service, 
    7573                    int nodeId ) 
    76     : FFADODevice( configRom, ieee1394service, nodeId ) 
    77     , AVC::Unit( ) 
    78     , m_model ( NULL ) 
     74    : GenericAVC::AvDevice( configRom, ieee1394service, nodeId ) 
    7975    , m_Mixer ( NULL ) 
    8076{ 
    8177    debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::AvDevice (NodeID %d)\n", 
    8278                 nodeId ); 
    83     addOption(Util::OptionContainer::Option("snoopMode",false)); 
    8479} 
    8580 
     
    9590 
    9691AVC::Subunit*  
    97 BeBoB::AvDevice::createSubunit(AVC::Unit& unit, 
     92AvDevice::createSubunit(AVC::Unit& unit, 
    9893                               AVC::ESubunitType type, 
    9994                               AVC::subunit_t id )  
     
    110105 
    111106AVC::Plug * 
    112 BeBoB::AvDevice::createPlug( AVC::Unit* unit, 
     107AvDevice::createPlug( AVC::Unit* unit, 
    113108                     AVC::Subunit* subunit, 
    114109                     AVC::function_block_type_t functionBlockType, 
     
    128123} 
    129124 
    130 void 
    131 AvDevice::setVerboseLevel(int l) 
    132 { 
    133     m_pPlugManager->setVerboseLevel(l); 
    134  
    135     FFADODevice::setVerboseLevel(l); 
    136     AVC::Unit::setVerboseLevel(l); 
    137 } 
    138  
    139125bool 
    140126AvDevice::probe( ConfigRom& configRom ) 
     
    144130 
    145131    for ( unsigned int i = 0; 
    146           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     132          i < ( sizeof( supportedDeviceList )/sizeof( GenericAVC::VendorModelEntry ) ); 
    147133          ++i ) 
    148134    { 
     
    163149 
    164150    for ( unsigned int i = 0; 
    165           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     151          i < ( sizeof( supportedDeviceList )/sizeof( GenericAVC::VendorModelEntry ) ); 
    166152          ++i ) 
    167153    { 
     
    223209 
    224210bool 
    225 AvDevice::setSamplingFrequency( int s ) 
    226 
    227     ESamplingFrequency samplingFrequency=parseSampleRate( s ); 
    228     bool snoopMode=false; 
    229     if(!getOption("snoopMode", snoopMode)) { 
    230         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
    231     } 
    232  
    233     if(snoopMode) { 
    234         int current_sr=getSamplingFrequency(); 
    235         if (current_sr != convertESamplingFrequency( samplingFrequency ) ) { 
    236             debugError("In snoop mode it is impossible to set the sample rate.\n"); 
    237             debugError("Please start the client with the correct setting.\n"); 
    238             return false; 
    239         } 
    240         return true; 
    241     } else { 
    242         AVC::Plug* plug = getPlugById( m_pcrPlugs, Plug::eAPD_Input, 0 ); 
    243         if ( !plug ) { 
    244             debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 
    245             return false; 
    246         } 
    247  
    248         if ( !setSamplingFrequencyPlug( *plug, 
    249                                         Plug::eAPD_Input, 
    250                                         samplingFrequency ) ) 
    251         { 
    252             debugError( "setSampleRate: Setting sample rate failed\n" ); 
    253             return false; 
    254         } 
    255  
    256         plug = getPlugById( m_pcrPlugs, Plug::eAPD_Output,  0 ); 
    257         if ( !plug ) { 
    258             debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 
    259             return false; 
    260         } 
    261  
    262         if ( !setSamplingFrequencyPlug( *plug, 
    263                                         Plug::eAPD_Output, 
    264                                         samplingFrequency ) ) 
    265         { 
    266             debugError( "setSampleRate: Setting sample rate failed\n" ); 
    267             return false; 
    268         } 
    269  
    270         debugOutput( DEBUG_LEVEL_VERBOSE, 
    271                      "setSampleRate: Set sample rate to %d\n", 
    272                      convertESamplingFrequency( samplingFrequency ) ); 
    273         return true; 
    274     } 
    275     // not executable 
    276     return false; 
    277 
    278  
    279 int 
    280 AvDevice::getSamplingFrequency( ) { 
    281     AVC::Plug* inputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Input, 0 ); 
    282     if ( !inputPlug ) { 
    283         debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 
    284         return false; 
    285     } 
    286     AVC::Plug* outputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Output, 0 ); 
    287     if ( !outputPlug ) { 
    288         debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 
    289         return false; 
    290     } 
    291  
    292     int samplerate_playback=inputPlug->getSampleRate(); 
    293     int samplerate_capture=outputPlug->getSampleRate(); 
    294  
    295     if (samplerate_playback != samplerate_capture) { 
    296         debugWarning("Samplerates for capture and playback differ!\n"); 
    297     } 
    298     return samplerate_capture; 
    299 
    300  
    301  
    302 bool 
    303 AvDevice::setSamplingFrequencyPlug( AVC::Plug& plug, 
    304                                     Plug::EPlugDirection direction, 
    305                                     ESamplingFrequency samplingFrequency ) 
    306 
    307  
    308     ExtendedStreamFormatCmd extStreamFormatCmd( 
    309         *m_p1394Service, 
    310         ExtendedStreamFormatCmd::eSF_ExtendedStreamFormatInformationCommandList ); 
    311     UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 
    312                                      plug.getPlugId() ); 
    313  
    314     extStreamFormatCmd.setPlugAddress( 
    315         PlugAddress( 
    316             Plug::convertPlugDirection(direction ), 
    317             PlugAddress::ePAM_Unit, 
    318             unitPlugAddress ) ); 
    319  
    320     extStreamFormatCmd.setNodeId( m_pConfigRom->getNodeId() ); 
    321     extStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 
    322  
    323     int i = 0; 
    324     bool cmdSuccess = false; 
    325     bool correctFormatFound = false; 
    326  
    327     do { 
    328         extStreamFormatCmd.setIndexInStreamFormat( i ); 
    329         extStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 
    330         extStreamFormatCmd.setVerbose( m_verboseLevel ); 
    331  
    332         cmdSuccess = extStreamFormatCmd.fire(); 
    333  
    334         if ( cmdSuccess 
    335              && ( extStreamFormatCmd.getResponse() == 
    336                   AVCCommand::eR_Implemented ) ) 
    337         { 
    338             ESamplingFrequency foundFreq = eSF_DontCare; 
    339  
    340             FormatInformation* formatInfo = 
    341                 extStreamFormatCmd.getFormatInformation(); 
    342             FormatInformationStreamsCompound* compoundStream 
    343                 = dynamic_cast< FormatInformationStreamsCompound* > ( 
    344                     formatInfo->m_streams ); 
    345             if ( compoundStream ) { 
    346                 foundFreq = 
    347                     static_cast< ESamplingFrequency >( 
    348                         compoundStream->m_samplingFrequency ); 
    349             } 
    350  
    351             FormatInformationStreamsSync* syncStream 
    352                 = dynamic_cast< FormatInformationStreamsSync* > ( 
    353                     formatInfo->m_streams ); 
    354             if ( syncStream ) { 
    355                 foundFreq = 
    356                     static_cast< ESamplingFrequency >( 
    357                         syncStream->m_samplingFrequency ); 
    358             } 
    359  
    360             if ( foundFreq == samplingFrequency ) 
    361             { 
    362                 correctFormatFound = true; 
    363                 break; 
    364             } 
    365         } 
    366  
    367         ++i; 
    368     } while ( cmdSuccess 
    369               && ( extStreamFormatCmd.getResponse() == 
    370                    ExtendedStreamFormatCmd::eR_Implemented ) ); 
    371  
    372     if ( !cmdSuccess ) { 
    373         debugError( "setSampleRatePlug: Failed to retrieve format info\n" ); 
    374         return false; 
    375     } 
    376  
    377     if ( !correctFormatFound ) { 
    378         debugError( "setSampleRatePlug: %s plug %d does not support " 
    379                     "sample rate %d\n", 
    380                     plug.getName(), 
    381                     plug.getPlugId(), 
    382                     convertESamplingFrequency( samplingFrequency ) ); 
    383         return false; 
    384     } 
    385  
    386     extStreamFormatCmd.setSubFunction( 
    387         ExtendedStreamFormatCmd::eSF_ExtendedStreamFormatInformationCommand ); 
    388     extStreamFormatCmd.setCommandType( AVCCommand::eCT_Control ); 
    389     extStreamFormatCmd.setVerbose( m_verboseLevel ); 
    390  
    391     if ( !extStreamFormatCmd.fire() ) { 
    392         debugError( "setSampleRate: Could not set sample rate %d " 
    393                     "to %s plug %d\n", 
    394                     convertESamplingFrequency( samplingFrequency ), 
    395                     plug.getName(), 
    396                     plug.getPlugId() ); 
    397         return false; 
    398     } 
    399  
     211AvDevice::propagatePlugInfo() { 
     212    // we don't have to propagate since we discover things 
     213    // another way 
     214    debugOutput(DEBUG_LEVEL_VERBOSE, "Skip plug info propagation\n"); 
    400215    return true; 
    401 } 
    402  
    403 void 
    404 AvDevice::showDevice() 
    405 { 
    406     debugOutput(DEBUG_LEVEL_VERBOSE, 
    407         "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, 
    408         m_nodeId); 
    409  
    410     m_pPlugManager->showPlugs(); 
    411     flushDebugOutput(); 
    412 } 
    413  
    414  
    415 bool 
    416 AvDevice::lock() { 
    417     bool snoopMode=false; 
    418     if(!getOption("snoopMode", snoopMode)) { 
    419         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
    420     } 
    421  
    422     if (snoopMode) { 
    423         // don't lock 
    424     } else { 
    425 //         return Unit::reserve(4); 
    426     } 
    427  
    428     return true; 
    429 } 
    430  
    431 bool 
    432 AvDevice::unlock() { 
    433     bool snoopMode=false; 
    434     if(!getOption("snoopMode", snoopMode)) { 
    435         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
    436     } 
    437  
    438     if (snoopMode) { 
    439         // don't unlock 
    440     } else { 
    441 //         return Unit::reserve(0); 
    442     } 
    443     return true; 
    444 } 
    445  
    446 bool 
    447 AvDevice::prepare() { 
    448     bool snoopMode=false; 
    449     if(!getOption("snoopMode", snoopMode)) { 
    450         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
    451     } 
    452  
    453     /////////// 
    454     // get plugs 
    455  
    456     AVC::Plug* inputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Input, 0 ); 
    457     if ( !inputPlug ) { 
    458         debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 
    459         return false; 
    460     } 
    461     AVC::Plug* outputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Output, 0 ); 
    462     if ( !outputPlug ) { 
    463         debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 
    464         return false; 
    465     } 
    466  
    467     int samplerate=outputPlug->getSampleRate(); 
    468  
    469     debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing receive processor...\n"); 
    470     // create & add streamprocessors 
    471     Streaming::StreamProcessor *p; 
    472  
    473     p=new Streaming::AmdtpReceiveStreamProcessor( 
    474                              m_p1394Service->getPort(), 
    475                              samplerate, 
    476                              outputPlug->getNrOfChannels()); 
    477  
    478     if(!p->init()) { 
    479         debugFatal("Could not initialize receive processor!\n"); 
    480         delete p; 
    481         return false; 
    482     } 
    483  
    484     if (!addPlugToProcessor(*outputPlug,p, 
    485         Streaming::Port::E_Capture)) { 
    486         debugFatal("Could not add plug to processor!\n"); 
    487         delete p; 
    488         return false; 
    489     } 
    490  
    491     m_receiveProcessors.push_back(p); 
    492  
    493     // do the transmit processor 
    494     debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing transmit processor%s...\n", 
    495             (snoopMode?" in snoop mode":"")); 
    496     if (snoopMode) { 
    497         // we are snooping, so this is receive too. 
    498         p=new Streaming::AmdtpReceiveStreamProcessor( 
    499                                   m_p1394Service->getPort(), 
    500                                   samplerate, 
    501                                   inputPlug->getNrOfChannels()); 
    502     } else { 
    503         p=new Streaming::AmdtpTransmitStreamProcessor( 
    504                                 m_p1394Service->getPort(), 
    505                                 samplerate, 
    506                                 inputPlug->getNrOfChannels()); 
    507     } 
    508  
    509     if(!p->init()) { 
    510         debugFatal("Could not initialize transmit processor %s!\n", 
    511             (snoopMode?" in snoop mode":"")); 
    512         delete p; 
    513         return false; 
    514     } 
    515  
    516     if (snoopMode) { 
    517         if (!addPlugToProcessor(*inputPlug,p, 
    518             Streaming::Port::E_Capture)) { 
    519             debugFatal("Could not add plug to processor!\n"); 
    520             return false; 
    521         } 
    522     } else { 
    523         if (!addPlugToProcessor(*inputPlug,p, 
    524             Streaming::Port::E_Playback)) { 
    525             debugFatal("Could not add plug to processor!\n"); 
    526             return false; 
    527         } 
    528     } 
    529  
    530     // we put this SP into the transmit SP vector, 
    531     // no matter if we are in snoop mode or not 
    532     // this allows us to find out what direction 
    533     // a certain stream should have. 
    534     m_transmitProcessors.push_back(p); 
    535  
    536     return true; 
    537 } 
    538  
    539 bool 
    540 AvDevice::addPlugToProcessor( 
    541     AVC::Plug& plug, 
    542     Streaming::StreamProcessor *processor, 
    543     Streaming::AmdtpAudioPort::E_Direction direction) { 
    544  
    545     std::string id=std::string("dev?"); 
    546     if(!getOption("id", id)) { 
    547         debugWarning("Could not retrieve id parameter, defauling to 'dev?'\n"); 
    548     } 
    549  
    550     Plug::ClusterInfoVector& clusterInfos = plug.getClusterInfos(); 
    551     for ( Plug::ClusterInfoVector::const_iterator it = clusterInfos.begin(); 
    552           it != clusterInfos.end(); 
    553           ++it ) 
    554     { 
    555         const Plug::ClusterInfo* clusterInfo = &( *it ); 
    556  
    557         Plug::ChannelInfoVector channelInfos = clusterInfo->m_channelInfos; 
    558         for ( Plug::ChannelInfoVector::const_iterator it = channelInfos.begin(); 
    559               it != channelInfos.end(); 
    560               ++it ) 
    561         { 
    562             const Plug::ChannelInfo* channelInfo = &( *it ); 
    563             std::ostringstream portname; 
    564  
    565             portname << id << "_" << channelInfo->m_name; 
    566  
    567             Streaming::Port *p=NULL; 
    568             switch(clusterInfo->m_portType) { 
    569             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Speaker: 
    570             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Headphone: 
    571             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Microphone: 
    572             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Line: 
    573             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Analog: 
    574                 debugOutput(DEBUG_LEVEL_VERBOSE, " Adding audio channel %s (pos=0x%02X, loc=0x%02X)\n", 
    575                     channelInfo->m_name.c_str(), channelInfo->m_streamPosition-1, channelInfo->m_location-1); 
    576                 p=new Streaming::AmdtpAudioPort( 
    577                         portname.str(), 
    578                         direction, 
    579                         // \todo: streaming backend expects indexing starting from 0 
    580                         // but bebob reports it starting from 1. Decide where 
    581                         // and how to handle this (pp: here) 
    582                         // note that the descriptor mechanism specifies indexing from 0 
    583                         channelInfo->m_streamPosition-1, 
    584                         channelInfo->m_location - 1, 
    585                         Streaming::AmdtpPortInfo::E_MBLA 
    586                 ); 
    587                 break; 
    588  
    589             case ExtendedPlugInfoClusterInfoSpecificData::ePT_MIDI: 
    590                 debugOutput(DEBUG_LEVEL_VERBOSE, " Adding MIDI channel %s (pos=0x%02X, loc=0x%02X)\n", 
    591                     channelInfo->m_name.c_str(), channelInfo->m_streamPosition-1, processor->getPortCount(Streaming::Port::E_Midi)); 
    592                 p=new Streaming::AmdtpMidiPort( 
    593                         portname.str(), 
    594                         direction, 
    595                         channelInfo->m_streamPosition-1, 
    596                         // Workaround for out-of-spec hardware 
    597                         // should be: 
    598                         // channelInfo->m_location-1, 
    599                         // but now we renumber the midi channels' location as they 
    600                         // are discovered 
    601                         processor->getPortCount(Streaming::Port::E_Midi), 
    602                         Streaming::AmdtpPortInfo::E_Midi 
    603                 ); 
    604  
    605                 break; 
    606             case ExtendedPlugInfoClusterInfoSpecificData::ePT_SPDIF: 
    607             case ExtendedPlugInfoClusterInfoSpecificData::ePT_ADAT: 
    608             case ExtendedPlugInfoClusterInfoSpecificData::ePT_TDIF: 
    609             case ExtendedPlugInfoClusterInfoSpecificData::ePT_MADI: 
    610             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Digital: 
    611             case ExtendedPlugInfoClusterInfoSpecificData::ePT_NoType: 
    612             default: 
    613             // unsupported 
    614                 break; 
    615             } 
    616  
    617             if (!p) { 
    618                 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",channelInfo->m_name.c_str()); 
    619             } else { 
    620  
    621                 if (!processor->addPort(p)) { 
    622                     debugWarning("Could not register port with stream processor\n"); 
    623                     return false; 
    624                 } 
    625             } 
    626          } 
    627     } 
    628     return true; 
    629 } 
    630  
    631 int 
    632 AvDevice::getStreamCount() { 
    633     return m_receiveProcessors.size() + m_transmitProcessors.size(); 
    634 } 
    635  
    636 Streaming::StreamProcessor * 
    637 AvDevice::getStreamProcessorByIndex(int i) { 
    638  
    639     if (i<(int)m_receiveProcessors.size()) { 
    640         return m_receiveProcessors.at(i); 
    641     } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 
    642         return m_transmitProcessors.at(i-m_receiveProcessors.size()); 
    643     } 
    644  
    645     return NULL; 
    646 } 
    647  
    648 bool 
    649 AvDevice::startStreamByIndex(int i) { 
    650     int iso_channel=-1; 
    651     bool snoopMode=false; 
    652     if(!getOption("snoopMode", snoopMode)) { 
    653         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
    654     } 
    655  
    656     if (i<(int)m_receiveProcessors.size()) { 
    657         int n=i; 
    658         Streaming::StreamProcessor *p=m_receiveProcessors.at(n); 
    659  
    660         if(snoopMode) { // a stream from the device to another host 
    661             // FIXME: put this into a decent framework! 
    662             // we should check the oPCR[n] on the device 
    663             struct iec61883_oPCR opcr; 
    664             if (iec61883_get_oPCRX( 
    665                     m_p1394Service->getHandle(), 
    666                     m_pConfigRom->getNodeId() | 0xffc0, 
    667                     (quadlet_t *)&opcr, 
    668                     n)) { 
    669  
    670                 debugWarning("Error getting the channel for SP %d\n",i); 
    671                 return false; 
    672             } 
    673  
    674             iso_channel=opcr.channel; 
    675         } else { 
    676             iso_channel=m_p1394Service->allocateIsoChannelCMP( 
    677                 m_pConfigRom->getNodeId() | 0xffc0, n, 
    678                 m_p1394Service->getLocalNodeId()| 0xffc0, -1); 
    679         } 
    680         if (iso_channel<0) { 
    681             debugError("Could not allocate ISO channel for SP %d\n",i); 
    682             return false; 
    683         } 
    684  
    685         debugOutput(DEBUG_LEVEL_VERBOSE, "Started SP %d on channel %d\n",i,iso_channel); 
    686  
    687         p->setChannel(iso_channel); 
    688         return true; 
    689  
    690     } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 
    691         int n=i-m_receiveProcessors.size(); 
    692         Streaming::StreamProcessor *p=m_transmitProcessors.at(n); 
    693  
    694         if(snoopMode) { // a stream from another host to the device 
    695             // FIXME: put this into a decent framework! 
    696             // we should check the iPCR[n] on the device 
    697             struct iec61883_iPCR ipcr; 
    698             if (iec61883_get_iPCRX( 
    699                     m_p1394Service->getHandle(), 
    700                     m_pConfigRom->getNodeId() | 0xffc0, 
    701                     (quadlet_t *)&ipcr, 
    702                     n)) { 
    703  
    704                 debugWarning("Error getting the channel for SP %d\n",i); 
    705                 return false; 
    706             } 
    707  
    708             iso_channel=ipcr.channel; 
    709  
    710         } else { 
    711             iso_channel=m_p1394Service->allocateIsoChannelCMP( 
    712                 m_p1394Service->getLocalNodeId()| 0xffc0, -1, 
    713                 m_pConfigRom->getNodeId() | 0xffc0, n); 
    714         } 
    715  
    716         if (iso_channel<0) { 
    717             debugError("Could not allocate ISO channel for SP %d\n",i); 
    718             return false; 
    719         } 
    720  
    721         debugOutput(DEBUG_LEVEL_VERBOSE, "Started SP %d on channel %d\n",i,iso_channel); 
    722  
    723         p->setChannel(iso_channel); 
    724         return true; 
    725     } 
    726  
    727     debugError("SP index %d out of range!\n",i); 
    728     return false; 
    729 } 
    730  
    731 bool 
    732 AvDevice::stopStreamByIndex(int i) { 
    733     bool snoopMode=false; 
    734     if(!getOption("snoopMode", snoopMode)) { 
    735         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); 
    736     } 
    737  
    738     if (i<(int)m_receiveProcessors.size()) { 
    739         int n=i; 
    740         Streaming::StreamProcessor *p=m_receiveProcessors.at(n); 
    741  
    742         if(snoopMode) { 
    743  
    744         } else { 
    745             // deallocate ISO channel 
    746             if(!m_p1394Service->freeIsoChannel(p->getChannel())) { 
    747                 debugError("Could not deallocate iso channel for SP %d\n",i); 
    748                 return false; 
    749             } 
    750         } 
    751         p->setChannel(-1); 
    752  
    753         return true; 
    754  
    755     } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 
    756         int n=i-m_receiveProcessors.size(); 
    757         Streaming::StreamProcessor *p=m_transmitProcessors.at(n); 
    758  
    759         if(snoopMode) { 
    760  
    761         } else { 
    762             // deallocate ISO channel 
    763             if(!m_p1394Service->freeIsoChannel(p->getChannel())) { 
    764                 debugError("Could not deallocate iso channel for SP %d\n",i); 
    765                 return false; 
    766             } 
    767         } 
    768         p->setChannel(-1); 
    769  
    770         return true; 
    771     } 
    772  
    773     debugError("SP index %d out of range!\n",i); 
    774     return false; 
    775216} 
    776217 
  • branches/echoaudio/src/bebob/bebob_avdevice.h

    r543 r548  
    4444#include "libutil/serialize.h" 
    4545 
     46#include "genericavc/avc_avdevice.h" 
     47 
    4648#include "ffadodevice.h" 
    4749 
     
    5456namespace BeBoB { 
    5557 
    56 struct VendorModelEntry { 
    57     unsigned int vendor_id; 
    58     unsigned int model_id; 
    59     char *vendor_name; 
    60     char *model_name; 
    61 }; 
    62  
    63 class AvDevice : public FFADODevice, public AVC::Unit { 
     58class AvDevice : public GenericAVC::AvDevice { 
    6459public: 
    6560    AvDevice( std::auto_ptr<ConfigRom>( configRom ), 
     
    6863    virtual ~AvDevice(); 
    6964 
    70     void setVerboseLevel(int l); 
    71  
    7265    static bool probe( ConfigRom& configRom ); 
    7366    virtual bool discover(); 
    7467 
    75     virtual bool setSamplingFrequency( int ); 
    76     virtual int getSamplingFrequency( ); 
    77  
    78     virtual int getStreamCount(); 
    79     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 
    80  
    81     virtual bool prepare(); 
    82     bool lock(); 
    83     bool unlock(); 
    84  
    85     bool startStreamByIndex(int i); 
    86     bool stopStreamByIndex(int i); 
    87  
    88     virtual void showDevice(); 
    89  
    90     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
    91     static AvDevice* deserialize( Glib::ustring basePath, 
    92                                   Util::IODeserialize& deser, 
    93                                   Ieee1394Service& ieee1394Service ); 
    94  
    95     // redefinition to resolve ambiguity 
    96     Ieee1394Service& get1394Service() 
    97         { return FFADODevice::get1394Service(); }; 
    98     ConfigRom& getConfigRom() const  
    99         { return FFADODevice::getConfigRom(); }; 
    100          
    10168    virtual AVC::Subunit* createSubunit(AVC::Unit& unit, 
    10269                                        AVC::ESubunitType type, 
     
    10976                                   AVC::Plug::EPlugDirection plugDirection, 
    11077                                   AVC::plug_id_t plugId ); 
    111 protected: 
    112  
    113     virtual bool addPlugToProcessor( AVC::Plug& plug, Streaming::StreamProcessor *processor, 
    114                              Streaming::AmdtpAudioPort::E_Direction direction); 
    115  
    116     bool setSamplingFrequencyPlug( AVC::Plug& plug, 
    117                                    AVC::Plug::EPlugDirection direction, 
    118                                    AVC::ESamplingFrequency samplingFrequency ); 
    119  
    120     virtual bool propagateClusterInfos() {return true;}; 
    12178 
    12279protected: 
    123     struct VendorModelEntry*  m_model; 
     80    virtual bool propagatePlugInfo(); 
     81 
     82public: 
     83    bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; 
     84    static AvDevice* deserialize( Glib::ustring basePath, 
     85                                  Util::IODeserialize& deser, 
     86                                  Ieee1394Service& ieee1394Service ); 
     87 
     88protected: 
    12489    GenericMixer*             m_Mixer; 
    12590 
    126     // streaming stuff 
    127     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector; 
    128     StreamProcessorVector m_receiveProcessors; 
    129     StreamProcessorVector m_transmitProcessors; 
    130  
    131     DECLARE_DEBUG_MODULE; 
    13291}; 
    13392 
  • branches/echoaudio/src/bebob/bebob_avplug.cpp

    r543 r548  
    312312 
    313313bool 
     314Plug::copyClusterInfo(ExtendedPlugInfoPlugChannelPositionSpecificData& 
     315                        channelPositionData ) 
     316{ 
     317    int index = 1; 
     318    for ( ExtendedPlugInfoPlugChannelPositionSpecificData::ClusterInfoVector::const_iterator it 
     319              = channelPositionData.m_clusterInfos.begin(); 
     320          it != channelPositionData.m_clusterInfos.end(); 
     321          ++it ) 
     322    { 
     323        const ExtendedPlugInfoPlugChannelPositionSpecificData::ClusterInfo* 
     324            extPlugSpClusterInfo = &( *it ); 
     325 
     326        ClusterInfo clusterInfo; 
     327        clusterInfo.m_nrOfChannels = extPlugSpClusterInfo->m_nrOfChannels; 
     328        clusterInfo.m_index = index; 
     329        index++; 
     330 
     331        for (  ExtendedPlugInfoPlugChannelPositionSpecificData::ChannelInfoVector::const_iterator cit 
     332                  = extPlugSpClusterInfo->m_channelInfos.begin(); 
     333              cit != extPlugSpClusterInfo->m_channelInfos.end(); 
     334              ++cit ) 
     335        { 
     336            const ExtendedPlugInfoPlugChannelPositionSpecificData::ChannelInfo* 
     337                extPlugSpChannelInfo = &( *cit ); 
     338 
     339            ChannelInfo channelInfo; 
     340            channelInfo.m_streamPosition = 
     341                extPlugSpChannelInfo->m_streamPosition-1; 
     342            // FIXME: this can only become a mess with the two meanings 
     343            //        of the location parameter. the audio style meaning 
     344            //        starts from 1, the midi style meaning from 0 
     345            //        lucky for us we recalculate this for the midi channels 
     346            //        and don't use this value. 
     347            channelInfo.m_location = 
     348                extPlugSpChannelInfo->m_location; 
     349 
     350            clusterInfo.m_channelInfos.push_back( channelInfo ); 
     351        } 
     352        m_clusterInfos.push_back( clusterInfo ); 
     353    } 
     354 
     355    return true; 
     356} 
     357 
     358bool 
    314359Plug::discoverChannelName() 
    315360{ 
     
    539584} 
    540585 
    541 
     586ExtendedPlugInfoCmd 
     587Plug::setPlugAddrToPlugInfoCmd() 
     588
     589    ExtendedPlugInfoCmd extPlugInfoCmd( m_unit->get1394Service() ); 
     590 
     591    switch( getSubunitType() ) { 
     592    case eST_Unit: 
     593        { 
     594            UnitPlugAddress::EPlugType ePlugType = 
     595                UnitPlugAddress::ePT_Unknown; 
     596            switch ( m_addressType ) { 
     597                case eAPA_PCR: 
     598                    ePlugType = UnitPlugAddress::ePT_PCR; 
     599                    break; 
     600                case eAPA_ExternalPlug: 
     601                    ePlugType = UnitPlugAddress::ePT_ExternalPlug; 
     602                    break; 
     603                case eAPA_AsynchronousPlug: 
     604                    ePlugType = UnitPlugAddress::ePT_AsynchronousPlug; 
     605                    break; 
     606                default: 
     607                    ePlugType = UnitPlugAddress::ePT_Unknown; 
     608            } 
     609            UnitPlugAddress unitPlugAddress( ePlugType, 
     610                                             m_id ); 
     611            extPlugInfoCmd.setPlugAddress( 
     612                PlugAddress( convertPlugDirection( getPlugDirection() ), 
     613                             PlugAddress::ePAM_Unit, 
     614                             unitPlugAddress ) ); 
     615        } 
     616        break; 
     617    case eST_Music: 
     618    case eST_Audio: 
     619        { 
     620            switch( m_addressType ) { 
     621            case eAPA_SubunitPlug: 
     622            { 
     623                SubunitPlugAddress subunitPlugAddress( m_id ); 
     624                extPlugInfoCmd.setPlugAddress( 
     625                    PlugAddress( 
     626                        convertPlugDirection( getPlugDirection() ), 
     627                        PlugAddress::ePAM_Subunit, 
     628                        subunitPlugAddress ) ); 
     629            } 
     630            break; 
     631            case eAPA_FunctionBlockPlug: 
     632            { 
     633                FunctionBlockPlugAddress functionBlockPlugAddress( 
     634                    m_functionBlockType, 
     635                    m_functionBlockId, 
     636                    m_id ); 
     637                extPlugInfoCmd.setPlugAddress( 
     638                    PlugAddress( 
     639                        convertPlugDirection( getPlugDirection() ), 
     640                        PlugAddress::ePAM_FunctionBlock, 
     641                        functionBlockPlugAddress ) ); 
     642            } 
     643            break; 
     644            default: 
     645                extPlugInfoCmd.setPlugAddress(PlugAddress()); 
     646            } 
     647        } 
     648        break; 
     649    default: 
     650        debugError( "Unknown subunit type\n" ); 
     651    } 
     652 
     653    extPlugInfoCmd.setNodeId( m_unit->getConfigRom().getNodeId() ); 
     654    extPlugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
     655    extPlugInfoCmd.setSubunitId( getSubunitId() ); 
     656    extPlugInfoCmd.setSubunitType( getSubunitType() ); 
     657 
     658    return extPlugInfoCmd; 
     659
     660 
     661
  • branches/echoaudio/src/bebob/bebob_avplug.h

    r524 r548  
    7878 
    7979private: 
     80    bool copyClusterInfo(AVC::ExtendedPlugInfoPlugChannelPositionSpecificData& 
     81                         channelPositionData ); 
     82    AVC::ExtendedPlugInfoCmd setPlugAddrToPlugInfoCmd(); 
     83 
    8084 
    8185}; 
  • branches/echoaudio/src/genericavc/avc_avdevice.cpp

    r541 r548  
    6565    debugOutput( DEBUG_LEVEL_VERBOSE, "Created GenericAVC::AvDevice (NodeID %d)\n", 
    6666                 nodeId ); 
     67    addOption(Util::OptionContainer::Option("snoopMode",false)); 
    6768} 
    6869 
     
    134135} 
    135136 
     137void 
     138AvDevice::setVerboseLevel(int l) 
     139{ 
     140    m_pPlugManager->setVerboseLevel(l); 
     141 
     142    FFADODevice::setVerboseLevel(l); 
     143    AVC::Unit::setVerboseLevel(l); 
     144} 
     145 
    136146int 
    137147AvDevice::getSamplingFrequency( ) { 
     
    159169AvDevice::setSamplingFrequency( int s ) 
    160170{ 
    161     ESamplingFrequency samplingFrequency=parseSampleRate( s ); 
    162171    bool snoopMode=false; 
    163172    if(!getOption("snoopMode", snoopMode)) { 
     
    167176    if(snoopMode) { 
    168177        int current_sr=getSamplingFrequency(); 
    169         if (current_sr != convertESamplingFrequency( samplingFrequency ) ) { 
     178        if (current_sr != s ) { 
    170179            debugError("In snoop mode it is impossible to set the sample rate.\n"); 
    171180            debugError("Please start the client with the correct setting.\n"); 
     
    180189        } 
    181190 
    182         if ( !plug->setSampleRate( convertESamplingFrequency( samplingFrequency ) ) ) 
     191        if ( !plug->setSampleRate( s ) ) 
    183192        { 
    184193            debugError( "setSampleRate: Setting sample rate failed\n" ); 
     
    192201        } 
    193202 
    194         if ( !plug->setSampleRate( convertESamplingFrequency( samplingFrequency ) ) ) 
     203        if ( !plug->setSampleRate( s ) ) 
    195204        { 
    196205            debugError( "setSampleRate: Setting sample rate failed\n" ); 
     
    200209        debugOutput( DEBUG_LEVEL_VERBOSE, 
    201210                     "setSampleRate: Set sample rate to %d\n", 
    202                      convertESamplingFrequency( samplingFrequency ) ); 
     211                     s ); 
    203212        return true; 
    204213    } 
     
    348357    Streaming::StreamProcessor *processor, 
    349358    Streaming::AmdtpAudioPort::E_Direction direction) { 
    350          
    351     debugOutput(DEBUG_LEVEL_VERBOSE, " Adding plug %s to processor\n", plug.getName()); 
    352359 
    353360    std::string id=std::string("dev?"); 
     
    362369    { 
    363370        const Plug::ClusterInfo* clusterInfo = &( *it ); 
    364          
    365         debugOutput(DEBUG_LEVEL_VERBOSE, " Adding cluster %s\n", clusterInfo->m_name.c_str()); 
    366371 
    367372        Plug::ChannelInfoVector channelInfos = clusterInfo->m_channelInfos; 
     
    370375              ++it ) 
    371376        { 
    372  
    373377            const Plug::ChannelInfo* channelInfo = &( *it ); 
    374              
    375378            std::ostringstream portname; 
    376379 
     
    396399 
    397400            case ExtendedPlugInfoClusterInfoSpecificData::ePT_MIDI: 
    398                 // HACK: for audiofire2 only !!! 
    399401                debugOutput(DEBUG_LEVEL_VERBOSE, " Adding MIDI channel %s (pos=0x%02X, loc=0x%02X)\n", 
    400                     channelInfo->m_name.c_str(), (direction==Streaming::Port::E_Capture?4:6), 
    401                     processor->getPortCount(Streaming::Port::E_Midi)); 
     402                    channelInfo->m_name.c_str(), channelInfo->m_streamPosition, processor->getPortCount(Streaming::Port::E_Midi)); 
    402403                p=new Streaming::AmdtpMidiPort( 
    403404                        portname.str(), 
    404405                        direction, 
    405                         (direction==Streaming::Port::E_Capture?4:6), 
    406 //                         channelInfo->m_streamPosition, 
     406                        channelInfo->m_streamPosition, 
    407407                        // Workaround for out-of-spec hardware 
    408408                        // should be: 
     
    420420            case ExtendedPlugInfoClusterInfoSpecificData::ePT_MADI: 
    421421            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Digital: 
     422                debugOutput(DEBUG_LEVEL_VERBOSE, " Adding digital audio channel %s (pos=0x%02X, loc=0x%02X)\n", 
     423                    channelInfo->m_name.c_str(), channelInfo->m_streamPosition, channelInfo->m_location); 
     424                p=new Streaming::AmdtpAudioPort( 
     425                        portname.str(), 
     426                        direction, 
     427                        channelInfo->m_streamPosition, 
     428                        channelInfo->m_location, 
     429                        Streaming::AmdtpPortInfo::E_MBLA 
     430                ); 
     431                break; 
     432                 
    422433            case ExtendedPlugInfoClusterInfoSpecificData::ePT_NoType: 
    423434            default: 
  • branches/echoaudio/src/genericavc/avc_avdevice.h

    r542 r548  
    6060 
    6161    static bool probe( ConfigRom& configRom ); 
    62     bool discover(); 
     62    virtual bool discover(); 
     63     
     64    virtual void setVerboseLevel(int l); 
     65    virtual void showDevice(); 
    6366 
    64     void showDevice(); 
     67    virtual bool setSamplingFrequency( int ); 
     68    virtual int getSamplingFrequency( ); 
    6569 
    66     bool setSamplingFrequency( int ); 
    67     int getSamplingFrequency( ); 
     70    virtual int getStreamCount(); 
     71    virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 
    6872 
    69     int getStreamCount(); 
    70     Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 
     73    virtual bool prepare(); 
     74    virtual bool lock(); 
     75    virtual bool unlock(); 
    7176 
    72     bool prepare(); 
    73     bool lock(); 
    74     bool unlock(); 
    75  
    76     bool startStreamByIndex(int i); 
    77     bool stopStreamByIndex(int i); 
     77    virtual bool startStreamByIndex(int i); 
     78    virtual bool stopStreamByIndex(int i); 
    7879     
    7980    // redefinition to resolve ambiguity 
    80     Ieee1394Service& get1394Service() 
     81    virtual Ieee1394Service& get1394Service() 
    8182        { return FFADODevice::get1394Service(); }; 
    82     ConfigRom& getConfigRom() const  
     83    virtual ConfigRom& getConfigRom() const  
    8384        { return FFADODevice::getConfigRom(); }; 
    8485         
     
    8687    virtual bool addPlugToProcessor( AVC::Plug& plug, Streaming::StreamProcessor *processor, 
    8788                             Streaming::AmdtpAudioPort::E_Direction direction); 
    88     bool setSamplingFrequencyPlug( AVC::Plug& plug, 
     89/*    bool setSamplingFrequencyPlug( AVC::Plug& plug, 
    8990                                   AVC::Plug::EPlugDirection direction, 
    90                                    AVC::ESamplingFrequency samplingFrequency ); 
     91                                   AVC::ESamplingFrequency samplingFrequency );*/ 
    9192     
    9293    struct VendorModelEntry *m_model; 
  • branches/echoaudio/src/libavc/general/avc_plug.cpp

    r524 r548  
    520520Plug::discoverConnectionsOutput() 
    521521{ 
    522     debugOutput( DEBUG_LEVEL_VERBOSE, "Discovering outgoing connections...\n"); 
    523      
    524 //     int i=0; 
    525 //     int nbPlugs=m_unit->getPlugManager().getPlugCount(); 
    526 //     debugOutput( DEBUG_LEVEL_VERBOSE, "checking %d plugs\n", nbPlugs); 
    527 //      
    528 //     for (i=0;i<nbPlugs;i++) { 
    529 //         Plug *p=m_unit->getPlugManager().getPlug(i); 
    530 //          
    531 //         if(p==NULL) { 
    532 //             debugError("could not get plug 0x%02X\n",i); 
    533 //             continue; 
    534 //         } 
    535 //          
    536 //         if(p->getGlobalId()==getGlobalId()) continue; // skip yourself 
    537 //          
    538 //  
    539 //     } 
    540  
    541522    return true; 
    542523} 
     
    10981079        debugError( "Unknown subunit type\n" ); 
    10991080    } 
    1100 } 
    1101  
    1102  
    1103 bool 
    1104 Plug::copyClusterInfo(ExtendedPlugInfoPlugChannelPositionSpecificData& 
    1105                         channelPositionData ) 
    1106 { 
    1107     int index = 1; 
    1108     for ( ExtendedPlugInfoPlugChannelPositionSpecificData::ClusterInfoVector::const_iterator it 
    1109               = channelPositionData.m_clusterInfos.begin(); 
    1110           it != channelPositionData.m_clusterInfos.end(); 
    1111           ++it ) 
    1112     { 
    1113         const ExtendedPlugInfoPlugChannelPositionSpecificData::ClusterInfo* 
    1114             extPlugSpClusterInfo = &( *it ); 
    1115  
    1116         ClusterInfo clusterInfo; 
    1117         clusterInfo.m_nrOfChannels = extPlugSpClusterInfo->m_nrOfChannels; 
    1118         clusterInfo.m_index = index; 
    1119         index++; 
    1120  
    1121         for (  ExtendedPlugInfoPlugChannelPositionSpecificData::ChannelInfoVector::const_iterator cit 
    1122                   = extPlugSpClusterInfo->m_channelInfos.begin(); 
    1123               cit != extPlugSpClusterInfo->m_channelInfos.end(); 
    1124               ++cit ) 
    1125         { 
    1126             const ExtendedPlugInfoPlugChannelPositionSpecificData::ChannelInfo* 
    1127                 extPlugSpChannelInfo = &( *cit ); 
    1128  
    1129             ChannelInfo channelInfo; 
    1130             channelInfo.m_streamPosition = 
    1131                 extPlugSpChannelInfo->m_streamPosition; 
    1132             channelInfo.m_location = 
    1133                 extPlugSpChannelInfo->m_location; 
    1134  
    1135             clusterInfo.m_channelInfos.push_back( channelInfo ); 
    1136         } 
    1137         m_clusterInfos.push_back( clusterInfo ); 
    1138     } 
    1139  
    1140     return true; 
    11411081} 
    11421082 
     
    23082248} 
    23092249 
    2310 ExtendedPlugInfoCmd 
    2311 Plug::setPlugAddrToPlugInfoCmd() 
    2312 
    2313     ExtendedPlugInfoCmd extPlugInfoCmd( m_unit->get1394Service() ); 
    2314  
     2250ExtendedStreamFormatCmd 
     2251Plug::setPlugAddrToStreamFormatCmd( 
     2252    ExtendedStreamFormatCmd::ESubFunction subFunction) 
     2253
     2254    ExtendedStreamFormatCmd extStreamFormatInfoCmd( 
     2255        m_unit->get1394Service(), 
     2256        subFunction ); 
    23152257    switch( getSubunitType() ) { 
    23162258    case eST_Unit: 
    2317        
     2259   
    23182260            UnitPlugAddress::EPlugType ePlugType = 
    23192261                UnitPlugAddress::ePT_Unknown; 
     
    23312273                    ePlugType = UnitPlugAddress::ePT_Unknown; 
    23322274            } 
    2333             UnitPlugAddress unitPlugAddress( ePlugType, 
    2334                                              m_id ); 
    2335             extPlugInfoCmd.setPlugAddress( 
    2336                 PlugAddress( convertPlugDirection( getPlugDirection() ), 
    2337                              PlugAddress::ePAM_Unit, 
    2338                              unitPlugAddress ) ); 
    2339         } 
    2340         break; 
    2341     case eST_Music: 
    2342     case eST_Audio: 
    2343         { 
    2344             switch( m_addressType ) { 
    2345             case eAPA_SubunitPlug: 
    2346             { 
    2347                 SubunitPlugAddress subunitPlugAddress( m_id ); 
    2348                 extPlugInfoCmd.setPlugAddress( 
    2349                     PlugAddress( 
    2350                         convertPlugDirection( getPlugDirection() ), 
    2351                         PlugAddress::ePAM_Subunit, 
    2352                         subunitPlugAddress ) ); 
    2353             } 
    2354             break; 
    2355             case eAPA_FunctionBlockPlug: 
    2356             { 
    2357                 FunctionBlockPlugAddress functionBlockPlugAddress( 
    2358                     m_functionBlockType, 
    2359                     m_functionBlockId, 
    2360                     m_id ); 
    2361                 extPlugInfoCmd.setPlugAddress( 
    2362                     PlugAddress( 
    2363                         convertPlugDirection( getPlugDirection() ), 
    2364                         PlugAddress::ePAM_FunctionBlock, 
    2365                         functionBlockPlugAddress ) ); 
    2366             } 
    2367             break; 
    2368             default: 
    2369                 extPlugInfoCmd.setPlugAddress(PlugAddress()); 
    2370             } 
    2371         } 
    2372         break; 
    2373     default: 
    2374         debugError( "Unknown subunit type\n" ); 
    2375     } 
    2376  
    2377     extPlugInfoCmd.setNodeId( m_unit->getConfigRom().getNodeId() ); 
    2378     extPlugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
    2379     extPlugInfoCmd.setSubunitId( getSubunitId() ); 
    2380     extPlugInfoCmd.setSubunitType( getSubunitType() ); 
    2381  
    2382     return extPlugInfoCmd; 
    2383 } 
    2384  
    2385 ExtendedStreamFormatCmd 
    2386 Plug::setPlugAddrToStreamFormatCmd( 
    2387     ExtendedStreamFormatCmd::ESubFunction subFunction) 
    2388 { 
    2389     ExtendedStreamFormatCmd extStreamFormatInfoCmd( 
    2390         m_unit->get1394Service(), 
    2391         subFunction ); 
    2392     switch( getSubunitType() ) { 
    2393     case eST_Unit: 
    2394     { 
    2395             UnitPlugAddress::EPlugType ePlugType = 
    2396                 UnitPlugAddress::ePT_Unknown; 
    2397             switch ( m_addressType ) { 
    2398                 case eAPA_PCR: 
    2399                     ePlugType = UnitPlugAddress::ePT_PCR; 
    2400                     break; 
    2401                 case eAPA_ExternalPlug: 
    2402                     ePlugType = UnitPlugAddress::ePT_ExternalPlug; 
    2403                     break; 
    2404                 case eAPA_AsynchronousPlug: 
    2405                     ePlugType = UnitPlugAddress::ePT_AsynchronousPlug; 
    2406                     break; 
    2407                 default: 
    2408                     ePlugType = UnitPlugAddress::ePT_Unknown; 
    2409             } 
    24102275        UnitPlugAddress unitPlugAddress( ePlugType, 
    24112276                                         m_id ); 
  • branches/echoaudio/src/libavc/general/avc_plug.h

    r524 r548  
    2828#include "../ccm/avc_signal_source.h" 
    2929#include "../streamformat/avc_extended_stream_format.h" 
    30 #include "avc_extended_plug_info.h" 
    31 #include "avc_extended_cmd_generic.h" 
    3230#include "../avc_definitions.h" 
    3331#include "avc_generic.h" 
     
    214212    bool propagateFromPlug( Plug *p ); 
    215213 
    216     ExtendedPlugInfoCmd setPlugAddrToPlugInfoCmd(); 
    217  
    218214    ExtendedStreamFormatCmd setPlugAddrToStreamFormatCmd( 
    219215            ExtendedStreamFormatCmd::ESubFunction subFunction); 
     
    228224 
    229225    void debugOutputClusterInfos( int debugLevel ); 
    230  
    231     bool copyClusterInfo(ExtendedPlugInfoPlugChannelPositionSpecificData& 
    232                          channelPositionData ); 
    233226 
    234227    bool addPlugConnection( PlugVector& connections, Plug& plug ); 
  • branches/echoaudio/src/libavc/general/avc_unit.cpp

    r524 r548  
    156156    } 
    157157 
    158     if ( !propagateClusterInfos() ) { 
    159         debugError( "Failed to propagate cluster info's\n" ); 
     158    if ( !propagatePlugInfo() ) { 
     159        debugError( "Failed to propagate plug info\n" ); 
    160160        return false; 
    161161    } 
     
    458458 
    459459bool 
    460 Unit::propagateClusterInfos() 
     460Unit::propagatePlugInfo() 
    461461{ 
    462462    debugOutput( DEBUG_LEVEL_NORMAL, "Propagating info to PCR plugs...\n"); 
  • branches/echoaudio/src/libavc/general/avc_unit.h

    r524 r548  
    127127    virtual bool discoverPlugsExternal( AVC::Plug::EPlugDirection plugDirection, 
    128128                                AVC::plug_id_t plugMaxId ); 
    129     virtual bool propagateClusterInfos(); 
     129    virtual bool propagatePlugInfo(); 
    130130    virtual bool discoverSyncModes(); 
    131131    virtual bool checkSyncConnectionsAndAddToList( AVC::PlugVector& plhs, 
  • branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.cpp

    r524 r548  
    124124    // number of channels 
    125125    result &= plug.setNrOfChannels(info->m_nb_channels); 
    126      
    127      
    128126     
    129127    int idx=1; 
     
    165163            } 
    166164             
     165            if (plug.getDirection() == Plug::eAPD_Input) { 
     166                // it's an input plug to the subunit  
     167                // so we have to check the source field of the music plug 
     168                if(s.stream_position != mplug->m_source_stream_position) { 
     169                    debugWarning("s.stream_position (= 0x%02X) != mplug->m_source_stream_position (= 0x%02X)\n", 
     170                        s.stream_position, mplug->m_source_stream_position); 
     171                    // use the one from the music plug 
     172                    sinfo.m_streamPosition= mplug->m_source_stream_position; 
     173                } 
     174                if(s.stream_location != mplug->m_source_stream_location) { 
     175                    debugWarning("s.stream_location (= 0x%02X) != mplug->m_source_stream_location (= 0x%02X)\n", 
     176                        s.stream_location, mplug->m_source_stream_location); 
     177                    // use the one from the music plug 
     178                    sinfo.m_location=mplug->m_source_stream_location; 
     179                } 
     180            } else if (plug.getDirection() == Plug::eAPD_Output) { 
     181                // it's an output plug from the subunit  
     182                // so we have to check the destination field of the music plug 
     183                if(s.stream_position != mplug->m_dest_stream_position) { 
     184                    debugWarning("s.stream_position (= 0x%02X) != mplug->m_dest_stream_position (= 0x%02X)\n", 
     185                        s.stream_position, mplug->m_dest_stream_position); 
     186                    // use the one from the music plug 
     187                    sinfo.m_streamPosition=mplug->m_dest_stream_position; 
     188                } 
     189                if(s.stream_location != mplug->m_dest_stream_location) { 
     190                    debugWarning("s.stream_location (= 0x%02X) != mplug->m_dest_stream_location (= 0x%02X)\n", 
     191                        s.stream_location, mplug->m_dest_stream_location); 
     192                    // use the one from the music plug 
     193                    sinfo.m_location=mplug->m_dest_stream_location; 
     194                } 
     195            } else { 
     196                debugWarning("Invalid plug direction.\n"); 
     197            } 
     198             
    167199            debugOutput(DEBUG_LEVEL_VERBOSE, "Adding signal pos=%2d loc=%2d name=%s\n", 
    168200                sinfo.m_streamPosition, sinfo.m_location, mplug->getName().c_str());