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 
48 
50  QMap<uint64_t, UDPPacket> m_empty_packets;
51 
53  QList<UDPPacket> m_available_packets;
54 };
55 
56 #endif // PACKET_BUFFER_H
PacketBuffer::FreePacket
void FreePacket(const UDPPacket &packet)
Frees an RTPDataPacket returned by PopDataPacket.
Definition: packetbuffer.cpp:56
PacketBuffer
Definition: packetbuffer.h:16
PacketBuffer::~PacketBuffer
virtual ~PacketBuffer()=default
PacketBuffer::m_next_empty_packet_key
uint64_t m_next_empty_packet_key
Packets key to use for next empty packet.
Definition: packetbuffer.h:47
PacketBuffer::m_available_packets
QList< UDPPacket > m_available_packets
Ordered list of available packets.
Definition: packetbuffer.h:53
uint
unsigned int uint
Definition: compat.h:140
PacketBuffer::m_bitrate
uint m_bitrate
Definition: packetbuffer.h:44
udppacket.h
PacketBuffer::HasAvailablePacket
bool HasAvailablePacket(void) const
Returns true if there are ordered packets ready for processing.
Definition: packetbuffer.cpp:26
PacketBuffer::PushFECPacket
virtual void PushFECPacket(const UDPPacket &, unsigned int)=0
PacketBuffer::m_empty_packets
QMap< uint64_t, UDPPacket > m_empty_packets
Packets ready for reuse.
Definition: packetbuffer.h:50
PacketBuffer::PushDataPacket
virtual void PushDataPacket(const UDPPacket &)=0
PacketBuffer::PacketBuffer
PacketBuffer(unsigned int bitrate)
Definition: packetbuffer.cpp:14
PacketBuffer::PopDataPacket
UDPPacket PopDataPacket(void)
Fetches a data packet for processing.
Definition: packetbuffer.cpp:31
UDPPacket
UDP Packet.
Definition: udppacket.h:21
PacketBuffer::GetEmptyPacket
UDPPacket GetEmptyPacket(void)
Gets a packet for use in PushDataPacket/PushFECPacket.
Definition: packetbuffer.cpp:42