style: unify identifier naming per updated conventions

Automated with clang-tidy readability-identifier-naming (config added to
.clang-tidy) plus scripted passes, per the updated rules now documented
in CONTRIBUTING.md:

- types (class/struct/enum/alias/template params): PascalCase
- functions, variables, members: snake_case (incl. rational -> Rational)
- private/protected members: trailing underscore; static member
  variables likewise (instance_, available_themes_)
- constants and enum values: snake_case (kLinear -> k_linear,
  F32P -> f32p); ALL_CAPS reserved for macros
- macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG ->
  OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE,
  include guards -> OAK_*)
- file names: all lowercase (Current/Plugin/OliveHost/OliveClip/
  OlivePluginInstance -> current/plugin/olivehost/oliveclip/
  oliveplugininstance)
- getters share the member name sans underscore, setters set_foo()
- Qt and third-party (OpenFX) virtual overrides and framework callbacks
  keep their original names (exempt in .clang-tidy)

Manual follow-ups required where automation could not reach:
- string-based QMetaObject/SIGNAL/SLOT references updated to renamed
  methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...)
- macro bodies referencing renamed methods (OLIVE_CONFIG,
  NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*)
- self-shadowing locals renamed where signals/methods became same-named
  (size_changed, worker_count, selected_items, import param, filters)
- third_party OFX member/namespace usages restored (OFX::Host::*,
  _created, _clipPrefsDirty, createInstance, clearPersistentMessage)
- STL protocol aliases restored (const_iterator) with .clang-tidy
  ignore rules; qHash overloads restored

Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
2026-07-19 16:10:54 +08:00
parent cb1718a103
commit bb40b4923e
1014 changed files with 44257 additions and 44220 deletions
+101 -101
View File
@@ -6,126 +6,126 @@ using namespace olive;
TEST(CommonFFmpegUtils, GetNativeSampleFormatMapsCorrectly)
{
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_U8),
SampleFormat::U8);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_S16),
SampleFormat::S16);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_S32),
SampleFormat::S32);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_S64),
SampleFormat::S64);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_FLT),
SampleFormat::F32);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_DBL),
SampleFormat::F64);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_U8P),
SampleFormat::U8P);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_S16P),
SampleFormat::S16P);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_S32P),
SampleFormat::S32P);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_S64P),
SampleFormat::S64P);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_FLTP),
SampleFormat::F32P);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_DBLP),
SampleFormat::F64P);
EXPECT_EQ(FFmpegUtils::GetNativeSampleFormat(FB_SAMPLE_FMT_NONE),
SampleFormat::INVALID);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_u8),
SampleFormat::u8);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_s16),
SampleFormat::s16);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_s32),
SampleFormat::s32);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_s64),
SampleFormat::s64);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_flt),
SampleFormat::f32);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_dbl),
SampleFormat::f64);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_u8_p),
SampleFormat::u8_p);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_s16_p),
SampleFormat::s16_p);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_s32_p),
SampleFormat::s32_p);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_s64_p),
SampleFormat::s64_p);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_fltp),
SampleFormat::f32_p);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_dblp),
SampleFormat::f64_p);
EXPECT_EQ(FFmpegUtils::get_native_sample_format(fb_sample_fmt_none),
SampleFormat::invalid);
}
TEST(CommonFFmpegUtils, GetFFmpegSampleFormatMapsCorrectly)
{
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::U8),
FB_SAMPLE_FMT_U8);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::S16),
FB_SAMPLE_FMT_S16);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::S32),
FB_SAMPLE_FMT_S32);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::S64),
FB_SAMPLE_FMT_S64);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::F32),
FB_SAMPLE_FMT_FLT);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::F64),
FB_SAMPLE_FMT_DBL);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::U8P),
FB_SAMPLE_FMT_U8P);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::S16P),
FB_SAMPLE_FMT_S16P);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::S32P),
FB_SAMPLE_FMT_S32P);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::S64P),
FB_SAMPLE_FMT_S64P);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::F32P),
FB_SAMPLE_FMT_FLTP);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::F64P),
FB_SAMPLE_FMT_DBLP);
EXPECT_EQ(FFmpegUtils::GetFFmpegSampleFormat(SampleFormat::INVALID),
FB_SAMPLE_FMT_NONE);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::u8),
fb_sample_fmt_u8);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::s16),
fb_sample_fmt_s16);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::s32),
fb_sample_fmt_s32);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::s64),
fb_sample_fmt_s64);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::f32),
fb_sample_fmt_flt);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::f64),
fb_sample_fmt_dbl);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::u8_p),
fb_sample_fmt_u8_p);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::s16_p),
fb_sample_fmt_s16_p);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::s32_p),
fb_sample_fmt_s32_p);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::s64_p),
fb_sample_fmt_s64_p);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::f32_p),
fb_sample_fmt_fltp);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::f64_p),
fb_sample_fmt_dblp);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_sample_format(SampleFormat::invalid),
fb_sample_fmt_none);
}
TEST(CommonFFmpegUtils, ConvertJPEGSpaceToRegularSpace)
{
EXPECT_EQ(FFmpegUtils::ConvertJPEGSpaceToRegularSpace(FB_PIX_FMT_YUVJ420P),
FB_PIX_FMT_YUV420P);
EXPECT_EQ(FFmpegUtils::ConvertJPEGSpaceToRegularSpace(FB_PIX_FMT_YUVJ422P),
FB_PIX_FMT_YUV422P);
EXPECT_EQ(FFmpegUtils::ConvertJPEGSpaceToRegularSpace(FB_PIX_FMT_YUVJ444P),
FB_PIX_FMT_YUV444P);
EXPECT_EQ(FFmpegUtils::ConvertJPEGSpaceToRegularSpace(FB_PIX_FMT_YUVJ440P),
FB_PIX_FMT_YUV440P);
EXPECT_EQ(FFmpegUtils::ConvertJPEGSpaceToRegularSpace(FB_PIX_FMT_YUVJ411P),
FB_PIX_FMT_YUV411P);
EXPECT_EQ(FFmpegUtils::ConvertJPEGSpaceToRegularSpace(FB_PIX_FMT_YUV420P),
FB_PIX_FMT_YUV420P);
EXPECT_EQ(FFmpegUtils::convert_jpeg_space_to_regular_space(fb_pix_fmt_yuv_j420_p),
fb_pix_fmt_yu_v420_p);
EXPECT_EQ(FFmpegUtils::convert_jpeg_space_to_regular_space(fb_pix_fmt_yuv_j422_p),
fb_pix_fmt_yu_v422_p);
EXPECT_EQ(FFmpegUtils::convert_jpeg_space_to_regular_space(fb_pix_fmt_yuv_j444_p),
fb_pix_fmt_yu_v444_p);
EXPECT_EQ(FFmpegUtils::convert_jpeg_space_to_regular_space(fb_pix_fmt_yuv_j440_p),
fb_pix_fmt_yu_v440_p);
EXPECT_EQ(FFmpegUtils::convert_jpeg_space_to_regular_space(fb_pix_fmt_yuv_j411_p),
fb_pix_fmt_yu_v411_p);
EXPECT_EQ(FFmpegUtils::convert_jpeg_space_to_regular_space(fb_pix_fmt_yu_v420_p),
fb_pix_fmt_yu_v420_p);
}
TEST(CommonFFmpegUtils, GetCompatiblePixelFormatNative)
{
EXPECT_EQ(FFmpegUtils::GetCompatiblePixelFormat(PixelFormat::U8),
PixelFormat::U8);
EXPECT_EQ(FFmpegUtils::GetCompatiblePixelFormat(PixelFormat::U10),
PixelFormat::U8);
EXPECT_EQ(FFmpegUtils::GetCompatiblePixelFormat(PixelFormat::U16),
PixelFormat::U16);
EXPECT_EQ(FFmpegUtils::GetCompatiblePixelFormat(PixelFormat::F16),
PixelFormat::U16);
EXPECT_EQ(FFmpegUtils::GetCompatiblePixelFormat(PixelFormat::F32),
PixelFormat::U16);
EXPECT_EQ(FFmpegUtils::GetCompatiblePixelFormat(PixelFormat::INVALID),
PixelFormat::INVALID);
EXPECT_EQ(FFmpegUtils::get_compatible_pixel_format(PixelFormat::u8),
PixelFormat::u8);
EXPECT_EQ(FFmpegUtils::get_compatible_pixel_format(PixelFormat::u10),
PixelFormat::u8);
EXPECT_EQ(FFmpegUtils::get_compatible_pixel_format(PixelFormat::u16),
PixelFormat::u16);
EXPECT_EQ(FFmpegUtils::get_compatible_pixel_format(PixelFormat::f16),
PixelFormat::u16);
EXPECT_EQ(FFmpegUtils::get_compatible_pixel_format(PixelFormat::f32),
PixelFormat::u16);
EXPECT_EQ(FFmpegUtils::get_compatible_pixel_format(PixelFormat::invalid),
PixelFormat::invalid);
}
TEST(CommonFFmpegUtils, GetFFmpegPixelFormat)
{
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::U8,
VideoParams::kRGBChannelCount),
FB_PIX_FMT_RGB24);
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::U16,
VideoParams::kRGBChannelCount),
FB_PIX_FMT_RGB48LE);
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::F32,
VideoParams::kRGBChannelCount),
FB_PIX_FMT_RGBF32LE);
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::U8,
VideoParams::kRGBAChannelCount),
FB_PIX_FMT_RGBA);
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::U16,
VideoParams::kRGBAChannelCount),
FB_PIX_FMT_RGBA64LE);
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::F32,
VideoParams::kRGBAChannelCount),
FB_PIX_FMT_RGBAF32LE);
EXPECT_EQ(FFmpegUtils::GetFFmpegPixelFormat(PixelFormat::INVALID, 0),
FB_PIX_FMT_NONE);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::u8,
VideoParams::k_rgb_channel_count),
fb_pix_fmt_rg_b24);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::u16,
VideoParams::k_rgb_channel_count),
fb_pix_fmt_rg_b48_le);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::f32,
VideoParams::k_rgb_channel_count),
fb_pix_fmt_rgb_f32_le);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::u8,
VideoParams::k_rgba_channel_count),
fb_pix_fmt_rgba);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::u16,
VideoParams::k_rgba_channel_count),
fb_pix_fmt_rgb_a64_le);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::f32,
VideoParams::k_rgba_channel_count),
fb_pix_fmt_rgba_f32_le);
EXPECT_EQ(FFmpegUtils::get_f_fmpeg_pixel_format(PixelFormat::invalid, 0),
fb_pix_fmt_none);
}
TEST(CommonFFmpegUtils, GetCompatiblePixelFormatAV)
{
int fmt = FFmpegUtils::GetCompatibleBridgePixelFormat(FB_PIX_FMT_YUV420P);
EXPECT_NE(fmt, FB_PIX_FMT_NONE);
int fmt = FFmpegUtils::get_compatible_bridge_pixel_format(fb_pix_fmt_yu_v420_p);
EXPECT_NE(fmt, fb_pix_fmt_none);
fmt = FFmpegUtils::GetCompatibleBridgePixelFormat(FB_PIX_FMT_YUV420P,
PixelFormat::U8);
EXPECT_EQ(fmt, FB_PIX_FMT_RGBA);
fmt = FFmpegUtils::get_compatible_bridge_pixel_format(fb_pix_fmt_yu_v420_p,
PixelFormat::u8);
EXPECT_EQ(fmt, fb_pix_fmt_rgba);
}