root/branches/streaming-rework/src/libavc/avc_function_block.h

Revision 439, 8.4 kB (checked in by pieterpalmers, 17 years ago)

- some work on the AVC mixer & control stuff

Line 
1 /* avc_function_block.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 #ifndef AVCFUNCTIONBLOCK_H
22 #define AVCFUNCTIONBLOCK_H
23
24 #include "avc_extended_cmd_generic.h"
25 #include "avc_generic.h"
26
27 #include <libavc1394/avc1394.h>
28 #include <vector>
29 using namespace std;
30
31 class FunctionBlockFeatureVolume: public IBusData
32 {
33 public:
34     FunctionBlockFeatureVolume();
35     FunctionBlockFeatureVolume( const FunctionBlockFeatureVolume& rhs );
36     virtual ~FunctionBlockFeatureVolume();
37
38     virtual bool serialize( IOSSerialize& se );
39     virtual bool deserialize( IISDeserialize& de );
40     virtual FunctionBlockFeatureVolume* clone() const;
41
42     control_selector_t     m_controlSelector;
43     control_data_length_t  m_controlDataLength;
44     u_int16_t              m_volume;
45 };
46
47 ///////////////////////////////////////////
48
49 class FunctionBlockProcessingMixer: public IBusData
50 {
51 public:
52     FunctionBlockProcessingMixer();
53     FunctionBlockProcessingMixer( const FunctionBlockProcessingMixer& rhs );
54     virtual ~FunctionBlockProcessingMixer();
55
56     virtual bool serialize( IOSSerialize& se );
57     virtual bool deserialize( IISDeserialize& de );
58     virtual FunctionBlockProcessingMixer* clone() const;
59
60     control_selector_t m_controlSelector;
61 };
62
63 ///////////////////////////////////////////
64
65 class FunctionBlockProcessingEnhancedMixer: public IBusData
66 {
67 public:
68     enum EStatusSelector {
69         eSS_ProgramableState = 0x00,
70         eSS_Level            = 0x01,
71     };
72
73     FunctionBlockProcessingEnhancedMixer();
74     FunctionBlockProcessingEnhancedMixer(
75         const FunctionBlockProcessingEnhancedMixer& rhs );
76     virtual ~FunctionBlockProcessingEnhancedMixer();
77
78     virtual bool serialize( IOSSerialize& se );
79     virtual bool deserialize( IISDeserialize& de );
80     virtual FunctionBlockProcessingEnhancedMixer* clone() const;
81
82     control_selector_t        m_controlSelector;
83     status_selector_t         m_statusSelector;
84     control_data_ext_length_t m_controlDataLength;
85     vector<mixer_programmable_state_t> m_ProgramableStateData;
86     vector<mixer_level_t>              m_LevelData;
87 };
88
89 ///////////////////////////////////////////
90 ///////////////////////////////////////////
91
92 class FunctionBlockSelector: public IBusData
93 {
94 // untested
95 public:
96     // Control selector encoding
97     enum EControlSelectorEncoding {
98         eCSE_Selector_Unknown           = 0x00,
99         eCSE_Selector_Selector          = 0x01,
100     };
101
102     FunctionBlockSelector();
103     FunctionBlockSelector( const FunctionBlockSelector& rhs );
104     virtual ~FunctionBlockSelector();
105
106     virtual bool serialize( IOSSerialize& se );
107     virtual bool deserialize( IISDeserialize& de );
108     virtual FunctionBlockSelector* clone() const;
109
110     selector_length_t      m_selectorLength;
111     input_fb_plug_number_t m_inputFbPlugNumber;
112     control_selector_t     m_controlSelector;
113 };
114
115 ///////////////////////////////////////////
116
117 class FunctionBlockFeature: public IBusData
118 {
119 // no complete implementation
120 public:
121     // Control selector encoding
122     enum EControlSelectorEncoding {
123         eCSE_Feature_Unknown            = 0x00,
124         eCSE_Feature_Mute               = 0x01,
125         eCSE_Feature_Volume             = 0x02,
126         eCSE_Feature_LRBalance          = 0x03,
127         eCSE_Feature_FRBalance          = 0x04,
128         eCSE_Feature_Bass               = 0x05,
129         eCSE_Feature_Mid                = 0x06,
130         eCSE_Feature_Treble             = 0x07,
131         eCSE_Feature_GEQ                = 0x08,
132         eCSE_Feature_AGC                = 0x09,
133         eCSE_Feature_Delay              = 0x0a,
134         eCSE_Feature_BassBoost          = 0x0b,
135         eCSE_Feature_Loudness           = 0x0c,
136     };
137
138     FunctionBlockFeature();
139     FunctionBlockFeature( const FunctionBlockFeature& rhs );
140     virtual ~FunctionBlockFeature();
141
142     virtual bool serialize( IOSSerialize& se );
143     virtual bool deserialize( IISDeserialize& de );
144     virtual FunctionBlockFeature* clone() const;
145
146     selector_length_t      m_selectorLength;
147     audio_channel_number_t m_audioChannelNumber;
148
149     FunctionBlockFeatureVolume*     m_pVolume;
150 };
151
152 ///////////////////////////////////////////
153
154 class FunctionBlockProcessing: public IBusData
155 {
156 // no complete implementation
157 public:
158     // Function block selector
159     enum EProcessingTypeEncoding {
160         ePTE_Mixer                      = 0x01,
161         ePTE_Generic                    = 0x02,
162         ePTE_UpDown                     = 0x03,
163         ePTE_DolbyProLogic              = 0x04,
164         ePTE_3dStereoExtender           = 0x05,
165         ePTE_Reverberation              = 0x06,
166         ePTE_Chorus                     = 0x07,
167         ePTE_DynamicRangeCompression    = 0x08,
168     };
169
170     // Control selector encoding
171     enum EControlSelectorEncoding {
172         eCSE_Processing_Unknown         = 0x00,
173         eCSE_Processing_Enable          = 0x01,
174         eCSE_Processing_Mode            = 0x02,
175         eCSE_Processing_Mixer           = 0x03,
176         eCSE_Processing_EnhancedMixer   = 0xf1,
177
178         // lots of definitions missing
179
180     };
181
182     FunctionBlockProcessing();
183     FunctionBlockProcessing( const FunctionBlockProcessing& rhs );
184     virtual ~FunctionBlockProcessing();
185
186     virtual bool serialize( IOSSerialize& se );
187     virtual bool deserialize( IISDeserialize& de );
188     virtual FunctionBlockProcessing* clone() const;
189
190     selector_length_t             m_selectorLength;
191     input_fb_plug_number_t        m_fbInputPlugNumber;
192     input_audio_channel_number_t  m_inputAudioChannelNumber;
193     output_audio_channel_number_t m_outputAudioChannelNumber;
194
195     FunctionBlockProcessingMixer*         m_pMixer;
196     FunctionBlockProcessingEnhancedMixer* m_pEnhancedMixer;
197 };
198
199 ///////////////////////////////////////////
200
201 class FunctionBlockCodec: public IBusData
202 {
203 // dummy implementation
204 public:
205     // CODEC type endcoding
206     enum ECodecTypeEncoding {
207         eCTE_Unknown                    = 0x00,
208         eCTE_Ac3Decoder                 = 0x01,
209         eCTE_MpegDecoder                = 0x02,
210         eCTE_DtsDecoder                 = 0x03,
211     };
212
213     FunctionBlockCodec();
214     FunctionBlockCodec( const FunctionBlockCodec& rhs );
215     virtual ~FunctionBlockCodec();
216
217     virtual bool serialize( IOSSerialize& se );
218     virtual bool deserialize( IISDeserialize& de );
219     virtual FunctionBlockCodec* clone() const;
220 };
221
222 ///////////////////////////////////////////
223 ///////////////////////////////////////////
224
225 #define AVC1394_FUNCTION_BLOCK_CMD 0xB8
226
227 class FunctionBlockCmd: public AVCCommand
228 {
229 public:
230     enum EFunctionBlockType {
231         eFBT_Selector   = 0x80,
232         eFBT_Feature    = 0x81,
233         eFBT_Processing = 0x82,
234         eFBT_Codec      = 0x83,
235     };
236
237     enum EControlAttribute {
238         eCA_Resolution = 0x01,
239         eCA_Minimum    = 0x02,
240         eCA_Maximum    = 0x03,
241         eCA_Default    = 0x04,
242         eCA_Duration   = 0x08,
243         eCA_Current    = 0x10,
244         eCA_Move       = 0x18,
245         eCA_Delta      = 0x19,
246     };
247
248     FunctionBlockCmd( Ieee1394Service& ieee1394service,
249                       EFunctionBlockType eType,
250                       function_block_id_t id,
251                       EControlAttribute eCtrlAttrib );
252     FunctionBlockCmd( const FunctionBlockCmd& rhs );
253     virtual ~FunctionBlockCmd();
254
255     virtual bool serialize( IOSSerialize& se );
256     virtual bool deserialize( IISDeserialize& de );
257     virtual FunctionBlockCmd* clone() const;
258
259     virtual const char* getCmdName() const
260         { return "FunctionBlockCmd"; }
261
262     function_block_type_t m_functionBlockType;
263     function_block_id_t   m_functionBlockId;
264     control_attribute_t   m_controlAttribute;
265
266     FunctionBlockSelector*      m_pFBSelector;
267     FunctionBlockFeature*       m_pFBFeature;
268     FunctionBlockProcessing*    m_pFBProcessing;
269     FunctionBlockCodec*         m_pFBCodec;
270 };
271
272 #endif
Note: See TracBrowser for help on using the browser.