root/branches/streaming-rework/src/libstreaming/IsoStream.h

Revision 390, 3.0 kB (checked in by pieterpalmers, 16 years ago)

* working version of SYT based AMDTP receive and transmit.

Still has to be tuned to work with low buffer sizes.

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) 2005,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_ISOSTREAM__
29 #define __FREEBOB_ISOSTREAM__
30
31 #include <libraw1394/raw1394.h>
32 #include "../debugmodule/debugmodule.h"
33 #include "IsoHandler.h"
34
35 namespace FreebobStreaming
36 {
37
38 class PacketBuffer;
39
40 /*!
41 \brief The Base Class for ISO streams
42 */
43
44 class IsoStream
45 {
46     friend class IsoHandler;
47     friend class IsoRecvHandler;
48     friend class IsoXmitHandler;
49
50     public:
51
52         enum EStreamType {
53                 EST_Receive,
54                 EST_Transmit
55         };
56
57         IsoStream(enum EStreamType type)
58                     : m_type(type), m_channel(-1), m_port(0), m_handler(0)
59         {};
60         IsoStream(enum EStreamType type, int port)
61                     : m_type(type), m_channel(-1), m_port(port), m_handler(0)
62         {};
63         virtual ~IsoStream()
64         {};
65    
66         virtual void setVerboseLevel(int l) { setDebugLevel( l ); };
67
68         int getChannel() {return m_channel;};
69         bool setChannel(int c);
70
71         int getPort() {return m_port;};
72
73         enum EStreamType getType() { return m_type;};
74
75         virtual unsigned int getPacketsPerPeriod() {return 1;};
76         virtual unsigned int getMaxPacketSize() {return 1024;}; //FIXME: arbitrary
77        
78         virtual bool init();
79
80         virtual enum raw1394_iso_disposition
81                 putPacket(unsigned char *data, unsigned int length,
82                         unsigned char channel, unsigned char tag, unsigned char sy,
83                             unsigned int cycle, unsigned int dropped);
84         virtual enum raw1394_iso_disposition
85                 getPacket(unsigned char *data, unsigned int *length,
86                         unsigned char *tag, unsigned char *sy,
87                         int cycle, unsigned int dropped, unsigned int max_length);
88
89         void dumpInfo();
90
91         int getNodeId();
92        
93         virtual bool reset();
94         virtual bool prepare();
95    
96     protected:
97
98         void setHandler( IsoHandler * h) ;
99         void clearHandler();
100
101         enum EStreamType m_type;
102         int m_channel;
103         int m_port;
104
105         IsoHandler *m_handler;
106        
107         DECLARE_DEBUG_MODULE;
108
109 };
110
111 }
112
113 #endif /* __FREEBOB_ISOSTREAM__ */
114
115
116
Note: See TracBrowser for help on using the browser.