root/branches/echoaudio/src/bebob/bebob_avdevice.h

Revision 509, 4.2 kB (checked in by ppalmers, 17 years ago)

- Moved all generic stuff but the functionblocks over to libavc
- compiles and works

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_AVDEVICE_H
25 #define BEBOB_AVDEVICE_H
26
27 #include <stdint.h>
28
29 #include "debugmodule/debugmodule.h"
30 #include "libavc/avc_definitions.h"
31 #include "libavc/general/avc_extended_cmd_generic.h"
32 #include "libavc/general/avc_unit.h"
33 #include "libavc/general/avc_subunit.h"
34 #include "libavc/general/avc_plug.h"
35
36 #include "bebob/bebob_avplug.h"
37 #include "bebob/bebob_avdevice_subunit.h"
38 #include "bebob/GenericMixer.h"
39
40 #include "libstreaming/AmdtpStreamProcessor.h"
41 #include "libstreaming/AmdtpPort.h"
42 #include "libstreaming/AmdtpPortInfo.h"
43
44 #include "libutil/serialize.h"
45
46 #include "ffadodevice.h"
47
48 #include <sstream>
49 #include <vector>
50
51 class ConfigRom;
52 class Ieee1394Service;
53
54 namespace BeBoB {
55
56 struct VendorModelEntry {
57     unsigned int vendor_id;
58     unsigned int model_id;
59     char *vendor_name;
60     char *model_name;
61 };
62
63 class AvDevice : public FFADODevice, public AVC::Unit {
64 public:
65     AvDevice( std::auto_ptr<ConfigRom>( configRom ),
66               Ieee1394Service& ieee1394Service,
67               int nodeId );
68     virtual ~AvDevice();
69
70     void setVerboseLevel(int l);
71
72     static bool probe( ConfigRom& configRom );
73     virtual bool discover();
74
75     virtual bool setSamplingFrequency( int );
76     virtual int getSamplingFrequency( );
77
78     virtual int getStreamCount();
79     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
80
81     virtual bool prepare();
82     bool lock();
83     bool unlock();
84
85     bool startStreamByIndex(int i);
86     bool stopStreamByIndex(int i);
87
88     virtual void showDevice();
89
90     bool setActiveSync( const SyncInfo& syncInfo );
91
92     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
93     static AvDevice* deserialize( Glib::ustring basePath,
94                                   Util::IODeserialize& deser,
95                                   Ieee1394Service& ieee1394Service );
96
97     // redefinition to resolve ambiguity
98     Ieee1394Service& get1394Service()
99         { return FFADODevice::get1394Service(); };
100     ConfigRom& getConfigRom() const
101         { return FFADODevice::getConfigRom(); };
102
103 protected:
104
105     bool enumerateSubUnits();
106
107     bool discoverPlugs();
108     bool discoverPlugsPCR( AVC::Plug::EPlugDirection plugDirection,
109                            AVC::plug_id_t plugMaxId );
110     bool discoverPlugsExternal( AVC::Plug::EPlugDirection plugDirection,
111                                 AVC::plug_id_t plugMaxId );
112     bool discoverPlugConnections();
113     bool discoverSyncModes();
114     bool discoverSubUnitsPlugConnections();
115
116     bool addPlugToProcessor( AVC::Plug& plug, Streaming::StreamProcessor *processor,
117                              Streaming::AmdtpAudioPort::E_Direction direction);
118
119     bool setSamplingFrequencyPlug( AVC::Plug& plug,
120                                    AVC::Plug::EPlugDirection direction,
121                                    AVC::ESamplingFrequency samplingFrequency );
122
123     bool checkSyncConnectionsAndAddToList( AVC::PlugVector& plhs,
124                                            AVC::PlugVector& prhs,
125                                            std::string syncDescription );
126
127 protected:
128     struct VendorModelEntry*  m_model;
129     GenericMixer*             m_Mixer;
130
131     // streaming stuff
132     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector;
133     StreamProcessorVector m_receiveProcessors;
134     StreamProcessorVector m_transmitProcessors;
135
136     DECLARE_DEBUG_MODULE;
137 };
138
139 }
140
141 #endif
Note: See TracBrowser for help on using the browser.