root/branches/echoaudio/src/genericavc/avc_avdevice.cpp

Revision 475, 3.6 kB (checked in by ppalmers, 17 years ago)

- Add Generic AV/C device

Currently this is a placeholder

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