From e1ddb630543a74fb8216b7b405df1a03b247c7bb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Jul 2018 14:33:53 +0200 Subject: [PATCH] lib/xiph/FlacStreamMetadata: move code to Scan(FLAC__StreamMetadata_StreamInfo) --- src/lib/xiph/FlacStreamMetadata.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/xiph/FlacStreamMetadata.cxx b/src/lib/xiph/FlacStreamMetadata.cxx index dfb34c438..a19e6dce5 100644 --- a/src/lib/xiph/FlacStreamMetadata.cxx +++ b/src/lib/xiph/FlacStreamMetadata.cxx @@ -131,6 +131,14 @@ flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) noexcept stream_info->sample_rate); } +static void +Scan(const FLAC__StreamMetadata_StreamInfo &stream_info, + TagHandler &handler) noexcept +{ + if (stream_info.sample_rate > 0) + handler.OnDuration(flac_duration(&stream_info)); +} + void flac_scan_metadata(const FLAC__StreamMetadata *block, TagHandler &handler) noexcept @@ -142,8 +150,7 @@ flac_scan_metadata(const FLAC__StreamMetadata *block, break; case FLAC__METADATA_TYPE_STREAMINFO: - if (block->data.stream_info.sample_rate > 0) - handler.OnDuration(flac_duration(&block->data.stream_info)); + Scan(block->data.stream_info, handler); break; default: