root/trunk/libffado/src/bebob/bebob_avdevice_subunit.h

Revision 612, 4.0 kB (checked in by ppalmers, 13 years ago)

- Remove dependencies between BeBoB and generic AVC code (functionblocks)
- Clean up the code at some places

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 BEBOB_AVDEVICESUBUNIT_H
25 #define BEBOB_AVDEVICESUBUNIT_H
26
27 #include "bebob/bebob_avplug.h"
28 #include "bebob/bebob_functionblock.h"
29
30 #include "debugmodule/debugmodule.h"
31 #include "libavc/general/avc_extended_subunit_info.h"
32 #include "libavc/avc_definitions.h"
33 #include "libavc/general/avc_generic.h"
34
35 #include <vector>
36
37 #include "libavc/general/avc_subunit.h"
38 #include "libavc/musicsubunit/avc_musicsubunit.h"
39 #include "libavc/audiosubunit/avc_audiosubunit.h"
40 #include "libavc/general/avc_plug.h"
41
42 namespace BeBoB {
43
44 /////////////////////////////
45
46 class SubunitAudio : public AVC::SubunitAudio
47 {
48 public:
49     SubunitAudio( AVC::Unit& avDevice,
50                   AVC::subunit_t id );
51     SubunitAudio();
52     virtual ~SubunitAudio();
53
54     virtual bool discover();
55     virtual bool discoverConnections();
56
57     virtual AVC::Plug *createPlug( AVC::Unit* unit,
58                                    AVC::Subunit* subunit,
59                                    AVC::function_block_type_t functionBlockType,
60                                    AVC::function_block_type_t functionBlockId,
61                                    AVC::Plug::EPlugAddressType plugAddressType,
62                                    AVC::Plug::EPlugDirection plugDirection,
63                                    AVC::plug_id_t plugId );
64
65     virtual const char* getName();
66     virtual FunctionBlockVector getFunctionBlocks() { return m_functions; };
67
68 protected:
69     bool discoverFunctionBlocks();
70     bool discoverFunctionBlocksDo(
71         AVC::ExtendedSubunitInfoCmd::EFunctionBlockType fbType );
72     bool createFunctionBlock(
73         AVC::ExtendedSubunitInfoCmd::EFunctionBlockType fbType,
74         AVC::ExtendedSubunitInfoPageData& data );
75
76     FunctionBlock::ESpecialPurpose convertSpecialPurpose(
77         AVC::function_block_special_purpose_t specialPurpose );
78
79     virtual bool serializeChild( Glib::ustring basePath,
80                                  Util::IOSerialize& ser ) const;
81     virtual bool deserializeChild( Glib::ustring basePath,
82                                    Util::IODeserialize& deser,
83                                    AVC::Unit& unit );
84
85 protected:
86      FunctionBlockVector m_functions;
87 };
88
89 /////////////////////////////
90
91 class SubunitMusic : public AVC::SubunitMusic
92 {
93  public:
94     SubunitMusic( AVC::Unit& avDevice,
95               AVC::subunit_t id );
96     SubunitMusic();
97     virtual ~SubunitMusic();
98
99     virtual bool discover();
100    
101     virtual AVC::Plug *createPlug( AVC::Unit* unit,
102                                    AVC::Subunit* subunit,
103                                    AVC::function_block_type_t functionBlockType,
104                                    AVC::function_block_type_t functionBlockId,
105                                    AVC::Plug::EPlugAddressType plugAddressType,
106                                    AVC::Plug::EPlugDirection plugDirection,
107                                    AVC::plug_id_t plugId );
108
109     virtual const char* getName();
110
111 protected:
112     virtual bool serializeChild( Glib::ustring basePath,
113                                  Util::IOSerialize& ser ) const;
114     virtual bool deserializeChild( Glib::ustring basePath,
115                                    Util::IODeserialize& deser,
116                                    AVC::Unit& unit );
117
118 };
119
120 }
121
122 #endif
Note: See TracBrowser for help on using the browser.