root/branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.h

Revision 719, 2.9 kB (checked in by ppalmers, 16 years ago)

backup commit

Line 
1 /*
2  * Copyright (C) 2005-2007 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23
24 #ifndef __FFADO_ISOSTREAM__
25 #define __FFADO_ISOSTREAM__
26
27 #include "../util/IsoHandler.h"
28
29 #include "debugmodule/debugmodule.h"
30
31 #include <libraw1394/raw1394.h>
32
33 namespace Streaming
34 {
35
36 class PacketBuffer;
37
38 /*!
39 \brief The Base Class for ISO streams
40 */
41
42 class IsoStream
43 {
44     friend class IsoHandler;
45     friend class IsoRecvHandler;
46     friend class IsoXmitHandler;
47
48     public:
49
50         enum eStreamType {
51                 eST_Receive,
52                 eST_Transmit
53         };
54
55         IsoStream(enum eStreamType type)
56             : m_channel(-1), m_port(0), m_handler(0), m_isostream_type(type)
57         {};
58         IsoStream(enum eStreamType type, int port)
59                     : m_channel(-1), m_port(port), m_handler(0), m_isostream_type(type)
60         {};
61         virtual ~IsoStream()
62         {};
63
64         virtual void setVerboseLevel(int l) { setDebugLevel( l ); };
65
66         int getChannel() {return m_channel;};
67         bool setChannel(int c);
68
69         int getPort() {return m_port;};
70
71         enum eStreamType getStreamType() { return m_isostream_type;};
72
73         virtual unsigned int getPacketsPerPeriod() {return 1;};
74         virtual unsigned int getMaxPacketSize() {return 1024;}; //FIXME: arbitrary
75
76         virtual enum raw1394_iso_disposition
77                 putPacket(unsigned char *data, unsigned int length,
78                         unsigned char channel, unsigned char tag, unsigned char sy,
79                             unsigned int cycle, unsigned int dropped);
80         virtual enum raw1394_iso_disposition
81                 getPacket(unsigned char *data, unsigned int *length,
82                         unsigned char *tag, unsigned char *sy,
83                         int cycle, unsigned int dropped, unsigned int max_length);
84
85         void dumpInfo();
86
87     protected:
88         void setHandler( IsoHandler * h) ;
89         void clearHandler();
90
91         int m_channel;
92         int m_port;
93
94         IsoHandler *m_handler;
95
96     private: // should be set in the constructor
97         enum eStreamType m_isostream_type;
98
99         DECLARE_DEBUG_MODULE;
100
101 };
102
103 }
104
105 #endif /* __FFADO_ISOSTREAM__ */
106
107
108
Note: See TracBrowser for help on using the browser.