Changeset 151
- Timestamp:
- 01/08/06 10:44:20 (18 years ago)
- Files:
-
- trunk/libfreebob/ChangeLog (modified) (1 diff)
- trunk/libfreebob/configure.ac (modified) (1 diff)
- trunk/libfreebob/src/avdevice.cpp (modified) (20 diffs)
- trunk/libfreebob/src/avdevice.h (modified) (3 diffs)
- trunk/libfreebob/src/avplug.cpp (modified) (2 diffs)
- trunk/libfreebob/src/avplug.h (modified) (4 diffs)
- trunk/libfreebob/src/devicemanager.cpp (modified) (1 diff)
- trunk/libfreebob/src/freebob.cpp (modified) (2 diffs)
- trunk/libfreebob/src/libfreebobavc/avc_definitions.cpp (modified) (1 diff)
- trunk/libfreebob/src/libfreebobavc/avc_definitions.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libfreebob/ChangeLog
r146 r151 1 2006-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 1 36 2006-01-06 Daniel Wagner <wagi@monom.org> 2 37 trunk/libfreebob/configure.ac
r146 r151 23 23 m4_define(freebob_major_version, 0) 24 24 m4_define(freebob_minor_version, 0) 25 m4_define(freebob_micro_version, 5)25 m4_define(freebob_micro_version, 6) 26 26 m4_define(freebob_version, freebob_major_version.freebob_minor_version.freebob_micro_version) 27 27 trunk/libfreebob/src/avdevice.cpp
r146 r151 29 29 #include "libfreebobavc/serialize.h" 30 30 #include "libfreebobavc/ieee1394service.h" 31 #include "libfreebobavc/avc_definitions.h" 31 32 32 33 #include "debugmodule/debugmodule.h" … … 119 120 if ( !discoverStep9() ) { 120 121 debugError( "Discover step 9 failed\n" ); 122 return false; 123 } 124 if ( !discoverStep10() ) { 125 debugError( "Discover step 10 failed\n" ); 121 126 return false; 122 127 } … … 1239 1244 } 1240 1245 1241 bool AvDevice::discoverPlugConnection( AvPlug& srcPlug, 1242 SubunitPlugSpecificDataPlugAddress& subunitPlugAddress ) 1246 bool 1247 AvDevice::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 1345 bool 1346 AvDevice::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 1360 bool 1361 AvDevice::discoverPlugConnection( AvPlug& srcPlug, 1362 SubunitPlugSpecificDataPlugAddress& subunitPlugAddress ) 1243 1363 { 1244 1364 AvDeviceSubunit* subunit = getSubunit( subunitPlugAddress.m_subunitType, … … 1301 1421 subunit_type_t subunit_type 1302 1422 = subUnitInfoCmd.m_table[i].m_subunit_type; 1303 max_subunit_id_t max_subunit_id1304 = subUnitInfoCmd.m_table[i].m_max_subunit_id;1305 1423 1306 1424 unsigned int subunitId = getNrOfSubunits( subunit_type ); 1307 1425 1308 1426 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", 1311 1428 subunitId, 1312 1429 subunit_type, 1313 subunitTypeToString( subunit_type ), 1314 max_subunit_id ); 1430 subunitTypeToString( subunit_type ) ); 1315 1431 1316 1432 AvDeviceSubunit* subunit = 0; … … 1419 1535 AvDevice::getVendorName() 1420 1536 { 1421 return m_configRom->get ModelName();1537 return m_configRom->getVendorName(); 1422 1538 } 1423 1539 … … 1425 1541 AvDevice::getModelName() 1426 1542 { 1427 return m_configRom->get VendorName();1543 return m_configRom->getModelName(); 1428 1544 } 1429 1545 … … 1435 1551 1436 1552 bool 1437 AvDevice::add PlugToXmlDescription( AvPlug& plug,1438 1553 AvDevice::addXmlDescriptionPlug( AvPlug& plug, 1554 xmlNodePtr connectionSet ) 1439 1555 { 1440 1556 char* result; … … 1602 1718 } 1603 1719 1720 1721 bool 1722 AvDevice::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 1604 1792 bool 1605 1793 AvDevice::addXmlDescription( xmlNodePtr deviceNode ) … … 1610 1798 // id 1611 1799 // port 1612 // node1800 // node 1613 1801 // plug 1614 1802 // dimension … … 1617 1805 // stream 1618 1806 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 1619 1825 xmlNodePtr connectionSet = xmlNewChild( deviceNode, 0, 1620 1826 BAD_CAST "ConnectionSet", 0 ); 1621 1827 if ( !connectionSet ) { 1622 debugError( " Couldn't create connection setnode for "1828 debugError( "addXmlDescription:: Could not create 'ConnnectionSet' node for " 1623 1829 "direction 1 (playback)\n" ); 1624 1830 return false; 1625 1831 } 1626 1832 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 1636 1839 1637 1840 connectionSet = xmlNewChild( deviceNode, 0, 1638 1841 BAD_CAST "ConnectionSet", 0 ); 1639 1842 if ( !connectionSet ) { 1640 debugError( " Couldn't create connection setnode for "1843 debugError( "addXmlDescription: Couldn't create 'ConnectionSet' node for " 1641 1844 "direction 0 (recorder)\n" ); 1642 1845 return false; 1643 1846 } 1644 1847 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" ); 1652 1877 return false; 1653 1878 } … … 1657 1882 1658 1883 bool 1659 AvDevice::setSampl eRatePlug( AvPlug& plug,1660 PlugAddress::EPlugDirection direction,1661 ESampleRate sampleRate)1884 AvDevice::setSamplingFrequencyPlug( AvPlug& plug, 1885 PlugAddress::EPlugDirection direction, 1886 ESamplingFrequency samplingFrequency ) 1662 1887 { 1663 1888 ExtendedStreamFormatCmd extStreamFormatCmd( m_1394Service, … … 1685 1910 && ( extStreamFormatCmd.getResponse() == AVCCommand::eR_Implemented ) ) 1686 1911 { 1687 ESampl eRate foundRate= eSF_DontCare;1912 ESamplingFrequency foundFreq = eSF_DontCare; 1688 1913 1689 1914 FormatInformation* formatInfo = … … 1693 1918 formatInfo->m_streams ); 1694 1919 if ( compoundStream ) { 1695 found Rate = static_cast<ESampleRate>( compoundStream->m_samplingFrequency );1920 foundFreq = static_cast<ESamplingFrequency>( compoundStream->m_samplingFrequency ); 1696 1921 } 1697 1922 … … 1700 1925 formatInfo->m_streams ); 1701 1926 if ( syncStream ) { 1702 found Rate = static_cast<ESampleRate>( compoundStream->m_samplingFrequency );1703 } 1704 1705 if ( found Rate == sampleRate)1927 foundFreq = static_cast<ESamplingFrequency>( compoundStream->m_samplingFrequency ); 1928 } 1929 1930 if ( foundFreq == samplingFrequency ) 1706 1931 { 1707 1932 correctFormatFound = true; … … 1723 1948 plug.getName(), 1724 1949 plug.getPlugId(), 1725 sampleRate);1950 convertESamplingFrequency( samplingFrequency ) ); 1726 1951 return false; 1727 1952 } … … 1734 1959 debugError( "setSampleRate: Could not set sample rate %d " 1735 1960 "to %s plug %d\n", 1736 sampleRate,1961 convertESamplingFrequency( samplingFrequency ), 1737 1962 plug.getName(), 1738 1963 plug.getPlugId() ); … … 1744 1969 1745 1970 bool 1746 AvDevice::setSampl eRate( ESampleRate sampleRate)1971 AvDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) 1747 1972 { 1748 1973 AvPlug* plug = getPlugById( m_isoInputPlugs, 0 ); … … 1752 1977 } 1753 1978 1754 if ( !setSampl eRatePlug( *plug, PlugAddress::ePD_Input, sampleRate) ) {1979 if ( !setSamplingFrequencyPlug( *plug, PlugAddress::ePD_Input, samplingFrequency ) ) { 1755 1980 debugError( "setSampleRate: Setting sample rate failed\n" ); 1756 1981 return false; … … 1763 1988 } 1764 1989 1765 if ( !setSampl eRatePlug( *plug, PlugAddress::ePD_Output, sampleRate) ) {1990 if ( !setSamplingFrequencyPlug( *plug, PlugAddress::ePD_Output, samplingFrequency ) ) { 1766 1991 debugError( "setSampleRate: Setting sample rate failed\n" ); 1767 1992 return false; … … 1769 1994 1770 1995 debugOutput( DEBUG_LEVEL_VERBOSE, 1771 "setSampleRate: Set sample rate to %d\n", sampleRate);1996 "setSampleRate: Set sample rate to %d\n", convertESamplingFrequency( samplingFrequency ) ); 1772 1997 return true; 1773 1998 } trunk/libfreebob/src/avdevice.h
r144 r151 56 56 { return m_nodeId; } 57 57 58 bool setSampl eRate( ESampleRate sampleRate);58 bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 59 59 60 60 protected: … … 68 68 bool discoverStep8(); 69 69 bool discoverStep9(); 70 bool discoverStep10(); 71 bool discoverStep10Plug( AvPlugVector& isoPlugs ); 70 72 71 73 bool discoverPlugConnection( AvPlug& srcPlug, … … 82 84 83 85 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 ); 85 88 86 bool setSampl eRatePlug( AvPlug& plug,87 PlugAddress::EPlugDirection direction,88 ESampleRate sampleRate);89 bool setSamplingFrequencyPlug( AvPlug& plug, 90 PlugAddress::EPlugDirection direction, 91 ESamplingFrequency samplingFrequency ); 89 92 protected: 90 93 Ieee1394Service* m_1394Service; trunk/libfreebob/src/avplug.cpp
r138 r151 22 22 23 23 #include "libfreebobavc/avc_extended_plug_info.h" 24 #include "libfreebobavc/avc_definitions.h" 24 25 25 26 IMPL_DEBUG_MODULE( AvPlug, AvPlug, DEBUG_LEVEL_VERBOSE ); … … 160 161 AvPlug::getSampleRate() 161 162 { 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 ) ); 196 164 } 197 165 trunk/libfreebob/src/avplug.h
r138 r151 48 48 plug_direction_t getPlugDirection() 49 49 { return m_direction; } 50 sampling_frequency_t getSamplingFrequency() 50 sampling_frequency_t getSamplingFrequency() 51 51 { return m_samplingFrequency; } 52 52 int getSampleRate(); // 22050, 24000, 32000, ... 53 53 int getNrOfChannels(); 54 54 int getNrOfStreams(); 55 55 56 56 plug_type_t m_plugType; 57 57 plug_id_t m_plugId; … … 64 64 65 65 66 // --- 67 // Channel & Cluster Info 66 68 struct ChannelInfo { 67 69 stream_position_t m_streamPosition; … … 84 86 ClusterInfoVector m_clusterInfos; 85 87 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 // --- 86 108 87 109 void debugOutputClusterInfos( int debugLevel ); … … 91 113 92 114 ClusterInfo* getClusterInfoByIndex(int index); 93 ClusterInfoVector& getClusterInfos() 115 ClusterInfoVector& getClusterInfos() 94 116 { return m_clusterInfos; } 95 117 trunk/libfreebob/src/devicemanager.cpp
r146 r151 261 261 } 262 262 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; 274 272 } 275 273 trunk/libfreebob/src/freebob.cpp
r146 r151 39 39 IMPL_GLOBAL_DEBUG_MODULE( FreeBob, DEBUG_LEVEL_VERBOSE ); 40 40 41 ESampleRate42 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 80 41 const char* 81 42 freebob_get_version() { … … 159 120 AvDevice* avDevice = freebob_handle->m_deviceManager->getAvDevice( node_id ); 160 121 if ( avDevice ) { 161 if ( avDevice->setSampl eRate( parseSampleRate( samplerate ) ) ) {122 if ( avDevice->setSamplingFrequency( parseSampleRate( samplerate ) ) ) { 162 123 return freebob_handle->m_deviceManager->discover()? 1 : 0; 163 124 } trunk/libfreebob/src/libfreebobavc/avc_definitions.cpp
r145 r151 21 21 #include "avc_definitions.h" 22 22 23 std::ostream& operator<<( std::ostream& stream, ESampleRate sampleRate ) 23 24 int 25 convertESamplingFrequency(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 65 ESamplingFrequency 66 parseSampleRate( 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 104 std::ostream& operator<<( std::ostream& stream, ESamplingFrequency samplingFrequency ) 24 105 { 25 106 char* str; 26 switch ( sampl eRate) {107 switch ( samplingFrequency ) { 27 108 case eSF_22050Hz: 28 109 str = "22050"; trunk/libfreebob/src/libfreebobavc/avc_definitions.h
r145 r151 62 62 typedef quadlet_t company_id_t; 63 63 64 enum ESampl eRate{64 enum ESamplingFrequency { 65 65 eSF_22050Hz = 0x00, 66 66 eSF_24000Hz = 0x01, … … 75 75 }; 76 76 77 std::ostream& operator<<( std::ostream& stream, ESampleRate sampleRate ); 77 int convertESamplingFrequency(ESamplingFrequency freq); 78 ESamplingFrequency parseSampleRate( int sampleRate ); 79 80 std::ostream& operator<<( std::ostream& stream, ESamplingFrequency samplingFrequency ); 78 81 79 82 #define AVC1394_SUBUNIT_AUDIO 1