obs-StreamFX/source/ffmpeg/avframe-queue.hpp

56 lines
1.2 KiB
C++
Raw Normal View History

// 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
#include "common.hpp"
#include "warning-disable.hpp"
2020-01-13 00:52:30 +00:00
#include <deque>
#include <mutex>
#include "warning-enable.hpp"
2020-01-13 00:52:30 +00:00
extern "C" {
#include "warning-disable.hpp"
2020-01-13 00:52:30 +00:00
#include <libavutil/frame.h>
#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
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();
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