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

Revision 705, 2.9 kB (checked in by ppalmers, 13 years ago)

restructure the streaming directory

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_type(type), m_channel(-1), m_port(0), m_handler(0)
57         {};
58         IsoStream(enum EStreamType type, int port)
59                     : m_type(type), m_channel(-1), m_port(port), m_handler(0)
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 getType() { return m_type;};
72
73         virtual unsigned int getPacketsPerPeriod() {return 1;};
74         virtual unsigned int getMaxPacketSize() {return 1024;}; //FIXME: arbitrary
75
76         virtual bool init();
77
78         virtual enum raw1394_iso_disposition
79                 putPacket(unsigned char *data, unsigned int length,
80                         unsigned char channel, unsigned char tag, unsigned char sy,
81                             unsigned int cycle, unsigned int dropped);
82         virtual enum raw1394_iso_disposition
83                 getPacket(unsigned char *data, unsigned int *length,
84                         unsigned char *tag, unsigned char *sy,
85                         int cycle, unsigned int dropped, unsigned int max_length);
86
87         void dumpInfo();
88
89         int getNodeId();
90
91         virtual bool reset();
92         virtual bool prepare();
93
94     protected:
95
96         void setHandler( IsoHandler * h) ;
97         void clearHandler();
98
99         enum EStreamType m_type;
100         int m_channel;
101         int m_port;
102
103         IsoHandler *m_handler;
104
105         DECLARE_DEBUG_MODULE;
106
107 };
108
109 }
110
111 #endif /* __FFADO_ISOSTREAM__ */
112
113
114
Note: See TracBrowser for help on using the browser.