Changeset 612 for trunk

Show
Ignore:
Timestamp:
09/02/07 11:31:15 (17 years ago)
Author:
ppalmers
Message:

- Remove dependencies between BeBoB and generic AVC code (functionblocks)
- Clean up the code at some places

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/bebob/bebob_avdevice_subunit.cpp

    r554 r612  
    5151BeBoB::SubunitAudio::~SubunitAudio() 
    5252{ 
    53  
     53    for ( FunctionBlockVector::iterator it = m_functions.begin(); 
     54          it != m_functions.end(); 
     55          ++it ) 
     56    { 
     57        delete *it; 
     58    } 
    5459} 
    5560 
  • trunk/libffado/src/bebob/bebob_avdevice_subunit.h

    r554 r612  
    6464 
    6565    virtual const char* getName(); 
     66    virtual FunctionBlockVector getFunctionBlocks() { return m_functions; }; 
    6667 
    6768protected: 
     
    8283                                   AVC::Unit& unit ); 
    8384 
     85protected: 
     86     FunctionBlockVector m_functions; 
    8487}; 
    8588 
  • trunk/libffado/src/bebob/bebob_functionblock.h

    r554 r612  
    2828 
    2929#include "libavc/avc_definitions.h" 
    30 // #include "libavc/general/avc_subunit.h" 
    3130 
    3231#include "debugmodule/debugmodule.h" 
  • trunk/libffado/src/bebob/bebob_mixer.cpp

    r580 r612  
    103103        delete *it; 
    104104    } 
     105    m_Children.clear(); 
     106     
     107    return true; 
    105108} 
    106109 
     
    144147    debugOutput(DEBUG_LEVEL_NORMAL,"Adding elements for functionblocks...\n"); 
    145148 
    146     if(m_device.getAudioSubunit(0)==NULL) { 
    147         debugWarning("No audio subunit found\n"); 
     149    BeBoB::SubunitAudio *asu = 
     150        dynamic_cast<BeBoB::SubunitAudio *>(m_device.getAudioSubunit(0)); 
     151 
     152    if(asu == NULL) { 
     153        debugWarning("No BeBoB audio subunit found\n"); 
    148154        return false; 
    149155    } 
    150     FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); 
     156    FunctionBlockVector functions=asu->getFunctionBlocks(); 
    151157 
    152158    for ( FunctionBlockVector::iterator it = functions.begin(); 
     
    190196MixerFBFeatureVolume::setValue(double v) 
    191197{ 
    192     int volume=v; 
     198    int volume=(int)v; 
    193199    debugOutput(DEBUG_LEVEL_NORMAL,"Set feature volume %d channel %d to %d...\n", 
    194200        m_Slave.getId(), m_channel, volume); 
  • trunk/libffado/src/debugmodule/debugmodule.cpp

    r587 r612  
    3232#include <time.h> 
    3333 
    34 #define DO_MESSAGE_BUFFER_PRINT 
     34// #define DO_MESSAGE_BUFFER_PRINT 
    3535 
    3636#ifndef DO_MESSAGE_BUFFER_PRINT 
     
    352352    char msg[MB_BUFFERSIZE]; 
    353353    va_list ap; 
     354 
     355#ifdef DO_MESSAGE_BUFFER_PRINT 
    354356    unsigned int ntries=5; 
    355357    struct timespec wait = {0,50000}; 
    356      
     358#endif 
     359 
    357360    /* format the message first, to reduce lock contention */ 
    358361    va_start(ap, fmt); 
     
    397400{ 
    398401    char msg[MB_BUFFERSIZE]; 
     402 
     403#ifdef DO_MESSAGE_BUFFER_PRINT 
    399404    unsigned int ntries=5; 
    400405    struct timespec wait = {0,50000}; 
     406#endif 
    401407 
    402408    /* format the message first, to reduce lock contention */ 
  • trunk/libffado/src/genericavc/avc_avdevice.cpp

    r607 r612  
    2323 */ 
    2424 
    25 #warning Generic AV/C support is currently useless 
    26  
    2725#include "genericavc/avc_avdevice.h" 
    2826 
     
    3230#include "libavc/avc_definitions.h" 
    3331#include "libavc/general/avc_plug_info.h" 
     32#include "libavc/general/avc_extended_plug_info.h" 
    3433 
    3534#include "debugmodule/debugmodule.h" 
  • trunk/libffado/src/libavc/audiosubunit/avc_audiosubunit.cpp

    r509 r612  
    4949SubunitAudio::~SubunitAudio() 
    5050{ 
    51     for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); 
    52           it != m_functions.end(); 
    53           ++it ) 
    54     { 
    55         delete *it; 
    56     } 
     51 
    5752} 
    5853 
     
    7671} 
    7772 
    78 // bool 
    79 // SubunitAudio::discoverConnections() 
    80 // { 
    81 //     debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); 
    82 //     if ( !Subunit::discoverConnections() ) { 
    83 //         return false; 
    84 //     } 
    85 //  
    86 //     for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); 
    87 //           it != m_functions.end(); 
    88 //           ++it ) 
    89 //     { 
    90 //         BeBoB::FunctionBlock* function = *it; 
    91 //         if ( !function->discoverConnections() ) { 
    92 //             debugError( "functionblock connection discovering failed ('%s')\n", 
    93 //                         function->getName() ); 
    94 //             return false; 
    95 //         } 
    96 //     } 
    97 //  
    98 //     return true; 
    99 // } 
    100 // bool 
    101 // SubunitAudio::discoverBeBoB::FunctionBlocks() 
    102 // { 
    103 //     debugOutput( DEBUG_LEVEL_NORMAL, 
    104 //                  "Discovering function blocks...\n"); 
    105 //  
    106 //     if ( !discoverBeBoB::FunctionBlocksDo( 
    107 //              ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector) ) 
    108 //     { 
    109 //         debugError( "Could not discover function block selector\n" ); 
    110 //         return false; 
    111 //     } 
    112 //     if ( !discoverBeBoB::FunctionBlocksDo( 
    113 //              ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature) ) 
    114 //     { 
    115 //         debugError( "Could not discover function block feature\n" ); 
    116 //         return false; 
    117 //     } 
    118 //     if ( !discoverBeBoB::FunctionBlocksDo( 
    119 //              ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing) ) 
    120 //     { 
    121 //         debugError( "Could not discover function block processing\n" ); 
    122 //         return false; 
    123 //     } 
    124 //     if ( !discoverBeBoB::FunctionBlocksDo( 
    125 //              ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec) ) 
    126 //     { 
    127 //         debugError( "Could not discover function block codec\n" ); 
    128 //         return false; 
    129 //     } 
    130 //  
    131 //     // print a function block list 
    132 // #ifdef DEBUG 
    133 //     if (getDebugLevel() >= DEBUG_LEVEL_NORMAL) { 
    134 //      
    135 //         for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); 
    136 //             it != m_functions.end(); 
    137 //             ++it ) 
    138 //         { 
    139 //             debugOutput(DEBUG_LEVEL_NORMAL, "%20s FB, type 0x%X, id=%d\n", 
    140 //                 (*it)->getName(), 
    141 //                 (*it)->getType(), 
    142 //                 (*it)->getId()); 
    143 //         } 
    144 //     } 
    145 // #endif 
    146 //  
    147 //     return true; 
    148 // } 
    149 //  
    150 // bool 
    151 // SubunitAudio::discoverBeBoB::FunctionBlocksDo( 
    152 //     ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType ) 
    153 // { 
    154 //     int page = 0; 
    155 //     bool cmdSuccess = false; 
    156 //     bool finished = false; 
    157 //  
    158 //     do { 
    159 //         ExtendedSubunitInfoCmd 
    160 //             extSubunitInfoCmd( m_unit->get1394Service() ); 
    161 //         extSubunitInfoCmd.setNodeId( m_unit->getConfigRom().getNodeId() ); 
    162 //         extSubunitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
    163 //         extSubunitInfoCmd.setSubunitId( getSubunitId() ); 
    164 //         extSubunitInfoCmd.setSubunitType( getSubunitType() ); 
    165 //         extSubunitInfoCmd.setVerbose( m_verboseLevel ); 
    166 //  
    167 //         extSubunitInfoCmd.m_fbType = fbType; 
    168 //         extSubunitInfoCmd.m_page = page; 
    169 //  
    170 //         cmdSuccess = extSubunitInfoCmd.fire(); 
    171 //         if ( cmdSuccess 
    172 //              && ( extSubunitInfoCmd.getResponse() 
    173 //                   == AVCCommand::eR_Implemented ) ) 
    174 //         { 
    175 //             for ( ExtendedSubunitInfoPageDataVector::iterator it = 
    176 //                       extSubunitInfoCmd.m_infoPageDatas.begin(); 
    177 //                   cmdSuccess 
    178 //                       && ( it != extSubunitInfoCmd.m_infoPageDatas.end() ); 
    179 //                   ++it ) 
    180 //             { 
    181 //                 cmdSuccess = createBeBoB::FunctionBlock( fbType, **it ); 
    182 //             } 
    183 //             if ( ( extSubunitInfoCmd.m_infoPageDatas.size() != 0 ) 
    184 //                  && ( extSubunitInfoCmd.m_infoPageDatas.size() == 5 ) ) 
    185 //             { 
    186 //                 page++; 
    187 //             } else { 
    188 //                 finished = true; 
    189 //             } 
    190 //         } else { 
    191 //             finished = true; 
    192 //         } 
    193 //     } while ( cmdSuccess && !finished ); 
    194 //  
    195 //     return cmdSuccess; 
    196 // } 
    197 //  
    198 // bool 
    199 // SubunitAudio::createBeBoB::FunctionBlock( 
    200 //     ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType, 
    201 //     ExtendedSubunitInfoPageData& data ) 
    202 // { 
    203 //     BeBoB::FunctionBlock::ESpecialPurpose purpose 
    204 //         = convertSpecialPurpose(  data.m_functionBlockSpecialPupose ); 
    205 //  
    206 //     BeBoB::FunctionBlock* fb = 0; 
    207 //  
    208 //     switch ( fbType ) { 
    209 //     case ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector: 
    210 //     { 
    211 //         fb = new BeBoB::FunctionBlockSelector( *this, 
    212 //                                         data.m_functionBlockId, 
    213 //                                         purpose, 
    214 //                                         data.m_noOfInputPlugs, 
    215 //                                         data.m_noOfOutputPlugs, 
    216 //                                         m_verboseLevel ); 
    217 //     } 
    218 //     break; 
    219 //     case ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature: 
    220 //     { 
    221 //         fb = new BeBoB::FunctionBlockFeature( *this, 
    222 //                                        data.m_functionBlockId, 
    223 //                                        purpose, 
    224 //                                        data.m_noOfInputPlugs, 
    225 //                                        data.m_noOfOutputPlugs, 
    226 //                                        m_verboseLevel ); 
    227 //     } 
    228 //     break; 
    229 //     case ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing: 
    230 //     { 
    231 //         switch ( data.m_functionBlockType ) { 
    232 //         case ExtendedSubunitInfoCmd::ePT_EnhancedMixer: 
    233 //         { 
    234 //             fb = new BeBoB::FunctionBlockEnhancedMixer( *this, 
    235 //                                                  data.m_functionBlockId, 
    236 //                                                  purpose, 
    237 //                                                  data.m_noOfInputPlugs, 
    238 //                                                  data.m_noOfOutputPlugs, 
    239 //                                                  m_verboseLevel ); 
    240 //         } 
    241 //         break; 
    242 //         case ExtendedSubunitInfoCmd::ePT_Mixer: 
    243 //         case ExtendedSubunitInfoCmd::ePT_Generic: 
    244 //         case ExtendedSubunitInfoCmd::ePT_UpDown: 
    245 //         case ExtendedSubunitInfoCmd::ePT_DolbyProLogic: 
    246 //         case ExtendedSubunitInfoCmd::ePT_3DStereoExtender: 
    247 //         case ExtendedSubunitInfoCmd::ePT_Reverberation: 
    248 //         case ExtendedSubunitInfoCmd::ePT_Chorus: 
    249 //         case ExtendedSubunitInfoCmd::ePT_DynamicRangeCompression: 
    250 //         default: 
    251 //             fb = new BeBoB::FunctionBlockProcessing( *this, 
    252 //                                               data.m_functionBlockId, 
    253 //                                               purpose, 
    254 //                                               data.m_noOfInputPlugs, 
    255 //                                               data.m_noOfOutputPlugs, 
    256 //                                               m_verboseLevel ); 
    257 //             debugWarning( "Dummy function block processing created. " 
    258 //                           "Implementation is missing\n" ); 
    259 //         } 
    260 //     } 
    261 //     break; 
    262 //     case ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec: 
    263 //     { 
    264 //         fb = new BeBoB::FunctionBlockCodec( *this, 
    265 //                                      data.m_functionBlockId, 
    266 //                                      purpose, 
    267 //                                      data.m_noOfInputPlugs, 
    268 //                                      data.m_noOfOutputPlugs, 
    269 //                                      m_verboseLevel ); 
    270 //         debugWarning( "Dummy function block codec created. " 
    271 //                       "Implementation is missing\n" ); 
    272 //     } 
    273 //     break; 
    274 //     default: 
    275 //         debugError( "Unhandled function block type found\n" ); 
    276 //         return false; 
    277 //     } 
    278 //  
    279 //     if ( !fb ) { 
    280 //         debugError( "Could create function block\n" ); 
    281 //         return false; 
    282 //     } 
    283 //     if ( !fb->discover() ) { 
    284 //         debugError( "Could not discover function block %s\n", 
    285 //                     fb->getName() ); 
    286 //         delete fb; 
    287 //         return false; 
    288 //     } 
    289 //     m_functions.push_back( fb ); 
    290 //  
    291 //     return true; 
    292 // } 
    293 //  
    294 // BeBoB::FunctionBlock::ESpecialPurpose 
    295 // SubunitAudio::convertSpecialPurpose( 
    296 //     function_block_special_purpose_t specialPurpose ) 
    297 // { 
    298 //     BeBoB::FunctionBlock::ESpecialPurpose p; 
    299 //     switch ( specialPurpose ) { 
    300 //     case ExtendedSubunitInfoPageData::eSP_InputGain: 
    301 //         p  = BeBoB::FunctionBlock::eSP_InputGain; 
    302 //         break; 
    303 //     case ExtendedSubunitInfoPageData::eSP_OutputVolume: 
    304 //         p = BeBoB::FunctionBlock::eSP_OutputVolume; 
    305 //     break; 
    306 //     default: 
    307 //         p = BeBoB::FunctionBlock::eSP_NoSpecialPurpose; 
    308 //     } 
    309 //     return p; 
    310 // } 
    311 //  
    312 bool 
    313 SubunitAudio::serializeChild( Glib::ustring basePath, 
    314                                              Util::IOSerialize& ser ) const 
    315 { 
    316     bool result = true; 
    317     int i = 0; 
    318  
    319     for ( BeBoB::FunctionBlockVector::const_iterator it = m_functions.begin(); 
    320           it != m_functions.end(); 
    321           ++it ) 
    322     { 
    323         BeBoB::FunctionBlock* pFB = *it; 
    324         std::ostringstream strstrm; 
    325         strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; 
    326  
    327         result &= pFB->serialize( strstrm.str() , ser ); 
    328  
    329         i++; 
    330     } 
    331  
    332     return result; 
    333 } 
    334  
    335 bool 
    336 SubunitAudio::deserializeChild( Glib::ustring basePath, 
    337                                                Util::IODeserialize& deser, 
    338                                                Unit& unit ) 
    339 { 
    340     int i = 0; 
    341     bool bFinished = false; 
    342     do { 
    343         std::ostringstream strstrm; 
    344         strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; 
    345         BeBoB::FunctionBlock* pFB = BeBoB::FunctionBlock::deserialize( strstrm.str(), 
    346                                                          deser, 
    347                                                          unit, 
    348                                                          *this ); 
    349         if ( pFB ) { 
    350             m_functions.push_back( pFB ); 
    351             i++; 
    352         } else { 
    353             bFinished = true; 
    354         } 
    355     } while ( !bFinished ); 
    356  
    357     return true; 
    358 } 
    35973 
    36074} 
  • trunk/libffado/src/libavc/audiosubunit/avc_audiosubunit.h

    r508 r612  
    3232#include <vector> 
    3333 
    34 #warning merge with bebob functionblock 
    35 #include "bebob/bebob_functionblock.h" 
    3634#include "../audiosubunit/avc_function_block.h" 
    3735 
     
    4947 
    5048    virtual bool discover(); 
    51 //     virtual bool discoverConnections(); 
    52 //  
     49 
    5350    virtual const char* getName(); 
    54 //  
    55     BeBoB::FunctionBlockVector getFunctionBlocks() { return m_functions; }; 
    56 //      
    57 // protected: 
    58 //     bool discoverFunctionBlocks(); 
    59 //     bool discoverFunctionBlocksDo( 
    60 //         ExtendedSubunitInfoCmd::EFunctionBlockType fbType ); 
    61 //     bool createFunctionBlock( 
    62 //         ExtendedSubunitInfoCmd::EFunctionBlockType fbType, 
    63 //         ExtendedSubunitInfoPageData& data ); 
    64 //  
    65 //     FunctionBlock::ESpecialPurpose convertSpecialPurpose( 
    66 //         function_block_special_purpose_t specialPurpose ); 
    6751 
     52protected: 
    6853    virtual bool serializeChild( Glib::ustring basePath, 
    69                                  Util::IOSerialize& ser ) const
     54                                 Util::IOSerialize& ser ) const {return false;}
    7055    virtual bool deserializeChild( Glib::ustring basePath, 
    7156                                   Util::IODeserialize& deser, 
    72                                    Unit& avDevice )
     57                                   Unit& avDevice ) {return false;}
    7358 
    74 protected: 
    75      BeBoB::FunctionBlockVector m_functions; 
    7659}; 
    7760 
  • trunk/libffado/src/libavc/general/avc_plug.cpp

    r560 r612  
    2626#include "avc_unit.h" 
    2727#include "avc_signal_format.h" 
     28 
     29#include "avc_extended_plug_info.h" 
    2830 
    2931#include "libieee1394/configrom.h" 
  • trunk/libffado/src/libavc/general/avc_subunit.h

    r560 r612  
    3535 
    3636#include <vector> 
    37  
    38 #warning merge with bebob functionblock 
    39 #include "bebob/bebob_functionblock.h" 
    4037 
    4138namespace AVC { 
  • trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.cpp

    r548 r612  
    2323 */ 
    2424 
    25 #warning this header should go 
    26 #include "bebob/bebob_avplug.h" 
    2725#include "libieee1394/configrom.h" 
    2826