2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
|
|
|
|
// 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 <list>
|
|
|
|
#include <utility>
|
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>
|
|
|
|
#include <libavutil/hwcontext.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::hwapi {
|
2020-01-13 21:40:15 +00:00
|
|
|
struct device {
|
|
|
|
std::pair<int64_t, int64_t> id;
|
|
|
|
std::string name;
|
|
|
|
};
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-01-13 21:40:15 +00:00
|
|
|
class instance {
|
|
|
|
public:
|
2020-04-02 18:29:00 +00:00
|
|
|
virtual ~instance(){};
|
|
|
|
|
2020-01-13 21:40:15 +00:00
|
|
|
virtual AVBufferRef* create_device_context() = 0;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-01-13 21:40:15 +00:00
|
|
|
virtual std::shared_ptr<AVFrame> allocate_frame(AVBufferRef* frames) = 0;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-08-10 01:29:05 +00:00
|
|
|
virtual void copy_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key, uint64_t* next_lock_key,
|
|
|
|
std::shared_ptr<AVFrame> frame) = 0;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-08-10 01:29:05 +00:00
|
|
|
virtual std::shared_ptr<AVFrame> avframe_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key,
|
2020-01-13 21:40:15 +00:00
|
|
|
uint64_t* next_lock_key) = 0;
|
|
|
|
};
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-01-13 21:40:15 +00:00
|
|
|
class base {
|
|
|
|
public:
|
2020-04-02 18:29:00 +00:00
|
|
|
virtual ~base(){};
|
|
|
|
|
2020-01-13 21:40:15 +00:00
|
|
|
virtual std::list<hwapi::device> enumerate_adapters() = 0;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2022-07-21 11:09:10 +00:00
|
|
|
virtual std::shared_ptr<hwapi::instance> create(const hwapi::device& target) = 0;
|
2020-01-13 00:52:30 +00:00
|
|
|
|
2020-01-13 21:40:15 +00:00
|
|
|
virtual std::shared_ptr<hwapi::instance> create_from_obs() = 0;
|
|
|
|
};
|
2021-06-08 02:12:55 +00:00
|
|
|
} // namespace streamfx::ffmpeg::hwapi
|