decoder/mpg123: relax mpg123_length() check in Scan()
Do not fail the Scan() function completely if libmpg123 cannot determine the duration.
This commit is contained in:
parent
e00e7802c8
commit
8e42467bd2
|
@ -390,20 +390,17 @@ Scan(mpg123_handle &handle, TagHandler &handler) noexcept
|
|||
return false;
|
||||
}
|
||||
|
||||
const off_t num_samples = mpg123_length(&handle);
|
||||
if (num_samples <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
handler.OnAudioFormat(audio_format);
|
||||
|
||||
/* ID3 tag support not yet implemented */
|
||||
|
||||
if (const off_t num_samples = mpg123_length(&handle); num_samples >= 0) {
|
||||
const auto duration =
|
||||
SongTime::FromScale<uint64_t>(num_samples,
|
||||
audio_format.sample_rate);
|
||||
|
||||
handler.OnDuration(duration);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue