decoder/flac: handle unknown duration correctly
If the duration is unknown, pass SignedSongTime::Negative(), as documented for decoder_initialized().
This commit is contained in:
parent
7f36923eb4
commit
4a7042e847
1
NEWS
1
NEWS
@ -1,6 +1,7 @@
|
|||||||
ver 0.19.17 (not yet released)
|
ver 0.19.17 (not yet released)
|
||||||
* decoder
|
* decoder
|
||||||
- flac: fix assertion failure while seeking
|
- flac: fix assertion failure while seeking
|
||||||
|
- flac: fix stream duration indicator
|
||||||
- fix seek problems in several plugins
|
- fix seek problems in several plugins
|
||||||
* fix spurious seek error "Failed to allocate silence buffer"
|
* fix spurious seek error "Failed to allocate silence buffer"
|
||||||
* replay gain: fix "replay_gain_handler mixer" setting
|
* replay gain: fix "replay_gain_handler mixer" setting
|
||||||
|
@ -55,9 +55,7 @@ struct flac_data : public FlacInput {
|
|||||||
AudioFormat audio_format;
|
AudioFormat audio_format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The total number of frames in this song. The decoder
|
* The total number of frames in this song. 0 means unknown.
|
||||||
* plugin may initialize this attribute to override the value
|
|
||||||
* provided by libFLAC (e.g. for sub songs from a CUE sheet).
|
|
||||||
*/
|
*/
|
||||||
FLAC__uint64 total_frames;
|
FLAC__uint64 total_frames;
|
||||||
|
|
||||||
|
@ -145,9 +145,10 @@ flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd,
|
|||||||
if (data->initialized) {
|
if (data->initialized) {
|
||||||
/* done */
|
/* done */
|
||||||
|
|
||||||
const auto duration2 =
|
const auto duration2 = data->total_frames > 0
|
||||||
SignedSongTime::FromScale<uint64_t>(data->total_frames,
|
? SignedSongTime::FromScale<uint64_t>(data->total_frames,
|
||||||
data->audio_format.sample_rate);
|
data->audio_format.sample_rate)
|
||||||
|
: SignedSongTime::Negative();
|
||||||
|
|
||||||
decoder_initialized(data->decoder, data->audio_format,
|
decoder_initialized(data->decoder, data->audio_format,
|
||||||
data->input_stream.IsSeekable(),
|
data->input_stream.IsSeekable(),
|
||||||
|
Loading…
Reference in New Issue
Block a user