root/trunk/libfreebob/src/bebob/bebob_avdevice.h

Revision 375, 5.6 kB (checked in by wagi, 17 years ago)

AVCCommand: All AVC commants take a reference instead a pointer to 1394 service
BeBoB::AvDevice?: PreSonus? FIREBOX id added

De/Serialize all AvPlugs? through AvPlugManager?
AvPlugManager? can't be a member because of serialization

Line 
1 /* bebob_avdevice.h
2  * Copyright (C) 2005,06,07 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20
21 #ifndef BEBOB_AVDEVICE_H
22 #define BEBOB_AVDEVICE_H
23
24 #include <stdint.h>
25
26 #include "debugmodule/debugmodule.h"
27 #include "libfreebobavc/avc_definitions.h"
28 #include "libfreebobavc/avc_extended_cmd_generic.h"
29 #include "libfreebob/xmlparser.h"
30
31 #include "bebob/bebob_avplug.h"
32 #include "bebob/bebob_avdevice_subunit.h"
33
34 #include "libstreaming/AmdtpStreamProcessor.h"
35 #include "libstreaming/AmdtpPort.h"
36 #include "libstreaming/AmdtpPortInfo.h"
37
38 #include "libutil/serialize.h"
39
40 #include "iavdevice.h"
41
42 class ConfigRom;
43 class Ieee1394Service;
44 class SubunitPlugSpecificDataPlugAddress;
45
46 namespace BeBoB {
47
48 class AvDevice : public IAvDevice {
49 public:
50     AvDevice( std::auto_ptr<ConfigRom>( configRom ),
51               Ieee1394Service& ieee1394Service,
52               int nodeId,
53               int verboseLevel );
54     virtual ~AvDevice();
55
56     static bool probe( ConfigRom& configRom );
57     virtual bool discover();
58     virtual ConfigRom& getConfigRom() const;
59
60     virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency );
61     virtual int getSamplingFrequency( );
62
63     virtual int getStreamCount();
64     virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i);
65
66     virtual bool prepare();
67
68     virtual int startStreamByIndex(int i);
69     virtual int stopStreamByIndex(int i);
70
71     virtual bool addXmlDescription( xmlNodePtr deviceNode );
72     virtual void showDevice() const;
73     virtual bool setId(unsigned int id);
74
75     Ieee1394Service& get1394Service()
76         { return *m_p1394Service; }
77
78     AvPlugManager& getPlugManager()
79         { return *m_pPlugManager; }
80
81     struct SyncInfo {
82         SyncInfo( AvPlug& source,
83                   AvPlug& destination,
84                   std::string description )
85             : m_source( &source )
86             , m_destination( &destination )
87             , m_description( description )
88             {}
89         AvPlug*     m_source;
90         AvPlug*     m_destination;
91         std::string m_description;
92     };
93
94     typedef std::vector<SyncInfo> SyncInfoVector;
95     const SyncInfoVector& getSyncInfos() const
96         { return m_syncInfos; }
97     const SyncInfo* getActiveSyncInfo() const
98         { return m_activeSyncInfo; }
99     bool setActiveSync( const SyncInfo& syncInfo );
100
101     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser );
102     static AvDevice* deserialize( Glib::ustring basePath,
103                                   Util::IODeserialize& deser,
104                                   Ieee1394Service& ieee1394Service );
105
106 protected:
107     AvDevice();
108
109     bool enumerateSubUnits();
110
111     bool discoverPlugs();
112     bool discoverPlugsPCR( AvPlug::EAvPlugDirection plugDirection,
113                            plug_id_t plugMaxId );
114     bool discoverPlugsExternal( AvPlug::EAvPlugDirection plugDirection,
115                                 plug_id_t plugMaxId );
116     bool discoverPlugConnections();
117     bool discoverSyncModes();
118     bool discoverSubUnitsPlugConnections();
119
120     AvDeviceSubunit* getSubunit( subunit_type_t subunitType,
121                                  subunit_id_t subunitId ) const;
122
123     unsigned int getNrOfSubunits( subunit_type_t subunitType ) const;
124     AvPlugConnection* getPlugConnection( AvPlug& srcPlug ) const;
125
126     AvPlug* getSyncPlug( int maxPlugId, AvPlug::EAvPlugDirection );
127
128     AvPlug* getPlugById( AvPlugVector& plugs,
129                          AvPlug::EAvPlugDirection plugDireciton,
130                          int id );
131     AvPlugVector getPlugsByType( AvPlugVector& plugs,
132                  AvPlug::EAvPlugDirection plugDirection,
133                  AvPlug::EAvPlugType type);
134
135     bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor,
136                              FreebobStreaming::AmdtpAudioPort::E_Direction direction);
137
138     bool setSamplingFrequencyPlug( AvPlug& plug,
139                                    AvPlug::EAvPlugDirection direction,
140                                    ESamplingFrequency samplingFrequency );
141
142     void showAvPlugs( AvPlugVector& plugs ) const;
143
144     bool checkSyncConnectionsAndAddToList( AvPlugVector& plhs,
145                                            AvPlugVector& prhs,
146                                            std::string syncDescription );
147 protected:
148     std::auto_ptr<ConfigRom>( m_pConfigRom );
149     Ieee1394Service*          m_p1394Service;
150     int                       m_verboseLevel;
151     AvPlugVector              m_pcrPlugs;
152     AvPlugVector              m_externalPlugs;
153     AvPlugConnectionVector    m_plugConnections;
154     AvDeviceSubunitVector     m_subunits;
155     AvPlugManager*            m_pPlugManager;
156     SyncInfoVector            m_syncInfos;
157     SyncInfo*                 m_activeSyncInfo;
158     unsigned int              m_id;
159
160     // streaming stuff
161     FreebobStreaming::AmdtpReceiveStreamProcessor *m_receiveProcessor;
162     int m_receiveProcessorBandwidth;
163
164     FreebobStreaming::AmdtpTransmitStreamProcessor *m_transmitProcessor;
165     int m_transmitProcessorBandwidth;
166
167     DECLARE_DEBUG_MODULE;
168 };
169
170 }
171
172 #endif
Note: See TracBrowser for help on using the browser.