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

Revision 336, 5.2 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_functionblock.h
2  * Copyright (C) 2006 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_FUNCTION_BLOCK_H
22 #define BEBOB_FUNCTION_BLOCK_H
23
24 #include "bebob/bebob_avplug.h"
25
26 #include "libfreebobavc/avc_definitions.h"
27 #include "debugmodule/debugmodule.h"
28
29 namespace BeBoB {
30
31 class AvDeviceSubunit;
32
33 class FunctionBlock {
34 public:
35     enum EFunctionBlockType {
36         eFBT_AllFunctinBlockType    = 0xff,
37         eFBT_AudioSubunitSelector   = 0x80,
38         eFBT_AudioSubunitFeature    = 0x81,
39         eFBT_AudioSubunitProcessing = 0x82,
40         eFBT_AudioSubunitCodec      = 0x83,
41     };
42
43     enum ESpecialPurpose {
44         eSP_InputGain,
45         eSP_OutputVolume,
46         eSP_NoSpecialPurpose
47     };
48
49     FunctionBlock( AvDeviceSubunit& subunit,
50                    function_block_type_t type,
51                    function_block_id_t id,
52                    ESpecialPurpose purpose,
53                    no_of_input_plugs_t nrOfInputPlugs,
54                    no_of_output_plugs_t nrOfOutputPlugs,
55                    bool verbose );
56     FunctionBlock( const FunctionBlock& rhs );
57     virtual ~FunctionBlock();
58
59     virtual bool discover();
60     virtual bool discoverConnections();
61
62     virtual const char* getName() = 0;
63
64 protected:
65     bool discoverPlugs( AvPlug::EAvPlugDirection plugDirection,
66                         plug_id_t plugMaxId );
67
68 protected:
69     AvDeviceSubunit*      m_subunit;
70     function_block_type_t m_type;
71     function_block_id_t   m_id;
72     ESpecialPurpose       m_purpose;
73     no_of_input_plugs_t   m_nrOfInputPlugs;
74     no_of_output_plugs_t  m_nrOfOutputPlugs;
75     bool m_verbose;
76
77     AvPlugVector m_plugs;
78
79     DECLARE_DEBUG_MODULE;
80 };
81
82 typedef std::vector<FunctionBlock*> FunctionBlockVector;
83
84 /////////////////////////////////////
85 /////////////////////////////////////
86
87 class FunctionBlockSelector: public FunctionBlock
88 {
89 public:
90     FunctionBlockSelector(AvDeviceSubunit& subunit,
91                           function_block_id_t id,
92                           ESpecialPurpose purpose,
93                           no_of_input_plugs_t nrOfInputPlugs,
94                           no_of_output_plugs_t nrOfOutputPlugs,
95                           bool verbose);
96     FunctionBlockSelector( const FunctionBlockSelector& rhs );
97     virtual ~FunctionBlockSelector();
98
99     virtual const char* getName();
100 };
101
102 /////////////////////////////////////
103
104 class FunctionBlockFeature: public FunctionBlock
105 {
106 public:
107     FunctionBlockFeature(AvDeviceSubunit& subunit,
108                          function_block_id_t id,
109                          ESpecialPurpose purpose,
110                          no_of_input_plugs_t nrOfInputPlugs,
111                          no_of_output_plugs_t nrOfOutputPlugs,
112                          bool verbose);
113     FunctionBlockFeature( const FunctionBlockFeature& rhs );
114     virtual ~FunctionBlockFeature();
115
116     virtual const char* getName();
117 };
118
119 /////////////////////////////////////
120
121 class FunctionBlockEnhancedMixer: public FunctionBlock
122 {
123 public:
124     FunctionBlockEnhancedMixer( 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                                 bool verbose );
130     FunctionBlockEnhancedMixer( const FunctionBlockEnhancedMixer& rhs );
131     virtual ~FunctionBlockEnhancedMixer();
132
133     virtual const char* getName();
134 };
135
136 /////////////////////////////////////
137
138 class FunctionBlockProcessing: public FunctionBlock
139 {
140 public:
141     FunctionBlockProcessing( AvDeviceSubunit& subunit,
142                              function_block_id_t id,
143                              ESpecialPurpose purpose,
144                              no_of_input_plugs_t nrOfInputPlugs,
145                              no_of_output_plugs_t nrOfOutputPlugs,
146                              bool verbose );
147     FunctionBlockProcessing( const FunctionBlockProcessing& rhs );
148     virtual ~FunctionBlockProcessing();
149
150     virtual const char* getName();
151 };
152
153 /////////////////////////////////////
154
155 class FunctionBlockCodec: public FunctionBlock
156 {
157 public:
158     FunctionBlockCodec(AvDeviceSubunit& subunit,
159                        function_block_id_t id,
160                        ESpecialPurpose purpose,
161                        no_of_input_plugs_t nrOfInputPlugs,
162                        no_of_output_plugs_t nrOfOutputPlugs,
163                        bool verbose);
164     FunctionBlockCodec( const FunctionBlockCodec& rhs );
165     virtual ~FunctionBlockCodec();
166
167     virtual const char* getName();
168 };
169
170 }
171
172 #endif
Note: See TracBrowser for help on using the browser.