Merge branch 'extend-robustness-of-cdda-playback' of https://github.com/lazypingu/MPD
This commit is contained in:
commit
cc291e8c98
@ -214,11 +214,6 @@ input_cdio_open(const char *uri,
|
||||
}
|
||||
|
||||
cdio_cddap_verbose_set(drv, CDDA_MESSAGE_FORGETIT, CDDA_MESSAGE_FORGETIT);
|
||||
if (speed > 0) {
|
||||
FmtDebug(cdio_domain, "Attempting to set CD speed to {}x",
|
||||
speed);
|
||||
cdio_cddap_speed_set(drv,speed);
|
||||
}
|
||||
|
||||
if (0 != cdio_cddap_open(drv)) {
|
||||
cdio_cddap_close_no_free_cdio(drv);
|
||||
@ -226,6 +221,15 @@ input_cdio_open(const char *uri,
|
||||
throw std::runtime_error("Unable to open disc.");
|
||||
}
|
||||
|
||||
if (speed > 0) {
|
||||
FmtDebug(cdio_domain, "Attempting to set CD speed to {}x",
|
||||
speed);
|
||||
/* Negative value indicate error (e.g. -405: not supported) */
|
||||
if (cdio_cddap_speed_set(drv,speed) < 0)
|
||||
FmtDebug(cdio_domain, "Failed to set CD speed to {}x",
|
||||
speed);
|
||||
}
|
||||
|
||||
bool reverse_endian;
|
||||
const int be = data_bigendianp(drv);
|
||||
switch (be) {
|
||||
@ -253,13 +257,23 @@ input_cdio_open(const char *uri,
|
||||
|
||||
lsn_t lsn_from, lsn_to;
|
||||
if (parsed_uri.track >= 0) {
|
||||
lsn_from = cdio_get_track_lsn(cdio, parsed_uri.track);
|
||||
lsn_to = cdio_get_track_last_lsn(cdio, parsed_uri.track);
|
||||
lsn_from = cdio_cddap_track_firstsector(drv, parsed_uri.track);
|
||||
lsn_to = cdio_cddap_track_lastsector(drv, parsed_uri.track);
|
||||
} else {
|
||||
lsn_from = 0;
|
||||
lsn_to = cdio_get_disc_last_lsn(cdio);
|
||||
lsn_from = cdio_cddap_disc_firstsector(drv);
|
||||
lsn_to = cdio_cddap_disc_lastsector(drv);
|
||||
}
|
||||
|
||||
/* LSNs < 0 indicate errors (e.g. -401: Invaid track, -402: no pregap) */
|
||||
if(lsn_from < 0 || lsn_to < 0)
|
||||
throw FmtRuntimeError("Error {} on track {}",
|
||||
lsn_from < 0 ? lsn_from : lsn_to, parsed_uri.track);
|
||||
|
||||
/* Only check for audio track if not pregap or whole CD */
|
||||
if (!cdio_cddap_track_audiop(drv, parsed_uri.track) && parsed_uri.track > 0)
|
||||
throw FmtRuntimeError("No audio track: {}",
|
||||
parsed_uri.track);
|
||||
|
||||
return std::make_unique<CdioParanoiaInputStream>(uri, mutex,
|
||||
drv, cdio,
|
||||
reverse_endian,
|
||||
|
Loading…
Reference in New Issue
Block a user