decoder/mad: merge mad_decoder_total_file_time() into mad_decoder_scan_stream()
This commit is contained in:
parent
0f18e7baf9
commit
0d0569b9af
@ -831,16 +831,6 @@ MadDecoder::~MadDecoder()
|
||||
delete[] times;
|
||||
}
|
||||
|
||||
/* this is primarily used for getting total time for tags */
|
||||
static std::pair<bool, SignedSongTime>
|
||||
mad_decoder_total_file_time(InputStream &is)
|
||||
{
|
||||
MadDecoder data(nullptr, is);
|
||||
return data.DecodeFirstFrame(nullptr)
|
||||
? std::make_pair(true, data.total_time)
|
||||
: std::make_pair(false, SignedSongTime::Negative());
|
||||
}
|
||||
|
||||
long
|
||||
MadDecoder::TimeToFrame(SongTime t) const noexcept
|
||||
{
|
||||
@ -1064,12 +1054,12 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
|
||||
static bool
|
||||
mad_decoder_scan_stream(InputStream &is, TagHandler &handler) noexcept
|
||||
{
|
||||
const auto result = mad_decoder_total_file_time(is);
|
||||
if (!result.first)
|
||||
MadDecoder data(nullptr, is);
|
||||
if (!data.DecodeFirstFrame(nullptr))
|
||||
return false;
|
||||
|
||||
if (!result.second.IsNegative())
|
||||
handler.OnDuration(SongTime(result.second));
|
||||
if (!data.total_time.IsNegative())
|
||||
handler.OnDuration(SongTime(data.total_time));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user