2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2020-01-13 00:52:30 +00:00
|
|
|
|
|
|
|
#pragma once
|
2020-04-02 15:02:01 +00:00
|
|
|
#include "common.hpp"
|
2022-08-29 10:29:44 +00:00
|
|
|
|
|
|
|
#include "warning-disable.hpp"
|
2020-01-13 00:52:30 +00:00
|
|
|
#include <deque>
|
|
|
|
#include <mutex>
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-enable.hpp"
|
2020-01-13 00:52:30 +00:00
|
|
|
|
|
|
|
extern "C" {
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-disable.hpp"
|
2020-01-13 00:52:30 +00:00
|
|
|
#include <libavutil/frame.h>
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-enable.hpp"
|
2020-01-13 00:52:30 +00:00
|
|
|
}
|
|
|
|
|
2021-06-08 02:12:55 +00:00
|
|
|
namespace streamfx::ffmpeg {
|
2020-01-13 00:52:30 +00:00
|
|
|
class avframe_queue {
|
2020-01-13 21:40:15 +00:00
|
|
|
std::deque<std::shared_ptr<AVFrame>> _frames;
|
|
|
|
std::mutex _lock;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-08-10 01:29:05 +00:00
|
|
|
std::pair<int32_t, int32_t> _resolution;
|
|
|
|
AVPixelFormat _format = AV_PIX_FMT_NONE;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
|
|
|
std::shared_ptr<AVFrame> create_frame();
|
|
|
|
|
|
|
|
public:
|
|
|
|
avframe_queue();
|
|
|
|
~avframe_queue();
|
|
|
|
|
2020-08-10 01:29:05 +00:00
|
|
|
void set_resolution(int32_t width, int32_t height);
|
|
|
|
void get_resolution(int32_t& width, int32_t& height);
|
|
|
|
int32_t get_width();
|
|
|
|
int32_t get_height();
|
2020-01-13 00:52:30 +00:00
|
|
|
|
|
|
|
void set_pixel_format(AVPixelFormat format);
|
|
|
|
AVPixelFormat get_pixel_format();
|
|
|
|
|
2020-04-08 21:38:42 +00:00
|
|
|
void precache(std::size_t count);
|
2020-01-13 00:52:30 +00:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
void push(std::shared_ptr<AVFrame> frame);
|
|
|
|
|
|
|
|
std::shared_ptr<AVFrame> pop();
|
|
|
|
|
|
|
|
std::shared_ptr<AVFrame> pop_only();
|
|
|
|
|
|
|
|
bool empty();
|
|
|
|
|
2020-04-08 21:38:42 +00:00
|
|
|
std::size_t size();
|
2020-01-13 00:52:30 +00:00
|
|
|
};
|
2021-06-08 02:12:55 +00:00
|
|
|
} // namespace streamfx::ffmpeg
|