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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const off_t num_samples = mpg123_length(&handle);
|
|
||||||
if (num_samples <= 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.OnAudioFormat(audio_format);
|
handler.OnAudioFormat(audio_format);
|
||||||
|
|
||||||
/* ID3 tag support not yet implemented */
|
/* ID3 tag support not yet implemented */
|
||||||
|
|
||||||
const auto duration =
|
if (const off_t num_samples = mpg123_length(&handle); num_samples >= 0) {
|
||||||
SongTime::FromScale<uint64_t>(num_samples,
|
const auto duration =
|
||||||
audio_format.sample_rate);
|
SongTime::FromScale<uint64_t>(num_samples,
|
||||||
|
audio_format.sample_rate);
|
||||||
|
handler.OnDuration(duration);
|
||||||
|
}
|
||||||
|
|
||||||
handler.OnDuration(duration);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue