root/trunk/libfreebob/src/libfreebobavc/avc_function_block.h

Revision 378, 8.1 kB (checked in by wagi, 16 years ago)

FunctionBlock?: De/Serialize added

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