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

Revision 1042, 7.5 kB (checked in by ppalmers, 14 years ago)

- use cluster infoblock information for stream setup
- implement graphviz output for music plugs

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 <libavc1394/avc1394.h>
41
42 #include <vector>
43 #include <string>
44
45 class Ieee1394Service;
46
47 namespace AVC {
48
49
50 class Util::Cmd::IOSSerialize;
51 class Util::Cmd::IISDeserialize;
52
53 /**
54  * The info blocks
55  */
56 class AVCMusicGeneralStatusInfoBlock : public AVCInfoBlock
57 {
58 public:
59
60     virtual bool serialize( Util::Cmd::IOSSerialize& se );
61     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
62
63     AVCMusicGeneralStatusInfoBlock( );
64     virtual ~AVCMusicGeneralStatusInfoBlock() {};
65     virtual const char* getInfoBlockName() const
66         {return "AVCMusicGeneralStatusInfoBlock";};
67
68     byte_t  m_current_transmit_capability;
69     byte_t  m_current_receive_capability;
70     quadlet_t m_current_latency_capability;
71    
72 protected:
73
74 private:
75
76 };
77
78 class AVCMusicOutputPlugStatusInfoBlock : public AVCInfoBlock
79 {
80 public:
81
82     virtual bool serialize( Util::Cmd::IOSSerialize& se );
83     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
84
85     AVCMusicOutputPlugStatusInfoBlock( );
86     virtual ~AVCMusicOutputPlugStatusInfoBlock() {};
87     virtual const char* getInfoBlockName() const
88         {return "AVCMusicOutputPlugStatusInfoBlock";};
89
90 protected:
91
92 private:
93
94 };
95
96 class AVCMusicClusterInfoBlock : public AVCInfoBlock
97 {
98 public:
99
100     struct sSignalInfo {
101         uint16_t music_plug_id;
102         byte_t stream_position;
103         byte_t stream_location;
104     };
105     typedef std::vector<struct sSignalInfo> SignalInfoVector;
106     typedef std::vector<struct sSignalInfo>::iterator SignalInfoVectorIterator;
107
108     virtual bool serialize( Util::Cmd::IOSSerialize& se );
109     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
110
111     virtual bool clear();
112
113     std::string getName();
114
115     AVCMusicClusterInfoBlock( );
116     virtual ~AVCMusicClusterInfoBlock();
117     virtual const char* getInfoBlockName() const
118         {return "AVCMusicClusterInfoBlock";};
119
120     byte_t      m_stream_format;
121     byte_t      m_port_type;
122     byte_t      m_nb_signals;
123     SignalInfoVector m_SignalInfos;
124
125     AVCRawTextInfoBlock m_RawTextInfoBlock;
126     AVCNameInfoBlock    m_NameInfoBlock;
127
128     virtual void show();
129
130 protected:
131
132 private:
133
134 };
135 typedef std::vector<AVCMusicClusterInfoBlock *> AVCMusicClusterInfoBlockVector;
136 typedef std::vector<AVCMusicClusterInfoBlock *>::iterator AVCMusicClusterInfoBlockVectorIterator;
137
138 class AVCMusicSubunitPlugInfoBlock : public AVCInfoBlock
139 {
140 public:
141     enum AVCMusicSubunitPlugInfoBlockPlugType {
142         ePT_IsoStream   = 0x0,
143         ePT_AsyncStream = 0x1,
144         ePT_Midi        = 0x2,
145         ePT_Sync        = 0x3,
146         ePT_Analog      = 0x4,
147         ePT_Digital     = 0x5,
148
149         ePT_Unknown     = 0xff,
150     };
151
152     virtual bool serialize( Util::Cmd::IOSSerialize& se );
153     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
154
155     AVCMusicSubunitPlugInfoBlock( );
156     virtual ~AVCMusicSubunitPlugInfoBlock();
157     virtual const char* getInfoBlockName() const
158         {return "AVCMusicSubunitPlugInfoBlock";};
159        
160     virtual bool clear();
161    
162     std::string getName();
163    
164     byte_t      m_subunit_plug_id;
165     uint16_t    m_signal_format;
166     byte_t      m_plug_type;
167     uint16_t    m_nb_clusters;
168     uint16_t    m_nb_channels;
169
170     AVCMusicClusterInfoBlockVector m_Clusters;
171     AVCRawTextInfoBlock m_RawTextInfoBlock;
172     AVCNameInfoBlock    m_NameInfoBlock;
173
174 protected:
175
176 private:
177
178 };
179 typedef std::vector<AVCMusicSubunitPlugInfoBlock *> AVCMusicSubunitPlugInfoBlockVector;
180 typedef std::vector<AVCMusicSubunitPlugInfoBlock *>::iterator AVCMusicSubunitPlugInfoBlockVectorIterator;
181
182 class AVCMusicPlugInfoBlock : public AVCInfoBlock
183 {
184 public:
185
186     virtual bool serialize( Util::Cmd::IOSSerialize& se );
187     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
188     virtual bool clear();
189
190     AVCMusicPlugInfoBlock( );
191     virtual ~AVCMusicPlugInfoBlock() {};
192     virtual const char* getInfoBlockName() const
193         {return "AVCMusicPlugInfoBlock";};
194
195     std::string getName();
196
197     byte_t      m_music_plug_type;
198     uint16_t    m_music_plug_id;
199     byte_t      m_routing_support;
200     byte_t      m_source_plug_function_type;
201     byte_t      m_source_plug_id;
202     byte_t      m_source_plug_function_block_id;
203     byte_t      m_source_stream_position;
204     byte_t      m_source_stream_location;
205     byte_t      m_dest_plug_function_type;
206     byte_t      m_dest_plug_id;
207     byte_t      m_dest_plug_function_block_id;
208     byte_t      m_dest_stream_position;
209     byte_t      m_dest_stream_location;
210    
211     AVCRawTextInfoBlock m_RawTextInfoBlock;
212     AVCNameInfoBlock    m_NameInfoBlock;
213
214     virtual void show();
215
216 protected:
217
218 private:
219
220 };
221 typedef std::vector<AVCMusicPlugInfoBlock *> AVCMusicPlugInfoBlockVector;
222 typedef std::vector<AVCMusicPlugInfoBlock *>::iterator AVCMusicPlugInfoBlockVectorIterator;
223
224 class AVCMusicRoutingStatusInfoBlock : public AVCInfoBlock
225 {
226 public:
227
228     virtual bool serialize( Util::Cmd::IOSSerialize& se );
229     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
230
231     AVCMusicRoutingStatusInfoBlock( );
232     virtual ~AVCMusicRoutingStatusInfoBlock();
233     virtual const char* getInfoBlockName() const
234         {return "AVCMusicRoutingStatusInfoBlock";};
235
236     AVCMusicSubunitPlugInfoBlock *getSubunitPlugInfoBlock(Plug::EPlugDirection, plug_id_t);
237     AVCMusicPlugInfoBlock *getMusicPlugInfoBlock(plug_id_t);
238    
239     virtual bool clear();
240
241     byte_t      m_nb_dest_plugs;
242     byte_t      m_nb_source_plugs;
243     uint16_t    m_nb_music_plugs;
244    
245     AVCMusicSubunitPlugInfoBlockVector  mDestPlugInfoBlocks;
246     AVCMusicSubunitPlugInfoBlockVector  mSourcePlugInfoBlocks;
247     AVCMusicPlugInfoBlockVector         mMusicPlugInfoBlocks;
248
249 protected:
250
251 private:
252
253 };
254
255 /**
256  *
257  */
258 class AVCMusicStatusDescriptor : public AVCDescriptor
259 {
260
261 public:
262     virtual bool serialize( Util::Cmd::IOSSerialize& se );
263     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
264    
265     AVCMusicStatusDescriptor( Unit* unit, Subunit* subunit );
266     virtual ~AVCMusicStatusDescriptor() {}
267    
268     virtual const char* getDescriptorName() const
269         {return "AVCMusicStatusDescriptor";};
270        
271     AVCMusicSubunitPlugInfoBlock *getSubunitPlugInfoBlock(Plug::EPlugDirection, plug_id_t);
272     AVCMusicPlugInfoBlock *getMusicPlugInfoBlock(plug_id_t);
273     unsigned int getNbMusicPlugs();
274
275 private:
276     // the child info blocks
277     AVCMusicGeneralStatusInfoBlock m_general_status_infoblock;
278     AVCMusicOutputPlugStatusInfoBlock m_output_plug_status_infoblock;
279     AVCMusicRoutingStatusInfoBlock m_routing_status_infoblock;
280    
281 };
282
283 }
284
285 #endif // AVCDESCRIPTORMUSIC_H
Note: See TracBrowser for help on using the browser.