1 |
/* mh_avdevice.cpp |
---|
2 |
* Copyright (C) 2007 by Pieter Palmers |
---|
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 |
#warning Metric Halo support is currently useless |
---|
22 |
|
---|
23 |
#include "metrichalo/mh_avdevice.h" |
---|
24 |
|
---|
25 |
#include "libieee1394/configrom.h" |
---|
26 |
#include "libieee1394/ieee1394service.h" |
---|
27 |
|
---|
28 |
#include "libavc/avc_definitions.h" |
---|
29 |
|
---|
30 |
#include "debugmodule/debugmodule.h" |
---|
31 |
|
---|
32 |
#include <string> |
---|
33 |
#include <stdint.h> |
---|
34 |
#include <assert.h> |
---|
35 |
#include <netinet/in.h> |
---|
36 |
#include <iostream> |
---|
37 |
#include <sstream> |
---|
38 |
|
---|
39 |
#include <libraw1394/csr.h> |
---|
40 |
|
---|
41 |
namespace MetricHalo { |
---|
42 |
|
---|
43 |
// to define the supported devices |
---|
44 |
static VendorModelEntry supportedDeviceList[] = |
---|
45 |
{ |
---|
46 |
{0x00000000, 0x0000, "Metric Halo", "XXX"}, |
---|
47 |
}; |
---|
48 |
|
---|
49 |
MHAvDevice::MHAvDevice( std::auto_ptr< ConfigRom >( configRom ), |
---|
50 |
Ieee1394Service& ieee1394service, |
---|
51 |
int nodeId ) |
---|
52 |
: IAvDevice( configRom, ieee1394service, nodeId ) |
---|
53 |
, m_model( NULL ) |
---|
54 |
|
---|
55 |
{ |
---|
56 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Created MetricHalo::MHAvDevice (NodeID %d)\n", |
---|
57 |
nodeId ); |
---|
58 |
} |
---|
59 |
|
---|
60 |
MHAvDevice::~MHAvDevice() |
---|
61 |
{ |
---|
62 |
|
---|
63 |
} |
---|
64 |
|
---|
65 |
bool |
---|
66 |
MHAvDevice::probe( ConfigRom& configRom ) |
---|
67 |
{ |
---|
68 |
unsigned int vendorId = configRom.getNodeVendorId(); |
---|
69 |
unsigned int modelId = configRom.getModelId(); |
---|
70 |
|
---|
71 |
for ( unsigned int i = 0; |
---|
72 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
73 |
++i ) |
---|
74 |
{ |
---|
75 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
76 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
77 |
) |
---|
78 |
{ |
---|
79 |
return true; |
---|
80 |
} |
---|
81 |
} |
---|
82 |
|
---|
83 |
return false; |
---|
84 |
} |
---|
85 |
|
---|
86 |
bool |
---|
87 |
MHAvDevice::discover() |
---|
88 |
{ |
---|
89 |
unsigned int vendorId = m_pConfigRom->getNodeVendorId(); |
---|
90 |
unsigned int modelId = m_pConfigRom->getModelId(); |
---|
91 |
|
---|
92 |
for ( unsigned int i = 0; |
---|
93 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
94 |
++i ) |
---|
95 |
{ |
---|
96 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
97 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
98 |
) |
---|
99 |
{ |
---|
100 |
m_model = &(supportedDeviceList[i]); |
---|
101 |
} |
---|
102 |
} |
---|
103 |
|
---|
104 |
if (m_model != NULL) { |
---|
105 |
debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", |
---|
106 |
m_model->vendor_name, m_model->model_name); |
---|
107 |
return true; |
---|
108 |
} |
---|
109 |
|
---|
110 |
return false; |
---|
111 |
} |
---|
112 |
|
---|
113 |
int |
---|
114 |
MHAvDevice::getSamplingFrequency( ) { |
---|
115 |
return 0; |
---|
116 |
} |
---|
117 |
|
---|
118 |
bool |
---|
119 |
MHAvDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) |
---|
120 |
{ |
---|
121 |
|
---|
122 |
return false; |
---|
123 |
} |
---|
124 |
|
---|
125 |
bool |
---|
126 |
MHAvDevice::lock() { |
---|
127 |
|
---|
128 |
return true; |
---|
129 |
} |
---|
130 |
|
---|
131 |
|
---|
132 |
bool |
---|
133 |
MHAvDevice::unlock() { |
---|
134 |
|
---|
135 |
return true; |
---|
136 |
} |
---|
137 |
|
---|
138 |
void |
---|
139 |
MHAvDevice::showDevice() |
---|
140 |
{ |
---|
141 |
debugOutput(DEBUG_LEVEL_VERBOSE, |
---|
142 |
"%s %s at node %d\n", m_model->vendor_name, m_model->model_name, |
---|
143 |
m_nodeId); |
---|
144 |
} |
---|
145 |
|
---|
146 |
bool |
---|
147 |
MHAvDevice::prepare() { |
---|
148 |
|
---|
149 |
return true; |
---|
150 |
} |
---|
151 |
|
---|
152 |
int |
---|
153 |
MHAvDevice::getStreamCount() { |
---|
154 |
return 0; |
---|
155 |
} |
---|
156 |
|
---|
157 |
Streaming::StreamProcessor * |
---|
158 |
MHAvDevice::getStreamProcessorByIndex(int i) { |
---|
159 |
|
---|
160 |
return NULL; |
---|
161 |
} |
---|
162 |
|
---|
163 |
bool |
---|
164 |
MHAvDevice::startStreamByIndex(int i) { |
---|
165 |
return false; |
---|
166 |
} |
---|
167 |
|
---|
168 |
bool |
---|
169 |
MHAvDevice::stopStreamByIndex(int i) { |
---|
170 |
return false; |
---|
171 |
} |
---|
172 |
|
---|
173 |
} |
---|