| 2891 | typedef int (*vaapi_init_avcodec_hardware_input_buffer_fn)(platf::avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf); |
| 2892 | |
| 2893 | util::Either<avcodec_buffer_t, int> vaapi_init_avcodec_hardware_input_buffer(platf::avcodec_encode_device_t *encode_device) { |
| 2894 | avcodec_buffer_t hw_device_buf; |
| 2895 | |
| 2896 | // If an egl hwdevice |
| 2897 | if (encode_device->data) { |
| 2898 | if (((vaapi_init_avcodec_hardware_input_buffer_fn) encode_device->data)(encode_device, &hw_device_buf)) { |
| 2899 | return -1; |
| 2900 | } |
| 2901 | |
| 2902 | return hw_device_buf; |
| 2903 | } |
| 2904 | |
| 2905 | auto render_device = config::video.adapter_name.empty() ? nullptr : config::video.adapter_name.c_str(); |
| 2906 | |
| 2907 | auto status = av_hwdevice_ctx_create(&hw_device_buf, AV_HWDEVICE_TYPE_VAAPI, render_device, nullptr, 0); |
| 2908 | if (status < 0) { |
| 2909 | char string[AV_ERROR_MAX_STRING_SIZE]; |
| 2910 | BOOST_LOG(error) << "Failed to create a VAAPI device: "sv << av_make_error_string(string, AV_ERROR_MAX_STRING_SIZE, status); |
| 2911 | return -1; |
| 2912 | } |
| 2913 | |
| 2914 | return hw_device_buf; |
| 2915 | } |
| 2916 | |
| 2917 | util::Either<avcodec_buffer_t, int> cuda_init_avcodec_hardware_input_buffer(platf::avcodec_encode_device_t *encode_device) { |
| 2918 | avcodec_buffer_t hw_device_buf; |
nothing calls this directly
no outgoing calls
no test coverage detected