root/branches/libfreebob-2.0/src/libstreaming/IsoHandler.h

Revision 199, 3.0 kB (checked in by pieterpalmers, 18 years ago)

- start of a new streaming API implementation, C++ based

Line 
1 /* $Id$ */
2
3 /*
4  *   FreeBob Streaming API
5  *   FreeBob = Firewire (pro-)audio for linux
6  *
7  *   http://freebob.sf.net
8  *
9  *   Copyright (C) 2006 Pieter Palmers <pieterpalmers@users.sourceforge.net>
10  *
11  *   This program is free software {} you can redistribute it and/or modify
12  *   it under the terms of the GNU General Public License as published by
13  *   the Free Software Foundation {} either version 2 of the License, or
14  *   (at your option) any later version.
15  *
16  *   This program is distributed in the hope that it will be useful,
17  *   but WITHOUT ANY WARRANTY {} without even the implied warranty of
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *   GNU General Public License for more details.
20  *
21  *   You should have received a copy of the GNU General Public License
22  *   along with this program {} if not, write to the Free Software
23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  *
26  *
27  */
28 #ifndef __FREEBOB_ISOHANDLER__
29 #define __FREEBOB_ISOHANDLER__
30
31 #include <libraw1394/raw1394.h>
32
33
34 enum raw1394_iso_disposition ;
35 namespace FreebobStreaming
36 {
37
38 extern "C" {
39                 enum raw1394_iso_disposition iso_transmit_handler(raw1394handle_t handle,
40                                 unsigned char *data, unsigned int *length,
41                                 unsigned char *tag, unsigned char *sy,
42                                 int cycle, unsigned int dropped);
43 }
44 /*!
45 \brief The Base Class for ISO Handlers
46
47  These classes perform the actual ISO communication through libraw1394.
48  They are different from IsoStreams because one handler can provide multiple
49  streams with packets in case of ISO multichannel receive.
50
51 */
52
53 class IsoHandler
54 {
55         protected:
56        
57         public:
58        
59                 enum EHandlerType {
60                         EHT_Receive,
61                         EHT_Transmit
62                 };
63        
64                 IsoHandler() : m_handle(0)
65                 {}
66                 virtual ~IsoHandler()
67                 {}
68
69             bool Initialize( int port );
70                
71
72                 virtual enum EHandlerType getType() = 0;
73
74         private:
75             raw1394handle_t m_handle;
76         int             m_port;
77
78 };
79
80 /*!
81 \brief ISO receive handler class
82 */
83
84 class IsoRecvHandler : public IsoHandler
85 {
86
87         public:
88                 IsoRecvHandler();
89                 virtual ~IsoRecvHandler();
90
91         bool Initialize( int port );
92                
93                 virtual enum EHandlerType getType() { return EHT_Receive;};
94        
95         private:
96                 enum raw1394_iso_disposition 
97                         PutPacket(unsigned char *data, unsigned int length,
98                               unsigned char channel, unsigned char tag, unsigned char sy,
99                                   unsigned int cycle, unsigned int dropped);
100
101 };
102
103 /*!
104 \brief ISO transmit handler class
105 */
106
107 class IsoXmitHandler  : public IsoHandler
108 {
109         public:
110                 friend enum raw1394_iso_disposition iso_transmit_handler(raw1394handle_t handle,
111                                 unsigned char *data, unsigned int *length,
112                                 unsigned char *tag, unsigned char *sy,
113                                 int cycle, unsigned int dropped);
114
115         IsoXmitHandler();
116         virtual ~IsoXmitHandler();
117
118             bool Initialize( int port );
119                
120                 virtual enum EHandlerType getType() { return EHT_Transmit;};
121
122         private:
123                 enum raw1394_iso_disposition 
124                         GetPacket(unsigned char *data, unsigned int *length,
125                               unsigned char *tag, unsigned char *sy,
126                               int cycle, unsigned int dropped);
127
128
129 };
130
131 }
132
133 #endif /* __FREEBOB_ISOHANDLER__  */
134
135
136
Note: See TracBrowser for help on using the browser.