MythTV master
packetbuffer.h
Go to the documentation of this file.
1/* -*- Mode: c++ -*-
2 * PacketBuffer
3 * Copyright (c) 2012 Digital Nirvana, Inc.
4 * Distributed as part of MythTV under GPL v2 and later.
5 */
6
7#ifndef PACKET_BUFFER_H
8#define PACKET_BUFFER_H
9
10#include <QList>
11#include <QMap>
12
13#include "udppacket.h"
14
16{
17 public:
18 explicit PacketBuffer(unsigned int bitrate);
19 virtual ~PacketBuffer() = default;
20
21 virtual void PushDataPacket(const UDPPacket&) = 0;
22
23 virtual void PushFECPacket(const UDPPacket&, unsigned int) = 0;
24
26 bool HasAvailablePacket(void) const;
27
31
34
41 void FreePacket(const UDPPacket &packet);
42
43 protected:
45
50
52 QMap<uint64_t, UDPPacket> m_empty_packets;
53
55 QList<UDPPacket> m_available_packets;
56};
57
58#endif // PACKET_BUFFER_H
UDPPacket PopDataPacket(void)
Fetches a data packet for processing.
virtual void PushFECPacket(const UDPPacket &, unsigned int)=0
UDPPacket GetEmptyPacket(void)
Gets a packet for use in PushDataPacket/PushFECPacket.
QList< UDPPacket > m_available_packets
Ordered list of available packets.
Definition: packetbuffer.h:55
virtual void PushDataPacket(const UDPPacket &)=0
PacketBuffer(unsigned int bitrate)
void FreePacket(const UDPPacket &packet)
Frees an RTPDataPacket returned by PopDataPacket.
bool HasAvailablePacket(void) const
Returns true if there are ordered packets ready for processing.
virtual ~PacketBuffer()=default
uint64_t m_next_empty_packet_key
Packets key to use for next empty packet.
Definition: packetbuffer.h:49
QMap< uint64_t, UDPPacket > m_empty_packets
Packets ready for reuse.
Definition: packetbuffer.h:52
UDP Packet.
Definition: udppacket.h:21
unsigned int uint
Definition: freesurround.h:24