tagreader: Add debug handler for taglib
Pass taglib debug messages through qLog instead of printing directly to stderr.
This commit is contained in:
parent
934fd336da
commit
509c65ced7
|
@ -47,6 +47,7 @@
|
|||
#include <popularimeterframe.h>
|
||||
#include <speexfile.h>
|
||||
#include <tag.h>
|
||||
#include <tdebuglistener.h>
|
||||
#include <textidentificationframe.h>
|
||||
#include <trueaudiofile.h>
|
||||
#include <tstring.h>
|
||||
|
@ -87,6 +88,22 @@ class TagLibFileRefFactory : public FileRefFactory {
|
|||
}
|
||||
};
|
||||
|
||||
// Handler to push TagLib messages to qLog instead of printing to stderr.
|
||||
class TagReaderDebugListener : public TagLib::DebugListener {
|
||||
private:
|
||||
TagReaderDebugListener() {
|
||||
// Install handler.
|
||||
TagLib::setDebugListener(this);
|
||||
}
|
||||
|
||||
virtual void printMessage(const TagLib::String &msg) override {
|
||||
// Remove trailing newline.
|
||||
qLog(Debug).noquote() << TStringToQString(msg).trimmed();
|
||||
}
|
||||
static TagReaderDebugListener listener_;
|
||||
};
|
||||
TagReaderDebugListener TagReaderDebugListener::listener_;
|
||||
|
||||
namespace {
|
||||
|
||||
TagLib::String StdStringToTaglibString(const std::string& s) {
|
||||
|
|
Loading…
Reference in New Issue