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_PACKETBUFFER__ |
---|
29 |
#define __FREEBOB_PACKETBUFFER__ |
---|
30 |
|
---|
31 |
#include "../debugmodule/debugmodule.h" |
---|
32 |
#include <libraw1394/raw1394.h> |
---|
33 |
#include "libutil/ringbuffer.h" |
---|
34 |
|
---|
35 |
namespace Streaming { |
---|
36 |
|
---|
37 |
class PacketBuffer { |
---|
38 |
// note: all sizes in quadlets |
---|
39 |
public: |
---|
40 |
|
---|
41 |
PacketBuffer(int headersize, int buffersize, int max_packetsize) |
---|
42 |
: m_headersize(headersize), m_buffersize(buffersize), m_max_packetsize(max_packetsize), |
---|
43 |
payload_buffer(0), header_buffer(0), len_buffer(0) |
---|
44 |
{}; |
---|
45 |
|
---|
46 |
virtual ~PacketBuffer(); |
---|
47 |
void setVerboseLevel(int l) { setDebugLevel( l ); }; |
---|
48 |
|
---|
49 |
int initialize(); |
---|
50 |
|
---|
51 |
void flush(); |
---|
52 |
|
---|
53 |
int addPacket(quadlet_t *packet, int packet_len); |
---|
54 |
|
---|
55 |
int getNextPacket(quadlet_t *packet, int packet_len); |
---|
56 |
int getBufferFillPackets(); |
---|
57 |
int getBufferFillPayload(); |
---|
58 |
|
---|
59 |
protected: |
---|
60 |
int m_headersize; |
---|
61 |
int m_buffersize; |
---|
62 |
int m_max_packetsize; |
---|
63 |
|
---|
64 |
freebob_ringbuffer_t *payload_buffer; |
---|
65 |
freebob_ringbuffer_t *header_buffer; |
---|
66 |
freebob_ringbuffer_t *len_buffer; |
---|
67 |
|
---|
68 |
DECLARE_DEBUG_MODULE; |
---|
69 |
|
---|
70 |
}; |
---|
71 |
|
---|
72 |
} |
---|
73 |
|
---|
74 |
#endif /* __FREEBOB_PACKETBUFFER__ */ |
---|
75 |
|
---|
76 |
|
---|