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
453features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE',453features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE',
454 prefix: '#include <string.h>')}454 prefix: '#include <string.h>')}
455 455
456cd_devices = {456optical_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}
464if host_machine.system() in cd_devices464if host_machine.system() in optical_devices
465 cd_device = cd_devices[host_machine.system()]465 optical_device = optical_devices[host_machine.system()]
466else466else
467 cd_device = '/dev/cdrom'467 optical_device = '/dev/cdrom'
468endif
469
470dvd_devices = {
471 'windows': 'D:',
472 'cygwin': 'D:',
473 'darwin': '/dev/diskN',
474 'freebsd': '/dev/cd0',
475 'openbsd': '/dev/rcd0c',
476 'linux': '/dev/sr0',
477}
478if host_machine.system() in cd_devices
479 dvd_device = dvd_devices[host_machine.system()]
480else
481 dvd_device = '/dev/dvd'
482endif468endif
483 469
484features += {'android': host_machine.system() == 'android'}470features += {'android': host_machine.system() == 'android'}
@@ -1716,8 +1702,7 @@ endif · 1231 unmodified lines
1716# Set config.h1702# Set config.h
1717conf_data = configuration_data()1703conf_data = configuration_data()
1718conf_data.set_quoted('CONFIGURATION', meson.build_options())1704conf_data.set_quoted('CONFIGURATION', meson.build_options())
1719conf_data.set_quoted('DEFAULT_DVD_DEVICE', dvd_device)1705conf_data.set_quoted('DEFAULT_OPTICAL_DEVICE', optical_device)
1720conf_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.h1707# Loop over all features in the build, create a define and add them to config.h
1723feature_keys = []1708feature_keys = []
stream/stream_cdda.c+1−1
@@ -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__)
stream/stream_dvdnav.c+1−1
@@ -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 else589 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);

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