root/trunk/libffado/src/devicemanager.h

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

update license to GPLv2 or GPLv3 instead of GPLv2 or any later version. Update copyrights to reflect the new year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  * Copyright (C) 2005-2008 by Pieter Palmers
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 FFADODEVICEMANAGER_H
26 #define FFADODEVICEMANAGER_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include "libieee1394/configrom.h"
31 #include "libieee1394/ieee1394service.h"
32
33 #include "libstreaming/StreamProcessorManager.h"
34
35 #include "libutil/OptionContainer.h"
36 #include "libcontrol/BasicElements.h"
37
38 #include <glibmm/ustring.h>
39
40 #include <vector>
41 #include <string>
42
43 class Ieee1394Service;
44 class FFADODevice;
45 namespace Streaming {
46     class StreamProcessor;
47 }
48
49 typedef std::vector< FFADODevice* > FFADODeviceVector;
50 typedef std::vector< FFADODevice* >::iterator FFADODeviceVectorIterator;
51
52 typedef std::vector< Ieee1394Service* > Ieee1394ServiceVector;
53 typedef std::vector< Ieee1394Service* >::iterator Ieee1394ServiceVectorIterator;
54
55 typedef std::vector< Functor* > FunctorVector;
56 typedef std::vector< Functor* >::iterator FunctorVectorIterator;
57
58 class DeviceManager
59     : public Util::OptionContainer,
60       public Control::Container
61 {
62 public:
63     enum eWaitResult {
64         eWR_OK,
65         eWR_Xrun,
66         eWR_Error,
67     };
68
69     DeviceManager();
70     ~DeviceManager();
71
72     bool setThreadParameters(bool rt, int priority);
73
74     bool initialize();
75     bool deinitialize();
76
77     bool addSpecString(char *);
78     bool isSpecStringValid(std::string s);
79
80     bool discover(bool userCache=true);
81     bool initStreaming();
82     bool prepareStreaming();
83     bool finishStreaming();
84     bool startStreaming();
85     bool stopStreaming();
86     bool resetStreaming();
87     enum eWaitResult waitForPeriod();
88     bool setStreamingParams(unsigned int period, unsigned int rate, unsigned int nb_buffers);
89
90     bool isValidNode( int node );
91     int getNbDevices();
92     int getDeviceNodeId( int deviceNr );
93
94     FFADODevice* getAvDevice( int nodeId );
95     FFADODevice* getAvDeviceByIndex( int idx );
96     unsigned int getAvDeviceCount();
97
98     Streaming::StreamProcessor *getSyncSource();
99
100     void showDeviceInfo();
101     void showStreamingInfo();
102
103     // the Control::Container functions
104     virtual std::string getName()
105         {return "DeviceManager";};
106     virtual bool setName( std::string n )
107         { return false;};
108
109 protected:
110     FFADODevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ),
111                                      int id );
112     FFADODevice* getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) );
113
114     void busresetHandler();
115
116 protected:
117     // we have one service for each port
118     // found on the system. We don't allow dynamic addition of ports (yet)
119     Ieee1394ServiceVector   m_1394Services;
120     FFADODeviceVector       m_avDevices;
121     FunctorVector           m_busreset_functors;
122
123 public: // FIXME: this should be better
124     Streaming::StreamProcessorManager&  getStreamProcessorManager()
125         {return *m_processorManager;};
126 private:
127     Streaming::StreamProcessorManager*  m_processorManager;
128 protected:
129     std::vector<std::string>          m_SpecStrings;
130
131     bool m_thread_realtime;
132     int m_thread_priority;
133
134 // debug stuff
135 public:
136     void setVerboseLevel(int l);
137 private:
138     DECLARE_DEBUG_MODULE;
139 };
140
141 #endif
Note: See TracBrowser for help on using the browser.