root/trunk/libffado/src/libutil/PacketBuffer.h

Revision 742, 1.8 kB (checked in by ppalmers, 16 years ago)

- Remove some obsolete support files and dirs

- Clean up the license statements in the source files. Everything is

GPL version 3 now.

- Add license and copyright notices to scons scripts

- Clean up some other text files

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 program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef __FFADO_PACKETBUFFER__
25 #define __FFADO_PACKETBUFFER__
26
27 #include "../debugmodule/debugmodule.h"
28 #include <libraw1394/raw1394.h>
29 #include "libutil/ringbuffer.h"
30
31 namespace Streaming {
32
33 class PacketBuffer {
34 // note: all sizes in quadlets
35 public:
36
37     PacketBuffer(int headersize, int buffersize, int max_packetsize)
38        : m_headersize(headersize), m_buffersize(buffersize), m_max_packetsize(max_packetsize),
39          payload_buffer(0), header_buffer(0), len_buffer(0)
40     {};
41
42     virtual ~PacketBuffer();
43     void setVerboseLevel(int l) { setDebugLevel( l ); };
44
45     int initialize();
46
47     void flush();
48
49     int addPacket(quadlet_t *packet, int packet_len);
50
51     int getNextPacket(quadlet_t *packet, int packet_len);
52     int getBufferFillPackets();
53     int getBufferFillPayload();
54
55 protected:
56     int m_headersize;
57     int m_buffersize;
58     int m_max_packetsize;
59
60     ffado_ringbuffer_t *payload_buffer;
61     ffado_ringbuffer_t *header_buffer;
62     ffado_ringbuffer_t *len_buffer;
63
64     DECLARE_DEBUG_MODULE;
65
66 };
67
68 }
69
70 #endif /* __FFADO_PACKETBUFFER__ */
71
72
Note: See TracBrowser for help on using the browser.