root/trunk/libffado/src/libavc/avc_definitions.h

Revision 554, 5.1 kB (checked in by ppalmers, 17 years ago)

Merge echoaudio branch into trunk.

This adds support for the Echo Audiofire devices to FFADO. Possibly also other devices working with the Apple Class Driver will work with this code. It is not fully complete yet, but the main rework is
done.

First of all the IAvDevice class/interface is renamed to FFADODevice, in order to separate the AV/C code from the FFADO API code. A device supported by FFADO implements a FFADODevice.

The BeBoB device has been split up into three groups:
- libavc/* : all code and commands that are specified by AV/C specs. Note that a lot of the code that used to be in BeBoB::AvDevice? now resides in AVC::Unit
- genericavc/* : a FFADODevice that uses AV/C descriptors & commands for discovery and config
- bebob/* : the bebob FFADODevice that inherits from GenericAVC::AvDevice? but that uses BridgeCo? commands for discovery

Everything has been moved as high as possible in the class hierarchy. If necessary, a subclass that uses device specific commands is introduced (e.g. BeBoB::Plug inherits from AVC::Plug and uses the
BridgeCo? extended plug info command to discover it's properties).

There are some other fixes along the way that have been done too.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2007 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 library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23
24 #ifndef AVCDEFINITIONS_H
25 #define AVCDEFINITIONS_H
26
27 #include <libavc1394/avc1394.h>
28 #include <ostream>
29
30
31 namespace AVC {
32
33 typedef byte_t ctype_t;
34 typedef byte_t unit_t;
35 typedef byte_t unit_type_t;
36 typedef byte_t subunit_t;
37 typedef byte_t opcode_t;
38 typedef byte_t plug_type_t;
39 typedef byte_t plug_id_t;
40 typedef byte_t reserved_t;
41 typedef byte_t function_block_type_t;
42 typedef byte_t function_block_id_t;
43 typedef byte_t control_attribute_t;
44 typedef byte_t plug_direction_t;
45 typedef byte_t plug_address_mode_t;
46 typedef byte_t status_t;
47 typedef byte_t number_of_channels_t;
48 typedef byte_t stream_format_t;
49 typedef byte_t sampling_frequency_t;
50 typedef byte_t rate_control_t;
51 typedef byte_t number_of_stream_format_infos_t;
52 typedef byte_t nr_of_plugs_t;
53 typedef byte_t subunit_id_t;
54 typedef byte_t subfunction_t;
55 typedef byte_t opcode_t;
56 typedef byte_t page_t;
57 typedef byte_t extension_code_t;
58 typedef byte_t subunit_type_t;
59 typedef byte_t max_subunit_id_t;
60 typedef byte_t nr_of_channels_t;
61 typedef byte_t stream_position_t;
62 typedef byte_t stream_position_location_t;
63 typedef byte_t nr_of_clusters_t;
64 typedef byte_t string_length_t;
65 typedef byte_t cluster_index_t;
66 typedef byte_t port_type_t;
67 typedef byte_t number_of_output_plugs_t;
68 typedef byte_t function_block_type_t;
69 typedef byte_t function_block_id_t;
70 typedef byte_t function_block_special_purpose_t;
71 typedef byte_t no_of_input_plugs_t;
72 typedef byte_t no_of_output_plugs_t;
73 typedef byte_t info_type_t;
74 typedef byte_t audio_channel_number_t;
75 typedef byte_t selector_length_t;
76 typedef byte_t control_selector_t;
77 typedef byte_t control_data_length_t;
78 typedef uint16_t control_data_ext_length_t;
79 typedef uint16_t mixer_level_t;
80 typedef byte_t mixer_programmable_state_t;
81 typedef byte_t input_fb_plug_number_t;
82 typedef byte_t input_audio_channel_number_t;
83 typedef byte_t output_audio_channel_number_t;
84 typedef byte_t status_selector_t;
85
86 typedef quadlet_t company_id_t;
87
88 #define AVC1394_SUBUNIT_AUDIO 1
89 #define AVC1394_SUBUNIT_PRINTER 2
90 #define AVC1394_SUBUNIT_CA 6
91 #define AVC1394_SUBUNIT_PANEL 9
92 #define AVC1394_SUBUNIT_BULLETIN_BOARD 0xA
93 #define AVC1394_SUBUNIT_CAMERA_STORAGE 0xB
94 #define AVC1394_SUBUNIT_MUSIC 0xC
95 #define AVC1394_SUBUNIT_RESERVED 0x1D
96
97 #define AVC1394_SUBUNIT_ID_RESERVED 0x06
98
99 enum ESubunitType {
100     eST_Monitor       = AVC1394_SUBUNIT_VIDEO_MONITOR,
101     eST_Audio         = AVC1394_SUBUNIT_AUDIO,
102     eST_Printer       = AVC1394_SUBUNIT_PRINTER,
103     eST_Disc          = AVC1394_SUBUNIT_DISC_RECORDER,
104     eST_VCR           = AVC1394_SUBUNIT_VCR,
105     eST_Tuner         = AVC1394_SUBUNIT_TUNER,
106     eST_CA            = AVC1394_SUBUNIT_CA,
107     eST_Camera        = AVC1394_SUBUNIT_VIDEO_CAMERA,
108     eST_Panel         = AVC1394_SUBUNIT_PANEL,
109     eST_BulltinBoard  = AVC1394_SUBUNIT_BULLETIN_BOARD,
110     eST_CameraStorage = AVC1394_SUBUNIT_CAMERA_STORAGE,
111     eST_Music         = AVC1394_SUBUNIT_MUSIC,
112     eST_VendorUnique  = AVC1394_SUBUNIT_VENDOR_UNIQUE,
113     eST_Reserved      = AVC1394_SUBUNIT_RESERVED,
114     eST_Extended      = AVC1394_SUBUNIT_EXTENDED,
115     eST_Unit          = AVC1394_SUBUNIT_UNIT,
116 };
117
118 enum ESubunitType byteToSubunitType(byte_t s);
119
120 /**
121  * \brief the possible sampling frequencies
122  */
123 enum ESamplingFrequency {
124     eSF_22050Hz = 0x00,
125     eSF_24000Hz = 0x01,
126     eSF_32000Hz = 0x02,
127     eSF_44100Hz = 0x03,
128     eSF_48000Hz = 0x04,
129     eSF_88200Hz = 0x0A,
130     eSF_96000Hz = 0x05,
131     eSF_176400Hz = 0x06,
132     eSF_192000Hz = 0x07,
133     eSF_AnyLow   = 0x0B,
134     eSF_AnyMid   = 0x0C,
135     eSF_AnyHigh  = 0x0D,
136     eSF_None     = 0x0E,
137     eSF_DontCare = 0x0F,
138 };
139
140 /**
141  * \brief Convert from ESamplingFrequency to an integer
142  * @param freq
143  * @return
144  */
145 int convertESamplingFrequency(ESamplingFrequency freq);
146 /**
147  * \brief Convert from integer to ESamplingFrequency
148  * @param sampleRate
149  * @return
150  */
151 ESamplingFrequency parseSampleRate( int sampleRate );
152
153 std::ostream& operator<<( std::ostream& stream, ESamplingFrequency samplingFrequency );
154
155 /**
156  * \brief Convert from a FDF SFC field value to an integer sample rate
157  * @param fdf fdf sfc field value
158  * @return sample rate
159  */
160 unsigned int fdfSfcToSampleRate(byte_t fdf);
161
162 /**
163  * \brief Convert from an integer sample rate to a78 FDF SFC field value
164  * @param rate integer sample rate
165  * @return fdf sfc field value
166  */
167 byte_t sampleRateToFdfSfc(unsigned int rate);
168
169 }
170
171 #endif // AVCDEFINITIONS_H
Note: See TracBrowser for help on using the browser.