1 |
/* bebob_avdevice.h |
---|
2 |
* Copyright (C) 2005,06 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 |
#ifndef BEBOB_AVDEVICE_H |
---|
22 |
#define BEBOB_AVDEVICE_H |
---|
23 |
|
---|
24 |
#include <stdint.h> |
---|
25 |
|
---|
26 |
#include "debugmodule/debugmodule.h" |
---|
27 |
#include "libfreebobavc/avc_definitions.h" |
---|
28 |
#include "libfreebobavc/avc_extended_cmd_generic.h" |
---|
29 |
#include "libfreebob/xmlparser.h" |
---|
30 |
|
---|
31 |
#include "bebob/bebob_avplug.h" |
---|
32 |
#include "bebob/bebob_avdevice_subunit.h" |
---|
33 |
|
---|
34 |
#include "libstreaming/AmdtpStreamProcessor.h" |
---|
35 |
#include "libstreaming/AmdtpPort.h" |
---|
36 |
#include "libstreaming/AmdtpPortInfo.h" |
---|
37 |
|
---|
38 |
#include "libutil/serialize.h" |
---|
39 |
|
---|
40 |
#include "iavdevice.h" |
---|
41 |
|
---|
42 |
class ConfigRom; |
---|
43 |
class Ieee1394Service; |
---|
44 |
class SubunitPlugSpecificDataPlugAddress; |
---|
45 |
|
---|
46 |
namespace BeBoB { |
---|
47 |
|
---|
48 |
class AvDevice : public IAvDevice { |
---|
49 |
public: |
---|
50 |
AvDevice( std::auto_ptr<ConfigRom>( configRom ), |
---|
51 |
Ieee1394Service& ieee1394Service, |
---|
52 |
int nodeId, |
---|
53 |
int verboseLevel ); |
---|
54 |
virtual ~AvDevice(); |
---|
55 |
|
---|
56 |
static bool probe( ConfigRom& configRom ); |
---|
57 |
virtual bool discover(); |
---|
58 |
virtual ConfigRom& getConfigRom() const; |
---|
59 |
|
---|
60 |
virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); |
---|
61 |
virtual int getSamplingFrequency( ); |
---|
62 |
|
---|
63 |
virtual int getStreamCount(); |
---|
64 |
virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i); |
---|
65 |
|
---|
66 |
virtual bool prepare(); |
---|
67 |
|
---|
68 |
virtual int startStreamByIndex(int i); |
---|
69 |
virtual int stopStreamByIndex(int i); |
---|
70 |
|
---|
71 |
virtual bool addXmlDescription( xmlNodePtr deviceNode ); |
---|
72 |
virtual void showDevice() const; |
---|
73 |
virtual bool setId(unsigned int id); |
---|
74 |
|
---|
75 |
Ieee1394Service* get1394Service() |
---|
76 |
{ return m_1394Service; } |
---|
77 |
|
---|
78 |
AvPlugManager& getPlugManager() |
---|
79 |
{ return m_plugManager; } |
---|
80 |
|
---|
81 |
struct SyncInfo { |
---|
82 |
SyncInfo( AvPlug& source, |
---|
83 |
AvPlug& destination, |
---|
84 |
std::string description ) |
---|
85 |
: m_source( &source ) |
---|
86 |
, m_destination( &destination ) |
---|
87 |
, m_description( description ) |
---|
88 |
{} |
---|
89 |
AvPlug* m_source; |
---|
90 |
AvPlug* m_destination; |
---|
91 |
std::string m_description; |
---|
92 |
}; |
---|
93 |
|
---|
94 |
typedef std::vector<SyncInfo> SyncInfoVector; |
---|
95 |
const SyncInfoVector& getSyncInfos() const |
---|
96 |
{ return m_syncInfos; } |
---|
97 |
const SyncInfo* getActiveSyncInfo() const |
---|
98 |
{ return m_activeSyncInfo; } |
---|
99 |
bool setActiveSync( const SyncInfo& syncInfo ); |
---|
100 |
|
---|
101 |
bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ); |
---|
102 |
static AvDevice* deserialize( Glib::ustring basePath, |
---|
103 |
Util::IODeserialize& deser, |
---|
104 |
Ieee1394Service& ieee1394Service ); |
---|
105 |
|
---|
106 |
protected: |
---|
107 |
AvDevice(); |
---|
108 |
|
---|
109 |
bool enumerateSubUnits(); |
---|
110 |
|
---|
111 |
bool discoverPlugs(); |
---|
112 |
bool discoverPlugsPCR( AvPlug::EAvPlugDirection plugDirection, |
---|
113 |
plug_id_t plugMaxId ); |
---|
114 |
bool discoverPlugsExternal( AvPlug::EAvPlugDirection plugDirection, |
---|
115 |
plug_id_t plugMaxId ); |
---|
116 |
bool discoverPlugConnections(); |
---|
117 |
bool discoverSyncModes(); |
---|
118 |
bool discoverSubUnitsPlugConnections(); |
---|
119 |
|
---|
120 |
AvDeviceSubunit* getSubunit( subunit_type_t subunitType, |
---|
121 |
subunit_id_t subunitId ) const; |
---|
122 |
|
---|
123 |
unsigned int getNrOfSubunits( subunit_type_t subunitType ) const; |
---|
124 |
AvPlugConnection* getPlugConnection( AvPlug& srcPlug ) const; |
---|
125 |
|
---|
126 |
AvPlug* getSyncPlug( int maxPlugId, AvPlug::EAvPlugDirection ); |
---|
127 |
|
---|
128 |
AvPlug* getPlugById( AvPlugVector& plugs, |
---|
129 |
AvPlug::EAvPlugDirection plugDireciton, |
---|
130 |
int id ); |
---|
131 |
AvPlugVector getPlugsByType( AvPlugVector& plugs, |
---|
132 |
AvPlug::EAvPlugDirection plugDirection, |
---|
133 |
AvPlug::EAvPlugType type); |
---|
134 |
|
---|
135 |
bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor, |
---|
136 |
FreebobStreaming::AmdtpAudioPort::E_Direction direction); |
---|
137 |
|
---|
138 |
bool setSamplingFrequencyPlug( AvPlug& plug, |
---|
139 |
AvPlug::EAvPlugDirection direction, |
---|
140 |
ESamplingFrequency samplingFrequency ); |
---|
141 |
|
---|
142 |
void showAvPlugs( AvPlugVector& plugs ) const; |
---|
143 |
|
---|
144 |
bool checkSyncConnectionsAndAddToList( AvPlugVector& plhs, |
---|
145 |
AvPlugVector& prhs, |
---|
146 |
std::string syncDescription ); |
---|
147 |
protected: |
---|
148 |
std::auto_ptr<ConfigRom>( m_pConfigRom ); |
---|
149 |
Ieee1394Service* m_1394Service; |
---|
150 |
int m_nodeId; |
---|
151 |
int m_verboseLevel; |
---|
152 |
|
---|
153 |
AvPlugVector m_pcrPlugs; |
---|
154 |
AvPlugVector m_externalPlugs; |
---|
155 |
|
---|
156 |
AvPlugConnectionVector m_plugConnections; |
---|
157 |
|
---|
158 |
AvDeviceSubunitVector m_subunits; |
---|
159 |
|
---|
160 |
AvPlugManager m_plugManager; |
---|
161 |
|
---|
162 |
SyncInfoVector m_syncInfos; |
---|
163 |
SyncInfo* m_activeSyncInfo; |
---|
164 |
|
---|
165 |
unsigned int m_id; |
---|
166 |
|
---|
167 |
// streaming stuff |
---|
168 |
FreebobStreaming::AmdtpReceiveStreamProcessor *m_receiveProcessor; |
---|
169 |
int m_receiveProcessorBandwidth; |
---|
170 |
|
---|
171 |
FreebobStreaming::AmdtpTransmitStreamProcessor *m_transmitProcessor; |
---|
172 |
int m_transmitProcessorBandwidth; |
---|
173 |
|
---|
174 |
DECLARE_DEBUG_MODULE; |
---|
175 |
}; |
---|
176 |
|
---|
177 |
} |
---|
178 |
|
---|
179 |
#endif |
---|