Changeset 1042

Show
Ignore:
Timestamp:
04/26/08 04:30:55 (16 years ago)
Author:
ppalmers
Message:

- use cluster infoblock information for stream setup
- implement graphviz output for music plugs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/config.h.in

    r1040 r1042  
    192192/// The unavoidable device specific hacks 
    193193 
    194 // specify this to 1 for ECHO audio firmwares older than v4.3 
    195 #define AVC_STREAMPOSITION_USE_MUSICPLUG 0 
     194// Use the information in the music plug instead of that in the 
     195// cluster info block for the stream configuration. Should not 
     196// be necessary 
     197#define AVC_STREAMCONFIG_USE_MUSICPLUG 0 
    196198 
    197199#endif // CONFIG_H 
  • trunk/libffado/src/libavc/general/avc_unit.cpp

    r969 r1042  
    825825{ 
    826826    m_pPlugManager->showPlugs(); 
     827    SubunitMusic* s=getMusicSubunit(0); 
     828    if(s) s->showMusicPlugs(); 
    827829} 
    828830 
  • trunk/libffado/src/libavc/musicsubunit/avc_descriptor_music.cpp

    r1024 r1042  
    769769} 
    770770 
    771 
     771unsigned int 
     772AVCMusicStatusDescriptor::getNbMusicPlugs() { 
     773    return m_routing_status_infoblock.m_nb_music_plugs; 
     774
     775 
     776
  • trunk/libffado/src/libavc/musicsubunit/avc_descriptor_music.h

    r1024 r1042  
    271271    AVCMusicSubunitPlugInfoBlock *getSubunitPlugInfoBlock(Plug::EPlugDirection, plug_id_t); 
    272272    AVCMusicPlugInfoBlock *getMusicPlugInfoBlock(plug_id_t); 
    273      
     273    unsigned int getNbMusicPlugs(); 
     274 
    274275private: 
    275276    // the child info blocks 
  • trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.cpp

    r1013 r1042  
    149149            struct Plug::ChannelInfo sinfo; 
    150150 
    151             sinfo.m_streamPosition=s.stream_position; 
    152             sinfo.m_location=s.stream_location; 
    153  
    154             AVCMusicPlugInfoBlock *mplug=m_status_descriptor->getMusicPlugInfoBlock(s.music_plug_id); 
     151            sinfo.m_streamPosition = s.stream_position; 
     152            sinfo.m_location = s.stream_location; 
     153 
     154            AVCMusicPlugInfoBlock *mplug = m_status_descriptor->getMusicPlugInfoBlock(s.music_plug_id); 
    155155 
    156156            if (mplug==NULL) { 
    157157                debugWarning("No music plug found for this signal\n"); 
    158                 sinfo.m_name="unknown"; 
     158                sinfo.m_name = "unknown"; 
    159159            } else { 
    160                 sinfo.m_name=mplug->getName(); 
     160                sinfo.m_name = mplug->getName(); 
     161 
     162                #if AVC_STREAMCONFIG_USE_MUSICPLUG 
     163                if (plug.getDirection() == Plug::eAPD_Input) { 
     164                    // it's an input plug to the subunit 
     165                    // so we have to check the source field of the music plug 
     166                    if(s.stream_position != mplug->m_source_stream_position) { 
     167                        debugWarning("s.stream_position (= 0x%02X) != mplug->m_source_stream_position (= 0x%02X)\n", 
     168                            s.stream_position, mplug->m_source_stream_position); 
     169                        // use the one from the music plug 
     170                        sinfo.m_streamPosition= mplug->m_source_stream_position; 
     171                    } 
     172                    if(s.stream_location != mplug->m_source_stream_location) { 
     173                        debugWarning("s.stream_location (= 0x%02X) != mplug->m_source_stream_location (= 0x%02X)\n", 
     174                            s.stream_location, mplug->m_source_stream_location); 
     175                        // use the one from the music plug 
     176                        sinfo.m_location=mplug->m_source_stream_location; 
     177                    } 
     178                } else if (plug.getDirection() == Plug::eAPD_Output) { 
     179                    // it's an output plug from the subunit 
     180                    // so we have to check the destination field of the music plug 
     181                    if(s.stream_position != mplug->m_dest_stream_position) { 
     182                        debugWarning("s.stream_position (= 0x%02X) != mplug->m_dest_stream_position (= 0x%02X)\n", 
     183                            s.stream_position, mplug->m_dest_stream_position); 
     184     
     185                        // use the one from the music plug 
     186                        sinfo.m_streamPosition=mplug->m_dest_stream_position; 
     187                    } 
     188                    if(s.stream_location != mplug->m_dest_stream_location) { 
     189                        debugWarning("s.stream_location (= 0x%02X) != mplug->m_dest_stream_location (= 0x%02X)\n", 
     190                            s.stream_location, mplug->m_dest_stream_location); 
     191                        // use the one from the music plug 
     192                        //sinfo.m_location=mplug->m_dest_stream_location; 
     193                        // HACK: recent ECHO firmware only fills the AVCMusicClusterInfoBlock correctly 
     194                        sinfo.m_location=s.stream_location; 
     195                    } 
     196                } else { 
     197                    debugWarning("Invalid plug direction.\n"); 
     198                } 
     199                #endif 
    161200            } 
    162201 
    163             if (plug.getDirection() == Plug::eAPD_Input) { 
    164                 // it's an input plug to the subunit 
    165                 // so we have to check the source field of the music plug 
    166                 if(s.stream_position != mplug->m_source_stream_position) { 
    167                     debugWarning("s.stream_position (= 0x%02X) != mplug->m_source_stream_position (= 0x%02X)\n", 
    168                         s.stream_position, mplug->m_source_stream_position); 
    169                     // use the one from the music plug 
    170                     sinfo.m_streamPosition= mplug->m_source_stream_position; 
    171                 } 
    172                 if(s.stream_location != mplug->m_source_stream_location) { 
    173                     debugWarning("s.stream_location (= 0x%02X) != mplug->m_source_stream_location (= 0x%02X)\n", 
    174                         s.stream_location, mplug->m_source_stream_location); 
    175                     // use the one from the music plug 
    176                     sinfo.m_location=mplug->m_source_stream_location; 
    177                 } 
    178             } else if (plug.getDirection() == Plug::eAPD_Output) { 
    179                 // it's an output plug from the subunit 
    180                 // so we have to check the destination field of the music plug 
    181                 if(s.stream_position != mplug->m_dest_stream_position) { 
    182                     debugWarning("s.stream_position (= 0x%02X) != mplug->m_dest_stream_position (= 0x%02X)\n", 
    183                         s.stream_position, mplug->m_dest_stream_position); 
    184                     #if AVC_STREAMPOSITION_USE_MUSICPLUG 
    185                     // use the one from the music plug 
    186                     sinfo.m_streamPosition=mplug->m_dest_stream_position; 
    187                     #else 
    188                     // HACK: recent ECHO firmware only fills the AVCMusicClusterInfoBlock correctly 
    189                     sinfo.m_streamPosition=s.stream_position; 
    190                     #endif 
    191                 } 
    192                 if(s.stream_location != mplug->m_dest_stream_location) { 
    193                     debugWarning("s.stream_location (= 0x%02X) != mplug->m_dest_stream_location (= 0x%02X)\n", 
    194                         s.stream_location, mplug->m_dest_stream_location); 
    195                     // use the one from the music plug 
    196                     //sinfo.m_location=mplug->m_dest_stream_location; 
    197                     // HACK: recent ECHO firmware only fills the AVCMusicClusterInfoBlock correctly 
    198                     sinfo.m_location=s.stream_location; 
    199                 } 
    200             } else { 
    201                 debugWarning("Invalid plug direction.\n"); 
    202             } 
    203  
    204202            debugOutput(DEBUG_LEVEL_VERBOSE, "Adding signal pos=%2d loc=%2d name=%s\n", 
    205                 sinfo.m_streamPosition, sinfo.m_location, mplug->getName().c_str()); 
     203                sinfo.m_streamPosition, sinfo.m_location, sinfo.m_name.c_str()); 
    206204 
    207205            cinfo.m_channelInfos.push_back(sinfo); 
     
    230228} 
    231229 
    232 void SubunitMusic::setVerboseLevel(int l) 
     230void 
     231SubunitMusic::showMusicPlugs() 
     232
     233    if(m_status_descriptor) { 
     234        unsigned int nbplugs = m_status_descriptor->getNbMusicPlugs(); 
     235        printf( "digraph musicplugconnections {\n" ); 
     236 
     237        for(unsigned int i=0;i<nbplugs;i++) { 
     238            AVCMusicPlugInfoBlock *mplug = m_status_descriptor->getMusicPlugInfoBlock(i); 
     239            if(mplug==NULL) { 
     240                debugError("NULL plug!\n"); 
     241                return; 
     242            } 
     243            char plugstr[32]; 
     244            snprintf(plugstr, 32, "MusicPlug %d", mplug->m_music_plug_id); 
     245 
     246            // the plug itself 
     247            printf( "\t\"%s\" [color=red,style=filled];\n", 
     248                    plugstr ); 
     249 
     250            Plug * plug; 
     251            // the source connection (where it's signal originates) 
     252            plug = m_unit->getPlugManager().getPlug( eST_Music, 0, 
     253                                                     0xFF, 0xFF, 
     254                                                     Plug::eAPA_SubunitPlug, 
     255                                                     Plug::eAPD_Input, 
     256                                                     mplug->m_source_plug_id); 
     257            if(plug) { 
     258                printf( "\t\"(%d) %s\" -> \"%s\"\n", 
     259                        plug->getGlobalId(), 
     260                        plug->getName(), 
     261                        plugstr ); 
     262            } else { 
     263                debugWarning("Destination plug not found\n"); 
     264            } 
     265 
     266            // the destination connection (where it's signal goes) 
     267            plug = m_unit->getPlugManager().getPlug( eST_Music, 0, 
     268                                                     0xFF, 0xFF, 
     269                                                     Plug::eAPA_SubunitPlug, 
     270                                                     Plug::eAPD_Output, 
     271                                                     mplug->m_dest_plug_id); 
     272            if(plug) { 
     273                 
     274                printf( "\t\"%s\" -> \"(%d) %s\"\n", 
     275                        plugstr, 
     276                        plug->getGlobalId(), 
     277                        plug->getName() ); 
     278            } else { 
     279                debugWarning("Source plug not found\n"); 
     280            } 
     281     
     282        } 
     283         
     284        printf("}\n" ); 
     285        printf( "Use \"dot -Tps FILENAME.dot -o FILENAME.ps\" " 
     286                "to generate graph\n"); 
     287    } 
     288
     289 
     290void 
     291SubunitMusic::setVerboseLevel(int l) 
    233292{ 
    234293    Subunit::setVerboseLevel(l); 
  • trunk/libffado/src/libavc/musicsubunit/avc_musicsubunit.h

    r864 r1042  
    4949    virtual bool loadDescriptors(); 
    5050     
     51    virtual void showMusicPlugs(); 
     52     
    5153    virtual void setVerboseLevel(int l); 
    5254    virtual const char* getName();