Changeset 2057

Show
Ignore:
Timestamp:
03/03/12 08:14:46 (11 years ago)
Author:
adi
Message:

DICE-EAP: Get Capture/Playback names when EAP router is present.

When a router is available, Capture/Playback, i.e. inputs/outputs for
jack, are related to the corresponding entries in the router table.
When no router is available (no initialized router or no initialized
EAP) Capture/Playback are receivers/transmitters respectively.

Patch by Philippe Carriere

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/dice/dice_avdevice.cpp

    r2048 r2057  
    831831    if (direction == Streaming::Port::E_Capture) { 
    832832        // we are a receive processor 
    833         names_audio = getTxNameString(i); 
     833        names_audio = getCptrNameString(i); 
    834834    } else { 
    835         names_audio = getRxNameString(i); 
     835        names_audio = getPbckNameString(i); 
    836836    } 
    837837     
     
    14491449 
    14501450stringlist 
     1451Device::getCptrNameString(unsigned int i) { 
     1452    if (m_eap) return m_eap->getCptrNameString(i); 
     1453    else return getTxNameString(i); 
     1454} 
     1455 
     1456stringlist 
     1457Device::getPbckNameString(unsigned int i) { 
     1458    if (m_eap) return m_eap->getPbckNameString(i); 
     1459    return getRxNameString(i); 
     1460} 
     1461 
     1462stringlist 
    14511463Device::getClockSourceNameString() { 
    14521464    stringlist names; 
  • trunk/libffado/src/dice/dice_avdevice.h

    r1939 r2057  
    152152    stringlist getTxNameString(unsigned int i); 
    153153    stringlist getRxNameString(unsigned int i); 
     154    stringlist getCptrNameString(unsigned int); 
     155    stringlist getPbckNameString(unsigned int); 
    154156    stringlist getClockSourceNameString(); 
    155157 
  • trunk/libffado/src/dice/dice_eap.cpp

    r2056 r2057  
    377377    if(m_mixer) m_mixer->updateNameCache(); 
    378378    return true; 
     379} 
     380 
     381// Get capture and playback names 
     382//   If the device has a router, capture and playback are destinations and sources, respectively, 
     383//     as defined above 
     384//   If no router is found, transmitters and receivers names are returned 
     385 
     386stringlist 
     387EAP::getCptrNameString(unsigned int i) { 
     388    std::vector<unsigned int> destid; 
     389    unsigned int destid_0; 
     390    stringlist cptr_names; 
     391    std::string dest_name, src_name; 
     392     
     393    if (m_router) { 
     394        switch (i) { 
     395          case 0: destid_0 = (eRD_ATX0<<4); break; 
     396          case 1: destid_0 = (eRD_ATX1<<4); break; 
     397          // Only 2 transmitter possible (?) 
     398          default: return cptr_names; 
     399        } 
     400        // At most 16 destinations per eRD 
     401        for (int j=0; j<16; j++) { 
     402          destid.push_back(destid_0+j); 
     403        } 
     404        for (unsigned it=0; it<destid.size(); it++) { 
     405          // If destination identifier is not part of the router, destination name will be empty 
     406          dest_name = m_router->getDestinationName(destid.at(it)); 
     407          if (dest_name.size() > 0) { 
     408            // get a source possibly routed to the destination (only one source per destination) 
     409            src_name = m_router->getSourceForDestination(dest_name); 
     410            if (src_name.size() > 0) { 
     411              dest_name.append(" ("); dest_name.append(src_name); dest_name.append(")"); 
     412            } 
     413            cptr_names.push_back(dest_name); 
     414          } 
     415        } 
     416 
     417    } else { 
     418        StreamConfig *scfg = getActiveStreamConfig(); 
     419        if(scfg) { 
     420          cptr_names = scfg->getTxNamesString(i); 
     421        } 
     422    } 
     423    return cptr_names; 
     424} 
     425 
     426stringlist 
     427EAP::getPbckNameString(unsigned int i) { 
     428    std::vector<unsigned int> srcid; 
     429    unsigned int srcid_0; 
     430    stringlist pbck_names, dest_names; 
     431    std::string src_name; 
     432     
     433    if (m_router) { 
     434        switch (i) { 
     435           case 0: srcid_0 = (eRS_ARX0<<4); break; 
     436           case 1: srcid_0 = (eRS_ARX1<<4); break; 
     437            // Only 2 receiver possible (?) 
     438          default: return pbck_names; 
     439        } 
     440        // At most 16 destinations per eRD 
     441        for (int j=0; j<16; j++) { 
     442          srcid.push_back(srcid_0+j); 
     443        } 
     444        for (unsigned it=0; it<srcid.size(); it++) { 
     445          // If source identifier is not part of the router, source name will be empty 
     446          src_name = m_router->getSourceName(srcid.at(it)); 
     447          if (src_name.size() > 0) { 
     448            // Search for destinations routed to this source 
     449            //   Multiple destinations for a single source are possible 
     450            dest_names = m_router->getDestinationsForSource(src_name); 
     451            if (dest_names.size() > 0) { 
     452              src_name.append(" ("); 
     453              stringlist::iterator it_d = dest_names.begin(); 
     454              stringlist::iterator it_d_end_m1 = dest_names.end(); --it_d_end_m1; 
     455              while (it_d != it_d_end_m1) { 
     456                src_name.append((*it_d).c_str()); src_name.append("; "); 
     457                it_d++; 
     458              } 
     459              src_name.append((*it_d).c_str()); src_name.append(")"); 
     460            } 
     461            pbck_names.push_back(src_name); 
     462          } 
     463        } 
     464    } else { 
     465        StreamConfig *scfg = getActiveStreamConfig(); 
     466        if(scfg) { 
     467          pbck_names = scfg->getRxNamesString(i); 
     468        } 
     469    } 
     470    return pbck_names; 
    379471} 
    380472 
     
    17771869} 
    17781870 
     1871stringlist 
     1872EAP::StreamConfig::getTxNamesString(unsigned int i) 
     1873{ 
     1874    return getNamesForBlock(m_tx_configs[i]); 
     1875} 
     1876 
     1877stringlist 
     1878EAP::StreamConfig::getRxNamesString(unsigned int i) 
     1879{ 
     1880    return getNamesForBlock(m_rx_configs[i]); 
     1881} 
     1882 
    17791883void 
    17801884EAP::StreamConfig::showConfigBlock(struct ConfigBlock &b) 
  • trunk/libffado/src/dice/dice_eap.h

    r2056 r2057  
    311311        void showConfigBlock(struct ConfigBlock &); 
    312312        stringlist getNamesForBlock(struct ConfigBlock &b); 
     313        stringlist getTxNamesString(unsigned int); 
     314        stringlist getRxNamesString(unsigned int); 
    313315 
    314316        bool read() {return read(m_base, m_offset);}; 
     
    503505    /** @brief Get access to the router */ 
    504506    Router* getRouter() {return m_router;}; 
     507 
     508    /** @brief Get capture and playback names */ 
     509    stringlist getCptrNameString(unsigned int); 
     510    stringlist getPbckNameString(unsigned int); 
    505511 
    506512protected: