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 |
|
---|
34 |
namespace FreebobStreaming |
---|
35 |
{ |
---|
36 |
|
---|
37 |
class PacketBuffer; |
---|
38 |
|
---|
39 |
/*! |
---|
40 |
\brief The Base Class for ISO streams |
---|
41 |
*/ |
---|
42 |
|
---|
43 |
class IsoStream |
---|
44 |
{ |
---|
45 |
|
---|
46 |
public: |
---|
47 |
|
---|
48 |
enum EStreamType { |
---|
49 |
EST_Receive, |
---|
50 |
EST_Transmit |
---|
51 |
}; |
---|
52 |
|
---|
53 |
IsoStream(enum EStreamType type, int channel) : m_type(type), m_Channel(channel) |
---|
54 |
{}; |
---|
55 |
virtual ~IsoStream() |
---|
56 |
{}; |
---|
57 |
|
---|
58 |
void setVerboseLevel(int l) { setDebugLevel( l ); }; |
---|
59 |
|
---|
60 |
int getChannel() {return m_Channel;}; |
---|
61 |
|
---|
62 |
enum EStreamType getType() { return m_type;}; |
---|
63 |
|
---|
64 |
int initialize() {return 0;}; |
---|
65 |
|
---|
66 |
int |
---|
67 |
putPacket(unsigned char *data, unsigned int length, |
---|
68 |
unsigned char channel, unsigned char tag, unsigned char sy, |
---|
69 |
unsigned int cycle, unsigned int dropped); |
---|
70 |
int |
---|
71 |
getPacket(unsigned char *data, unsigned int *length, |
---|
72 |
unsigned char *tag, unsigned char *sy, |
---|
73 |
int cycle, unsigned int dropped, unsigned int max_length); |
---|
74 |
|
---|
75 |
protected: |
---|
76 |
enum EStreamType m_type; |
---|
77 |
int m_Channel; |
---|
78 |
|
---|
79 |
DECLARE_DEBUG_MODULE; |
---|
80 |
|
---|
81 |
}; |
---|
82 |
|
---|
83 |
class IsoStreamBuffered : public IsoStream |
---|
84 |
{ |
---|
85 |
|
---|
86 |
public: |
---|
87 |
|
---|
88 |
IsoStreamBuffered(int headersize,int buffersize, int max_packetsize, enum EStreamType type, int channel) |
---|
89 |
: IsoStream(type,channel), m_headersize(headersize), m_buffersize(buffersize), m_max_packetsize(max_packetsize), buffer(0) |
---|
90 |
{}; |
---|
91 |
virtual ~IsoStreamBuffered(); |
---|
92 |
|
---|
93 |
void setVerboseLevel(int l); |
---|
94 |
|
---|
95 |
int initialize(); |
---|
96 |
|
---|
97 |
int |
---|
98 |
putPacket(unsigned char *data, unsigned int length, |
---|
99 |
unsigned char channel, unsigned char tag, unsigned char sy, |
---|
100 |
unsigned int cycle, unsigned int dropped); |
---|
101 |
int |
---|
102 |
getPacket(unsigned char *data, unsigned int *length, |
---|
103 |
unsigned char *tag, unsigned char *sy, |
---|
104 |
int cycle, unsigned int dropped, unsigned int max_length); |
---|
105 |
int getBufferFillPackets(); |
---|
106 |
int getBufferFillPayload(); |
---|
107 |
|
---|
108 |
protected: |
---|
109 |
int m_headersize; |
---|
110 |
int m_buffersize; |
---|
111 |
int m_max_packetsize; |
---|
112 |
|
---|
113 |
PacketBuffer *buffer; |
---|
114 |
|
---|
115 |
DECLARE_DEBUG_MODULE; |
---|
116 |
|
---|
117 |
}; |
---|
118 |
|
---|
119 |
} |
---|
120 |
|
---|
121 |
#endif /* __FREEBOB_ISOSTREAM__ */ |
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|