root/trunk/libfreebob/src/bebob/bebob_avdevice.h

Revision 231, 3.5 kB (checked in by pieterpalmers, 18 years ago)

- implemented a hacked solution to the naming problem when using 2 identical devices. Now the port name is prefixed with "dev#?" with # being the device number (in order of discovery), and the ? being either "c" or "p", meaning "capture" or "playback". Note however that there is no guarantee that device 1 will be the same device next time you start up.

Line 
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 "iavdevice.h"
35
36 class ConfigRom;
37 class Ieee1394Service;
38 class SubunitPlugSpecificDataPlugAddress;
39
40 namespace BeBoB {
41
42 class AvDevice : public IAvDevice {
43 public:
44     AvDevice( Ieee1394Service& ieee1394Service,
45               int nodeId,
46               int verboseLevel );
47     virtual ~AvDevice();
48
49     virtual bool discover();
50     virtual ConfigRom& getConfigRom() const;
51     virtual bool addXmlDescription( xmlNodePtr deviceNode );
52     virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency );
53     virtual void showDevice() const;
54     virtual bool setId(unsigned int id);
55
56     Ieee1394Service* get1394Service()
57         { return m_1394Service; }
58
59     AvPlugManager& getPlugManager()
60         { return m_plugManager; }
61
62 protected:
63     bool enumerateSubUnits();
64
65     bool discoverPlugs();
66     bool discoverPlugsPCR( AvPlug::EAvPlugDirection plugDirection,
67                            plug_id_t plugMaxId );
68     bool discoverPlugsExternal( AvPlug::EAvPlugDirection plugDirection,
69                                 plug_id_t plugMaxId );
70     bool discoverPlugConnections();
71     bool discoverSyncModes();
72     bool discoverSubUnitsPlugConnections();
73
74     AvDeviceSubunit* getSubunit( subunit_type_t subunitType,
75                                  subunit_id_t subunitId ) const;
76
77     unsigned int getNrOfSubunits( subunit_type_t subunitType ) const;
78     AvPlugConnection* getPlugConnection( AvPlug& srcPlug ) const;
79
80     AvPlug* getSyncPlug( int maxPlugId, AvPlug::EAvPlugDirection );
81
82     AvPlug* getPlugById( AvPlugVector& plugs,
83                          AvPlug::EAvPlugDirection plugDireciton,
84                          int id );
85     AvPlugVector getPlugsByType( AvPlugVector& plugs,
86                                  AvPlug::EAvPlugDirection plugDirection,
87                                  AvPlug::EAvPlugType type);
88
89     bool setSamplingFrequencyPlug( AvPlug& plug,
90                                    AvPlug::EAvPlugDirection direction,
91                                    ESamplingFrequency samplingFrequency );
92
93     void showAvPlugs( AvPlugVector& plugs ) const;
94
95     bool checkSyncConnections( AvPlugVector& plhs, AvPlugVector& prhs );
96 protected:
97     Ieee1394Service* m_1394Service;
98     ConfigRom*       m_configRom;
99     int              m_nodeId;
100     int              m_verboseLevel;
101
102     AvPlugVector     m_pcrPlugs;
103     AvPlugVector     m_externalPlugs;
104
105     AvPlugConnectionVector m_plugConnections;
106
107     AvDeviceSubunitVector  m_subunits;
108
109     AvPlugManager    m_plugManager;
110
111     DECLARE_DEBUG_MODULE;
112 };
113
114 }
115
116 #endif
Note: See TracBrowser for help on using the browser.