diff --git a/NEWS b/NEWS index bd547f42f..dd6a1c3cb 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.19.17 (not yet released) * decoder - flac: fix assertion failure while seeking + - flac: fix stream duration indicator - fix seek problems in several plugins * fix spurious seek error "Failed to allocate silence buffer" * replay gain: fix "replay_gain_handler mixer" setting diff --git a/src/decoder/plugins/FlacCommon.hxx b/src/decoder/plugins/FlacCommon.hxx index f38c9aacc..b5de6974d 100644 --- a/src/decoder/plugins/FlacCommon.hxx +++ b/src/decoder/plugins/FlacCommon.hxx @@ -55,9 +55,7 @@ struct flac_data : public FlacInput { AudioFormat audio_format; /** - * The total number of frames in this song. The decoder - * plugin may initialize this attribute to override the value - * provided by libFLAC (e.g. for sub songs from a CUE sheet). + * The total number of frames in this song. 0 means unknown. */ FLAC__uint64 total_frames; diff --git a/src/decoder/plugins/FlacDecoderPlugin.cxx b/src/decoder/plugins/FlacDecoderPlugin.cxx index d89d116a7..ff4862e78 100644 --- a/src/decoder/plugins/FlacDecoderPlugin.cxx +++ b/src/decoder/plugins/FlacDecoderPlugin.cxx @@ -145,9 +145,10 @@ flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd, if (data->initialized) { /* done */ - const auto duration2 = - SignedSongTime::FromScale(data->total_frames, - data->audio_format.sample_rate); + const auto duration2 = data->total_frames > 0 + ? SignedSongTime::FromScale(data->total_frames, + data->audio_format.sample_rate) + : SignedSongTime::Negative(); decoder_initialized(data->decoder, data->audio_format, data->input_stream.IsSeekable(),