root/trunk/libfreebob/src/bebob/bebob_functionblock.h

Revision 376, 5.4 kB (checked in by wagi, 17 years ago)

De/Serialize function added to subunit
Give AvDevice? reference to all deserialize functions (instead of
several arguments like config rom etc)

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                    int 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     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
65     static FunctionBlock* deserialize( Glib::ustring basePath,
66                                        Util::IODeserialize& deser,
67                                        AvDevice& avDevice );
68 protected:
69     bool discoverPlugs( AvPlug::EAvPlugDirection plugDirection,
70                         plug_id_t plugMaxId );
71
72 protected:
73     AvDeviceSubunit*      m_subunit;
74     function_block_type_t m_type;
75     function_block_id_t   m_id;
76     ESpecialPurpose       m_purpose;
77     no_of_input_plugs_t   m_nrOfInputPlugs;
78     no_of_output_plugs_t  m_nrOfOutputPlugs;
79     int m_verbose;
80
81     AvPlugVector m_plugs;
82
83     DECLARE_DEBUG_MODULE;
84 };
85
86 typedef std::vector<FunctionBlock*> FunctionBlockVector;
87
88 /////////////////////////////////////
89 /////////////////////////////////////
90
91 class FunctionBlockSelector: public FunctionBlock
92 {
93 public:
94     FunctionBlockSelector(AvDeviceSubunit& subunit,
95                           function_block_id_t id,
96                           ESpecialPurpose purpose,
97                           no_of_input_plugs_t nrOfInputPlugs,
98                           no_of_output_plugs_t nrOfOutputPlugs,
99                           int verbose);
100     FunctionBlockSelector( const FunctionBlockSelector& rhs );
101     virtual ~FunctionBlockSelector();
102
103     virtual const char* getName();
104 };
105
106 /////////////////////////////////////
107
108 class FunctionBlockFeature: public FunctionBlock
109 {
110 public:
111     FunctionBlockFeature(AvDeviceSubunit& subunit,
112                          function_block_id_t id,
113                          ESpecialPurpose purpose,
114                          no_of_input_plugs_t nrOfInputPlugs,
115                          no_of_output_plugs_t nrOfOutputPlugs,
116                          int verbose);
117     FunctionBlockFeature( const FunctionBlockFeature& rhs );
118     virtual ~FunctionBlockFeature();
119
120     virtual const char* getName();
121 };
122
123 /////////////////////////////////////
124
125 class FunctionBlockEnhancedMixer: public FunctionBlock
126 {
127 public:
128     FunctionBlockEnhancedMixer( AvDeviceSubunit& subunit,
129                                 function_block_id_t id,
130                                 ESpecialPurpose purpose,
131                                 no_of_input_plugs_t nrOfInputPlugs,
132                                 no_of_output_plugs_t nrOfOutputPlugs,
133                                 int verbose );
134     FunctionBlockEnhancedMixer( const FunctionBlockEnhancedMixer& rhs );
135     virtual ~FunctionBlockEnhancedMixer();
136
137     virtual const char* getName();
138 };
139
140 /////////////////////////////////////
141
142 class FunctionBlockProcessing: public FunctionBlock
143 {
144 public:
145     FunctionBlockProcessing( AvDeviceSubunit& subunit,
146                              function_block_id_t id,
147                              ESpecialPurpose purpose,
148                              no_of_input_plugs_t nrOfInputPlugs,
149                              no_of_output_plugs_t nrOfOutputPlugs,
150                              int verbose );
151     FunctionBlockProcessing( const FunctionBlockProcessing& rhs );
152     virtual ~FunctionBlockProcessing();
153
154     virtual const char* getName();
155 };
156
157 /////////////////////////////////////
158
159 class FunctionBlockCodec: public FunctionBlock
160 {
161 public:
162     FunctionBlockCodec(AvDeviceSubunit& subunit,
163                        function_block_id_t id,
164                        ESpecialPurpose purpose,
165                        no_of_input_plugs_t nrOfInputPlugs,
166                        no_of_output_plugs_t nrOfOutputPlugs,
167                        int verbose);
168     FunctionBlockCodec( const FunctionBlockCodec& rhs );
169     virtual ~FunctionBlockCodec();
170
171     virtual const char* getName();
172 };
173
174 }
175
176 #endif
Note: See TracBrowser for help on using the browser.