root/branches/ppalmers-streaming/src/genericavc/avc_avdevice.cpp

Revision 715, 22.9 kB (checked in by ppalmers, 16 years ago)

some more cleaning

Line 
1 /*
2  * Copyright (C) 2005-2007 by Pieter Palmers
3  * Copyright (C) 2005-2007 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 library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License version 2.1, as published by the Free Software Foundation;
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22  * MA 02110-1301 USA
23  */
24
25 #include "genericavc/avc_avdevice.h"
26
27 #include "libieee1394/configrom.h"
28 #include "libieee1394/ieee1394service.h"
29
30 #include "libavc/avc_definitions.h"
31 #include "libavc/general/avc_plug_info.h"
32 #include "libavc/general/avc_extended_plug_info.h"
33
34 #include "debugmodule/debugmodule.h"
35
36 #include "config.h"
37
38 #include <string>
39 #include <stdint.h>
40 #include <assert.h>
41 #include <netinet/in.h>
42 #include <iostream>
43 #include <sstream>
44
45 #include <libraw1394/csr.h>
46
47 using namespace AVC;
48
49 namespace GenericAVC {
50
51 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_VERBOSE );
52
53
54 AvDevice::AvDevice( Ieee1394Service& ieee1394Service,
55                     std::auto_ptr<ConfigRom>( configRom ))
56     : FFADODevice( ieee1394Service, configRom )
57 {
58     debugOutput( DEBUG_LEVEL_VERBOSE, "Created GenericAVC::AvDevice (NodeID %d)\n",
59                  getConfigRom().getNodeId() );
60     addOption(Util::OptionContainer::Option("snoopMode",false));
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     GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" );
75     if ( vendorModel.parse() ) {
76         return vendorModel.isPresent( vendorId, modelId );
77     }
78
79     return false;
80 }
81
82 FFADODevice *
83 AvDevice::createDevice( Ieee1394Service& ieee1394Service,
84                         std::auto_ptr<ConfigRom>( configRom ))
85 {
86     return new AvDevice(ieee1394Service, configRom );
87 }
88
89 bool
90 AvDevice::discover()
91 {
92     // check if we already have a valid VendorModel entry
93     // e.g. because a subclass called this function
94     if (!GenericAVC::VendorModel::isValid(m_model)) {
95         unsigned int vendorId = m_pConfigRom->getNodeVendorId();
96         unsigned int modelId = m_pConfigRom->getModelId();
97
98         GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" );
99         if ( vendorModel.parse() ) {
100             m_model = vendorModel.find( vendorId, modelId );
101         }
102
103         if (!GenericAVC::VendorModel::isValid(m_model)) {
104             return false;
105         }
106         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
107                 m_model.vendor_name.c_str(), m_model.model_name.c_str());
108     }
109
110     if ( !Unit::discover() ) {
111         debugError( "Could not discover unit\n" );
112         return false;
113     }
114
115     if((getAudioSubunit( 0 ) == NULL)) {
116         debugError( "Unit doesn't have an Audio subunit.\n");
117         return false;
118     }
119     if((getMusicSubunit( 0 ) == NULL)) {
120         debugError( "Unit doesn't have a Music subunit.\n");
121         return false;
122     }
123
124     return true;
125 }
126
127 void
128 AvDevice::setVerboseLevel(int l)
129 {
130     debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l );
131
132     m_pPlugManager->setVerboseLevel(l);
133
134     FFADODevice::setVerboseLevel(l);
135     AVC::Unit::setVerboseLevel(l);
136 }
137
138 int
139 AvDevice::getSamplingFrequency( ) {
140     AVC::Plug* inputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Input, 0 );
141     if ( !inputPlug ) {
142         debugError( "setSampleRate: Could not retrieve iso input plug 0\n" );
143         return false;
144     }
145     AVC::Plug* outputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Output, 0 );
146     if ( !outputPlug ) {
147         debugError( "setSampleRate: Could not retrieve iso output plug 0\n" );
148         return false;
149     }
150
151     int samplerate_playback=inputPlug->getSampleRate();
152     int samplerate_capture=outputPlug->getSampleRate();
153
154     if (samplerate_playback != samplerate_capture) {
155         debugWarning("Samplerates for capture and playback differ!\n");
156     }
157     return samplerate_capture;
158 }
159
160 bool
161 AvDevice::setSamplingFrequency( int s )
162 {
163     bool snoopMode=false;
164     if(!getOption("snoopMode", snoopMode)) {
165         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n");
166     }
167
168     if(snoopMode) {
169         int current_sr=getSamplingFrequency();
170         if (current_sr != s ) {
171             debugError("In snoop mode it is impossible to set the sample rate.\n");
172             debugError("Please start the client with the correct setting.\n");
173             return false;
174         }
175         return true;
176     } else {
177         AVC::Plug* plug = getPlugById( m_pcrPlugs, Plug::eAPD_Input, 0 );
178         if ( !plug ) {
179             debugError( "setSampleRate: Could not retrieve iso input plug 0\n" );
180             return false;
181         }
182
183         if ( !plug->setSampleRate( s ) )
184         {
185             debugError( "setSampleRate: Setting sample rate failed\n" );
186             return false;
187         }
188
189         plug = getPlugById( m_pcrPlugs, Plug::eAPD_Output,  0 );
190         if ( !plug ) {
191             debugError( "setSampleRate: Could not retrieve iso output plug 0\n" );
192             return false;
193         }
194
195         if ( !plug->setSampleRate( s ) )
196         {
197             debugError( "setSampleRate: Setting sample rate failed\n" );
198             return false;
199         }
200
201         debugOutput( DEBUG_LEVEL_VERBOSE,
202                      "setSampleRate: Set sample rate to %d\n",
203                      s );
204         return true;
205     }
206     // not executable
207     return false;
208
209 }
210
211 FFADODevice::ClockSourceVector
212 AvDevice::getSupportedClockSources() {
213     FFADODevice::ClockSourceVector r;
214
215     PlugVector syncMSUInputPlugs = m_pPlugManager->getPlugsByType(
216         eST_Music,
217         0,
218         0xff,
219         0xff,
220         Plug::eAPA_SubunitPlug,
221         Plug::eAPD_Input,
222         Plug::eAPT_Sync );
223     if ( !syncMSUInputPlugs.size() ) {
224         debugWarning( "No sync input plug for MSU subunit found\n" );
225         return r;
226     }
227
228     for ( SyncInfoVector::const_iterator it
229               = getSyncInfos().begin();
230           it != getSyncInfos().end();
231           ++it )
232     {
233         const SyncInfo si=*it;
234
235         // check if the destination is a MSU input plug
236         bool found=false;
237         for ( PlugVector::const_iterator it2 = syncMSUInputPlugs.begin();
238             it2 != syncMSUInputPlugs.end();
239             ++it2 )
240         {
241             AVC::Plug* msuPlug = *it2;
242             found |= (msuPlug == si.m_destination);
243         }
244
245         if (found) {
246             ClockSource s=syncInfoToClockSource(*it);
247             r.push_back(s);
248         }
249     }
250
251     return r;
252 }
253
254 bool
255 AvDevice::setActiveClockSource(ClockSource s) {
256     Plug *src=m_pPlugManager->getPlug( s.id );
257     if (!src) {
258         debugError("Could not find plug with id %d\n", s.id);
259         return false;
260     }
261
262     for ( SyncInfoVector::const_iterator it
263               = getSyncInfos().begin();
264           it != getSyncInfos().end();
265           ++it )
266     {
267         const SyncInfo si=*it;
268
269         if (si.m_source==src) {
270             return setActiveSync(si);
271         }
272     }
273
274     return false;
275 }
276
277 FFADODevice::ClockSource
278 AvDevice::getActiveClockSource() {
279     const SyncInfo* si=getActiveSyncInfo();
280     if ( !si ) {
281         debugError( "Could not retrieve active sync information\n" );
282         ClockSource s;
283         s.type=eCT_Invalid;
284         return s;
285     }
286     debugOutput(DEBUG_LEVEL_VERBOSE, "Active Sync mode:  %s\n", si->m_description.c_str() );
287
288     return syncInfoToClockSource(*si);
289 }
290
291 FFADODevice::ClockSource
292 AvDevice::syncInfoToClockSource(const SyncInfo& si) {
293     ClockSource s;
294
295     // the description is easy
296     // it can be that we overwrite it later
297     s.description=si.m_description;
298
299     // FIXME: always valid at the moment
300     s.valid=true;
301
302     assert(si.m_source);
303     s.id=si.m_source->getGlobalId();
304
305     // now figure out what type this is
306     switch(si.m_source->getPlugType()) {
307         case Plug::eAPT_IsoStream:
308             s.type=eCT_SytMatch;
309             break;
310         case Plug::eAPT_Sync:
311             if(si.m_source->getPlugAddressType() == Plug::eAPA_PCR) {
312                 s.type=eCT_SytStream; // this is logical
313             } else if(si.m_source->getPlugAddressType() == Plug::eAPA_SubunitPlug) {
314                 s.type=eCT_Internal; // this assumes some stuff
315             } else if(si.m_source->getPlugAddressType() == Plug::eAPA_ExternalPlug) {
316                 std::string plugname=si.m_source->getName();
317                 s.description=plugname;
318                 // this is basically due to Focusrites interpretation
319                 if(plugname.find( "SPDIF", 0 ) != string::npos) {
320                     s.type=eCT_SPDIF; // this assumes the name will tell us
321                 } else {
322                     s.type=eCT_WordClock; // this assumes a whole lot more
323                 }
324             } else {
325                 s.type=eCT_Invalid;
326             }
327             break;
328         case Plug::eAPT_Digital:
329             if(si.m_source->getPlugAddressType() == Plug::eAPA_ExternalPlug) {
330                 std::string plugname=si.m_source->getName();
331                 s.description=plugname;
332                 // this is basically due to Focusrites interpretation
333                 if(plugname.find( "ADAT", 0 ) != string::npos) {
334                     s.type=eCT_ADAT; // this assumes the name will tell us
335                 } else if(plugname.find( "SPDIF", 0 ) != string::npos) {
336                     s.type=eCT_SPDIF; // this assumes the name will tell us
337                 } else {
338                     s.type=eCT_WordClock; // this assumes a whole lot more
339                 }
340             } else {
341                 s.type=eCT_Invalid;
342             }
343             break;
344         default:
345             s.type=eCT_Invalid; break;
346     }
347
348     // is it active?
349     const SyncInfo* active=getActiveSyncInfo();
350     if (active) {
351         if ((active->m_source == si.m_source)
352            && (active->m_destination == si.m_destination))
353            s.active=true;
354         else s.active=false;
355     } else s.active=false;
356
357     return s;
358 }
359
360 bool
361 AvDevice::lock() {
362     bool snoopMode=false;
363     if(!getOption("snoopMode", snoopMode)) {
364         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n");
365     }
366
367     if (snoopMode) {
368         // don't lock
369     } else {
370 //         return Unit::reserve(4);
371     }
372
373     return true;
374 }
375
376 bool
377 AvDevice::unlock() {
378     bool snoopMode=false;
379     if(!getOption("snoopMode", snoopMode)) {
380         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n");
381     }
382
383     if (snoopMode) {
384         // don't unlock
385     } else {
386 //         return Unit::reserve(0);
387     }
388     return true;
389 }
390
391 void
392 AvDevice::showDevice()
393 {
394     FFADODevice::showDevice();
395
396     debugOutput(DEBUG_LEVEL_NORMAL,
397         "%s %s\n", m_model.vendor_name.c_str(), m_model.model_name.c_str());
398
399     AVC::Unit::show();
400     flushDebugOutput();
401 }
402
403 bool
404 AvDevice::prepare() {
405     bool snoopMode=false;
406     if(!getOption("snoopMode", snoopMode)) {
407         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n");
408     }
409
410     ///////////
411     // get plugs
412
413     AVC::Plug* inputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Input, 0 );
414     if ( !inputPlug ) {
415         debugError( "setSampleRate: Could not retrieve iso input plug 0\n" );
416         return false;
417     }
418     AVC::Plug* outputPlug = getPlugById( m_pcrPlugs, Plug::eAPD_Output, 0 );
419     if ( !outputPlug ) {
420         debugError( "setSampleRate: Could not retrieve iso output plug 0\n" );
421         return false;
422     }
423
424     int samplerate=outputPlug->getSampleRate();
425
426     debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing receive processor...\n");
427     // create & add streamprocessors
428     Streaming::StreamProcessor *p;
429
430     p=new Streaming::AmdtpReceiveStreamProcessor(
431                              get1394Service().getPort(),
432                              outputPlug->getNrOfChannels());
433
434     if(!p->init()) {
435         debugFatal("Could not initialize receive processor!\n");
436         delete p;
437         return false;
438     }
439
440     if (!addPlugToProcessor(*outputPlug,p,
441         Streaming::Port::E_Capture)) {
442         debugFatal("Could not add plug to processor!\n");
443         delete p;
444         return false;
445     }
446
447     m_receiveProcessors.push_back(p);
448
449     // do the transmit processor
450     debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing transmit processor%s...\n",
451             (snoopMode?" in snoop mode":""));
452     if (snoopMode) {
453         // we are snooping, so this is receive too.
454         p=new Streaming::AmdtpReceiveStreamProcessor(
455                                   get1394Service().getPort(),
456                                   inputPlug->getNrOfChannels());
457     } else {
458         p=new Streaming::AmdtpTransmitStreamProcessor(
459                                 get1394Service().getPort(),
460                                 inputPlug->getNrOfChannels());
461     }
462
463     if(!p->init()) {
464         debugFatal("Could not initialize transmit processor %s!\n",
465             (snoopMode?" in snoop mode":""));
466         delete p;
467         return false;
468     }
469
470     if (snoopMode) {
471         if (!addPlugToProcessor(*inputPlug,p,
472             Streaming::Port::E_Capture)) {
473             debugFatal("Could not add plug to processor!\n");
474             return false;
475         }
476     } else {
477         if (!addPlugToProcessor(*inputPlug,p,
478             Streaming::Port::E_Playback)) {
479             debugFatal("Could not add plug to processor!\n");
480             return false;
481         }
482     }
483
484     // we put this SP into the transmit SP vector,
485     // no matter if we are in snoop mode or not
486     // this allows us to find out what direction
487     // a certain stream should have.
488     m_transmitProcessors.push_back(p);
489
490     return true;
491 }
492
493 bool
494 AvDevice::addPlugToProcessor(
495     AVC::Plug& plug,
496     Streaming::StreamProcessor *processor,
497     Streaming::AmdtpAudioPort::E_Direction direction) {
498
499     std::string id=std::string("dev?");
500     if(!getOption("id", id)) {
501         debugWarning("Could not retrieve id parameter, defauling to 'dev?'\n");
502     }
503
504     Plug::ClusterInfoVector& clusterInfos = plug.getClusterInfos();
505     for ( Plug::ClusterInfoVector::const_iterator it = clusterInfos.begin();
506           it != clusterInfos.end();
507           ++it )
508     {
509         const Plug::ClusterInfo* clusterInfo = &( *it );
510
511         Plug::ChannelInfoVector channelInfos = clusterInfo->m_channelInfos;
512         for ( Plug::ChannelInfoVector::const_iterator it = channelInfos.begin();
513               it != channelInfos.end();
514               ++it )
515         {
516             const Plug::ChannelInfo* channelInfo = &( *it );
517             std::ostringstream portname;
518
519             portname << id << "_" << channelInfo->m_name;
520
521             Streaming::Port *p=NULL;
522             switch(clusterInfo->m_portType) {
523             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Speaker:
524             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Headphone:
525             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Microphone:
526             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Line:
527             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Analog:
528                 debugOutput(DEBUG_LEVEL_VERBOSE, " Adding audio channel %s (pos=0x%02X, loc=0x%02X)\n",
529                     channelInfo->m_name.c_str(), channelInfo->m_streamPosition, channelInfo->m_location);
530                 p=new Streaming::AmdtpAudioPort(
531                         portname.str(),
532                         direction,
533                         channelInfo->m_streamPosition,
534                         channelInfo->m_location,
535                         Streaming::AmdtpPortInfo::E_MBLA
536                 );
537                 break;
538
539             case ExtendedPlugInfoClusterInfoSpecificData::ePT_MIDI:
540                 debugOutput(DEBUG_LEVEL_VERBOSE, " Adding MIDI channel %s (pos=0x%02X, loc=0x%02X)\n",
541                     channelInfo->m_name.c_str(), channelInfo->m_streamPosition, processor->getPortCount(Streaming::Port::E_Midi));
542                 p=new Streaming::AmdtpMidiPort(
543                         portname.str(),
544                         direction,
545                         channelInfo->m_streamPosition,
546                         // Workaround for out-of-spec hardware
547                         // should be:
548                         // channelInfo->m_location,
549                         // but now we renumber the midi channels' location as they
550                         // are discovered
551                         processor->getPortCount(Streaming::Port::E_Midi),
552                         Streaming::AmdtpPortInfo::E_Midi
553                 );
554
555                 break;
556             case ExtendedPlugInfoClusterInfoSpecificData::ePT_SPDIF:
557             case ExtendedPlugInfoClusterInfoSpecificData::ePT_ADAT:
558             case ExtendedPlugInfoClusterInfoSpecificData::ePT_TDIF:
559             case ExtendedPlugInfoClusterInfoSpecificData::ePT_MADI:
560             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Digital:
561                 debugOutput(DEBUG_LEVEL_VERBOSE, " Adding digital audio channel %s (pos=0x%02X, loc=0x%02X)\n",
562                     channelInfo->m_name.c_str(), channelInfo->m_streamPosition, channelInfo->m_location);
563                 p=new Streaming::AmdtpAudioPort(
564                         portname.str(),
565                         direction,
566                         channelInfo->m_streamPosition,
567                         channelInfo->m_location,
568                         Streaming::AmdtpPortInfo::E_MBLA
569                 );
570                 break;
571
572             case ExtendedPlugInfoClusterInfoSpecificData::ePT_NoType:
573             default:
574             // unsupported
575                 break;
576             }
577
578             if (!p) {
579                 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",channelInfo->m_name.c_str());
580             } else {
581
582                 if (!processor->addPort(p)) {
583                     debugWarning("Could not register port with stream processor\n");
584                     return false;
585                 }
586             }
587          }
588     }
589     return true;
590 }
591
592 int
593 AvDevice::getStreamCount() {
594     return m_receiveProcessors.size() + m_transmitProcessors.size();
595 }
596
597 Streaming::StreamProcessor *
598 AvDevice::getStreamProcessorByIndex(int i) {
599
600     if (i<(int)m_receiveProcessors.size()) {
601         return m_receiveProcessors.at(i);
602     } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) {
603         return m_transmitProcessors.at(i-m_receiveProcessors.size());
604     }
605
606     return NULL;
607 }
608
609 bool
610 AvDevice::startStreamByIndex(int i) {
611     int iso_channel=-1;
612     bool snoopMode=false;
613     if(!getOption("snoopMode", snoopMode)) {
614         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n");
615     }
616
617     if (i<(int)m_receiveProcessors.size()) {
618         int n=i;
619         Streaming::StreamProcessor *p=m_receiveProcessors.at(n);
620
621         if(snoopMode) { // a stream from the device to another host
622             // FIXME: put this into a decent framework!
623             // we should check the oPCR[n] on the device
624             struct iec61883_oPCR opcr;
625             if (iec61883_get_oPCRX(
626                     get1394Service().getHandle(),
627                     m_pConfigRom->getNodeId() | 0xffc0,
628                     (quadlet_t *)&opcr,
629                     n)) {
630
631                 debugWarning("Error getting the channel for SP %d\n",i);
632                 return false;
633             }
634
635             iso_channel=opcr.channel;
636         } else {
637             iso_channel=get1394Service().allocateIsoChannelCMP(
638                 m_pConfigRom->getNodeId() | 0xffc0, n,
639                 get1394Service().getLocalNodeId()| 0xffc0, -1);
640         }
641         if (iso_channel<0) {
642             debugError("Could not allocate ISO channel for SP %d\n",i);
643             return false;
644         }
645
646         debugOutput(DEBUG_LEVEL_VERBOSE, "Started SP %d on channel %d\n",i,iso_channel);
647
648         p->setChannel(iso_channel);
649         return true;
650
651     } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) {
652         int n=i-m_receiveProcessors.size();
653         Streaming::StreamProcessor *p=m_transmitProcessors.at(n);
654
655         if(snoopMode) { // a stream from another host to the device
656             // FIXME: put this into a decent framework!
657             // we should check the iPCR[n] on the device
658             struct iec61883_iPCR ipcr;
659             if (iec61883_get_iPCRX(
660                     get1394Service().getHandle(),
661                     m_pConfigRom->getNodeId() | 0xffc0,
662                     (quadlet_t *)&ipcr,
663                     n)) {
664
665                 debugWarning("Error getting the channel for SP %d\n",i);
666                 return false;
667             }
668
669             iso_channel=ipcr.channel;
670
671         } else {
672             iso_channel=get1394Service().allocateIsoChannelCMP(
673                 get1394Service().getLocalNodeId()| 0xffc0, -1,
674                 m_pConfigRom->getNodeId() | 0xffc0, n);
675         }
676
677         if (iso_channel<0) {
678             debugError("Could not allocate ISO channel for SP %d\n",i);
679             return false;
680         }
681
682         debugOutput(DEBUG_LEVEL_VERBOSE, "Started SP %d on channel %d\n",i,iso_channel);
683
684         p->setChannel(iso_channel);
685         return true;
686     }
687
688     debugError("SP index %d out of range!\n",i);
689     return false;
690 }
691
692 bool
693 AvDevice::stopStreamByIndex(int i) {
694     bool snoopMode=false;
695     if(!getOption("snoopMode", snoopMode)) {
696         debugWarning("Could not retrieve snoopMode parameter, defauling to false\n");
697     }
698
699     if (i<(int)m_receiveProcessors.size()) {
700         int n=i;
701         Streaming::StreamProcessor *p=m_receiveProcessors.at(n);
702
703         if(snoopMode) {
704
705         } else {
706             // deallocate ISO channel
707             if(!get1394Service().freeIsoChannel(p->getChannel())) {
708                 debugError("Could not deallocate iso channel for SP %d\n",i);
709                 return false;
710             }
711         }
712         p->setChannel(-1);
713
714         return true;
715
716     } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) {
717         int n=i-m_receiveProcessors.size();
718         Streaming::StreamProcessor *p=m_transmitProcessors.at(n);
719
720         if(snoopMode) {
721
722         } else {
723             // deallocate ISO channel
724             if(!get1394Service().freeIsoChannel(p->getChannel())) {
725                 debugError("Could not deallocate iso channel for SP %d\n",i);
726                 return false;
727             }
728         }
729         p->setChannel(-1);
730
731         return true;
732     }
733
734     debugError("SP index %d out of range!\n",i);
735     return false;
736 }
737
738 bool
739 AvDevice::serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const
740 {
741     bool result;
742     result  = AVC::Unit::serialize( basePath, ser );
743     result &= serializeOptions( basePath + "Options", ser );
744     return result;
745 }
746
747 bool
748 AvDevice::deserialize( Glib::ustring basePath, Util::IODeserialize& deser )
749 {
750     bool result;
751     result = AVC::Unit::deserialize( basePath, deser );
752     return result;
753 }
754
755 }
Note: See TracBrowser for help on using the browser.