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;
|
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
|
long
|
||||||
MadDecoder::TimeToFrame(SongTime t) const noexcept
|
MadDecoder::TimeToFrame(SongTime t) const noexcept
|
||||||
{
|
{
|
||||||
@ -1064,12 +1054,12 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
|
|||||||
static bool
|
static bool
|
||||||
mad_decoder_scan_stream(InputStream &is, TagHandler &handler) noexcept
|
mad_decoder_scan_stream(InputStream &is, TagHandler &handler) noexcept
|
||||||
{
|
{
|
||||||
const auto result = mad_decoder_total_file_time(is);
|
MadDecoder data(nullptr, is);
|
||||||
if (!result.first)
|
if (!data.DecodeFirstFrame(nullptr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!result.second.IsNegative())
|
if (!data.total_time.IsNegative())
|
||||||
handler.OnDuration(SongTime(result.second));
|
handler.OnDuration(SongTime(data.total_time));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user