1 |
/* bebob_functionblock.h |
---|
2 |
* Copyright (C) 2006,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 |
#ifdef ENABLE_BEBOB |
---|
22 |
|
---|
23 |
#ifndef BEBOB_FUNCTION_BLOCK_H |
---|
24 |
#define BEBOB_FUNCTION_BLOCK_H |
---|
25 |
|
---|
26 |
#include "bebob/bebob_avplug.h" |
---|
27 |
|
---|
28 |
#include "libfreebobavc/avc_definitions.h" |
---|
29 |
#include "debugmodule/debugmodule.h" |
---|
30 |
|
---|
31 |
namespace BeBoB { |
---|
32 |
|
---|
33 |
class AvDeviceSubunit; |
---|
34 |
|
---|
35 |
class FunctionBlock { |
---|
36 |
public: |
---|
37 |
enum EFunctionBlockType { |
---|
38 |
eFBT_AllFunctinBlockType = 0xff, |
---|
39 |
eFBT_AudioSubunitSelector = 0x80, |
---|
40 |
eFBT_AudioSubunitFeature = 0x81, |
---|
41 |
eFBT_AudioSubunitProcessing = 0x82, |
---|
42 |
eFBT_AudioSubunitCodec = 0x83, |
---|
43 |
}; |
---|
44 |
|
---|
45 |
enum ESpecialPurpose { |
---|
46 |
eSP_InputGain, |
---|
47 |
eSP_OutputVolume, |
---|
48 |
eSP_NoSpecialPurpose |
---|
49 |
}; |
---|
50 |
|
---|
51 |
FunctionBlock( AvDeviceSubunit& subunit, |
---|
52 |
function_block_type_t type, |
---|
53 |
function_block_type_t subtype, |
---|
54 |
function_block_id_t id, |
---|
55 |
ESpecialPurpose purpose, |
---|
56 |
no_of_input_plugs_t nrOfInputPlugs, |
---|
57 |
no_of_output_plugs_t nrOfOutputPlugs, |
---|
58 |
int verbose ); |
---|
59 |
FunctionBlock( const FunctionBlock& rhs ); |
---|
60 |
FunctionBlock(); |
---|
61 |
virtual ~FunctionBlock(); |
---|
62 |
|
---|
63 |
virtual bool discover(); |
---|
64 |
virtual bool discoverConnections(); |
---|
65 |
|
---|
66 |
virtual const char* getName() = 0; |
---|
67 |
|
---|
68 |
bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; |
---|
69 |
static FunctionBlock* deserialize( Glib::ustring basePath, |
---|
70 |
Util::IODeserialize& deser, |
---|
71 |
AvDevice& avDevice, |
---|
72 |
AvDeviceSubunit& subunit); |
---|
73 |
protected: |
---|
74 |
bool discoverPlugs( AvPlug::EAvPlugDirection plugDirection, |
---|
75 |
plug_id_t plugMaxId ); |
---|
76 |
|
---|
77 |
protected: |
---|
78 |
AvDeviceSubunit* m_subunit; |
---|
79 |
function_block_type_t m_type; |
---|
80 |
function_block_type_t m_subtype; |
---|
81 |
function_block_id_t m_id; |
---|
82 |
ESpecialPurpose m_purpose; |
---|
83 |
no_of_input_plugs_t m_nrOfInputPlugs; |
---|
84 |
no_of_output_plugs_t m_nrOfOutputPlugs; |
---|
85 |
int m_verbose; |
---|
86 |
AvPlugVector m_plugs; |
---|
87 |
|
---|
88 |
DECLARE_DEBUG_MODULE; |
---|
89 |
}; |
---|
90 |
|
---|
91 |
typedef std::vector<FunctionBlock*> FunctionBlockVector; |
---|
92 |
|
---|
93 |
///////////////////////////////////// |
---|
94 |
///////////////////////////////////// |
---|
95 |
|
---|
96 |
class FunctionBlockSelector: public FunctionBlock |
---|
97 |
{ |
---|
98 |
public: |
---|
99 |
FunctionBlockSelector(AvDeviceSubunit& subunit, |
---|
100 |
function_block_id_t id, |
---|
101 |
ESpecialPurpose purpose, |
---|
102 |
no_of_input_plugs_t nrOfInputPlugs, |
---|
103 |
no_of_output_plugs_t nrOfOutputPlugs, |
---|
104 |
int verbose); |
---|
105 |
FunctionBlockSelector( const FunctionBlockSelector& rhs ); |
---|
106 |
FunctionBlockSelector(); |
---|
107 |
virtual ~FunctionBlockSelector(); |
---|
108 |
|
---|
109 |
virtual const char* getName(); |
---|
110 |
|
---|
111 |
protected: |
---|
112 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
113 |
Util::IOSerialize& ser ) const; |
---|
114 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
115 |
Util::IODeserialize& deser, |
---|
116 |
AvDevice& avDevice ); |
---|
117 |
}; |
---|
118 |
|
---|
119 |
///////////////////////////////////// |
---|
120 |
|
---|
121 |
class FunctionBlockFeature: public FunctionBlock |
---|
122 |
{ |
---|
123 |
public: |
---|
124 |
FunctionBlockFeature(AvDeviceSubunit& subunit, |
---|
125 |
function_block_id_t id, |
---|
126 |
ESpecialPurpose purpose, |
---|
127 |
no_of_input_plugs_t nrOfInputPlugs, |
---|
128 |
no_of_output_plugs_t nrOfOutputPlugs, |
---|
129 |
int verbose); |
---|
130 |
FunctionBlockFeature( const FunctionBlockFeature& rhs ); |
---|
131 |
FunctionBlockFeature(); |
---|
132 |
virtual ~FunctionBlockFeature(); |
---|
133 |
|
---|
134 |
virtual const char* getName(); |
---|
135 |
|
---|
136 |
protected: |
---|
137 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
138 |
Util::IOSerialize& ser ) const; |
---|
139 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
140 |
Util::IODeserialize& deser, |
---|
141 |
AvDevice& avDevice ); |
---|
142 |
}; |
---|
143 |
|
---|
144 |
///////////////////////////////////// |
---|
145 |
|
---|
146 |
class FunctionBlockEnhancedMixer: public FunctionBlock |
---|
147 |
{ |
---|
148 |
public: |
---|
149 |
FunctionBlockEnhancedMixer( AvDeviceSubunit& subunit, |
---|
150 |
function_block_id_t id, |
---|
151 |
ESpecialPurpose purpose, |
---|
152 |
no_of_input_plugs_t nrOfInputPlugs, |
---|
153 |
no_of_output_plugs_t nrOfOutputPlugs, |
---|
154 |
int verbose ); |
---|
155 |
FunctionBlockEnhancedMixer(); |
---|
156 |
FunctionBlockEnhancedMixer( const FunctionBlockEnhancedMixer& rhs ); |
---|
157 |
virtual ~FunctionBlockEnhancedMixer(); |
---|
158 |
|
---|
159 |
virtual const char* getName(); |
---|
160 |
|
---|
161 |
protected: |
---|
162 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
163 |
Util::IOSerialize& ser ) const; |
---|
164 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
165 |
Util::IODeserialize& deser, |
---|
166 |
AvDevice& avDevice ); |
---|
167 |
}; |
---|
168 |
|
---|
169 |
///////////////////////////////////// |
---|
170 |
|
---|
171 |
class FunctionBlockProcessing: public FunctionBlock |
---|
172 |
{ |
---|
173 |
public: |
---|
174 |
FunctionBlockProcessing( AvDeviceSubunit& subunit, |
---|
175 |
function_block_id_t id, |
---|
176 |
ESpecialPurpose purpose, |
---|
177 |
no_of_input_plugs_t nrOfInputPlugs, |
---|
178 |
no_of_output_plugs_t nrOfOutputPlugs, |
---|
179 |
int verbose ); |
---|
180 |
FunctionBlockProcessing( const FunctionBlockProcessing& rhs ); |
---|
181 |
FunctionBlockProcessing(); |
---|
182 |
virtual ~FunctionBlockProcessing(); |
---|
183 |
|
---|
184 |
virtual const char* getName(); |
---|
185 |
|
---|
186 |
protected: |
---|
187 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
188 |
Util::IOSerialize& ser ) const; |
---|
189 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
190 |
Util::IODeserialize& deser, |
---|
191 |
AvDevice& avDevice ); |
---|
192 |
}; |
---|
193 |
|
---|
194 |
///////////////////////////////////// |
---|
195 |
|
---|
196 |
class FunctionBlockCodec: public FunctionBlock |
---|
197 |
{ |
---|
198 |
public: |
---|
199 |
FunctionBlockCodec(AvDeviceSubunit& subunit, |
---|
200 |
function_block_id_t id, |
---|
201 |
ESpecialPurpose purpose, |
---|
202 |
no_of_input_plugs_t nrOfInputPlugs, |
---|
203 |
no_of_output_plugs_t nrOfOutputPlugs, |
---|
204 |
int verbose); |
---|
205 |
FunctionBlockCodec( const FunctionBlockCodec& rhs ); |
---|
206 |
FunctionBlockCodec(); |
---|
207 |
virtual ~FunctionBlockCodec(); |
---|
208 |
|
---|
209 |
virtual const char* getName(); |
---|
210 |
|
---|
211 |
protected: |
---|
212 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
213 |
Util::IOSerialize& ser ) const; |
---|
214 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
215 |
Util::IODeserialize& deser, |
---|
216 |
AvDevice& avDevice ); |
---|
217 |
}; |
---|
218 |
|
---|
219 |
} |
---|
220 |
|
---|
221 |
#endif |
---|
222 |
|
---|
223 |
#endif //#ifdef ENABLE_BEBOB |
---|