root/branches/stable_0_2_0/libfreebob/src/libfreebobavc/avc_extended_stream_format.h

Revision 161, 13.5 kB (checked in by anonymous, 18 years ago)

This commit was manufactured by cvs2svn to create branch 'stable_0_2_0'.

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