Changeset 138

Show
Ignore:
Timestamp:
01/02/06 08:10:34 (18 years ago)
Author:
pieterpalmers
Message:

* implemented dummy set samplerate functions

* fixed NodeId? bug

* commented out sanity check that failed for midi channels

* fixed Dimension bug

* increased all "XXX random length" requests

* made a mess of clean code ;)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libfreebob/configure.ac

    r133 r138  
    2323m4_define(freebob_major_version, 0) 
    2424m4_define(freebob_minor_version, 0) 
    25 m4_define(freebob_micro_version, 2
     25m4_define(freebob_micro_version, 3
    2626m4_define(freebob_version, freebob_major_version.freebob_minor_version.freebob_micro_version) 
    2727 
  • trunk/libfreebob/INSTALL

    r125 r138  
    1 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software 
    2 Foundation, Inc. 
    3  
    4    This file is free documentation; the Free Software Foundation gives 
     1Installation Instructions 
     2************************* 
     3 
     4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free 
     5Software Foundation, Inc. 
     6 
     7This file is free documentation; the Free Software Foundation gives 
    58unlimited permission to copy, distribute and modify it. 
    69 
     
    811================== 
    912 
    10    These are generic installation instructions. 
     13These are generic installation instructions. 
    1114 
    1215   The `configure' shell script attempts to guess correct values for 
     
    6871===================== 
    6972 
    70    Some systems require unusual options for compilation or linking that 
    71 the `configure' script does not know about.  Run `./configure --help' 
    72 for details on some of the pertinent environment variables. 
     73Some systems require unusual options for compilation or linking that the 
     74`configure' script does not know about.  Run `./configure --help' for 
     75details on some of the pertinent environment variables. 
    7376 
    7477   You can give `configure' initial values for configuration parameters 
     
    8386==================================== 
    8487 
    85    You can compile the package for more than one kind of computer at the 
     88You can compile the package for more than one kind of computer at the 
    8689same time, by placing the object files for each architecture in their 
    8790own directory.  To do this, you must use a version of `make' that 
     
    100103================== 
    101104 
    102    By default, `make install' will install the package's files in 
     105By default, `make install' will install the package's files in 
    103106`/usr/local/bin', `/usr/local/man', etc.  You can specify an 
    104107installation prefix other than `/usr/local' by giving `configure' the 
    105 option `--prefix=PATH'. 
     108option `--prefix=PREFIX'. 
    106109 
    107110   You can specify separate installation prefixes for 
    108111architecture-specific files and architecture-independent files.  If you 
    109 give `configure' the option `--exec-prefix=PATH', the package will use 
    110 PATH as the prefix for installing programs and libraries. 
     112give `configure' the option `--exec-prefix=PREFIX', the package will 
     113use PREFIX as the prefix for installing programs and libraries. 
    111114Documentation and other data files will still use the regular prefix. 
    112115 
    113116   In addition, if you use an unusual directory layout you can give 
    114 options like `--bindir=PATH' to specify different values for particular 
     117options like `--bindir=DIR' to specify different values for particular 
    115118kinds of files.  Run `configure --help' for a list of the directories 
    116119you can set and what kinds of files go in them. 
     
    123126================= 
    124127 
    125    Some packages pay attention to `--enable-FEATURE' options to 
     128Some packages pay attention to `--enable-FEATURE' options to 
    126129`configure', where FEATURE indicates an optional part of the package. 
    127130They may also pay attention to `--with-PACKAGE' options, where PACKAGE 
     
    138141========================== 
    139142 
    140    There may be some features `configure' cannot figure out 
    141 automatically, but needs to determine by the type of machine the package 
    142 will run on.  Usually, assuming the package is built to be run on the 
    143 _same_ architectures, `configure' can figure that out, but if it prints 
    144 a message saying it cannot guess the machine type, give it the 
     143There may be some features `configure' cannot figure out automatically, 
     144but needs to determine by the type of machine the package will run on. 
     145Usually, assuming the package is built to be run on the _same_ 
     146architectures, `configure' can figure that out, but if it prints a 
     147message saying it cannot guess the machine type, give it the 
    145148`--build=TYPE' option.  TYPE can either be a short name for the system 
    146149type, such as `sun4', or a canonical name which has the form: 
     
    168171================ 
    169172 
    170    If you want to set default values for `configure' scripts to share, 
    171 you can create a site shell script called `config.site' that gives 
    172 default values for variables like `CC', `cache_file', and `prefix'. 
     173If you want to set default values for `configure' scripts to share, you 
     174can create a site shell script called `config.site' that gives default 
     175values for variables like `CC', `cache_file', and `prefix'. 
    173176`configure' looks for `PREFIX/share/config.site' if it exists, then 
    174177`PREFIX/etc/config.site' if it exists.  Or, you can set the 
     
    179182================== 
    180183 
    181    Variables not defined in a site shell script can be set in the 
     184Variables not defined in a site shell script can be set in the 
    182185environment passed to `configure'.  However, some packages may run 
    183186configure again during the build, and the customized values of these 
     
    187190     ./configure CC=/usr/local2/bin/gcc 
    188191 
    189 will cause the specified gcc to be used as the C compiler (unless it is 
    190 overridden in the site shell script). 
     192causes the specified `gcc' to be used as the C compiler (unless it is 
     193overridden in the site shell script).  Here is a another example: 
     194 
     195     /bin/bash ./configure CONFIG_SHELL=/bin/bash 
     196 
     197Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent 
     198configuration-related scripts to be executed by `/bin/bash'. 
    191199 
    192200`configure' Invocation 
    193201====================== 
    194202 
    195    `configure' recognizes the following options to control how it 
    196 operates. 
     203`configure' recognizes the following options to control how it operates. 
    197204 
    198205`--help' 
  • trunk/libfreebob/src/avdevice.cpp

    r135 r138  
    10621062                    nrOfChannels = ( nrOfChannels / 8 ); 
    10631063                } 
    1064  
     1064/* 
    10651065                // sanity checks 
    10661066                if (  nrOfChannels != 
     
    10721072                                "reported %d\n", 
    10731073                                isoInputPlug->getPlugId(), 
    1074                                 clusterInfo->m_nrOfChannels, 
     1074                                nrOfChannels, 
    10751075                                clusterInfo->m_name.c_str(), 
    10761076                                streamFormatInfo->m_numberOfChannels); 
    10771077                    return false; 
    10781078                } 
     1079*/ 
    10791080                clusterInfo->m_streamFormat = streamFormatInfo->m_streamFormat; 
    10801081 
     
    11721173                    nrOfChannels = ( nrOfChannels / 8 ); 
    11731174                } 
    1174  
     1175/* 
    11751176                // sanity checks 
    11761177                if (  nrOfChannels != 
     
    11821183                                "reported %d\n", 
    11831184                                isoOutputPlug->getPlugId(), 
    1184                                 clusterInfo->m_nrOfChannels, 
     1185                                nrOfChannels, 
    11851186                                clusterInfo->m_name.c_str(), 
    11861187                                streamFormatInfo->m_numberOfChannels); 
    11871188                    return false; 
    11881189                } 
     1190*/ 
    11891191                clusterInfo->m_streamFormat = streamFormatInfo->m_streamFormat; 
    11901192 
     
    14061408{ 
    14071409    return m_configRom->getVendorName(); 
     1410} 
     1411 
     1412uint64_t 
     1413AvDevice::getGuid() 
     1414{ 
     1415    return m_configRom->getGuid(); 
    14081416} 
    14091417 
     
    14641472    asprintf( &result, "%d",  m_nodeId); 
    14651473    if ( !xmlNewChild( connection,  0, 
    1466                        BAD_CAST "NodeId",  BAD_CAST result ) ) { 
    1467         debugError( "Couldn't create 'NodeId' node\n" ); 
     1474                       BAD_CAST "Node",  BAD_CAST result ) ) { 
     1475        debugError( "Couldn't create 'Node' node\n" ); 
    14681476        return false; 
    14691477    } 
     
    16291637    return true; 
    16301638} 
     1639 
     1640bool 
     1641AvDevice::setSampleFrequency(int sr) 
     1642{ 
     1643 
     1644        std::cout << "Trying to set frequency (" << sr << "): " << std::endl; 
     1645 
     1646        std::cout << "Not implemented yet" << std::endl; 
     1647 
     1648    return true; 
     1649} 
     1650 
  • trunk/libfreebob/src/avdevice.h

    r125 r138  
    4848    std::string getVendorName(); 
    4949    std::string getModelName(); 
    50  
     50         
     51        uint64_t getGuid(); 
     52         
    5153    bool addXmlDescription( xmlNodePtr deviceNode ); 
    5254    int getNodeId() 
    5355        { return m_nodeId; } 
     56 
     57        bool setSampleFrequency(int sr); 
     58         
    5459 
    5560protected: 
  • trunk/libfreebob/src/avplug.cpp

    r125 r138  
    138138 
    139139int 
    140 AvPlug::getNrOfChannels() 
     140AvPlug::getNrOfStreams() 
    141141{ 
    142142    int nrOfChannels = 0; 
     
    152152 
    153153int 
     154AvPlug::getNrOfChannels() 
     155{ 
     156    return m_nrOfChannels; 
     157} 
     158 
     159int 
    154160AvPlug::getSampleRate() 
    155161{ 
  • trunk/libfreebob/src/avplug.h

    r125 r138  
    5252    int getSampleRate(); // 22050, 24000, 32000, ... 
    5353    int getNrOfChannels(); 
     54    int getNrOfStreams(); 
    5455     
    5556    plug_type_t          m_plugType; 
  • trunk/libfreebob/src/devicemanager.cpp

    r130 r138  
    117117} 
    118118 
     119bool DeviceManager::isValidNode(int node) { 
     120    for ( AvDeviceVectorIterator it = m_avDevices.begin(); 
     121          it != m_avDevices.end(); 
     122          ++it ) 
     123    { 
     124        AvDevice* avDevice = *it; 
     125         
     126        if (avDevice->getNodeId() == node) { 
     127                return true; 
     128        } 
     129        } 
     130        return false; 
     131} 
     132 
     133int DeviceManager::getNbDevices() { 
     134        return m_avDevices.size(); 
     135} 
     136 
     137int DeviceManager::getDeviceNodeId(int device_nr) { 
     138        if ( ! (device_nr < getNbDevices()) ) { 
     139                cerr << "Device number out of range ( " 
     140                                << device_nr << ")" << endl; 
     141                return -1; 
     142        } 
     143         
     144        AvDevice* avDevice = m_avDevices.at(device_nr); 
     145         
     146        if ( !avDevice ) { 
     147                cerr << "Could not get device at position ( " 
     148                                << device_nr << ")" << endl; 
     149                return -1; 
     150         
     151        } 
     152         
     153        return avDevice->getNodeId(); 
     154         
     155} 
     156 
     157bool DeviceManager::setNodeSampleFrequency(int node, int samplerate) { 
     158    for ( AvDeviceVectorIterator it = m_avDevices.begin(); 
     159          it != m_avDevices.end(); 
     160          ++it ) 
     161    { 
     162        AvDevice* avDevice = *it; 
     163         
     164        if (avDevice->getNodeId() == node) { 
     165                        return avDevice->setSampleFrequency(samplerate); 
     166        } 
     167        } 
     168        return false; 
     169} 
     170 
    119171xmlDocPtr DeviceManager::getXmlDescription() 
    120172{ 
     
    172224            return 0; 
    173225        } 
     226         
     227        res = avDevice->getVendorName(); 
     228         
     229        if ( !xmlNewChild( deviceNode, 
     230                           0, 
     231                           BAD_CAST "Vendor", 
     232                           BAD_CAST res.c_str() ) ) { 
     233            debugError( "Couldn't create vendor node\n" ); 
     234            xmlFreeDoc( doc ); 
     235            xmlCleanupParser(); 
     236            return 0; 
     237        } 
     238         
     239        res = avDevice->getModelName(); 
     240         
     241        if ( !xmlNewChild( deviceNode, 
     242                           0, 
     243                           BAD_CAST "Model", 
     244                           BAD_CAST res.c_str() ) ) { 
     245            debugError( "Couldn't create model node\n" ); 
     246            xmlFreeDoc( doc ); 
     247            xmlCleanupParser(); 
     248            return 0; 
     249        } 
     250         
     251        res = ""; 
     252        res = avDevice->getGuid(); 
     253         
     254        if ( !xmlNewChild( deviceNode, 
     255                           0, 
     256                           BAD_CAST "GUID", 
     257                           BAD_CAST res.c_str() ) ) { 
     258            debugError( "Couldn't create GUID node\n" ); 
     259            xmlFreeDoc( doc ); 
     260            xmlCleanupParser(); 
     261            return 0; 
     262        } 
    174263 
    175264        if ( !avDevice->addXmlDescription( deviceNode ) ) { 
  • trunk/libfreebob/src/devicemanager.h

    r125 r138  
    4444    bool discover(); 
    4545 
     46        bool isValidNode(int node); 
     47        int  getNbDevices(); 
     48        int  getDeviceNodeId(int device_nr); 
     49         
     50        bool setNodeSampleFrequency(int node_id, int samplerate); 
     51 
    4652    xmlDocPtr getXmlDescription(); 
    4753 protected: 
  • trunk/libfreebob/src/libfreebobavc/avc_connect.cpp

    r125 r138  
    5858    bool result = false; 
    5959 
    60     #define STREAM_FORMAT_REQUEST_SIZE 10 // XXX random length 
     60    #define STREAM_FORMAT_REQUEST_SIZE 20 // XXX random length 
    6161    union UPacket { 
    6262        quadlet_t     quadlet[STREAM_FORMAT_REQUEST_SIZE]; 
  • trunk/libfreebob/src/libfreebobavc/avc_extended_stream_format.cpp

    r132 r138  
    2525#include <netinet/in.h> 
    2626 
    27  
    28 //////////////////////////////////////////////////////////// 
     27/////////////////////////////////////////////////////////// 
     28std::ostream& operator<<( std::ostream& stream, StreamFormatInfo info ) 
     29
     30/*    stream << info.m_freq << " Hz ("; 
     31    if ( info.m_format ) { 
     32            stream << "sync "; 
     33    } else { 
     34        stream << "compound "; 
     35    } 
     36    stream << "stream, "; 
     37    stream << "audio channels: " << info.m_audioChannels 
     38           << ", midi channels: " << info.m_midiChannels << ")"; 
     39*/ 
     40        stream << "  NbChannels " << (int)info.m_numberOfChannels << ", Format " << (int)info.m_streamFormat; 
     41    return stream; 
     42
    2943 
    3044StreamFormatInfo::StreamFormatInfo() 
     
    103117 
    104118//////////////////////////////////////////////////////////// 
     119std::ostream& operator<<( std::ostream& stream, FormatInformationStreamsCompound info ) 
     120{ 
     121    stream << (int)info.m_samplingFrequency << " Hz (rate control: "; 
     122        stream << (int)info.m_rateControl << ")" << std::endl; 
     123         
     124        for ( FormatInformationStreamsCompound::StreamFormatInfoVector::iterator it = info.m_streamFormatInfos.begin(); 
     125                it != info.m_streamFormatInfos.end(); 
     126                ++it ) 
     127        { 
     128                StreamFormatInfo* sfi=*it; 
     129                stream << "     > " << *sfi << std::endl; 
     130        } 
     131 
     132    return stream; 
     133} 
    105134 
    106135FormatInformationStreamsCompound::FormatInformationStreamsCompound() 
  • trunk/libfreebob/src/libfreebobavc/avc_extended_stream_format.h

    r125 r138  
    124124    stream_format_t      m_streamFormat; 
    125125}; 
     126std::ostream& operator<<( std::ostream& stream, StreamFormatInfo info ); 
    126127 
    127128//////////////////////////////////////////////////////////// 
     
    170171    StreamFormatInfoVector                   m_streamFormatInfos; 
    171172}; 
     173std::ostream& operator<<( std::ostream& stream, FormatInformationStreamsCompound info ); 
    172174 
    173175 
  • trunk/libfreebob/src/libfreebobavc/avc_plug_info.cpp

    r125 r138  
    124124    bool result = false; 
    125125 
    126     #define STREAM_FORMAT_REQUEST_SIZE 5 // XXX random length 
     126    #define STREAM_FORMAT_REQUEST_SIZE 20 // XXX random length 
    127127    union UPacket { 
    128128        quadlet_t     quadlet[STREAM_FORMAT_REQUEST_SIZE]; 
  • trunk/libfreebob/src/libfreebobavc/avc_signal_source.cpp

    r125 r138  
    235235    bool result = false; 
    236236 
    237     #define STREAM_FORMAT_REQUEST_SIZE 5 // XXX random length 
     237    #define STREAM_FORMAT_REQUEST_SIZE 20 // XXX random length 
    238238    union UPacket { 
    239239        quadlet_t     quadlet[STREAM_FORMAT_REQUEST_SIZE];