root/branches/streaming-rework/src/bebob/bebob_avdevice_subunit.h

Revision 404, 4.5 kB (checked in by pieterpalmers, 17 years ago)

- introduce support framework for DICE and Metric Halo
- change probe/discovery code to make adding devices easier
- made conditional compilation effectively work.

./configure now has the following switches:

--enable-bebob build BeBoB support (default=yes)
--enable-motu build Motu support (default=no)
--enable-dice build DICE support (default=no)
--enable-metric-halo build Metric Halo support (note: completely useless)

(default=no)

--enable-rme build RME support (note: completely useless)

(default=no)

--enable-bounce build Bounce device support (default=no)
--enable-all-devices build support for all supported devices (default=no)

these now turn on/off compilation effectively.

Line 
1 /* bebob_avdevice_subunit.h
2  * Copyright (C) 2005,06,07 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 #ifdef ENABLE_BEBOB
22
23 #ifndef BEBOB_AVDEVICESUBUNIT_H
24 #define BEBOB_AVDEVICESUBUNIT_H
25
26 #include "bebob/bebob_avplug.h"
27 #include "bebob/bebob_functionblock.h"
28
29 #include "debugmodule/debugmodule.h"
30 #include "libfreebobavc/avc_extended_subunit_info.h"
31 #include "libfreebobavc/avc_definitions.h"
32 #include "libfreebobavc/avc_generic.h"
33
34 #include <vector>
35
36 namespace BeBoB {
37
38 class AvDevice;
39
40 class AvDeviceSubunit {
41  public:
42     AvDeviceSubunit( AvDevice& avDevice,
43                      AVCCommand::ESubunitType type,
44                      subunit_t id,
45                      int verboseLevel );
46     virtual ~AvDeviceSubunit();
47
48     virtual bool discover();
49     virtual bool discoverConnections();
50     virtual const char* getName() = 0;
51
52     bool addPlug( AvPlug& plug );
53
54     subunit_t getSubunitId()
55         { return m_sbId; }
56     AVCCommand::ESubunitType getSubunitType()
57         { return m_sbType; }
58
59     AvPlugVector& getPlugs()
60         { return m_plugs; }
61     AvPlug* getPlug(AvPlug::EAvPlugDirection direction, plug_id_t plugId);
62
63
64     AvDevice& getAvDevice() const
65         { return *m_avDevice; }
66
67
68     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
69     static AvDeviceSubunit* deserialize( Glib::ustring basePath,
70                                          Util::IODeserialize& deser,
71                                          AvDevice& avDevice );
72  protected:
73     AvDeviceSubunit();
74
75     bool discoverPlugs();
76     bool discoverPlugs(AvPlug::EAvPlugDirection plugDirection,
77                        plug_id_t plugMaxId );
78
79     virtual bool serializeChild( Glib::ustring basePath,
80                                  Util::IOSerialize& ser ) const = 0;
81     virtual bool deserializeChild( Glib::ustring basePath,
82                                    Util::IODeserialize& deser,
83                                    AvDevice& avDevice ) = 0;
84
85  protected:
86     AvDevice*                m_avDevice;
87     AVCCommand::ESubunitType m_sbType;
88     subunit_t                m_sbId;
89     int                      m_verboseLevel;
90
91     AvPlugVector             m_plugs;
92
93     DECLARE_DEBUG_MODULE;
94 };
95
96 typedef std::vector<AvDeviceSubunit*> AvDeviceSubunitVector;
97
98 /////////////////////////////
99
100 class AvDeviceSubunitAudio: public AvDeviceSubunit {
101  public:
102     AvDeviceSubunitAudio( AvDevice& avDevice,
103                           subunit_t id,
104                           int verboseLevel );
105     AvDeviceSubunitAudio();
106     virtual ~AvDeviceSubunitAudio();
107
108     virtual bool discover();
109     virtual bool discoverConnections();
110
111     virtual const char* getName();
112
113
114 protected:
115     bool discoverFunctionBlocks();
116     bool discoverFunctionBlocksDo(
117         ExtendedSubunitInfoCmd::EFunctionBlockType fbType );
118     bool createFunctionBlock(
119         ExtendedSubunitInfoCmd::EFunctionBlockType fbType,
120         ExtendedSubunitInfoPageData& data );
121
122     FunctionBlock::ESpecialPurpose convertSpecialPurpose(
123         function_block_special_purpose_t specialPurpose );
124
125     virtual bool serializeChild( Glib::ustring basePath,
126                                  Util::IOSerialize& ser ) const;
127     virtual bool deserializeChild( Glib::ustring basePath,
128                                    Util::IODeserialize& deser,
129                                    AvDevice& avDevice );
130
131 protected:
132     FunctionBlockVector m_functions;
133 };
134
135 /////////////////////////////
136
137 class AvDeviceSubunitMusic: public AvDeviceSubunit {
138  public:
139     AvDeviceSubunitMusic( AvDevice& avDevice,
140                           subunit_t id,
141                           int verboseLevel );
142     AvDeviceSubunitMusic();
143     virtual ~AvDeviceSubunitMusic();
144
145     virtual const char* getName();
146
147 protected:
148     virtual bool serializeChild( Glib::ustring basePath,
149                                  Util::IOSerialize& ser ) const;
150     virtual bool deserializeChild( Glib::ustring basePath,
151                                    Util::IODeserialize& deser,
152                                    AvDevice& avDevice );
153 };
154
155 }
156
157 #endif
158
159 #endif //#ifdef ENABLE_BEBOB
Note: See TracBrowser for help on using the browser.