From 6ea9ec9931d3cb65f812b79fec6c14eab7d05070 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 19 Sep 2023 16:14:24 -0500 Subject: [PATCH] stream_cdda: move cdrom-device to cdda_params There is zero reason for this to be an MPOpt. Because of how the OPT_SUBSTRACT works, the option gets renamed to cdda-device instead, but probably not a big deal since the old alias is still in place. --- DOCS/interface-changes.rst | 1 + DOCS/man/options.rst | 4 ++-- options/options.c | 2 +- options/options.h | 1 - stream/stream_cdda.c | 11 ++++------- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index b44b452b94..6f5d61340b 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -89,6 +89,7 @@ Interface changes instead) - add `--title-bar` option - add `--window-corners` option + - rename `--cdrom-device` to `--cdda-device` --- mpv 0.36.0 --- - add `--target-contrast` - Target luminance value is now also applied when ICC profile is used. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index d641af445a..9c9371d4a6 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -3472,8 +3472,8 @@ Window Disc Devices ------------ -``--cdrom-device=`` - Specify the CD-ROM device (default: ``/dev/cdrom``). +``--cdda-device=`` + Specify the CD device for CDDA playback (default: ``/dev/cdrom``). ``--dvd-device=`` Specify the DVD device or .iso filename (default: ``/dev/dvd``). You can diff --git a/options/options.c b/options/options.c index 5e893c4b86..c6a0873b31 100644 --- a/options/options.c +++ b/options/options.c @@ -547,7 +547,7 @@ static const m_option_t mp_opts[] = { #if HAVE_CDDA {"cdda", OPT_SUBSTRUCT(stream_cdda_opts, stream_cdda_conf)}, - {"cdrom-device", OPT_STRING(cdrom_device), .flags = M_OPT_FILE}, + {"cdrom-device", OPT_REPLACED("cdda-device")}, #endif // demuxer.c - select audio/sub file/demuxer diff --git a/options/options.h b/options/options.h index 78cbaf92e4..6f3d80239f 100644 --- a/options/options.h +++ b/options/options.h @@ -325,7 +325,6 @@ typedef struct MPOpts { struct dvb_params *stream_dvb_opts; struct stream_lavf_params *stream_lavf_opts; - char *cdrom_device; char *bluray_device; struct demux_rawaudio_opts *demux_rawaudio; diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index a0de09b6d1..0ad082c114 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -61,6 +61,7 @@ typedef struct cdda_params { size_t data_pos; // options + char *cdda_device; int speed; int paranoia_mode; int sector_size; @@ -76,6 +77,7 @@ typedef struct cdda_params { #define OPT_BASE_STRUCT struct cdda_params const struct m_sub_options stream_cdda_conf = { .opts = (const m_option_t[]) { + {"device", OPT_STRING(cdda_device), .flags = M_OPT_FILE}, {"speed", OPT_INT(speed), M_RANGE(1, 100)}, {"paranoia", OPT_INT(paranoia_mode), M_RANGE(0, 2)}, {"sector-size", OPT_INT(sector_size), M_RANGE(1, 100)}, @@ -286,15 +288,10 @@ static int open_cdda(stream_t *st) cdrom_drive_t *cdd = NULL; int last_track; - char *global_device; - mp_read_option_raw(st->global, "cdrom-device", &m_option_type_string, - &global_device); - talloc_steal(st, global_device); - if (st->path[0]) { p->device = st->path; - } else if (global_device && global_device[0]) { - p->device = global_device; + } else if (p->cdda_device && p->cdda_device[0]) { + p->device = p->cdda_device; } else { p->device = DEFAULT_CDROM_DEVICE; }