From 39f47d65a997b4f087257b75c673eb8d4ed0c77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 31 Jan 2023 22:39:27 +0800 Subject: [PATCH] Sound: remove manufacturer detection as it's only implemented on macOS --- src/detection/sound/sound.h | 1 - src/detection/sound/sound_apple.c | 13 ------------- src/detection/sound/sound_linux.c | 1 - src/detection/sound/sound_windows.cpp | 3 --- src/fastfetch.c | 1 - src/modules/sound.c | 4 +--- 6 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/detection/sound/sound.h b/src/detection/sound/sound.h index 76c17627c..9a89ab694 100644 --- a/src/detection/sound/sound.h +++ b/src/detection/sound/sound.h @@ -9,7 +9,6 @@ typedef struct FFSoundDevice { FFstrbuf identifier; FFstrbuf name; - FFstrbuf manufacturer; uint8_t volume; // 0-100% bool main; bool active; diff --git a/src/detection/sound/sound_apple.c b/src/detection/sound/sound_apple.c index b1260db2f..a9ec04703 100644 --- a/src/detection/sound/sound_apple.c +++ b/src/detection/sound/sound_apple.c @@ -42,7 +42,6 @@ const char* ffDetectSound(FF_MAYBE_UNUSED const FFinstance* instance, FFlist* de device->volume = 0; ffStrbufInitF(&device->identifier, "%u", (unsigned) deviceId); ffStrbufInit(&device->name); - ffStrbufInit(&device->manufacturer); uint32_t active; dataSize = sizeof(active); @@ -76,18 +75,6 @@ const char* ffDetectSound(FF_MAYBE_UNUSED const FFinstance* instance, FFlist* de ffCfStrGetString(name, &device->name); CFRelease(name); } - - CFStringRef manufacturer; - dataSize = sizeof(manufacturer); - if(AudioObjectGetPropertyData(deviceId, &(AudioObjectPropertyAddress){ - kAudioObjectPropertyManufacturer, - kAudioObjectPropertyScopeOutput, - kAudioObjectPropertyElementMain - }, 0, NULL, &dataSize, &manufacturer) == kAudioHardwareNoError) - { - ffCfStrGetString(manufacturer, &device->manufacturer); - CFRelease(manufacturer); - } } return NULL; diff --git a/src/detection/sound/sound_linux.c b/src/detection/sound/sound_linux.c index 658fc82c7..a752a6b5f 100644 --- a/src/detection/sound/sound_linux.c +++ b/src/detection/sound/sound_linux.c @@ -14,7 +14,6 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo FFSoundDevice* device = ffListAdd(userdata); ffStrbufInitS(&device->identifier, i->name); ffStrbufInitS(&device->name, i->description); - ffStrbufInitS(&device->manufacturer, i->driver); device->volume = i->mute ? 0 : (uint8_t) (i->volume.values[0] * 100 / PA_VOLUME_NORM); device->active = i->active_port && i->active_port->available != PA_PORT_AVAILABLE_NO; device->main = false; diff --git a/src/detection/sound/sound_windows.cpp b/src/detection/sound/sound_windows.cpp index 2b9e95be1..5221c8368 100644 --- a/src/detection/sound/sound_windows.cpp +++ b/src/detection/sound/sound_windows.cpp @@ -65,7 +65,6 @@ const char* ffDetectSound(FF_MAYBE_UNUSED const FFinstance* instance, FF_MAYBE_U device->volume = 0; ffStrbufInit(&device->identifier); ffStrbufInit(&device->name); - ffStrbufInit(&device->manufacturer); ffStrbufSetWS(&device->identifier, immDeviceId); @@ -74,8 +73,6 @@ const char* ffDetectSound(FF_MAYBE_UNUSED const FFinstance* instance, FF_MAYBE_U PropVariantInit(&friendlyName); if (SUCCEEDED(immPropStore->GetValue(PKEY_Device_FriendlyName, &friendlyName))) ffStrbufSetWS(&device->name, friendlyName.pwszVal); - if (SUCCEEDED(immPropStore->GetValue(PKEY_DeviceInterface_FriendlyName, &friendlyName))) - ffStrbufSetWS(&device->manufacturer, friendlyName.pwszVal); } IAudioEndpointVolume* FF_AUTO_RELEASE_COM_OBJECT immEndpointVolume; diff --git a/src/fastfetch.c b/src/fastfetch.c index 75431699f..ded937466 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -460,7 +460,6 @@ static inline void printCommandHelp(const char* command) "Main", "Name", "Volume", - "Manufacturer", "Identifier" ); } diff --git a/src/modules/sound.c b/src/modules/sound.c index 1bf02b824..4ef58cdc2 100644 --- a/src/modules/sound.c +++ b/src/modules/sound.c @@ -2,7 +2,7 @@ #include "detection/sound/sound.h" #define FF_SOUND_MODULE_NAME "Sound" -#define FF_SOUND_NUM_FORMAT_ARGS 5 +#define FF_SOUND_NUM_FORMAT_ARGS 4 static void printDevice(FFinstance* instance, const FFSoundDevice* device, uint8_t index) { @@ -27,7 +27,6 @@ static void printDevice(FFinstance* instance, const FFSoundDevice* device, uint8 {FF_FORMAT_ARG_TYPE_BOOL, &device->main}, {FF_FORMAT_ARG_TYPE_STRBUF, &device->name}, {FF_FORMAT_ARG_TYPE_UINT8, &device->volume}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->manufacturer}, {FF_FORMAT_ARG_TYPE_STRBUF, &device->identifier} }); } @@ -79,6 +78,5 @@ void ffPrintSound(FFinstance* instance) { ffStrbufDestroy(&device->identifier); ffStrbufDestroy(&device->name); - ffStrbufDestroy(&device->manufacturer); } }