decoder/audiofile: merge duplicate code into CheckAudioFormat(AFfilehandle)
This commit is contained in:
parent
1dcaf8f76a
commit
89b1e27d2e
@ -180,6 +180,14 @@ audiofile_setup_sample_format(AFfilehandle af_fp)
|
|||||||
return audiofile_bits_to_sample_format(bits);
|
return audiofile_bits_to_sample_format(bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static AudioFormat
|
||||||
|
CheckAudioFormat(AFfilehandle fh)
|
||||||
|
{
|
||||||
|
return CheckAudioFormat(afGetRate(fh, AF_DEFAULT_TRACK),
|
||||||
|
audiofile_setup_sample_format(fh),
|
||||||
|
afGetVirtualChannels(fh, AF_DEFAULT_TRACK));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
audiofile_stream_decode(DecoderClient &client, InputStream &is)
|
audiofile_stream_decode(DecoderClient &client, InputStream &is)
|
||||||
{
|
{
|
||||||
@ -197,11 +205,7 @@ audiofile_stream_decode(DecoderClient &client, InputStream &is)
|
|||||||
|
|
||||||
AtScopeExit(fh) { afCloseFile(fh); };
|
AtScopeExit(fh) { afCloseFile(fh); };
|
||||||
|
|
||||||
const auto audio_format =
|
const auto audio_format = CheckAudioFormat(fh);
|
||||||
CheckAudioFormat(afGetRate(fh, AF_DEFAULT_TRACK),
|
|
||||||
audiofile_setup_sample_format(fh),
|
|
||||||
afGetVirtualChannels(fh, AF_DEFAULT_TRACK));
|
|
||||||
|
|
||||||
const auto total_time = audiofile_get_duration(fh);
|
const auto total_time = audiofile_get_duration(fh);
|
||||||
|
|
||||||
const uint16_t kbit_rate = (uint16_t)
|
const uint16_t kbit_rate = (uint16_t)
|
||||||
@ -254,9 +258,7 @@ audiofile_scan_stream(InputStream &is, TagHandler &handler) noexcept
|
|||||||
handler.OnDuration(audiofile_get_duration(fh));
|
handler.OnDuration(audiofile_get_duration(fh));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
handler.OnAudioFormat(CheckAudioFormat(afGetRate(fh, AF_DEFAULT_TRACK),
|
handler.OnAudioFormat(CheckAudioFormat(fh));
|
||||||
audiofile_setup_sample_format(fh),
|
|
||||||
afGetVirtualChannels(fh, AF_DEFAULT_TRACK)));
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user