-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdl_packet_queue.h
More file actions
33 lines (24 loc) · 826 Bytes
/
sdl_packet_queue.h
File metadata and controls
33 lines (24 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include <functional>
#include <memory>
#include <queue>
#include <stdexcept>
#include <SDL.h>
#include "packet_consumer.h"
class SDLPacketQueue final : public PacketConsumer
{
SDLPacketQueue(const SDLPacketQueue&) = delete;
const SDLPacketQueue& operator=(const SDLPacketQueue&) = delete;
SDLPacketQueue(SDLPacketQueue&&) = delete;
const SDLPacketQueue& operator=(SDLPacketQueue&&) = delete;
public:
SDLPacketQueue() throw(std::runtime_error);
~SDLPacketQueue();
// implementation of PacketConsumer interface
bool AcceptPacket(const AVPacket& packet) noexcept override;
bool GetPacket(AVPacket& packet) noexcept;
private:
std::queue<AVPacket> _queue;
std::unique_ptr<SDL_mutex, std::function<void(SDL_mutex*)>> _mutex;
std::unique_ptr<SDL_cond, std::function<void(SDL_cond*)>> _cond;
};