Skip to content

Commit 3ad5d5c

Browse files
committed
Sound (FreeBSD): report OSS ABI version
1 parent 9324136 commit 3ad5d5c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/detection/sound/sound_bsd.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ const char* ffDetectSound(FFlist* devices)
1313
if (defaultDev == -1)
1414
return "sysctl(hw.snd.default_unit) failed";
1515

16-
for (int idev = 0; idev <= 9; ++idev)
16+
struct oss_sysinfo info = { .nummixers = 9 };
17+
18+
for (int idev = 0; idev <= info.nummixers; ++idev)
1719
{
1820
path[strlen("/dev/mixer")] = (char) ('0' + idev);
1921
FF_AUTO_CLOSE_FD int fd = open(path, O_RDWR);
2022
if (fd < 0) break;
2123

24+
if (idev == 0)
25+
{
26+
if (ioctl(fd, SNDCTL_SYSINFO, &info) != 0)
27+
return "ioctl(SNDCTL_SYSINFO) failed";
28+
}
29+
2230
uint32_t devmask = 0;
2331
if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask) < 0)
2432
continue;
@@ -40,7 +48,7 @@ const char* ffDetectSound(FFlist* devices)
4048
ffStrbufInitS(&device->identifier, path);
4149
ffStrbufInitF(&device->name, "%s %s", ci.longname, ci.hw_info);
4250
ffStrbufTrimRightSpace(&device->name);
43-
ffStrbufInitStatic(&device->platformApi, "OSS");
51+
ffStrbufInitF(&device->platformApi, "%s %s", info.product, info.version);
4452
device->volume = mutemask & SOUND_MASK_VOLUME
4553
? 0
4654
: ((uint8_t) volume /*left*/ + (uint8_t) (volume >> 8) /*right*/) / 2;

0 commit comments

Comments
 (0)