20 struct probe_image_t final:
img_t {
21 std::vector<std::uint8_t> pixels;
33 class encoder_probe_display_t final:
public display_t {
35 encoder_probe_display_t(mem_type_e memory,
const video::config_t &config):
36 memory_type {memory} {
38 height = config.height;
43 std::shared_ptr<img_t> alloc_img()
override {
44 auto image = std::make_shared<probe_image_t>();
46 image->height = height;
47 image->pixel_pitch = 4;
48 image->row_pitch = width * 4;
49 image->pixels.resize(
static_cast<std::size_t
>(image->row_pitch) * height);
50 image->data = image->pixels.data();
54 int dummy_img(img_t *image)
override {
55 auto *probe =
dynamic_cast<probe_image_t *
>(image);
59 std::fill(probe->pixels.begin(), probe->pixels.end(), 0);
63 capture_e capture(
const push_captured_image_cb_t &,
const pull_free_image_cb_t &,
bool *)
override {
64 BOOST_LOG(error) <<
"The encoder probe display has nothing to capture";
65 return capture_e::error;
68 std::unique_ptr<avcodec_encode_device_t> make_avcodec_encode_device(pix_fmt_e)
override {
69#ifdef HERMES_BUILD_VAAPI
70 if (memory_type == mem_type_e::vaapi) {
73 BOOST_LOG(error) <<
"The encoder probe found no GPU to encode on";
76 return va::make_avcodec_encode_device(width, height, std::move(card), 0, 0,
false);
79#ifdef HERMES_BUILD_CUDA
80 if (memory_type == mem_type_e::cuda) {
81 return cuda::make_avcodec_encode_device(width, height,
false);
84 return std::make_unique<avcodec_encode_device_t>();
93 if (config.width <= 0 || config.height <= 0) {
96 return std::make_shared<encoder_probe_display_t>(memory, config);
Declarations for common platform specific utilities.
std::shared_ptr< display_t > encoder_probe_display(mem_type_e hwdevice_type, const video::config_t &config)
A display with no screen behind it, for validating encoders.
Definitions for CUDA implementation.
int open_encode_render_node(bool nvenc)
Open the render node of the best GPU to encode a stream on.
Declarations for logging related functions.
Miscellaneous declarations for Linux.
Declarations for VA-API hardware accelerated capture.