History

build: use the same default optical drive for all disc streams

Amusingly, this was not working correctly for at least a decade. For all OSes, the default drive is the same except for macOS. It had "/dev/diskN" as the default dvd drive. Back in the mplayer days, there was actually dynamic compile time generation (only for mac) that replaced the N with the actual number*. But this didn't actually work for all stream types. It seems like it never worked for stream_dvdnav and was only a stream_dvd (libdvdread) feature. And then later that stream got removed completely. So at least for macOS users, they had a fallback device of "/dev/diskN" for certain stream types and for a very long time. We can't really do better here, but we should at least pick a default string that has a chance of working. So /dev/disk1 it is then. With that, all of the devices become the same so we can combine it all and use the same default optical drive for both CDs and DVDs. BD will be added in the next commit. Also /dev/dvd is some antiquated thing that doesn't really exist anymore. Linux systems will likely still have /dev/cdrom which has a decent chance of being usable. /dev/dvd probably won't be there. *: f215e84339c597f967c157f7e219fde3eb831b47

Dudemanguy committed 1 year ago

Commit 656f0f21 parent 9506e723 files · +7 −22Browse files

Unified · Split

3 files
  1. meson.build +5 −20
  2. stream/stream_cdda.c +1 −1
  3. stream/stream_dvdnav.c +1 −1
meson.build+5−20
@@ -453,7 +453,7 @@ features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE', · 452 unmodified lines
453453 features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE',
454454 prefix: '#include <string.h>')}
455455
456−cd_devices = {
456+optical_devices = {
457457 'windows': 'D:',
458458 'cygwin': 'D:',
459459 'darwin': '/dev/disk1',
@@ -461,24 +461,10 @@ cd_devices = { · 1 unmodified line
461461 'openbsd': '/dev/rcd0c',
462462 'linux': '/dev/sr0',
463463 }
464−if host_machine.system() in cd_devices
465− cd_device = cd_devices[host_machine.system()]
464+if host_machine.system() in optical_devices
465+ optical_device = optical_devices[host_machine.system()]
466466 else
467− cd_device = '/dev/cdrom'
468−endif
469−
470−dvd_devices = {
471− 'windows': 'D:',
472− 'cygwin': 'D:',
473− 'darwin': '/dev/diskN',
474− 'freebsd': '/dev/cd0',
475− 'openbsd': '/dev/rcd0c',
476− 'linux': '/dev/sr0',
477−}
478−if host_machine.system() in cd_devices
479− dvd_device = dvd_devices[host_machine.system()]
480−else
481− dvd_device = '/dev/dvd'
467+ optical_device = '/dev/cdrom'
482468 endif
483469
484470 features += {'android': host_machine.system() == 'android'}
@@ -1716,8 +1702,7 @@ endif · 1231 unmodified lines
17161702 # Set config.h
17171703 conf_data = configuration_data()
17181704 conf_data.set_quoted('CONFIGURATION', meson.build_options())
1719−conf_data.set_quoted('DEFAULT_DVD_DEVICE', dvd_device)
1720−conf_data.set_quoted('DEFAULT_CDROM_DEVICE', cd_device)
1705+conf_data.set_quoted('DEFAULT_OPTICAL_DEVICE', optical_device)
17211706
17221707 # Loop over all features in the build, create a define and add them to config.h
17231708 feature_keys = []
stream/stream_cdda.c+1−1
@@ -256,7 +256,7 @@ static int open_cdda(stream_t *st) · 255 unmodified lines
256256 } else if (p->cdda_device && p->cdda_device[0]) {
257257 p->device = mp_get_user_path(priv, st->global, p->cdda_device);
258258 } else {
259− p->device = talloc_strdup(priv, DEFAULT_CDROM_DEVICE);
259+ p->device = talloc_strdup(priv, DEFAULT_OPTICAL_DEVICE);
260260 }
261261
262262 #if defined(__NetBSD__)
stream/stream_dvdnav.c+1−1
@@ -587,7 +587,7 @@ static int open_s_internal(stream_t *stream) · 586 unmodified lines
587587 else if (p->opts->device && p->opts->device[0])
588588 filename = p->opts->device;
589589 else
590− filename = DEFAULT_DVD_DEVICE;
590+ filename = DEFAULT_OPTICAL_DEVICE;
591591 if (!new_dvdnav_stream(stream, filename)) {
592592 MP_ERR(stream, "Couldn't open DVD device: %s\n",
593593 filename);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t