From a30af2ba429b6110418b4419c8c011ab3542335a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Apr 2019 13:40:05 +0200 Subject: [PATCH] lib/chromaprint/DecoderClient: replace method PrintResult() --- src/lib/chromaprint/DecoderClient.cxx | 4 +--- src/lib/chromaprint/DecoderClient.hxx | 6 +++++- test/RunChromaprint.cxx | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/chromaprint/DecoderClient.cxx b/src/lib/chromaprint/DecoderClient.cxx index f5c124adf..98b9e37e8 100644 --- a/src/lib/chromaprint/DecoderClient.cxx +++ b/src/lib/chromaprint/DecoderClient.cxx @@ -26,7 +26,7 @@ ChromaprintDecoderClient::ChromaprintDecoderClient() = default; ChromaprintDecoderClient::~ChromaprintDecoderClient() noexcept = default; void -ChromaprintDecoderClient::PrintResult() +ChromaprintDecoderClient::Finish() { if (!ready) throw std::runtime_error("Decoding failed"); @@ -38,8 +38,6 @@ ChromaprintDecoderClient::PrintResult() } chromaprint.Finish(); - - printf("%s\n", chromaprint.GetFingerprint().c_str()); } void diff --git a/src/lib/chromaprint/DecoderClient.hxx b/src/lib/chromaprint/DecoderClient.hxx index d9a01b8db..c7dc021f3 100644 --- a/src/lib/chromaprint/DecoderClient.hxx +++ b/src/lib/chromaprint/DecoderClient.hxx @@ -45,7 +45,11 @@ public: ChromaprintDecoderClient(); ~ChromaprintDecoderClient() noexcept; - void PrintResult(); + void Finish(); + + std::string GetFingerprint() const { + return chromaprint.GetFingerprint(); + } /* virtual methods from DecoderClient */ void Ready(AudioFormat audio_format, diff --git a/test/RunChromaprint.cxx b/test/RunChromaprint.cxx index 710aaeeb8..1318d88f3 100644 --- a/test/RunChromaprint.cxx +++ b/test/RunChromaprint.cxx @@ -135,7 +135,8 @@ try { return EXIT_FAILURE; } - client.PrintResult(); + client.Finish(); + printf("%s\n", client.GetFingerprint().c_str()); return EXIT_SUCCESS; } catch (...) { PrintException(std::current_exception());