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
PacketBuffer::FreePacket
void FreePacket(const UDPPacket &packet)
Frees an RTPDataPacket returned by PopDataPacket.
Definition: packetbuffer.cpp:49
PacketBuffer
Definition: packetbuffer.h:15
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:49
PacketBuffer::m_available_packets
QList< UDPPacket > m_available_packets
Ordered list of available packets.
Definition: packetbuffer.h:55
uint
unsigned int uint
Definition: compat.h:81
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:19
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:52
PacketBuffer::PushDataPacket
virtual void PushDataPacket(const UDPPacket &)=0
PacketBuffer::PacketBuffer
PacketBuffer(unsigned int bitrate)
Definition: packetbuffer.cpp:13
PacketBuffer::PopDataPacket
UDPPacket PopDataPacket(void)
Fetches a data packet for processing.
Definition: packetbuffer.cpp:24
UDPPacket
UDP Packet.
Definition: udppacket.h:20
PacketBuffer::GetEmptyPacket
UDPPacket GetEmptyPacket(void)
Gets a packet for use in PushDataPacket/PushFECPacket.
Definition: packetbuffer.cpp:35