root/branches/libfreebob-2.0/src/libfreebobavc/avc_extended_plug_info.h

Revision 336, 10.5 kB (checked in by pieterpalmers, 16 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

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* avc_extended_plug_info.h
2  * Copyright (C) 2005 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 AVCEXTENDEDPLUGINFO_H
22 #define AVCEXTENDEDPLUGINFO_H
23
24 #include "avc_extended_cmd_generic.h"
25 #include "avc_generic.h"
26
27 #include <libavc1394/avc1394.h>
28
29 #include <string>
30 #include <vector>
31
32 class ExtendedPlugInfoPlugTypeSpecificData : public IBusData
33 {
34 public:
35     enum EExtendedPlugInfoPlugType {
36         eEPIPT_IsoStream   = 0x0,
37         eEPIPT_AsyncStream = 0x1,
38         eEPIPT_Midi        = 0x2,
39         eEPIPT_Sync        = 0x3,
40         eEPIPT_Analog      = 0x4,
41         eEPIPT_Digital     = 0x5,
42
43         eEPIPT_Unknown     = 0xff,
44     };
45
46     ExtendedPlugInfoPlugTypeSpecificData( EExtendedPlugInfoPlugType ePlugType =  eEPIPT_Unknown);
47     virtual ~ExtendedPlugInfoPlugTypeSpecificData();
48
49     virtual bool serialize( IOSSerialize& se );
50     virtual bool deserialize( IISDeserialize& de );
51     virtual ExtendedPlugInfoPlugTypeSpecificData* clone() const;
52
53     typedef byte_t plug_type_t;
54
55     plug_type_t m_plugType;
56 };
57
58 const char* extendedPlugInfoPlugTypeToString( plug_type_t plugType );
59
60 /////////////////////////////////////////
61
62 class ExtendedPlugInfoPlugNameSpecificData : public IBusData
63 {
64 public:
65     ExtendedPlugInfoPlugNameSpecificData();
66     virtual ~ExtendedPlugInfoPlugNameSpecificData();
67
68     virtual bool serialize( IOSSerialize& se );
69     virtual bool deserialize( IISDeserialize& de );
70     virtual ExtendedPlugInfoPlugNameSpecificData* clone() const;
71
72     std::string m_name;
73 };
74
75 /////////////////////////////////////////
76
77 class ExtendedPlugInfoPlugNumberOfChannelsSpecificData : public IBusData
78 {
79 public:
80     ExtendedPlugInfoPlugNumberOfChannelsSpecificData();
81     virtual ~ExtendedPlugInfoPlugNumberOfChannelsSpecificData();
82
83     virtual bool serialize( IOSSerialize& se );
84     virtual bool deserialize( IISDeserialize& de );
85     virtual ExtendedPlugInfoPlugNumberOfChannelsSpecificData* clone() const;
86
87     nr_of_channels_t m_nrOfChannels;
88 };
89
90
91 /////////////////////////////////////////
92
93 class ExtendedPlugInfoPlugChannelPositionSpecificData : public IBusData
94 {
95 public:
96     enum ELocation {
97         eEPI_LeftFront        = 0x01,
98         eEPI_RightFront       = 0x02,
99         eEPI_Center           = 0x03,
100         eEPI_Subwoofer        = 0x04,
101         eEPI_LeftSurround     = 0x05,
102         eEPI_RightSurround    = 0x06,
103         eEPI_LeftOfCenter     = 0x07,
104         eEPI_RightOfCenter    = 0x08,
105         eEPI_Surround         = 0x09,
106         eEPI_SideLeft         = 0x0a,
107         eEPI_SideRight        = 0x0b,
108         eEPI_Top              = 0x0c,
109         eEPI_Bottom           = 0x0d,
110         eEPI_LeftFrontEffect  = 0x0e,
111         eEPI_RightFrontEffect = 0x0f,
112         eEPI_NoPostion        = 0xff,
113     };
114
115     struct ChannelInfo {
116         stream_position_t          m_streamPosition;
117         stream_position_location_t m_location;
118     };
119
120     typedef std::vector<ChannelInfo> ChannelInfoVector;
121
122     struct ClusterInfo {
123         nr_of_channels_t         m_nrOfChannels;
124         ChannelInfoVector        m_channelInfos;
125     };
126
127     ExtendedPlugInfoPlugChannelPositionSpecificData();
128     virtual ~ExtendedPlugInfoPlugChannelPositionSpecificData();
129
130     virtual bool serialize( IOSSerialize& se );
131     virtual bool deserialize( IISDeserialize& de );
132     virtual ExtendedPlugInfoPlugChannelPositionSpecificData* clone() const;
133
134     typedef std::vector<ClusterInfo> ClusterInfoVector;
135
136     nr_of_clusters_t         m_nrOfClusters;
137     ClusterInfoVector        m_clusterInfos;
138 };
139
140 /////////////////////////////////////////
141
142 class ExtendedPlugInfoPlugChannelNameSpecificData : public IBusData
143 {
144 public:
145     ExtendedPlugInfoPlugChannelNameSpecificData();
146     virtual ~ExtendedPlugInfoPlugChannelNameSpecificData();
147
148     virtual bool serialize( IOSSerialize& se );
149     virtual bool deserialize( IISDeserialize& de );
150     virtual ExtendedPlugInfoPlugChannelNameSpecificData* clone() const;
151
152     stream_position_t m_streamPosition;
153     string_length_t   m_stringLength;
154     std::string       m_plugChannelName;
155 };
156
157 /////////////////////////////////////////
158
159 class ExtendedPlugInfoPlugInputSpecificData : public IBusData
160 {
161 public:
162     ExtendedPlugInfoPlugInputSpecificData();
163     ExtendedPlugInfoPlugInputSpecificData( const ExtendedPlugInfoPlugInputSpecificData& rhs );
164     virtual ~ExtendedPlugInfoPlugInputSpecificData();
165
166     virtual bool serialize( IOSSerialize& se );
167     virtual bool deserialize( IISDeserialize& de );
168     virtual ExtendedPlugInfoPlugInputSpecificData* clone() const;
169
170     PlugAddressSpecificData* m_plugAddress;
171 };
172
173
174 /////////////////////////////////////////
175
176 class ExtendedPlugInfoPlugOutputSpecificData : public IBusData
177 {
178 public:
179     ExtendedPlugInfoPlugOutputSpecificData();
180     ExtendedPlugInfoPlugOutputSpecificData( const ExtendedPlugInfoPlugOutputSpecificData& rhs );
181     virtual ~ExtendedPlugInfoPlugOutputSpecificData();
182
183     virtual bool serialize( IOSSerialize& se );
184     virtual bool deserialize( IISDeserialize& de );
185     virtual ExtendedPlugInfoPlugOutputSpecificData* clone() const;
186
187     number_of_output_plugs_t m_nrOfOutputPlugs;
188
189     typedef std::vector<PlugAddressSpecificData*> PlugAddressVector;
190     PlugAddressVector m_outputPlugAddresses;
191 };
192
193 /////////////////////////////////////////
194
195 class ExtendedPlugInfoClusterInfoSpecificData : public IBusData
196 {
197 public:
198     enum EPortType {
199         ePT_Speaker            = 0x00,
200         ePT_Headphone          = 0x01,
201         ePT_Microphone         = 0x02,
202         ePT_Line               = 0x03,
203         ePT_SPDIF              = 0x04,
204         ePT_ADAT               = 0x05,
205         ePT_TDIF               = 0x06,
206         ePT_MADI               = 0x07,
207         ePT_Analog             = 0x08,
208         ePT_Digital            = 0x09,
209         ePT_MIDI               = 0x0a,
210         ePT_NoType             = 0xff,
211     };
212
213     ExtendedPlugInfoClusterInfoSpecificData();
214     virtual ~ExtendedPlugInfoClusterInfoSpecificData();
215
216     virtual bool serialize( IOSSerialize& se );
217     virtual bool deserialize( IISDeserialize& de );
218     virtual ExtendedPlugInfoClusterInfoSpecificData* clone() const;
219
220     cluster_index_t m_clusterIndex;
221     port_type_t     m_portType;
222     string_length_t m_stringLength;
223     std::string     m_clusterName;
224 };
225
226 const char* extendedPlugInfoClusterInfoPortTypeToString( port_type_t portType );
227
228 /////////////////////////////////////////
229
230 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_TYPE                   0x00
231 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_NAME                   0x01
232 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_NO_OF_CHANNELS         0x02
233 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_CHANNEL_POSITION       0x03
234 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_CHANNEL_NAME           0x04
235 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_INPUT                  0x05
236 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_OUTPUT                 0x06
237 #define AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_CLUSTER_INFO           0x07
238
239 class ExtendedPlugInfoInfoType : public IBusData
240 {
241 public:
242     enum EInfoType {
243         eIT_PlugType        = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_TYPE,
244         eIT_PlugName        = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_NAME,
245         eIT_NoOfChannels    = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_NO_OF_CHANNELS,
246         eIT_ChannelPosition = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_CHANNEL_POSITION,
247         eIT_ChannelName     = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_CHANNEL_NAME,
248         eIT_PlugInput       = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_INPUT,
249         eIT_PlugOutput      = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_OUTPUT,
250         eIT_ClusterInfo     = AVC1394_EXTENDED_PLUG_INFO_INFO_TYPE_PLUG_CLUSTER_INFO,
251     };
252
253     ExtendedPlugInfoInfoType(EInfoType eInfoType);
254     ExtendedPlugInfoInfoType( const ExtendedPlugInfoInfoType& rhs );
255     virtual ~ExtendedPlugInfoInfoType();
256
257     bool initialize();
258
259     virtual bool serialize( IOSSerialize& se );
260     virtual bool deserialize( IISDeserialize& de );
261     virtual ExtendedPlugInfoInfoType* clone() const;
262
263     info_type_t m_infoType;
264
265     ExtendedPlugInfoPlugTypeSpecificData*               m_plugType;
266     ExtendedPlugInfoPlugNameSpecificData*               m_plugName;
267     ExtendedPlugInfoPlugNumberOfChannelsSpecificData*   m_plugNrOfChns;
268     ExtendedPlugInfoPlugChannelPositionSpecificData*    m_plugChannelPosition;
269     ExtendedPlugInfoPlugChannelNameSpecificData*        m_plugChannelName;
270     ExtendedPlugInfoPlugInputSpecificData*              m_plugInput;
271     ExtendedPlugInfoPlugOutputSpecificData*             m_plugOutput;
272     ExtendedPlugInfoClusterInfoSpecificData*            m_plugClusterInfo;
273 };
274
275 const char* extendedPlugInfoInfoTypeToString( info_type_t infoType );
276
277 /////////////////////////////////////////////////////////
278
279 #define AVC1394_PLUG_INFO_SUBFUNCTION_EXTENDED_PLUG_INFO_CMD   0xC0
280 #define AVC1394_PLUG_INFO_SUBFUNCTION_SERIAL_BUS_NOT_USED      0xFF
281
282
283 class ExtendedPlugInfoCmd: public AVCCommand
284 {
285 public:
286     enum ESubFunction {
287         eSF_ExtendedPlugInfoCmd                  = AVC1394_PLUG_INFO_SUBFUNCTION_EXTENDED_PLUG_INFO_CMD,
288         eSF_NotUsed                              = AVC1394_PLUG_INFO_SUBFUNCTION_SERIAL_BUS_NOT_USED,
289     };
290
291     ExtendedPlugInfoCmd( Ieee1394Service* ieee1394service,
292                          ESubFunction eSubFunction = eSF_ExtendedPlugInfoCmd );
293     ExtendedPlugInfoCmd( const ExtendedPlugInfoCmd& rhs );
294     virtual ~ExtendedPlugInfoCmd();
295
296     virtual bool serialize( IOSSerialize& se );
297     virtual bool deserialize( IISDeserialize& de );
298
299     bool setPlugAddress( const PlugAddress& plugAddress );
300     bool setSubFunction( ESubFunction subFunction );
301     bool setInfoType( const ExtendedPlugInfoInfoType& infoType );
302     ExtendedPlugInfoInfoType* getInfoType()
303         { return m_infoType; }
304
305     virtual const char* getCmdName() const
306         { return "ExtendedPlugInfoCmd"; }
307
308 protected:
309     subfunction_t             m_subFunction;
310     PlugAddress*              m_plugAddress;
311     ExtendedPlugInfoInfoType* m_infoType;
312 };
313
314
315 #endif
Note: See TracBrowser for help on using the browser.