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 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 |
void setHandler( IsoHandler * h) ; |
---|
96 |
void clearHandler(); |
---|
97 |
|
---|
98 |
int m_channel; |
---|
99 |
int m_port; |
---|
100 |
|
---|
101 |
IsoHandler *m_handler; |
---|
102 |
|
---|
103 |
private: // should be set in the constructor |
---|
104 |
enum eStreamType m_isostream_type; |
---|
105 |
|
---|
106 |
DECLARE_DEBUG_MODULE; |
---|
107 |
|
---|
108 |
}; |
---|
109 |
|
---|
110 |
} |
---|
111 |
|
---|
112 |
#endif /* __FFADO_ISOSTREAM__ */ |
---|
113 |
|
---|
114 |
|
---|
115 |
|
---|