root/branches/streaming-rework/src/bebob/bebob_avdevice.h

Revision 435, 6.0 kB (checked in by pieterpalmers, 15 years ago)

src/devicemanager:
- start OSC server for the device manager

src/devicemanager,
src/iavdevice,
src/libieee1394/configrom:
- inherit from OscNode? to become Osc'able

src/bounce,
src/libstreaming/AmdtpStreamProcessor,
src/libstreaming/AmdtpSlaveStreamProcessor:
- fixed bounce device implementation, now working

src/bebob:
- fixed midi bug

General:
- removed 'intermediate XML'
- removed obsolete tests
- removed obsolete files
- removed obsolete API calls

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 #ifndef BEBOB_AVDEVICE_H
21 #define BEBOB_AVDEVICE_H
22
23 #include <stdint.h>
24
25 #include "debugmodule/debugmodule.h"
26 #include "libavc/avc_definitions.h"
27 #include "libavc/avc_extended_cmd_generic.h"
28
29 #include "bebob/bebob_avplug.h"
30 #include "bebob/bebob_avdevice_subunit.h"
31
32 #include "libstreaming/AmdtpStreamProcessor.h"
33 #include "libstreaming/AmdtpPort.h"
34 #include "libstreaming/AmdtpPortInfo.h"
35
36 #include "libutil/serialize.h"
37
38 #include "iavdevice.h"
39
40 #include <sstream>
41 #include <vector>
42
43 class ConfigRom;
44 class Ieee1394Service;
45 class SubunitPlugSpecificDataPlugAddress;
46
47 namespace BeBoB {
48
49 struct VendorModelEntry {
50     unsigned int vendor_id;
51     unsigned int model_id;
52     char *vendor_name;
53     char *model_name;
54 };
55
56 class AvDevice : public IAvDevice {
57 public:
58     AvDevice( std::auto_ptr<ConfigRom>( configRom ),
59               Ieee1394Service& ieee1394Service,
60               int nodeId );
61     virtual ~AvDevice();
62    
63     void setVerboseLevel(int l);
64
65     static bool probe( ConfigRom& configRom );
66     virtual bool discover();
67
68     virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency );
69     virtual int getSamplingFrequency( );
70
71     virtual int getStreamCount();
72     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
73
74     virtual bool prepare();
75     bool lock();
76     bool unlock();
77
78     bool startStreamByIndex(int i);
79     bool stopStreamByIndex(int i);
80
81     virtual void showDevice() const;
82
83     Ieee1394Service& get1394Service()
84         { return *m_p1394Service; }
85
86     AvPlugManager& getPlugManager()
87         { return *m_pPlugManager; }
88
89     struct SyncInfo {
90         SyncInfo( AvPlug& source,
91                   AvPlug& destination,
92                   std::string description )
93             : m_source( &source )
94             , m_destination( &destination )
95             , m_description( description )
96             {}
97         SyncInfo()
98             : m_source( 0 )
99             , m_destination( 0 )
100             , m_description( "" )
101             {}
102         AvPlug*     m_source;
103         AvPlug*     m_destination;
104         std::string m_description;
105     };
106
107     typedef std::vector<SyncInfo> SyncInfoVector;
108     const SyncInfoVector& getSyncInfos() const
109         { return m_syncInfos; }
110     const SyncInfo* getActiveSyncInfo() const
111         { return m_activeSyncInfo; }
112     bool setActiveSync( const SyncInfo& syncInfo );
113
114     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
115     static AvDevice* deserialize( Glib::ustring basePath,
116                                   Util::IODeserialize& deser,
117                                   Ieee1394Service& ieee1394Service );
118 protected:
119
120     bool enumerateSubUnits();
121
122     bool discoverPlugs();
123     bool discoverPlugsPCR( AvPlug::EAvPlugDirection plugDirection,
124                            plug_id_t plugMaxId );
125     bool discoverPlugsExternal( AvPlug::EAvPlugDirection plugDirection,
126                                 plug_id_t plugMaxId );
127     bool discoverPlugConnections();
128     bool discoverSyncModes();
129     bool discoverSubUnitsPlugConnections();
130
131     AvDeviceSubunit* getSubunit( subunit_type_t subunitType,
132                                  subunit_id_t subunitId ) const;
133
134     unsigned int getNrOfSubunits( subunit_type_t subunitType ) const;
135     AvPlugConnection* getPlugConnection( AvPlug& srcPlug ) const;
136
137     AvPlug* getSyncPlug( int maxPlugId, AvPlug::EAvPlugDirection );
138
139     AvPlug* getPlugById( AvPlugVector& plugs,
140                          AvPlug::EAvPlugDirection plugDireciton,
141                          int id );
142     AvPlugVector getPlugsByType( AvPlugVector& plugs,
143                  AvPlug::EAvPlugDirection plugDirection,
144                  AvPlug::EAvPlugType type);
145
146     bool addPlugToProcessor( AvPlug& plug, Streaming::StreamProcessor *processor,
147                              Streaming::AmdtpAudioPort::E_Direction direction);
148
149     bool setSamplingFrequencyPlug( AvPlug& plug,
150                                    AvPlug::EAvPlugDirection direction,
151                                    ESamplingFrequency samplingFrequency );
152
153     void showAvPlugs( AvPlugVector& plugs ) const;
154
155     bool checkSyncConnectionsAndAddToList( AvPlugVector& plhs,
156                                            AvPlugVector& prhs,
157                                            std::string syncDescription );
158
159     static bool serializeSyncInfoVector( Glib::ustring basePath,
160                                          Util::IOSerialize& ser,
161                                          const SyncInfoVector& vec );
162     static bool deserializeSyncInfoVector( Glib::ustring basePath,
163                                            Util::IODeserialize& deser,
164                                            AvDevice& avDevice,
165                                            SyncInfoVector& vec );
166 protected:
167     AvPlugVector              m_pcrPlugs;
168     AvPlugVector              m_externalPlugs;
169     AvPlugConnectionVector    m_plugConnections;
170     AvDeviceSubunitVector     m_subunits;
171     AvPlugManager*            m_pPlugManager;
172     SyncInfoVector            m_syncInfos;
173     SyncInfo*                 m_activeSyncInfo;
174     struct VendorModelEntry*  m_model;
175
176     // streaming stuff
177     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector;
178     StreamProcessorVector m_receiveProcessors;
179     StreamProcessorVector m_transmitProcessors;
180 };
181
182 }
183
184 #endif
Note: See TracBrowser for help on using the browser.