Use VAAPI for hardware encoding on Linux

This commit is contained in:
loki
2021-05-29 16:25:37 +02:00
parent fe5375f17b
commit ff1ea1a63e
5 changed files with 223 additions and 101 deletions
+4 -4
View File
@@ -67,8 +67,8 @@ constexpr std::uint8_t map_surround71[] {
};
} // namespace speaker
enum class dev_type_e {
none,
enum class mem_type_e {
system,
dxgi,
unknown
};
@@ -155,7 +155,7 @@ struct sink_t {
struct hwdevice_t {
void *data {};
platf::img_t *img {};
void *img {};
virtual int convert(platf::img_t &img) {
return -1;
@@ -221,7 +221,7 @@ std::string from_sockaddr(const sockaddr *const);
std::pair<std::uint16_t, std::string> from_sockaddr_ex(const sockaddr *const);
std::unique_ptr<audio_control_t> audio_control();
std::shared_ptr<display_t> display(dev_type_e hwdevice_type);
std::shared_ptr<display_t> display(mem_type_e hwdevice_type);
input_t input();
void move_mouse(input_t &input, int deltaX, int deltaY);
+2 -2
View File
@@ -355,8 +355,8 @@ struct shm_attr_t : public x11_attr_t {
}
};
std::shared_ptr<display_t> display(platf::dev_type_e hwdevice_type) {
if(hwdevice_type != platf::dev_type_e::none) {
std::shared_ptr<display_t> display(platf::mem_type_e hwdevice_type) {
if(hwdevice_type != platf::mem_type_e::system) {
BOOST_LOG(error) << "Could not initialize display with the given hw device type."sv;
return nullptr;
}
+3 -3
View File
@@ -417,15 +417,15 @@ const char *format_str[] = {
} // namespace platf::dxgi
namespace platf {
std::shared_ptr<display_t> display(dev_type_e hwdevice_type) {
if(hwdevice_type == dev_type_e::dxgi) {
std::shared_ptr<display_t> display(mem_type_e hwdevice_type) {
if(hwdevice_type == mem_type_e::dxgi) {
auto disp = std::make_shared<dxgi::display_vram_t>();
if(!disp->init()) {
return disp;
}
}
else if(hwdevice_type == dev_type_e::none) {
else if(hwdevice_type == mem_type_e::system) {
auto disp = std::make_shared<dxgi::display_ram_t>();
if(!disp->init()) {