Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use the same default optical drive for everything #15889

Merged
merged 3 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions DOCS/man/mpv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,22 @@ Note that quitting the player manually will always lead to exit code 0,
overriding the exit code that would be returned normally. Also, the ``quit``
input command can take an exit code: in this case, that exit code is returned.

OPTICAL DRIVES
==============

Depending on the OS, mpv will choose a different disc device by default.
This applies for all optical disc playback (CDDA, DVD, and BD).

======= =============
OS Default Drive
======= =============
Linux /dev/sr0
Windows D:
macOS /dev/disk1
FreeBSD /dev/cd0
OpenBSD /dev/rcd0c
======= =============

FILES
=====

Expand Down
12 changes: 7 additions & 5 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3758,21 +3758,23 @@ Disc Devices
------------

``--cdda-device=<path>``
Specify the CD device for CDDA playback (default: ``/dev/cdrom``).
Specify the CD device for CDDA playback. The default device path depends on
the OS. See the `OPTICAL DRIVES`_ section.

``--dvd-device=<path>``
Specify the DVD device or .iso filename (default: ``/dev/dvd``). You can
Specify the DVD device or .iso filename. You can
also specify a directory that contains files previously copied directly
from a DVD (with e.g. vobcopy).
from a DVD (with e.g. vobcopy). The default device path depends on
the OS. See the `OPTICAL DRIVES`_ section.

.. admonition:: Example

``mpv dvd:// --dvd-device=/path/to/dvd/``

``--bluray-device=<path>``
(Blu-ray only)
Specify the Blu-ray disc location. Must be a directory with Blu-ray
structure.
structure. The default device path depends on the OS. See the
`OPTICAL DRIVES`_ section.

.. admonition:: Example

Expand Down
25 changes: 5 additions & 20 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -453,32 +453,18 @@ features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE',
features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE',
prefix: '#include <string.h>')}

cd_devices = {
optical_devices = {
'windows': 'D:',
'cygwin': 'D:',
'darwin': '/dev/disk1',
'freebsd': '/dev/cd0',
'openbsd': '/dev/rcd0c',
'linux': '/dev/sr0',
}
if host_machine.system() in cd_devices
cd_device = cd_devices[host_machine.system()]
if host_machine.system() in optical_devices
optical_device = optical_devices[host_machine.system()]
else
cd_device = '/dev/cdrom'
endif

dvd_devices = {
'windows': 'D:',
'cygwin': 'D:',
'darwin': '/dev/diskN',
'freebsd': '/dev/cd0',
'openbsd': '/dev/rcd0c',
'linux': '/dev/sr0',
}
if host_machine.system() in cd_devices
dvd_device = dvd_devices[host_machine.system()]
else
dvd_device = '/dev/dvd'
optical_device = '/dev/cdrom'
endif

features += {'android': host_machine.system() == 'android'}
Expand Down Expand Up @@ -1716,8 +1702,7 @@ endif
# Set config.h
conf_data = configuration_data()
conf_data.set_quoted('CONFIGURATION', meson.build_options())
conf_data.set_quoted('DEFAULT_DVD_DEVICE', dvd_device)
conf_data.set_quoted('DEFAULT_CDROM_DEVICE', cd_device)
conf_data.set_quoted('DEFAULT_OPTICAL_DEVICE', optical_device)

# Loop over all features in the build, create a define and add them to config.h
feature_keys = []
Expand Down
4 changes: 3 additions & 1 deletion stream/stream_bluray.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,10 @@ static int bluray_stream_open_internal(stream_t *s)
/* find the requested device */
if (b->cfg_device && b->cfg_device[0]) {
device = b->cfg_device;
} else {
} else if (b->opts->bluray_device && b->opts->bluray_device[0]) {
device = b->opts->bluray_device;
} else {
device = DEFAULT_OPTICAL_DEVICE;
}

if (!device || !device[0]) {
Expand Down
2 changes: 1 addition & 1 deletion stream/stream_cdda.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int open_cdda(stream_t *st)
} else if (p->cdda_device && p->cdda_device[0]) {
p->device = mp_get_user_path(priv, st->global, p->cdda_device);
} else {
p->device = talloc_strdup(priv, DEFAULT_CDROM_DEVICE);
p->device = talloc_strdup(priv, DEFAULT_OPTICAL_DEVICE);
}

#if defined(__NetBSD__)
Expand Down
2 changes: 1 addition & 1 deletion stream/stream_dvdnav.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ static int open_s_internal(stream_t *stream)
else if (p->opts->device && p->opts->device[0])
filename = p->opts->device;
else
filename = DEFAULT_DVD_DEVICE;
filename = DEFAULT_OPTICAL_DEVICE;
if (!new_dvdnav_stream(stream, filename)) {
MP_ERR(stream, "Couldn't open DVD device: %s\n",
filename);
Expand Down
Loading