root/trunk/libffado/src/genericavc/avc_avdevice.h

Revision 607, 3.1 kB (checked in by ppalmers, 13 years ago)

- Fix file-based discovery. The previous code used a pointer to a

vendormodel entry. This pointer however pointed to a VendorModel?
object that was created on the stack of the discover function.
Hence the pointer becomes invalid when the discover function is
exited.

The changes incorporate using a VendorModelEntry? struct instead
of a pointer to it. So now the FFADODevice has it's own copy of
this struct, instead of a pointer to it.

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 #ifndef GENERICAVC_AVDEVICE_H
26 #define GENERICAVC_AVDEVICE_H
27
28 #include "ffadodevice.h"
29 #include "genericavc/avc_vendormodel.h"
30
31 #include "libavc/avc_definitions.h"
32 #include "libavc/general/avc_unit.h"
33 #include "libavc/general/avc_subunit.h"
34 #include "libavc/general/avc_plug.h"
35
36 #include "libstreaming/AmdtpStreamProcessor.h"
37 #include "libstreaming/AmdtpPort.h"
38 #include "libstreaming/AmdtpPortInfo.h"
39
40 #include "debugmodule/debugmodule.h"
41
42 class ConfigRom;
43 class Ieee1394Service;
44
45 namespace GenericAVC {
46
47 class AvDevice : public FFADODevice, public AVC::Unit {
48 public:
49     AvDevice( Ieee1394Service& ieee1394Service,
50               std::auto_ptr<ConfigRom>( configRom ));
51     virtual ~AvDevice();
52
53     static bool probe( ConfigRom& configRom );
54     virtual bool discover();
55     static FFADODevice * createDevice( Ieee1394Service& ieee1394Service,
56                                         std::auto_ptr<ConfigRom>( configRom ));
57    
58     virtual void setVerboseLevel(int l);
59     virtual void showDevice();
60
61     virtual bool setSamplingFrequency( int );
62     virtual int getSamplingFrequency( );
63
64     virtual int getStreamCount();
65     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
66
67     virtual bool prepare();
68     virtual bool lock();
69     virtual bool unlock();
70
71     virtual bool startStreamByIndex(int i);
72     virtual bool stopStreamByIndex(int i);
73    
74     // redefinition to resolve ambiguity
75     virtual Ieee1394Service& get1394Service()
76         { return FFADODevice::get1394Service(); };
77     virtual ConfigRom& getConfigRom() const
78         { return FFADODevice::getConfigRom(); };
79        
80 protected:
81     virtual bool addPlugToProcessor( AVC::Plug& plug, Streaming::StreamProcessor *processor,
82                              Streaming::AmdtpAudioPort::E_Direction direction);
83 /*    bool setSamplingFrequencyPlug( AVC::Plug& plug,
84                                    AVC::Plug::EPlugDirection direction,
85                                    AVC::ESamplingFrequency samplingFrequency );*/
86    
87     struct VendorModelEntry m_model;
88    
89     // streaming stuff
90     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector;
91     StreamProcessorVector m_receiveProcessors;
92     StreamProcessorVector m_transmitProcessors;
93    
94     DECLARE_DEBUG_MODULE;
95 };
96
97 }
98
99 #endif //GENERICAVC_AVDEVICE_H
Note: See TracBrowser for help on using the browser.