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
Unified · Split
| @@ -453,7 +453,7 @@ features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE', · 452 unmodified lines | |||
| 453 | features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE', | 453 | features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE', |
| 454 | prefix: '#include <string.h>')} | 454 | prefix: '#include <string.h>')} |
| 455 | 455 | ||
| 456 | cd_devices = { | 456 | optical_devices = { |
| 457 | 'windows': 'D:', | 457 | 'windows': 'D:', |
| 458 | 'cygwin': 'D:', | 458 | 'cygwin': 'D:', |
| 459 | 'darwin': '/dev/disk1', | 459 | 'darwin': '/dev/disk1', |
| @@ -461,24 +461,10 @@ cd_devices = { · 1 unmodified line | |||
| 461 | 'openbsd': '/dev/rcd0c', | 461 | 'openbsd': '/dev/rcd0c', |
| 462 | 'linux': '/dev/sr0', | 462 | 'linux': '/dev/sr0', |
| 463 | } | 463 | } |
| 464 | if host_machine.system() in cd_devices | 464 | if host_machine.system() in optical_devices |
| 465 | cd_device = cd_devices[host_machine.system()] | 465 | optical_device = optical_devices[host_machine.system()] |
| 466 | else | 466 | else |
| 467 | cd_device = '/dev/cdrom' | 467 | optical_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' | ||
| 482 | endif | 468 | endif |
| 483 | 469 | ||
| 484 | features += {'android': host_machine.system() == 'android'} | 470 | features += {'android': host_machine.system() == 'android'} |
| @@ -1716,8 +1702,7 @@ endif · 1231 unmodified lines | |||
| 1716 | # Set config.h | 1702 | # Set config.h |
| 1717 | conf_data = configuration_data() | 1703 | conf_data = configuration_data() |
| 1718 | conf_data.set_quoted('CONFIGURATION', meson.build_options()) | 1704 | conf_data.set_quoted('CONFIGURATION', meson.build_options()) |
| 1719 | conf_data.set_quoted('DEFAULT_DVD_DEVICE', dvd_device) | 1705 | conf_data.set_quoted('DEFAULT_OPTICAL_DEVICE', optical_device) |
| 1720 | conf_data.set_quoted('DEFAULT_CDROM_DEVICE', cd_device) | ||
| 1721 | 1706 | ||
| 1722 | # Loop over all features in the build, create a define and add them to config.h | 1707 | # Loop over all features in the build, create a define and add them to config.h |
| 1723 | feature_keys = [] | 1708 | feature_keys = [] |
| @@ -256,7 +256,7 @@ static int open_cdda(stream_t *st) · 255 unmodified lines | |||
| 256 | } else if (p->cdda_device && p->cdda_device[0]) { | 256 | } else if (p->cdda_device && p->cdda_device[0]) { |
| 257 | p->device = mp_get_user_path(priv, st->global, p->cdda_device); | 257 | p->device = mp_get_user_path(priv, st->global, p->cdda_device); |
| 258 | } else { | 258 | } else { |
| 259 | p->device = talloc_strdup(priv, DEFAULT_CDROM_DEVICE); | 259 | p->device = talloc_strdup(priv, DEFAULT_OPTICAL_DEVICE); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | #if defined(__NetBSD__) | 262 | #if defined(__NetBSD__) |
| @@ -587,7 +587,7 @@ static int open_s_internal(stream_t *stream) · 586 unmodified lines | |||
| 587 | else if (p->opts->device && p->opts->device[0]) | 587 | else if (p->opts->device && p->opts->device[0]) |
| 588 | filename = p->opts->device; | 588 | filename = p->opts->device; |
| 589 | else | 589 | else |
| 590 | filename = DEFAULT_DVD_DEVICE; | 590 | filename = DEFAULT_OPTICAL_DEVICE; |
| 591 | if (!new_dvdnav_stream(stream, filename)) { | 591 | if (!new_dvdnav_stream(stream, filename)) { |
| 592 | MP_ERR(stream, "Couldn't open DVD device: %s\n", | 592 | MP_ERR(stream, "Couldn't open DVD device: %s\n", |
| 593 | filename); | 593 | filename); |