root/trunk/libffado/src/libavc/musicsubunit/avc_descriptor_music.h

Revision 1498, 7.4 kB (checked in by ppalmers, 12 years ago)

Merge all changes from 2.0 branch into trunk (since r1361). This _should_ contain all forward merges done in the mean time. At this moment in time both branches should be in sync.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 /**
25  * Implements the AV/C Descriptors/InfoBlocks for the Music Subunit as in TA2004007
26  *
27  */
28
29 #ifndef AVCDESCRIPTORMUSIC_H
30 #define AVCDESCRIPTORMUSIC_H
31
32 #include "../descriptors/avc_descriptor.h"
33 #include "../avc_definitions.h"
34
35 #include "../general/avc_generic.h"
36 #include "../general/avc_plug.h"
37
38 #include "debugmodule/debugmodule.h"
39
40 #include <vector>
41 #include <string>
42
43 class Ieee1394Service;
44
45 namespace AVC {
46
47 /**
48  * The info blocks
49  */
50 class AVCMusicGeneralStatusInfoBlock : public AVCInfoBlock
51 {
52 public:
53
54     virtual bool serialize( Util::Cmd::IOSSerialize& se );
55     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
56
57     AVCMusicGeneralStatusInfoBlock( );
58     virtual ~AVCMusicGeneralStatusInfoBlock() {};
59     virtual const char* getInfoBlockName() const
60         {return "AVCMusicGeneralStatusInfoBlock";};
61
62     byte_t  m_current_transmit_capability;
63     byte_t  m_current_receive_capability;
64     quadlet_t m_current_latency_capability;
65    
66 protected:
67
68 private:
69
70 };
71
72 class AVCMusicOutputPlugStatusInfoBlock : public AVCInfoBlock
73 {
74 public:
75
76     virtual bool serialize( Util::Cmd::IOSSerialize& se );
77     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
78
79     AVCMusicOutputPlugStatusInfoBlock( );
80     virtual ~AVCMusicOutputPlugStatusInfoBlock() {};
81     virtual const char* getInfoBlockName() const
82         {return "AVCMusicOutputPlugStatusInfoBlock";};
83
84 protected:
85
86 private:
87
88 };
89
90 class AVCMusicClusterInfoBlock : public AVCInfoBlock
91 {
92 public:
93
94     struct sSignalInfo {
95         uint16_t music_plug_id;
96         byte_t stream_position;
97         byte_t stream_location;
98     };
99     typedef std::vector<struct sSignalInfo> SignalInfoVector;
100     typedef std::vector<struct sSignalInfo>::iterator SignalInfoVectorIterator;
101
102     virtual bool serialize( Util::Cmd::IOSSerialize& se );
103     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
104
105     virtual bool clear();
106
107     std::string getName();
108
109     AVCMusicClusterInfoBlock( );
110     virtual ~AVCMusicClusterInfoBlock();
111     virtual const char* getInfoBlockName() const
112         {return "AVCMusicClusterInfoBlock";};
113
114     byte_t      m_stream_format;
115     byte_t      m_port_type;
116     byte_t      m_nb_signals;
117     SignalInfoVector m_SignalInfos;
118
119     AVCRawTextInfoBlock m_RawTextInfoBlock;
120     AVCNameInfoBlock    m_NameInfoBlock;
121
122     virtual void show();
123
124 protected:
125
126 private:
127
128 };
129 typedef std::vector<AVCMusicClusterInfoBlock *> AVCMusicClusterInfoBlockVector;
130 typedef std::vector<AVCMusicClusterInfoBlock *>::iterator AVCMusicClusterInfoBlockVectorIterator;
131
132 class AVCMusicSubunitPlugInfoBlock : public AVCInfoBlock
133 {
134 public:
135     enum AVCMusicSubunitPlugInfoBlockPlugType {
136         ePT_IsoStream   = 0x0,
137         ePT_AsyncStream = 0x1,
138         ePT_Midi        = 0x2,
139         ePT_Sync        = 0x3,
140         ePT_Analog      = 0x4,
141         ePT_Digital     = 0x5,
142
143         ePT_Unknown     = 0xff,
144     };
145
146     virtual bool serialize( Util::Cmd::IOSSerialize& se );
147     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
148
149     AVCMusicSubunitPlugInfoBlock( );
150     virtual ~AVCMusicSubunitPlugInfoBlock();
151     virtual const char* getInfoBlockName() const
152         {return "AVCMusicSubunitPlugInfoBlock";};
153        
154     virtual bool clear();
155    
156     std::string getName();
157    
158     byte_t      m_subunit_plug_id;
159     uint16_t    m_signal_format;
160     byte_t      m_plug_type;
161     uint16_t    m_nb_clusters;
162     uint16_t    m_nb_channels;
163
164     AVCMusicClusterInfoBlockVector m_Clusters;
165     AVCRawTextInfoBlock m_RawTextInfoBlock;
166     AVCNameInfoBlock    m_NameInfoBlock;
167
168 protected:
169
170 private:
171
172 };
173 typedef std::vector<AVCMusicSubunitPlugInfoBlock *> AVCMusicSubunitPlugInfoBlockVector;
174 typedef std::vector<AVCMusicSubunitPlugInfoBlock *>::iterator AVCMusicSubunitPlugInfoBlockVectorIterator;
175
176 class AVCMusicPlugInfoBlock : public AVCInfoBlock
177 {
178 public:
179
180     virtual bool serialize( Util::Cmd::IOSSerialize& se );
181     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
182     virtual bool clear();
183
184     AVCMusicPlugInfoBlock( );
185     virtual ~AVCMusicPlugInfoBlock() {};
186     virtual const char* getInfoBlockName() const
187         {return "AVCMusicPlugInfoBlock";};
188
189     std::string getName();
190
191     byte_t      m_music_plug_type;
192     uint16_t    m_music_plug_id;
193     byte_t      m_routing_support;
194     byte_t      m_source_plug_function_type;
195     byte_t      m_source_plug_id;
196     byte_t      m_source_plug_function_block_id;
197     byte_t      m_source_stream_position;
198     byte_t      m_source_stream_location;
199     byte_t      m_dest_plug_function_type;
200     byte_t      m_dest_plug_id;
201     byte_t      m_dest_plug_function_block_id;
202     byte_t      m_dest_stream_position;
203     byte_t      m_dest_stream_location;
204    
205     AVCRawTextInfoBlock m_RawTextInfoBlock;
206     AVCNameInfoBlock    m_NameInfoBlock;
207
208     virtual void show();
209
210 protected:
211
212 private:
213
214 };
215 typedef std::vector<AVCMusicPlugInfoBlock *> AVCMusicPlugInfoBlockVector;
216 typedef std::vector<AVCMusicPlugInfoBlock *>::iterator AVCMusicPlugInfoBlockVectorIterator;
217
218 class AVCMusicRoutingStatusInfoBlock : public AVCInfoBlock
219 {
220 public:
221
222     virtual bool serialize( Util::Cmd::IOSSerialize& se );
223     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
224
225     AVCMusicRoutingStatusInfoBlock( );
226     virtual ~AVCMusicRoutingStatusInfoBlock();
227     virtual const char* getInfoBlockName() const
228         {return "AVCMusicRoutingStatusInfoBlock";};
229
230     AVCMusicSubunitPlugInfoBlock *getSubunitPlugInfoBlock(Plug::EPlugDirection, plug_id_t);
231     AVCMusicPlugInfoBlock *getMusicPlugInfoBlock(plug_id_t);
232    
233     virtual bool clear();
234
235     byte_t      m_nb_dest_plugs;
236     byte_t      m_nb_source_plugs;
237     uint16_t    m_nb_music_plugs;
238    
239     AVCMusicSubunitPlugInfoBlockVector  mDestPlugInfoBlocks;
240     AVCMusicSubunitPlugInfoBlockVector  mSourcePlugInfoBlocks;
241     AVCMusicPlugInfoBlockVector         mMusicPlugInfoBlocks;
242
243 protected:
244
245 private:
246
247 };
248
249 /**
250  *
251  */
252 class AVCMusicStatusDescriptor : public AVCDescriptor
253 {
254
255 public:
256     virtual bool serialize( Util::Cmd::IOSSerialize& se );
257     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
258    
259     AVCMusicStatusDescriptor( Unit* unit, Subunit* subunit );
260     virtual ~AVCMusicStatusDescriptor() {}
261    
262     virtual const char* getDescriptorName() const
263         {return "AVCMusicStatusDescriptor";};
264        
265     AVCMusicSubunitPlugInfoBlock *getSubunitPlugInfoBlock(Plug::EPlugDirection, plug_id_t);
266     AVCMusicPlugInfoBlock *getMusicPlugInfoBlock(plug_id_t);
267     unsigned int getNbMusicPlugs();
268
269 private:
270     // the child info blocks
271     AVCMusicGeneralStatusInfoBlock m_general_status_infoblock;
272     AVCMusicOutputPlugStatusInfoBlock m_output_plug_status_infoblock;
273     AVCMusicRoutingStatusInfoBlock m_routing_status_infoblock;
274    
275 };
276
277 }
278
279 #endif // AVCDESCRIPTORMUSIC_H
Note: See TracBrowser for help on using the browser.