mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-12 09:16:10 -04:00
clang-format: Increase column limit from 80 to 120
This commit is contained in:
@@ -10,15 +10,9 @@ class NotificationClient : public IMMNotificationClient {
|
||||
WASAPINotifyDefaultDeviceChangedCallback cb;
|
||||
|
||||
public:
|
||||
NotificationClient(WASAPINotifyDefaultDeviceChangedCallback cb) : cb(cb)
|
||||
{
|
||||
assert(cb);
|
||||
}
|
||||
NotificationClient(WASAPINotifyDefaultDeviceChangedCallback cb) : cb(cb) { assert(cb); }
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef()
|
||||
{
|
||||
return (ULONG)os_atomic_inc_long(&refs);
|
||||
}
|
||||
STDMETHODIMP_(ULONG) AddRef() { return (ULONG)os_atomic_inc_long(&refs); }
|
||||
|
||||
STDMETHODIMP_(ULONG) STDMETHODCALLTYPE Release()
|
||||
{
|
||||
@@ -49,13 +43,9 @@ public:
|
||||
|
||||
STDMETHODIMP OnDeviceStateChanged(LPCWSTR, DWORD) { return S_OK; }
|
||||
|
||||
STDMETHODIMP OnPropertyValueChanged(LPCWSTR, const PROPERTYKEY)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP OnPropertyValueChanged(LPCWSTR, const PROPERTYKEY) { return S_OK; }
|
||||
|
||||
STDMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role,
|
||||
LPCWSTR id)
|
||||
STDMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR id)
|
||||
{
|
||||
if (cb && id)
|
||||
cb(flow, role, id);
|
||||
@@ -66,17 +56,13 @@ public:
|
||||
|
||||
WASAPINotify::WASAPINotify()
|
||||
{
|
||||
HRESULT res = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr,
|
||||
CLSCTX_ALL,
|
||||
__uuidof(IMMDeviceEnumerator),
|
||||
HRESULT res = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator),
|
||||
(LPVOID *)enumerator.Assign());
|
||||
if (SUCCEEDED(res)) {
|
||||
notificationClient = new NotificationClient(
|
||||
std::bind(&WASAPINotify::OnDefaultDeviceChanged, this,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3));
|
||||
enumerator->RegisterEndpointNotificationCallback(
|
||||
notificationClient);
|
||||
notificationClient = new NotificationClient(std::bind(&WASAPINotify::OnDefaultDeviceChanged, this,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3));
|
||||
enumerator->RegisterEndpointNotificationCallback(notificationClient);
|
||||
} else {
|
||||
enumerator.Clear();
|
||||
}
|
||||
@@ -85,16 +71,14 @@ WASAPINotify::WASAPINotify()
|
||||
WASAPINotify::~WASAPINotify()
|
||||
{
|
||||
if (enumerator) {
|
||||
enumerator->UnregisterEndpointNotificationCallback(
|
||||
notificationClient);
|
||||
enumerator->UnregisterEndpointNotificationCallback(notificationClient);
|
||||
enumerator.Clear();
|
||||
}
|
||||
|
||||
notificationClient.Clear();
|
||||
}
|
||||
|
||||
void WASAPINotify::AddDefaultDeviceChangedCallback(
|
||||
void *handle, WASAPINotifyDefaultDeviceChangedCallback cb)
|
||||
void WASAPINotify::AddDefaultDeviceChangedCallback(void *handle, WASAPINotifyDefaultDeviceChangedCallback cb)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
@@ -112,8 +96,7 @@ void WASAPINotify::RemoveDefaultDeviceChangedCallback(void *handle)
|
||||
defaultDeviceChangedCallbacks.erase(handle);
|
||||
}
|
||||
|
||||
void WASAPINotify::OnDefaultDeviceChanged(EDataFlow flow, ERole role,
|
||||
LPCWSTR id)
|
||||
void WASAPINotify::OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR id)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(mutex);
|
||||
for (const auto &cb : defaultDeviceChangedCallbacks)
|
||||
|
||||
Reference in New Issue
Block a user