2024-03-24 23:52:24 +00:00
|
|
|
/**
|
2024-06-28 12:34:14 +00:00
|
|
|
* @file tests/unit/test_video.cpp
|
2024-03-24 23:52:24 +00:00
|
|
|
* @brief Test src/video.*.
|
|
|
|
*/
|
|
|
|
#include <src/video.h>
|
|
|
|
|
2024-08-22 20:48:24 +00:00
|
|
|
#include "../tests_common.h"
|
2024-03-24 23:52:24 +00:00
|
|
|
|
2024-08-22 20:48:24 +00:00
|
|
|
struct EncoderTest: PlatformTestSuite, testing::WithParamInterface<video::encoder_t *> {
|
2024-03-24 23:52:24 +00:00
|
|
|
void
|
|
|
|
SetUp() override {
|
2024-08-22 20:48:24 +00:00
|
|
|
auto &encoder = *GetParam();
|
|
|
|
if (!video::validate_encoder(encoder, false)) {
|
|
|
|
// Encoder failed validation,
|
|
|
|
// if it's software - fail (unless overriden with compile definition), otherwise skip
|
|
|
|
if (encoder.name == "software" && std::string(TESTS_SOFTWARE_ENCODER_UNAVAILABLE) == "fail") {
|
|
|
|
FAIL() << "Software encoder not available";
|
2024-03-24 23:52:24 +00:00
|
|
|
}
|
|
|
|
else {
|
2024-08-22 20:48:24 +00:00
|
|
|
GTEST_SKIP() << "Encoder not available";
|
2024-03-24 23:52:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2024-08-22 20:48:24 +00:00
|
|
|
|
2024-03-24 23:52:24 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
|
|
|
EncoderVariants,
|
|
|
|
EncoderTest,
|
2024-08-22 20:48:24 +00:00
|
|
|
testing::Values(
|
2024-03-24 23:52:24 +00:00
|
|
|
#if !defined(__APPLE__)
|
2024-08-22 20:48:24 +00:00
|
|
|
&video::nvenc,
|
2024-03-24 23:52:24 +00:00
|
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
2024-08-22 20:48:24 +00:00
|
|
|
&video::amdvce,
|
|
|
|
&video::quicksync,
|
2024-03-24 23:52:24 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __linux__
|
2024-08-22 20:48:24 +00:00
|
|
|
&video::vaapi,
|
2024-03-24 23:52:24 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __APPLE__
|
2024-08-22 20:48:24 +00:00
|
|
|
&video::videotoolbox,
|
2024-03-24 23:52:24 +00:00
|
|
|
#endif
|
2024-08-22 20:48:24 +00:00
|
|
|
&video::software),
|
|
|
|
[](const auto &info) { return std::string(info.param->name); });
|
|
|
|
|
2024-03-24 23:52:24 +00:00
|
|
|
TEST_P(EncoderTest, ValidateEncoder) {
|
|
|
|
// todo:: test something besides fixture setup
|
|
|
|
}
|