root/branches/libffado-2.0/src/genericavc/avc_avdevice.h

Revision 1299, 3.8 kB (checked in by ppalmers, 13 years ago)

implement configuration file mechanism to ease device support and packaging. this mechanism replaces the vendormodel text files. it loads two files, one system-wide and a second in the user directory. the user config file takes precedence. this should ease adding
device id's on a per-user base. it also allows for other settings to be carried by the same 'Configuration' object (present in the devicemanager). The idea is that it will also replace the OptionContainer? mechanism on the long run, and allow for easy integration
of system options (e.g. the pre-transmit amount).

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  * Copyright (C) 2005-2008 by Daniel Wagner
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef GENERICAVC_AVDEVICE_H
26 #define GENERICAVC_AVDEVICE_H
27
28 #include "ffadodevice.h"
29 #include "libutil/Configuration.h"
30
31 #include "libavc/avc_definitions.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 "libstreaming/amdtp/AmdtpReceiveStreamProcessor.h"
37 #include "libstreaming/amdtp/AmdtpTransmitStreamProcessor.h"
38 #include "libstreaming/amdtp/AmdtpPort.h"
39 #include "libstreaming/amdtp/AmdtpPortInfo.h"
40
41 #include "debugmodule/debugmodule.h"
42
43 class ConfigRom;
44 class Ieee1394Service;
45
46 namespace GenericAVC {
47
48 class AvDevice : public FFADODevice, public AVC::Unit {
49 public:
50     AvDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ));
51     virtual ~AvDevice();
52
53     static bool probe( Util::Configuration&, ConfigRom& configRom, bool generic = false );
54     virtual bool discover();
55     bool discoverGeneric();
56     static FFADODevice * createDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ));
57
58     virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const;
59     virtual bool deserialize( std::string basePath, Util::IODeserialize& deser );
60
61     virtual void setVerboseLevel(int l);
62     virtual void showDevice();
63
64     virtual bool setSamplingFrequency( int );
65     virtual bool supportsSamplingFrequency( int s );
66     virtual int getSamplingFrequency( );
67     virtual std::vector<int> getSupportedSamplingFrequencies();
68
69     virtual ClockSourceVector getSupportedClockSources();
70     virtual bool setActiveClockSource(ClockSource);
71     virtual ClockSource getActiveClockSource();
72
73     virtual int getStreamCount();
74     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
75
76     virtual bool prepare();
77     virtual bool lock();
78     virtual bool unlock();
79
80     virtual bool startStreamByIndex(int i);
81     virtual bool stopStreamByIndex(int i);
82
83     // redefinition to resolve ambiguity
84     virtual Ieee1394Service& get1394Service()
85         { return FFADODevice::get1394Service(); };
86     virtual ConfigRom& getConfigRom() const
87         { return FFADODevice::getConfigRom(); };
88
89 protected:
90     virtual bool addPlugToProcessor( AVC::Plug& plug, Streaming::StreamProcessor *processor,
91                              Streaming::AmdtpAudioPort::E_Direction direction);
92 /*    bool setSamplingFrequencyPlug( AVC::Plug& plug,
93                                    AVC::Plug::EPlugDirection direction,
94                                    AVC::ESamplingFrequency samplingFrequency );*/
95
96     // streaming stuff
97     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector;
98     typedef std::vector< Streaming::StreamProcessor * >::iterator StreamProcessorVectorIterator;
99     StreamProcessorVector m_receiveProcessors;
100     StreamProcessorVector m_transmitProcessors;
101
102     DECLARE_DEBUG_MODULE;
103
104 private:
105     ClockSource syncInfoToClockSource(const SyncInfo& si);
106     std::vector<int> m_supported_frequencies_cache;
107 };
108
109 }
110
111 #endif //GENERICAVC_AVDEVICE_H
Note: See TracBrowser for help on using the browser.