Skip to content

ao_oss: add hotplug support, improve list_devs - #18221

Open
rozhuk-im wants to merge 1 commit into
mpv-player:masterfrom
rozhuk-im:oss_hotplug
Open

ao_oss: add hotplug support, improve list_devs#18221
rozhuk-im wants to merge 1 commit into
mpv-player:masterfrom
rozhuk-im:oss_hotplug

Conversation

@rozhuk-im

Copy link
Copy Markdown
Contributor
  • Add hotplug support for FreeBSD and DragonFlyBSD
  • Improve list_devs(): switch to scandir()

@rozhuk-im rozhuk-im changed the title audio/out/ao_oss.c: add hotplug support, improve list_devs ao_oss: add hotplug support, improve list_devs Jul 5, 2026
Comment thread audio/out/ao_oss.c Outdated
if (stat(dev_path, &st) != 0)
continue;
device_descr_get(i, dev_descr, sizeof(dev_descr));
rc = scandir("/dev", &dirp, scandir_filter_cb, alphasort);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphasort is locale dependent, should not be used. Also all other mpv code use opendir/readdir instead of scandir.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

versionsort is better for this, but in any case order in this is not critical.
scandir is not forbidden to use. I prefer it to get more compact code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

versionsort is better for this, but in any case order in this is not critical.

No. It is also locale dependent and is GNU extension. Please use mp_natural_sort_cmp for filename comparision which is the current standard in code.

scandir is not forbidden to use. I prefer it to get more compact code.

It requires the use of a compare function which as you said is not necessary for this at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compare function is needed to sort dev list, unsorted dev list still usable but not so pretty :)

@rozhuk-im
rozhuk-im force-pushed the oss_hotplug branch 5 times, most recently from 7219bbd to 790f770 Compare July 6, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants