Changeset 151

Show
Ignore:
Timestamp:
01/08/06 10:44:20 (18 years ago)
Author:
wagi
Message:

2006-01-08 Daniel Wagner <wagi@monom.org>

  • src/avdevice.cpp (getModelName):
    Return model name and not vendor name.
    (getVendorName):
    Return vendor name and not model name.
    (discoverStep10Plug): Implementation added.
    (enumerateSubUnits): max_subunit_id removed.
    (addXmlDescription): Add stream format infos.
  • src/avdevice.h: discoverStep10 added.
    Renaming of addPlugToXmlDescription to addXmlDescriptionPlug.
    ESampleRate to ESamplingFrequency changes.
  • src/avplug.cpp (getSampleRate):
    Use convertESamplingFrequency instead of
    local implementation.
  • src/avplug.h:
    ESampleRate to ESamplingFrequency changes.
    Added FormatInfo? struct.
  • src/devicemanager.cpp (getXmlDescription):
    Print GUID correctly.
  • src/freebob.cpp (parseSampleRate):
    Moved to avc_definitions.cpp
  • src/libfreebobavc/avc_definitions.h
    src/libfreebobavc/avc_definitions.cpp:
    Renamed ESampleRate back to ESamlingFrequency.
    Added connvert functions for ESamplingFrequency.
  • configure.ac: New micro version.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libfreebob/ChangeLog

    r146 r151  
     12006-01-08  Daniel Wagner  <wagi@monom.org> 
     2 
     3        * src/avdevice.cpp (getModelName):  
     4        Return model name and not vendor name. 
     5        (getVendorName):  
     6        Return vendor name and not model name. 
     7        (discoverStep10Plug): Implementation added. 
     8        (enumerateSubUnits): max_subunit_id removed. 
     9        (addXmlDescription): Add stream format infos. 
     10 
     11        * src/avdevice.h: discoverStep10 added. 
     12        Renaming of addPlugToXmlDescription to addXmlDescriptionPlug. 
     13        ESampleRate to ESamplingFrequency changes. 
     14 
     15        * src/avplug.cpp (getSampleRate):  
     16        Use convertESamplingFrequency instead of 
     17        local implementation. 
     18 
     19        * src/avplug.h:  
     20        ESampleRate to ESamplingFrequency changes. 
     21        Added FormatInfo struct. 
     22 
     23        * src/devicemanager.cpp (getXmlDescription):  
     24        Print GUID correctly. 
     25 
     26        * src/freebob.cpp (parseSampleRate):  
     27        Moved to avc_definitions.cpp 
     28 
     29        * src/libfreebobavc/avc_definitions.h 
     30        src/libfreebobavc/avc_definitions.cpp:  
     31        Renamed ESampleRate back to ESamlingFrequency. 
     32        Added connvert functions for ESamplingFrequency. 
     33 
     34        * configure.ac: New micro version. 
     35 
    1362006-01-06  Daniel Wagner  <wagi@monom.org> 
    237 
  • trunk/libfreebob/configure.ac

    r146 r151  
    2323m4_define(freebob_major_version, 0) 
    2424m4_define(freebob_minor_version, 0) 
    25 m4_define(freebob_micro_version, 5
     25m4_define(freebob_micro_version, 6
    2626m4_define(freebob_version, freebob_major_version.freebob_minor_version.freebob_micro_version) 
    2727 
  • trunk/libfreebob/src/avdevice.cpp

    r146 r151  
    2929#include "libfreebobavc/serialize.h" 
    3030#include "libfreebobavc/ieee1394service.h" 
     31#include "libfreebobavc/avc_definitions.h" 
    3132 
    3233#include "debugmodule/debugmodule.h" 
     
    119120    if ( !discoverStep9() ) { 
    120121        debugError( "Discover step 9 failed\n" ); 
     122        return false; 
     123    } 
     124    if ( !discoverStep10() ) { 
     125        debugError( "Discover step 10 failed\n" ); 
    121126        return false; 
    122127    } 
     
    12391244} 
    12401245 
    1241 bool AvDevice::discoverPlugConnection( AvPlug& srcPlug, 
    1242                                        SubunitPlugSpecificDataPlugAddress& subunitPlugAddress ) 
     1246bool 
     1247AvDevice::discoverStep10Plug( AvPlugVector& isoPlugs ) 
     1248
     1249   for ( AvPlugVector::iterator it = isoPlugs.begin(); 
     1250          it != isoPlugs.end(); 
     1251          ++it ) 
     1252    { 
     1253        AvPlug* isoPlug = *it; 
     1254        ExtendedStreamFormatCmd extStreamFormatCmd( m_1394Service, 
     1255                                                    ExtendedStreamFormatCmd::eSF_ExtendedStreamFormatInformationCommandList); 
     1256        UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 
     1257                                         isoPlug->getPlugId() ); 
     1258        PlugAddress::EPlugDirection direction = 
     1259            static_cast<PlugAddress::EPlugDirection>( isoPlug->getPlugDirection() ); 
     1260        extStreamFormatCmd.setPlugAddress( PlugAddress( direction, 
     1261                                                        PlugAddress::ePAM_Unit, 
     1262                                                        unitPlugAddress ) ); 
     1263 
     1264        extStreamFormatCmd.setNodeId( m_nodeId ); 
     1265        //extStreamFormatCmd.setVerbose( true ); 
     1266 
     1267        int i = 0; 
     1268        bool cmdSuccess = false; 
     1269 
     1270        do { 
     1271            extStreamFormatCmd.setIndexInStreamFormat( i ); 
     1272            extStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 
     1273            cmdSuccess = extStreamFormatCmd.fire(); 
     1274            if ( cmdSuccess 
     1275                 && ( extStreamFormatCmd.getResponse() == AVCCommand::eR_Implemented ) ) 
     1276            { 
     1277                AvPlug::FormatInfo formatInfo; 
     1278                formatInfo.m_index = i; 
     1279 
     1280                FormatInformationStreamsSync* syncStream 
     1281                    = dynamic_cast< FormatInformationStreamsSync* > 
     1282                    ( extStreamFormatCmd.getFormatInformation()->m_streams ); 
     1283                if ( syncStream ) { 
     1284                    formatInfo.m_samplingFrequency = 
     1285                        syncStream->m_samplingFrequency; 
     1286                    formatInfo.m_isSyncStream = true ; 
     1287                } 
     1288 
     1289                FormatInformationStreamsCompound* compoundStream 
     1290                    = dynamic_cast< FormatInformationStreamsCompound* > 
     1291                    ( extStreamFormatCmd.getFormatInformation()->m_streams ); 
     1292                if ( compoundStream ) { 
     1293                    formatInfo.m_samplingFrequency = 
     1294                        compoundStream->m_samplingFrequency; 
     1295                    formatInfo.m_isSyncStream = false; 
     1296                    for ( int j = 0; 
     1297                          j < compoundStream->m_numberOfStreamFormatInfos; 
     1298                          ++j ) 
     1299                    { 
     1300                        switch ( compoundStream->m_streamFormatInfos[j]->m_streamFormat ) { 
     1301                        case AVC1394_STREAM_FORMAT_AM824_MULTI_BIT_LINEAR_AUDIO_RAW: 
     1302                            formatInfo.m_audioChannels += 
     1303                                compoundStream->m_streamFormatInfos[j]->m_numberOfChannels; 
     1304                            break; 
     1305                        case AVC1394_STREAM_FORMAT_AM824_MIDI_CONFORMANT: 
     1306                            formatInfo.m_midiChannels += 
     1307                                compoundStream->m_streamFormatInfos[j]->m_numberOfChannels; 
     1308                            break; 
     1309                        default: 
     1310                            debugWarning( "discoverStep10Plug: unknown stream " 
     1311                                          "format for channel (%d)\n", j ); 
     1312                        } 
     1313                    } 
     1314                } 
     1315 
     1316                debugOutput( DEBUG_LEVEL_VERBOSE, 
     1317                             "[%s:%d] formatInfo[%d].m_samplingFrequency = %d\n", 
     1318                             isoPlug->getName(), isoPlug->getPlugId(), 
     1319                             i, formatInfo.m_samplingFrequency ); 
     1320                debugOutput( DEBUG_LEVEL_VERBOSE, 
     1321                             "[%s:%d] formatInfo[%d].m_isSyncStream = %d\n", 
     1322                             isoPlug->getName(), isoPlug->getPlugId(), 
     1323                             i, formatInfo.m_isSyncStream ); 
     1324                debugOutput( DEBUG_LEVEL_VERBOSE, 
     1325                             "[%s:%d] formatInfo[%d].m_audioChannels = %d\n", 
     1326                             isoPlug->getName(), isoPlug->getPlugId(), 
     1327                             i, formatInfo.m_audioChannels ); 
     1328                debugOutput( DEBUG_LEVEL_VERBOSE, 
     1329                             "[%s:%d] formatInfo[%d].m_midiChannels = %d\n", 
     1330                             isoPlug->getName(), isoPlug->getPlugId(), 
     1331                             i, formatInfo.m_midiChannels ); 
     1332 
     1333                isoPlug->m_formatInfos.push_back( formatInfo ); 
     1334            } 
     1335 
     1336            ++i; 
     1337        } while ( cmdSuccess && ( extStreamFormatCmd.getResponse() 
     1338                                  == ExtendedStreamFormatCmd::eR_Implemented ) ); 
     1339    } 
     1340 
     1341   return true; 
     1342
     1343 
     1344 
     1345bool 
     1346AvDevice::discoverStep10() 
     1347
     1348    ////////////////////////////////////////////// 
     1349    // Step 10: For all ISO plugs: get all stream 
     1350    // supported formats 
     1351 
     1352    bool success; 
     1353 
     1354    success  = discoverStep10Plug( m_isoInputPlugs ); 
     1355    success &= discoverStep10Plug( m_isoOutputPlugs ); 
     1356 
     1357    return success; 
     1358
     1359 
     1360bool 
     1361AvDevice::discoverPlugConnection( AvPlug& srcPlug, 
     1362                                  SubunitPlugSpecificDataPlugAddress& subunitPlugAddress ) 
    12431363{ 
    12441364    AvDeviceSubunit* subunit = getSubunit( subunitPlugAddress.m_subunitType, 
     
    13011421        subunit_type_t subunit_type 
    13021422            = subUnitInfoCmd.m_table[i].m_subunit_type; 
    1303         max_subunit_id_t max_subunit_id 
    1304             = subUnitInfoCmd.m_table[i].m_max_subunit_id; 
    13051423 
    13061424        unsigned int subunitId = getNrOfSubunits( subunit_type ); 
    13071425 
    13081426        debugOutput( DEBUG_LEVEL_VERBOSE, 
    1309                      "subunit_id = %2d, subunit_type = %2d (%s), " 
    1310                      "max_subunit_ID = %d\n", 
     1427                     "subunit_id = %2d, subunit_type = %2d (%s)\n", 
    13111428                     subunitId, 
    13121429                     subunit_type, 
    1313                      subunitTypeToString( subunit_type ), 
    1314                      max_subunit_id ); 
     1430                     subunitTypeToString( subunit_type ) ); 
    13151431 
    13161432        AvDeviceSubunit* subunit = 0; 
     
    14191535AvDevice::getVendorName() 
    14201536{ 
    1421     return m_configRom->getModelName(); 
     1537    return m_configRom->getVendorName(); 
    14221538} 
    14231539 
     
    14251541AvDevice::getModelName() 
    14261542{ 
    1427     return m_configRom->getVendorName(); 
     1543    return m_configRom->getModelName(); 
    14281544} 
    14291545 
     
    14351551 
    14361552bool 
    1437 AvDevice::addPlugToXmlDescription( AvPlug& plug, 
    1438                                    xmlNodePtr connectionSet ) 
     1553AvDevice::addXmlDescriptionPlug( AvPlug& plug, 
     1554                                 xmlNodePtr connectionSet ) 
    14391555{ 
    14401556    char* result; 
     
    16021718} 
    16031719 
     1720 
     1721bool 
     1722AvDevice::addXmlDescriptionStreamFormats( AvPlug& plug, 
     1723                                          xmlNodePtr streamFormatNode ) 
     1724{ 
     1725    int direction; 
     1726    switch ( plug.getPlugDirection() ) { 
     1727        case 0: 
     1728            direction = FREEBOB_PLAYBACK; 
     1729            break; 
     1730        case 1: 
     1731            direction = FREEBOB_CAPTURE; 
     1732            break; 
     1733    default: 
     1734        debugError( "addXmlDescriptionStreamFormats: plug direction invalid (%d)\n", 
     1735                    plug.getPlugDirection() ); 
     1736        return false; 
     1737    } 
     1738 
     1739    char* result; 
     1740    asprintf( &result, "%d",  direction ); 
     1741    if ( !xmlNewChild( streamFormatNode, 
     1742                       0, 
     1743                       BAD_CAST "Direction", 
     1744                       BAD_CAST result ) ) 
     1745    { 
     1746        debugError( "addXmlDescriptionStreamFormats: Could not  create 'Direction' node\n" ); 
     1747        return false; 
     1748    } 
     1749 
     1750    for ( AvPlug::FormatInfoVector::iterator it = 
     1751              plug.m_formatInfos.begin(); 
     1752          it != plug.m_formatInfos.end(); 
     1753          ++it ) 
     1754    { 
     1755        AvPlug::FormatInfo formatInfo = *it; 
     1756        xmlNodePtr formatNode = xmlNewChild( streamFormatNode, 0, 
     1757                                             BAD_CAST "Format", 0 ); 
     1758        if ( !formatNode ) { 
     1759            debugError( "addXmlDescriptionStreamFormats: Could not create 'Format' node\n" ); 
     1760            return false; 
     1761        } 
     1762 
     1763        asprintf( &result, "%d", 
     1764                  convertESamplingFrequency( static_cast<ESamplingFrequency>( formatInfo.m_samplingFrequency ) ) ); 
     1765        if ( !xmlNewChild( formatNode,  0, 
     1766                           BAD_CAST "Samplerate",  BAD_CAST result ) ) 
     1767        { 
     1768            debugError( "Couldn't create 'Samplerate' node\n" ); 
     1769            return false; 
     1770        } 
     1771 
     1772        asprintf( &result, "%d",  formatInfo.m_audioChannels ); 
     1773        if ( !xmlNewChild( formatNode,  0, 
     1774                           BAD_CAST "AudioChannels",  BAD_CAST result ) ) 
     1775        { 
     1776            debugError( "Couldn't create 'AudioChannels' node\n" ); 
     1777            return false; 
     1778        } 
     1779 
     1780        asprintf( &result, "%d",  formatInfo.m_midiChannels ); 
     1781        if ( !xmlNewChild( formatNode,  0, 
     1782                           BAD_CAST "MidiChannels",  BAD_CAST result ) ) 
     1783        { 
     1784            debugError( "Couldn't create 'MidiChannels' node\n" ); 
     1785            return false; 
     1786        } 
     1787    } 
     1788 
     1789    return true; 
     1790} 
     1791 
    16041792bool 
    16051793AvDevice::addXmlDescription( xmlNodePtr deviceNode ) 
     
    16101798    //    id 
    16111799    //    port 
    1612    //    node 
     1800    //    node 
    16131801    //    plug 
    16141802    //    dimension 
     
    16171805    //      stream 
    16181806 
     1807 
     1808    /////////// 
     1809    // get plugs 
     1810 
     1811    AvPlug* inputPlug = getPlugById( m_isoInputPlugs, 0 ); 
     1812    if ( !inputPlug ) { 
     1813        debugError( "addXmlDescription: No iso input plug found with id %d\n" ); 
     1814        return false; 
     1815    } 
     1816    AvPlug* outputPlug = getPlugById( m_isoOutputPlugs, 0 ); 
     1817    if ( !outputPlug ) { 
     1818        debugError( "addXmlDescription: No iso output plug found with id %d\n" ); 
     1819        return false; 
     1820    } 
     1821 
     1822    /////////// 
     1823    // add connection set output 
     1824 
    16191825    xmlNodePtr connectionSet = xmlNewChild( deviceNode, 0, 
    16201826                                            BAD_CAST "ConnectionSet", 0 ); 
    16211827    if ( !connectionSet ) { 
    1622         debugError( "Couldn't create connection set node for " 
     1828        debugError( "addXmlDescription:: Could not create 'ConnnectionSet' node for " 
    16231829                    "direction 1 (playback)\n" ); 
    16241830        return false; 
    16251831    } 
    16261832 
    1627     AvPlug* inputPlug = getPlugById( m_isoInputPlugs, 0 ); 
    1628     if ( !inputPlug ) { 
    1629         debugError( "No iso input plug found with id %d\n" ); 
    1630         return false; 
    1631     } 
    1632     if ( !addPlugToXmlDescription( *inputPlug, connectionSet ) ) { 
    1633         debugError( "Could not add iso input plug 0 to XML description\n" ); 
    1634         return false; 
    1635     } 
     1833    if ( !addXmlDescriptionPlug( *inputPlug, connectionSet ) ) { 
     1834        debugError( "addXmlDescription: Could not add iso input plug 0 to XML description\n" ); 
     1835        return false; 
     1836    } 
     1837 
     1838    // add connection set input 
    16361839 
    16371840    connectionSet = xmlNewChild( deviceNode, 0, 
    16381841                                 BAD_CAST "ConnectionSet", 0 ); 
    16391842    if ( !connectionSet ) { 
    1640         debugError( "Couldn't create connection set node for " 
     1843        debugError( "addXmlDescription: Couldn't create 'ConnectionSet' node for " 
    16411844                    "direction 0 (recorder)\n" ); 
    16421845        return false; 
    16431846    } 
    16441847 
    1645     AvPlug* outputPlug = getPlugById( m_isoOutputPlugs, 0 ); 
    1646     if ( !outputPlug ) { 
    1647         debugError( "No iso output plug found with id %d\n" ); 
    1648         return false; 
    1649     } 
    1650     if ( !addPlugToXmlDescription( *outputPlug, connectionSet ) ) { 
    1651         debugError( "Could not add iso output plug 0 to XML description\n" ); 
     1848    if ( !addXmlDescriptionPlug( *outputPlug, connectionSet ) ) { 
     1849        debugError( "addXmlDescription: Could not add iso output plug 0 to XML description\n" ); 
     1850        return false; 
     1851    } 
     1852 
     1853    //////////// 
     1854    // add stream format 
     1855 
     1856    xmlNodePtr streamFormatNode = xmlNewChild( deviceNode, 0, 
     1857                                               BAD_CAST "StreamFormats", 0 ); 
     1858    if ( !streamFormatNode ) { 
     1859        debugError( "addXmlDescription: Could not create 'StreamFormats' node\n" ); 
     1860        return false; 
     1861    } 
     1862 
     1863    if ( !addXmlDescriptionStreamFormats( *inputPlug, streamFormatNode ) ) { 
     1864        debugError( "addXmlDescription:: Could not add stream format info\n" ); 
     1865        return false; 
     1866    } 
     1867 
     1868    streamFormatNode= xmlNewChild( deviceNode, 0, 
     1869                                 BAD_CAST "StreamFormats", 0 ); 
     1870    if ( !streamFormatNode ) { 
     1871        debugError( "addXmlDescription: Could not create 'StreamFormat' node\n" ); 
     1872        return false; 
     1873    } 
     1874 
     1875    if ( !addXmlDescriptionStreamFormats( *outputPlug, streamFormatNode ) ) { 
     1876        debugError( "addXmlDescription:: Could not add stream format info\n" ); 
    16521877        return false; 
    16531878    } 
     
    16571882 
    16581883bool 
    1659 AvDevice::setSampleRatePlug( AvPlug& plug, 
    1660                              PlugAddress::EPlugDirection direction, 
    1661                              ESampleRate sampleRate
     1884AvDevice::setSamplingFrequencyPlug( AvPlug& plug, 
     1885                                    PlugAddress::EPlugDirection direction, 
     1886                                    ESamplingFrequency samplingFrequency
    16621887{ 
    16631888    ExtendedStreamFormatCmd extStreamFormatCmd( m_1394Service, 
     
    16851910             && ( extStreamFormatCmd.getResponse() == AVCCommand::eR_Implemented ) ) 
    16861911        { 
    1687             ESampleRate foundRate = eSF_DontCare; 
     1912            ESamplingFrequency foundFreq = eSF_DontCare; 
    16881913 
    16891914            FormatInformation* formatInfo = 
     
    16931918                    formatInfo->m_streams ); 
    16941919            if ( compoundStream ) { 
    1695                 foundRate = static_cast<ESampleRate>( compoundStream->m_samplingFrequency ); 
     1920                foundFreq = static_cast<ESamplingFrequency>( compoundStream->m_samplingFrequency ); 
    16961921            } 
    16971922 
     
    17001925                    formatInfo->m_streams ); 
    17011926            if ( syncStream ) { 
    1702                 foundRate = static_cast<ESampleRate>( compoundStream->m_samplingFrequency ); 
    1703             } 
    1704  
    1705             if (  foundRate == sampleRate
     1927                foundFreq = static_cast<ESamplingFrequency>( compoundStream->m_samplingFrequency ); 
     1928            } 
     1929 
     1930            if (  foundFreq == samplingFrequency
    17061931            { 
    17071932                correctFormatFound = true; 
     
    17231948                    plug.getName(), 
    17241949                    plug.getPlugId(), 
    1725                     sampleRate ); 
     1950                    convertESamplingFrequency( samplingFrequency ) ); 
    17261951        return false; 
    17271952    } 
     
    17341959        debugError( "setSampleRate: Could not set sample rate %d " 
    17351960                    "to %s plug %d\n", 
    1736                     sampleRate
     1961                    convertESamplingFrequency( samplingFrequency )
    17371962                    plug.getName(), 
    17381963                    plug.getPlugId() ); 
     
    17441969 
    17451970bool 
    1746 AvDevice::setSampleRate( ESampleRate sampleRate
     1971AvDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency
    17471972{ 
    17481973    AvPlug* plug = getPlugById( m_isoInputPlugs, 0 ); 
     
    17521977    } 
    17531978 
    1754     if ( !setSampleRatePlug( *plug, PlugAddress::ePD_Input, sampleRate ) ) { 
     1979    if ( !setSamplingFrequencyPlug( *plug, PlugAddress::ePD_Input, samplingFrequency ) ) { 
    17551980        debugError( "setSampleRate: Setting sample rate failed\n" ); 
    17561981        return false; 
     
    17631988    } 
    17641989 
    1765     if ( !setSampleRatePlug( *plug, PlugAddress::ePD_Output, sampleRate ) ) { 
     1990    if ( !setSamplingFrequencyPlug( *plug, PlugAddress::ePD_Output, samplingFrequency ) ) { 
    17661991        debugError( "setSampleRate: Setting sample rate failed\n" ); 
    17671992        return false; 
     
    17691994 
    17701995    debugOutput( DEBUG_LEVEL_VERBOSE, 
    1771                  "setSampleRate: Set sample rate to %d\n",  sampleRate ); 
     1996                 "setSampleRate: Set sample rate to %d\n",  convertESamplingFrequency( samplingFrequency ) ); 
    17721997    return true; 
    17731998} 
  • trunk/libfreebob/src/avdevice.h

    r144 r151  
    5656        { return m_nodeId; } 
    5757 
    58     bool setSampleRate( ESampleRate sampleRate ); 
     58    bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 
    5959 
    6060protected: 
     
    6868    bool discoverStep8(); 
    6969    bool discoverStep9(); 
     70    bool discoverStep10(); 
     71    bool discoverStep10Plug( AvPlugVector& isoPlugs ); 
    7072 
    7173    bool discoverPlugConnection( AvPlug& srcPlug, 
     
    8284 
    8385    AvPlug* getPlugById( AvPlugVector& plugs, int id ); 
    84     bool addPlugToXmlDescription( AvPlug& plug, xmlNodePtr conectionSet ); 
     86    bool addXmlDescriptionPlug( AvPlug& plug, xmlNodePtr conectionSet ); 
     87    bool addXmlDescriptionStreamFormats( AvPlug& plug, xmlNodePtr streamFormats ); 
    8588 
    86     bool setSampleRatePlug( AvPlug& plug, 
    87                             PlugAddress::EPlugDirection direction, 
    88                             ESampleRate sampleRate ); 
     89    bool setSamplingFrequencyPlug( AvPlug& plug, 
     90                                   PlugAddress::EPlugDirection direction, 
     91                                   ESamplingFrequency samplingFrequency ); 
    8992protected: 
    9093    Ieee1394Service* m_1394Service; 
  • trunk/libfreebob/src/avplug.cpp

    r138 r151  
    2222 
    2323#include "libfreebobavc/avc_extended_plug_info.h" 
     24#include "libfreebobavc/avc_definitions.h" 
    2425 
    2526IMPL_DEBUG_MODULE( AvPlug, AvPlug, DEBUG_LEVEL_VERBOSE ); 
     
    160161AvPlug::getSampleRate() 
    161162{ 
    162     int value = 0; 
    163     switch ( m_samplingFrequency ) { 
    164     case eSF_22050Hz: 
    165         value = 22050; 
    166         break; 
    167     case eSF_24000Hz: 
    168         value = 24000; 
    169         break; 
    170     case eSF_32000Hz: 
    171         value = 32000; 
    172         break; 
    173     case eSF_44100Hz: 
    174         value = 44100; 
    175         break; 
    176     case eSF_48000Hz: 
    177         value = 48000; 
    178         break; 
    179     case eSF_88200Hz: 
    180         value = 88200; 
    181         break; 
    182     case eSF_96000Hz: 
    183         value = 96000; 
    184         break; 
    185     case eSF_176400Hz: 
    186         value = 176400; 
    187         break; 
    188     case eSF_192000Hz: 
    189         value = 192000; 
    190         break; 
    191     default: 
    192         value = 0; 
    193     } 
    194  
    195     return value; 
     163    return convertESamplingFrequency( static_cast<ESamplingFrequency>( m_samplingFrequency ) ); 
    196164} 
    197165 
  • trunk/libfreebob/src/avplug.h

    r138 r151  
    4848    plug_direction_t getPlugDirection() 
    4949        { return m_direction; } 
    50     sampling_frequency_t getSamplingFrequency()  
     50    sampling_frequency_t getSamplingFrequency() 
    5151        { return m_samplingFrequency; } 
    5252    int getSampleRate(); // 22050, 24000, 32000, ... 
    5353    int getNrOfChannels(); 
    5454    int getNrOfStreams(); 
    55      
     55 
    5656    plug_type_t          m_plugType; 
    5757    plug_id_t            m_plugId; 
     
    6464 
    6565 
     66    // --- 
     67    // Channel & Cluster Info 
    6668    struct ChannelInfo { 
    6769        stream_position_t          m_streamPosition; 
     
    8486    ClusterInfoVector        m_clusterInfos; 
    8587 
     88    // --- 
     89    // Stream Format 
     90    struct FormatInfo { 
     91        FormatInfo() 
     92            : m_samplingFrequency( eSF_DontCare ) 
     93            , m_isSyncStream( false ) 
     94            , m_audioChannels( 0 ) 
     95            , m_midiChannels( 0 ) 
     96            , m_index( 0xff ) 
     97            {} 
     98        sampling_frequency_t  m_samplingFrequency; 
     99        bool                  m_isSyncStream; 
     100        number_of_channels_t  m_audioChannels; 
     101        number_of_channels_t  m_midiChannels; 
     102        byte_t                m_index; 
     103    }; 
     104    typedef std::vector<FormatInfo> FormatInfoVector; 
     105 
     106    FormatInfoVector         m_formatInfos; 
     107    // --- 
    86108 
    87109    void debugOutputClusterInfos( int debugLevel ); 
     
    91113 
    92114    ClusterInfo* getClusterInfoByIndex(int index); 
    93     ClusterInfoVector& getClusterInfos()  
     115    ClusterInfoVector& getClusterInfos() 
    94116        { return m_clusterInfos; } 
    95117 
  • trunk/libfreebob/src/devicemanager.cpp

    r146 r151  
    261261        } 
    262262 
    263         res = ""; 
    264         res = avDevice->getGuid(); 
    265  
    266         if ( !xmlNewChild( deviceNode, 
    267                            0, 
    268                            BAD_CAST "GUID", 
    269                            BAD_CAST res.c_str() ) ) { 
    270             debugError( "Couldn't create GUID node\n" ); 
    271             xmlFreeDoc( doc ); 
    272             xmlCleanupParser(); 
    273             return 0; 
     263        asprintf( &result, "%08x%08x", 
     264                  ( quadlet_t )( avDevice->getGuid() >> 32 ), 
     265                  ( quadlet_t )( avDevice->getGuid() & 0xfffffff ) ); 
     266        if ( !xmlNewChild( deviceNode,  0, 
     267                           BAD_CAST "GUID",  BAD_CAST result ) ) { 
     268            debugError( "Couldn't create 'GUID' node\n" ); 
     269            xmlFreeDoc( doc ); 
     270            xmlCleanupParser(); 
     271            return false; 
    274272        } 
    275273 
  • trunk/libfreebob/src/freebob.cpp

    r146 r151  
    3939IMPL_GLOBAL_DEBUG_MODULE( FreeBob, DEBUG_LEVEL_VERBOSE ); 
    4040 
    41 ESampleRate 
    42 parseSampleRate( int sampleRate ) 
    43 { 
    44     ESampleRate efreq; 
    45     switch ( sampleRate ) { 
    46     case 22050: 
    47         efreq = eSF_22050Hz; 
    48         break; 
    49     case 24000: 
    50         efreq = eSF_24000Hz; 
    51         break; 
    52     case 32000: 
    53         efreq = eSF_32000Hz; 
    54         break; 
    55     case 44100: 
    56         efreq = eSF_44100Hz; 
    57         break; 
    58     case 48000: 
    59         efreq = eSF_48000Hz; 
    60         break; 
    61     case 88200: 
    62         efreq = eSF_88200Hz; 
    63         break; 
    64     case 96000: 
    65         efreq = eSF_96000Hz; 
    66         break; 
    67     case 176400: 
    68         efreq = eSF_176400Hz; 
    69         break; 
    70     case 192000: 
    71         efreq = eSF_192000Hz; 
    72         break; 
    73     default: 
    74         efreq = eSF_DontCare; 
    75     } 
    76  
    77     return efreq; 
    78 } 
    79  
    8041const char* 
    8142freebob_get_version() { 
     
    159120    AvDevice* avDevice = freebob_handle->m_deviceManager->getAvDevice( node_id ); 
    160121    if ( avDevice ) { 
    161         if ( avDevice->setSampleRate( parseSampleRate( samplerate ) ) ) { 
     122        if ( avDevice->setSamplingFrequency( parseSampleRate( samplerate ) ) ) { 
    162123            return freebob_handle->m_deviceManager->discover()? 1 : 0; 
    163124        } 
  • trunk/libfreebob/src/libfreebobavc/avc_definitions.cpp

    r145 r151  
    2121#include "avc_definitions.h" 
    2222 
    23 std::ostream& operator<<( std::ostream& stream, ESampleRate sampleRate ) 
     23 
     24int 
     25convertESamplingFrequency(ESamplingFrequency freq) 
     26
     27    int value = 0; 
     28 
     29    switch ( freq ) { 
     30    case eSF_22050Hz: 
     31        value = 22050; 
     32        break; 
     33    case eSF_24000Hz: 
     34        value = 24000; 
     35        break; 
     36    case eSF_32000Hz: 
     37        value = 32000; 
     38        break; 
     39    case eSF_44100Hz: 
     40        value = 44100; 
     41        break; 
     42    case eSF_48000Hz: 
     43        value = 48000; 
     44        break; 
     45    case eSF_88200Hz: 
     46        value = 88200; 
     47        break; 
     48    case eSF_96000Hz: 
     49        value = 96000; 
     50        break; 
     51    case eSF_176400Hz: 
     52        value = 176400; 
     53        break; 
     54    case eSF_192000Hz: 
     55        value = 192000; 
     56        break; 
     57    default: 
     58        value = 0; 
     59    } 
     60 
     61 
     62    return value; 
     63
     64 
     65ESamplingFrequency 
     66parseSampleRate( int sampleRate ) 
     67
     68    ESamplingFrequency efreq; 
     69    switch ( sampleRate ) { 
     70    case 22050: 
     71        efreq = eSF_22050Hz; 
     72        break; 
     73    case 24000: 
     74        efreq = eSF_24000Hz; 
     75        break; 
     76    case 32000: 
     77        efreq = eSF_32000Hz; 
     78        break; 
     79    case 44100: 
     80        efreq = eSF_44100Hz; 
     81        break; 
     82    case 48000: 
     83        efreq = eSF_48000Hz; 
     84        break; 
     85    case 88200: 
     86        efreq = eSF_88200Hz; 
     87        break; 
     88    case 96000: 
     89        efreq = eSF_96000Hz; 
     90        break; 
     91    case 176400: 
     92        efreq = eSF_176400Hz; 
     93        break; 
     94    case 192000: 
     95        efreq = eSF_192000Hz; 
     96        break; 
     97    default: 
     98        efreq = eSF_DontCare; 
     99    } 
     100 
     101    return efreq; 
     102
     103 
     104std::ostream& operator<<( std::ostream& stream, ESamplingFrequency samplingFrequency ) 
    24105{ 
    25106    char* str; 
    26     switch ( sampleRate ) { 
     107    switch ( samplingFrequency ) { 
    27108    case eSF_22050Hz: 
    28109        str = "22050"; 
  • trunk/libfreebob/src/libfreebobavc/avc_definitions.h

    r145 r151  
    6262typedef quadlet_t company_id_t; 
    6363 
    64 enum ESampleRate
     64enum ESamplingFrequency
    6565    eSF_22050Hz = 0x00, 
    6666    eSF_24000Hz = 0x01, 
     
    7575}; 
    7676 
    77 std::ostream& operator<<( std::ostream& stream, ESampleRate sampleRate ); 
     77int convertESamplingFrequency(ESamplingFrequency freq); 
     78ESamplingFrequency parseSampleRate( int sampleRate ); 
     79 
     80std::ostream& operator<<( std::ostream& stream, ESamplingFrequency samplingFrequency ); 
    7881 
    7982#define AVC1394_SUBUNIT_AUDIO 1