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

Revision 420, 7.3 kB (checked in by pieterpalmers, 17 years ago)

moved src/libfreebobavc to src/libavc

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