From cb9b4f119ab4464f87f35a0f30b5f92887a40f86 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Sat, 13 Jun 2026 00:04:50 +0200 Subject: [PATCH] plugins: Apply clang-format 22 formatting --- plugins/coreaudio-encoder/encoder.cpp | 3 +- plugins/coreaudio-encoder/windows-imports.h | 6 ++-- plugins/linux-capture/xcomposite-input.c | 3 +- plugins/mac-avcapture/OBSAVCapture.m | 2 +- plugins/mac-avcapture/legacy/av-capture.mm | 11 ++++-- plugins/mac-capture/audio-device-enum.h | 3 +- .../src/dal-plugin/OBSDALPlugInInterface.mm | 4 +-- plugins/obs-ffmpeg/obs-ffmpeg-url.h | 36 +++++++++---------- plugins/obs-outputs/mp4-mux-internal.h | 2 +- plugins/win-capture/window-capture.c | 4 +-- 10 files changed, 41 insertions(+), 33 deletions(-) diff --git a/plugins/coreaudio-encoder/encoder.cpp b/plugins/coreaudio-encoder/encoder.cpp index 7a6ea7131..79377aaab 100644 --- a/plugins/coreaudio-encoder/encoder.cpp +++ b/plugins/coreaudio-encoder/encoder.cpp @@ -148,8 +148,7 @@ template using cf_ptr = unique_ptr::type> #ifndef _MSC_VER __attribute__((__format__(__printf__, 3, 4))) #endif -static void -log_to_dstr(DStr &str, ca_encoder *ca, const char *fmt, ...) +static void log_to_dstr(DStr &str, ca_encoder *ca, const char *fmt, ...) { dstr prev_str = *static_cast(str); diff --git a/plugins/coreaudio-encoder/windows-imports.h b/plugins/coreaudio-encoder/windows-imports.h index 27249c6db..20c90651d 100644 --- a/plugins/coreaudio-encoder/windows-imports.h +++ b/plugins/coreaudio-encoder/windows-imports.h @@ -400,8 +400,9 @@ static bool load_lib(void) /* attempt to load from path */ audio_toolbox = LoadLibraryExW(L"CoreAudioToolbox.dll", NULL, LOAD_LIBRARY_SAFE_CURRENT_DIRS); - if (!!audio_toolbox) + if (!!audio_toolbox) { return true; + } /* -------------------------------------------- */ /* attempt to load from known install locations */ @@ -446,8 +447,9 @@ static void unload_core_audio(void) #endif static bool load_core_audio(void) { - if (!load_lib()) + if (!load_lib()) { return false; + } #define LOAD_SYM_FROM_LIB(sym, lib, dll) \ if (!(sym = (sym##_t)GetProcAddress(lib, #sym))) { \ diff --git a/plugins/linux-capture/xcomposite-input.c b/plugins/linux-capture/xcomposite-input.c index 0e86fe443..174b794a8 100644 --- a/plugins/linux-capture/xcomposite-input.c +++ b/plugins/linux-capture/xcomposite-input.c @@ -164,7 +164,8 @@ struct dstr xcomp_window_name(xcb_connection_t *conn, Display *disp, xcb_window_ } if (name->type == ATOM_COMPOUND_TEXT) { // LibX11 is the only decoder for these. XTextProperty xname = { - (unsigned char *)data, name->type, + (unsigned char *)data, + name->type, 8, // 8 by definition. 1, // Only decode the first element of string arrays. }; diff --git a/plugins/mac-avcapture/OBSAVCapture.m b/plugins/mac-avcapture/OBSAVCapture.m index 3d0425afa..7ad885463 100644 --- a/plugins/mac-avcapture/OBSAVCapture.m +++ b/plugins/mac-avcapture/OBSAVCapture.m @@ -1324,7 +1324,7 @@ static const UInt32 kMaxFrameRateRangesInDescription = 10; if (frame->format != VIDEO_FORMAT_NONE && frame->format != videoFormat) { [self AVCaptureLog:LOG_DEBUG withFormat:@"Switching fourcc: '%@' (0x%x) -> '%@' (0x%x)", - [OBSAVCapture stringFromFourCharCode:frame->format], frame -> format, + [OBSAVCapture stringFromFourCharCode:frame->format], frame->format, [OBSAVCapture stringFromFourCharCode:mediaSubType], mediaSubType]; } #endif diff --git a/plugins/mac-avcapture/legacy/av-capture.mm b/plugins/mac-avcapture/legacy/av-capture.mm index 460fec5f3..5b28a2898 100644 --- a/plugins/mac-avcapture/legacy/av-capture.mm +++ b/plugins/mac-avcapture/legacy/av-capture.mm @@ -1257,9 +1257,14 @@ static NSArray *presets(void) return @[ //AVCaptureSessionPresetiFrame1280x720, //AVCaptureSessionPresetiFrame960x540, - AVCaptureSessionPreset3840x2160, AVCaptureSessionPreset1920x1080, AVCaptureSessionPreset1280x720, - AVCaptureSessionPreset960x540, AVCaptureSessionPreset640x480, AVCaptureSessionPreset352x288, - AVCaptureSessionPreset320x240, AVCaptureSessionPresetHigh, + AVCaptureSessionPreset3840x2160, + AVCaptureSessionPreset1920x1080, + AVCaptureSessionPreset1280x720, + AVCaptureSessionPreset960x540, + AVCaptureSessionPreset640x480, + AVCaptureSessionPreset352x288, + AVCaptureSessionPreset320x240, + AVCaptureSessionPresetHigh, //AVCaptureSessionPresetMedium, //AVCaptureSessionPresetLow, //AVCaptureSessionPresetPhoto, diff --git a/plugins/mac-capture/audio-device-enum.h b/plugins/mac-capture/audio-device-enum.h index 3e7174ca9..6ff234e44 100644 --- a/plugins/mac-capture/audio-device-enum.h +++ b/plugins/mac-capture/audio-device-enum.h @@ -19,8 +19,9 @@ struct device_list { static inline void device_list_free(struct device_list *list) { - for (size_t i = 0; i < list->items.num; i++) + for (size_t i = 0; i < list->items.num; i++) { device_item_free(list->items.array + i); + } da_free(list->items); } diff --git a/plugins/mac-virtualcam/src/dal-plugin/OBSDALPlugInInterface.mm b/plugins/mac-virtualcam/src/dal-plugin/OBSDALPlugInInterface.mm index 9d8dfb461..ed201f9f4 100644 --- a/plugins/mac-virtualcam/src/dal-plugin/OBSDALPlugInInterface.mm +++ b/plugins/mac-virtualcam/src/dal-plugin/OBSDALPlugInInterface.mm @@ -349,8 +349,8 @@ static CMIOHardwarePlugInInterface sInterface = { NULL, // IUnknown Routines - (HRESULT (*)(void *, CFUUIDBytes, void **)) HardwarePlugIn_QueryInterface, (ULONG(*)(void *)) HardwarePlugIn_AddRef, - (ULONG(*)(void *)) HardwarePlugIn_Release, + (HRESULT (*)(void *, CFUUIDBytes, void **)) HardwarePlugIn_QueryInterface, + (ULONG (*)(void *)) HardwarePlugIn_AddRef, (ULONG (*)(void *)) HardwarePlugIn_Release, // DAL Plug-In Routines HardwarePlugIn_Initialize, HardwarePlugIn_InitializeWithObjectID, HardwarePlugIn_Teardown, diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-url.h b/plugins/obs-ffmpeg/obs-ffmpeg-url.h index 57e527b01..072b6a090 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-url.h +++ b/plugins/obs-ffmpeg/obs-ffmpeg-url.h @@ -113,28 +113,28 @@ typedef void SRT_LOG_HANDLER_FN(void *opaque, int level, const char *file, int l const char *message); #ifdef __cplusplus -namespace srt_logging { +namespace srt_logging +{ -struct LogFA { -private: - int value; + struct LogFA { + private : int value; -public: - operator int() const { return value; } + public : operator int() const { return value; } - LogFA(int v) : value(v) {} -}; + LogFA(int v) : value(v) {} + }; -const LogFA LOGFA_GENERAL = 0; + const LogFA LOGFA_GENERAL = 0; -namespace LogLevel { -enum type { - fatal = LOG_CRIT, - error = LOG_ERR, - warning = 4, //issue w/ libobs so LOG_WARNING is removed - note = LOG_NOTICE, - debug = 7 //issue w/ libobs so LOG_DEBUG is removed -}; -} + namespace LogLevel + { + enum type { + fatal = LOG_CRIT, + error = LOG_ERR, + warning = 4, //issue w/ libobs so LOG_WARNING is removed + note = LOG_NOTICE, + debug = 7 //issue w/ libobs so LOG_DEBUG is removed + }; + } } // namespace srt_logging #endif diff --git a/plugins/obs-outputs/mp4-mux-internal.h b/plugins/obs-outputs/mp4-mux-internal.h index 4136927ae..90162ef3f 100644 --- a/plugins/obs-outputs/mp4-mux-internal.h +++ b/plugins/obs-outputs/mp4-mux-internal.h @@ -305,6 +305,7 @@ static inline void get_colour_information(obs_encoder_t *enc, uint16_t *pri, uin /* Chapter stubs (from libavformat/movenc.c) */ +/* clang-format off */ static const uint8_t TEXT_STUB_HEADER[] = { // TextSampleEntry 0x00, 0x00, 0x00, 0x01, // displayFlags @@ -327,7 +328,6 @@ static const uint8_t TEXT_STUB_HEADER[] = { 0x00, // font name length }; -/* clang-format off */ static const char CHAPTER_PKT_FOOTER[12] = { 0x00, 0x00, 0x00, 0x0C, 'e', 'n', 'c', 'd', diff --git a/plugins/win-capture/window-capture.c b/plugins/win-capture/window-capture.c index 472c59533..4203be2fc 100644 --- a/plugins/win-capture/window-capture.c +++ b/plugins/win-capture/window-capture.c @@ -152,7 +152,7 @@ static enum window_capture_method choose_method(enum window_capture_method metho if (astrstri(current_class, *class) != NULL) { return METHOD_WGC; } - class ++; + class++; } class = wgc_whole_match_classes; @@ -160,7 +160,7 @@ static enum window_capture_method choose_method(enum window_capture_method metho if (astrcmpi(current_class, *class) == 0) { return METHOD_WGC; } - class ++; + class++; } return METHOD_BITBLT;