root/branches/libfreebob-2.0/src/bebob/bebob_avdevice.h

Revision 336, 5.3 kB (checked in by pieterpalmers, 17 years ago)

- Merged the developments on trunk since branch-off:

branch occurred at rev 194
svn merge -r 194:HEAD https://svn.sourceforge.net/svnroot/freebob/trunk/libfreebob

- Modified libfreebobavc to use the messagebuffer for debug info.
- This should compile and run

Line 
1 /* bebob_avdevice.h
2  * Copyright (C) 2005,06 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 "iavdevice.h"
39
40 class ConfigRom;
41 class Ieee1394Service;
42 class SubunitPlugSpecificDataPlugAddress;
43
44 namespace BeBoB {
45
46 class AvDevice : public IAvDevice {
47 public:
48     AvDevice( std::auto_ptr<ConfigRom>( configRom ),
49           Ieee1394Service& ieee1394Service,
50               int nodeId,
51           int verboseLevel );
52     virtual ~AvDevice();
53
54     static bool probe( ConfigRom& configRom );
55     virtual bool discover();
56     virtual ConfigRom& getConfigRom() const;
57
58     virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency );
59     virtual int getSamplingFrequency( );
60
61     virtual int getStreamCount();
62     virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i);
63
64     virtual bool prepare();
65
66     virtual int startStreamByIndex(int i);
67     virtual int stopStreamByIndex(int i);
68
69     virtual bool addXmlDescription( xmlNodePtr deviceNode );
70     virtual void showDevice() const;
71     virtual bool setId(unsigned int id);
72
73     Ieee1394Service* get1394Service()
74     { return m_1394Service; }
75
76     AvPlugManager& getPlugManager()
77     { return m_plugManager; }
78
79     struct SyncInfo {
80         SyncInfo( AvPlug& source,
81                   AvPlug& destination,
82                   std::string description )
83             : m_source( &source )
84             , m_destination( &destination )
85             , m_description( description )
86             {}
87     AvPlug*     m_source;
88     AvPlug*     m_destination;
89         std::string m_description;
90     };
91
92     typedef std::vector<SyncInfo> SyncInfoVector;
93     const SyncInfoVector& getSyncInfos() const
94         { return m_syncInfos; }
95     const SyncInfo* getActiveSyncInfo() const
96         { return m_activeSyncInfo; }
97     bool setActiveSync( const SyncInfo& syncInfo );
98
99 protected:
100     bool enumerateSubUnits();
101
102     bool discoverPlugs();
103     bool discoverPlugsPCR( AvPlug::EAvPlugDirection plugDirection,
104                            plug_id_t plugMaxId );
105     bool discoverPlugsExternal( AvPlug::EAvPlugDirection plugDirection,
106                                 plug_id_t plugMaxId );
107     bool discoverPlugConnections();
108     bool discoverSyncModes();
109     bool discoverSubUnitsPlugConnections();
110
111     AvDeviceSubunit* getSubunit( subunit_type_t subunitType,
112                                  subunit_id_t subunitId ) const;
113
114     unsigned int getNrOfSubunits( subunit_type_t subunitType ) const;
115     AvPlugConnection* getPlugConnection( AvPlug& srcPlug ) const;
116
117     AvPlug* getSyncPlug( int maxPlugId, AvPlug::EAvPlugDirection );
118
119     AvPlug* getPlugById( AvPlugVector& plugs,
120                          AvPlug::EAvPlugDirection plugDireciton,
121                          int id );
122     AvPlugVector getPlugsByType( AvPlugVector& plugs,
123                  AvPlug::EAvPlugDirection plugDirection,
124                  AvPlug::EAvPlugType type);
125
126     bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor,
127                              FreebobStreaming::AmdtpAudioPort::E_Direction direction);
128
129     bool setSamplingFrequencyPlug( AvPlug& plug,
130                                    AvPlug::EAvPlugDirection direction,
131                                    ESamplingFrequency samplingFrequency );
132
133     void showAvPlugs( AvPlugVector& plugs ) const;
134
135     bool checkSyncConnectionsAndAddToList( AvPlugVector& plhs,
136                                            AvPlugVector& prhs,
137                                            std::string syncDescription );
138 protected:
139     std::auto_ptr<ConfigRom>( m_configRom );
140     Ieee1394Service* m_1394Service;
141     int              m_nodeId;
142     int              m_verboseLevel;
143
144     AvPlugVector     m_pcrPlugs;
145     AvPlugVector     m_externalPlugs;
146
147     AvPlugConnectionVector m_plugConnections;
148
149     AvDeviceSubunitVector  m_subunits;
150
151     AvPlugManager    m_plugManager;
152
153     SyncInfoVector   m_syncInfos;
154     SyncInfo*        m_activeSyncInfo;
155
156     unsigned int m_id;
157
158     // streaming stuff
159     FreebobStreaming::AmdtpReceiveStreamProcessor *m_receiveProcessor;
160     int m_receiveProcessorBandwidth;
161
162     FreebobStreaming::AmdtpTransmitStreamProcessor *m_transmitProcessor;
163     int m_transmitProcessorBandwidth;
164
165     DECLARE_DEBUG_MODULE;
166 };
167
168 }
169
170 #endif
Note: See TracBrowser for help on using the browser.