root/trunk/libffado/src/libavc/streamformat/avc_extended_stream_format.h

Revision 2803, 13.8 kB (checked in by jwoithe, 3 years ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
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 #ifndef AVCEXTENDEDSTREAMFROMAT_H
25 #define AVCEXTENDEDSTREAMFROMAT_H
26
27 #include "../general/avc_generic.h"
28 #include "../general/avc_extended_cmd_generic.h"
29
30 #include <iostream>
31 #include <vector>
32
33 namespace AVC {
34
35 #define AVC1394_STREAM_FORMAT_SUPPORT            0x2F
36 #define AVC1394_STREAM_FORMAT_SUBFUNCTION_INPUT  0x00
37 #define AVC1394_STREAM_FORMAT_SUBFUNCTION_OUTPUT 0x01
38
39 // BridgeCo extensions
40 #define AVC1394_STREAM_FORMAT_SUBFUNCTION_EXTENDED_STREAM_FORMAT      0xC0
41 #define AVC1394_STREAM_FORMAT_SUBFUNCTION_EXTENDED_STREAM_FORMAT_LIST 0xC1
42
43
44 #define AVC1394_STREAM_FORMAT_HIERARCHY_ROOT_DVCR       0x80
45 #define AVC1394_STREAM_FORMAT_HIERARCHY_ROOT_AUDIOMUSIC 0x90
46 #define AVC1394_STREAM_FORMAT_HIERARCHY_ROOT_INVALID    0xFF
47
48 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SD525_60                     0x00
49 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SDL525_60                    0x04
50 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_HD1125_60                    0x08
51 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SD625_60                     0x80
52 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SDL625_50                    0x84
53 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_HD1250_50                    0x88
54 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_AM824                  0x00
55 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_24_4_AUDIO_PACK        0x01
56 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_32_FLOATING_POINT_DATA 0x02
57 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_AM824_COMPOUND         0x40
58 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_DONT_CARE              0xFF
59
60
61 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC60958_3                            0x00
62 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_3                            0x01
63 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_4                            0x02
64 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_5                            0x03
65 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_6                            0x04
66 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_7                            0x05
67 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_MULTI_BIT_LINEAR_AUDIO_RAW            0x06
68 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_MULTI_BIT_LINEAR_AUDIO_DVD_AUDIO      0x07
69 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_PLAIN_RAW               0x08
70 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_PLAIN_SACD              0x09
71 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_ENCODED_RAW             0x0A
72 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_ENCODED_SACD            0x0B
73 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_HIGH_PRECISION_MULTIBIT_LINEAR_AUDIO  0x0C
74 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_MIDI_CONFORMANT                       0x0D
75 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_SYNC_STREAM                           0x40
76 #define AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_DONT_CARE                             0xFF
77
78 #define AVC1394_STREAM_FORMAT_AM824_IEC60958_3                            0x00
79 #define AVC1394_STREAM_FORMAT_AM824_IEC61937_3                            0x01
80 #define AVC1394_STREAM_FORMAT_AM824_IEC61937_4                            0x02
81 #define AVC1394_STREAM_FORMAT_AM824_IEC61937_5                            0x03
82 #define AVC1394_STREAM_FORMAT_AM824_IEC61937_6                            0x04
83 #define AVC1394_STREAM_FORMAT_AM824_IEC61937_7                            0x05
84 #define AVC1394_STREAM_FORMAT_AM824_MULTI_BIT_LINEAR_AUDIO_RAW            0x06
85 #define AVC1394_STREAM_FORMAT_AM824_MULTI_BIT_LINEAR_AUDIO_DVD_AUDIO      0x07
86 #define AVC1394_STREAM_FORMAT_AM824_HIGH_PRECISION_MULTIBIT_LINEAR_AUDIO  0x0C
87 #define AVC1394_STREAM_FORMAT_AM824_MIDI_CONFORMANT                       0x0D
88 #define AVC1394_STREAM_FORMAT_AM824_DONT_CARE                             0xFF
89
90 /*
91 // As defined in 'AV/C Stream Format Information Specification 1.0 TA Document 2001002'
92 // Not used for extended stream format
93 #define AVC1394_STREAM_FORMAT_SUPPORT_STATUS_SUPPORTED_AND_CONFIGURED              0x00
94 #define AVC1394_STREAM_FORMAT_SUPPORT_STATUS_SUPPORTED_AND_HAS_NOT_BEEN_CONFIGURED 0x01
95 #define AVC1394_STREAM_FORMAT_SUPPORT_STATUS_SUPPORTED_AND_READY_TO_CONFIGURE      0x02
96 #define AVC1394_STREAM_FORMAT_SUPPORT_STATUS_SUPPORTED_AND_NOT_CONFIGURED          0x03
97 #define AVC1394_STREAM_FORMAT_SUPPORT_STATUS_NOT_SUPPORTED                         0x04
98 // 0x05 - 0xFE reserved
99 #define AVC1394_STREAM_FORMAT_SUPPORT_STATUS_NO_INFORMATION                        0xFF
100 */
101
102 #define AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_ACTIVE           0x00
103 #define AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_INACTIVE         0x01
104 #define AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_NO_STREAM_FORMAT 0x02
105 #define AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_NOT_USED         0xff
106
107 enum ERateControl {
108     eRC_Supported = 0x00,
109     eRC_DontCare  = 0x01,
110 };
111
112 ////////////////////////////////////////////////////////////
113
114 class StreamFormatInfo: public IBusData
115 {
116 public:
117     StreamFormatInfo();
118
119     virtual bool serialize( Util::Cmd::IOSSerialize& se );
120     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
121
122     virtual StreamFormatInfo* clone() const;
123
124     number_of_channels_t m_numberOfChannels;
125     stream_format_t      m_streamFormat;
126 };
127 std::ostream& operator<<( std::ostream& stream, StreamFormatInfo info );
128
129 ////////////////////////////////////////////////////////////
130
131 class FormatInformationStreams: public IBusData
132 {
133 public:
134     FormatInformationStreams() {}
135     virtual ~FormatInformationStreams() {}
136 };
137
138 ////////////////////////////////////////////////////////////
139
140 class FormatInformationStreamsSync: public FormatInformationStreams
141 {
142 public:
143     FormatInformationStreamsSync();
144
145     virtual bool serialize( Util::Cmd::IOSSerialize& se );
146     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
147     virtual FormatInformationStreamsSync* clone() const;
148
149     reserved_t           m_reserved0;
150     sampling_frequency_t m_samplingFrequency;
151     rate_control_t       m_rateControl;
152     reserved_t           m_reserved1;
153 };
154
155 ////////////////////////////////////////////////////////////
156
157 class FormatInformationStreamsCompound: public FormatInformationStreams
158 {
159 public:
160     FormatInformationStreamsCompound();
161     virtual ~FormatInformationStreamsCompound();
162
163     virtual bool serialize( Util::Cmd::IOSSerialize& se );
164     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
165     virtual FormatInformationStreamsCompound* clone() const;
166
167     sampling_frequency_t                     m_samplingFrequency;
168     rate_control_t                           m_rateControl;
169     number_of_stream_format_infos_t          m_numberOfStreamFormatInfos;
170
171     typedef std::vector< StreamFormatInfo* > StreamFormatInfoVector;
172     StreamFormatInfoVector                   m_streamFormatInfos;
173 };
174 std::ostream& operator<<( std::ostream& stream, FormatInformationStreamsCompound info );
175
176
177 ////////////////////////////////////////////////////////////
178
179 class FormatInformation: public IBusData
180 {
181 public:
182     enum EFormatHierarchyRoot {
183         eFHR_DVCR            = AVC1394_STREAM_FORMAT_HIERARCHY_ROOT_DVCR,
184         eFHR_AudioMusic      = AVC1394_STREAM_FORMAT_HIERARCHY_ROOT_AUDIOMUSIC,
185         eFHR_Invalid         = AVC1394_STREAM_FORMAT_HIERARCHY_ROOT_INVALID,
186     };
187
188     enum EFomatHierarchyLevel1 {
189         eFHL1_DVCR_SD525_60                     = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SD525_60,
190         eFHL1_DVCR_SDL525_60                    = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SDL525_60,
191         eFHL1_DVCR_HD1125_60                    = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_HD1125_60,
192         eFHL1_DVCR_SD625_60                     = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SD625_60,
193         eFHL1_DVCR_SDL625_50                    = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_SDL625_50,
194         eFHL1_DVCR_HD1250_50                    = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_DVCR_HD1250_50,
195         eFHL1_AUDIOMUSIC_AM824                  = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_AM824,
196         eFHL1_AUDIOMUSIC_24_4_AUDIO_PACK        = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_24_4_AUDIO_PACK,
197         eFHL1_AUDIOMUSIC_32_FLOATING            = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_32_FLOATING_POINT_DATA,
198         eFHL1_AUDIOMUSIC_AM824_COMPOUND         = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_AM824_COMPOUND,
199         eFHL1_AUDIOMUSIC_DONT_CARE              = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_1_AUDIOMUSIC_DONT_CARE,
200     };
201
202     enum EFormatHierarchyLevel2 {
203         eFHL2_AM824_IEC60958_3 = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC60958_3,
204         eFHL2_AM824_IEC61937_3 = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_3,
205         eFHL2_AM824_IEC61937_4 = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_4,
206         eFHL2_AM824_IEC61937_5 = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_5,
207         eFHL2_AM824_IEC61937_6 = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_6,
208         eFHL2_AM824_IEC61937_7 = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_IEC61937_7,
209         eFHL2_AM824_MULTI_BIT_LINEAR_AUDIO_RAW = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_MULTI_BIT_LINEAR_AUDIO_RAW,
210         eFHL2_AM824_MULTI_BIT_LINEAR_AUDIO_DVD_AUDIO = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_MULTI_BIT_LINEAR_AUDIO_DVD_AUDIO,
211         eFHL2_AM824_ONE_BIT_AUDIO_PLAIN_RAW = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_PLAIN_RAW,
212         eFHL2_AM824_ONE_BIT_AUDIO_PLAIN_SACD = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_PLAIN_SACD,
213         eFHL2_AM824_ONE_BIT_AUDIO_ENCODED_RAW = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_ENCODED_RAW,
214         eFHL2_AM824_ONE_BIT_AUDIO_ENCODED_SACD = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_ONE_BIT_AUDIO_ENCODED_SACD,
215         eFHL2_AM824_HIGH_PRECISION_MULTIBIT_LINEAR_AUDIO = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_HIGH_PRECISION_MULTIBIT_LINEAR_AUDIO,
216         eFHL2_AM824_MIDI_CONFORMANT = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_MIDI_CONFORMANT,
217         eFHL2_AM824_SYNC_STREAM = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_SYNC_STREAM,
218         eFHL2_AM824_DONT_CARE = AVC1394_STREAM_FORMAT_HIERARCHY_LEVEL_2_AM824_DONT_CARE,
219     };
220
221     typedef byte_t format_hierarchy_root_t;
222     typedef byte_t format_hierarchy_level1_t;
223     typedef byte_t format_hierarchy_level2_t;
224
225     FormatInformation();
226     FormatInformation( const FormatInformation& rhs );
227     virtual ~FormatInformation();
228
229     virtual bool serialize( Util::Cmd::IOSSerialize& se );
230     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
231
232     virtual FormatInformation* clone() const;
233
234     format_hierarchy_root_t m_root;
235     format_hierarchy_level1_t m_level1;
236     format_hierarchy_level2_t m_level2;
237     FormatInformationStreams* m_streams;
238 };
239
240 ///////////////////////////////////////////////////////////
241
242 class ExtendedStreamFormatCmd: public AVCCommand
243 {
244 public:
245     enum ESubFunction {
246         eSF_Input                                               = AVC1394_STREAM_FORMAT_SUBFUNCTION_INPUT,
247         eSF_Output                                              = AVC1394_STREAM_FORMAT_SUBFUNCTION_OUTPUT,
248         eSF_ExtendedStreamFormatInformationCommand              = AVC1394_STREAM_FORMAT_SUBFUNCTION_EXTENDED_STREAM_FORMAT,
249         eSF_ExtendedStreamFormatInformationCommandList          = AVC1394_STREAM_FORMAT_SUBFUNCTION_EXTENDED_STREAM_FORMAT_LIST,
250     };
251
252     enum EStatus {
253         eS_Active         = AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_ACTIVE,
254         eS_Inactive       = AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_INACTIVE,
255         eS_NoStreamFormat = AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_NO_STREAM_FORMAT,
256         eS_NotUsed        = AVC1394_EXTENDED_STREAM_FORMAT_INFO_STATUS_NOT_USED,
257     };
258     typedef byte_t status_t;
259     typedef byte_t index_in_stream_format_t;
260
261     ExtendedStreamFormatCmd( Ieee1394Service& ieee1349service, ESubFunction eSubFunction = eSF_ExtendedStreamFormatInformationCommand );
262     ExtendedStreamFormatCmd( const ExtendedStreamFormatCmd& rhs );
263     virtual ~ExtendedStreamFormatCmd();
264
265     bool setPlugAddress( const PlugAddress& plugAddress );
266     bool setIndexInStreamFormat( const int index );
267     bool setSubFunction( ESubFunction subFunction );
268
269     virtual bool serialize( Util::Cmd::IOSSerialize& se );
270     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
271
272     EStatus getStatus();
273     FormatInformation* getFormatInformation();
274     index_in_stream_format_t getIndex();
275
276     virtual const char* getCmdName() const
277     { return "ExtendedStreamFormatCmd"; }
278
279 protected:
280     subfunction_t            m_subFunction;
281     PlugAddress*             m_plugAddress;
282     status_t                 m_status;
283     index_in_stream_format_t m_indexInStreamFormat;
284     FormatInformation*       m_formatInformation;
285 };
286
287 }
288
289 #endif // AVCEXTENDEDSTREAMFROMAT_H
Note: See TracBrowser for help on using the browser.