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

Revision 445, 1.9 kB (checked in by pieterpalmers, 17 years ago)

* name change from FreeBoB to FFADO
* replaced tabs by 4 spaces
* got rid of end-of-line spaces
* made all license and copyrights conform

library becomes LGPL, apps become GPL
explicitly state LGPL v2.1 and GPL v2 (don't like v3 draft)

copyrights are 2005-2007 Daniel & Pieter
except for the MotU stuff (C) Jonathan, Pieter

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_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.