From 822d766a049afc49d6c5f86a9ed935d9d66e07d3 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 2 Feb 2012 14:15:55 +0100 Subject: [PATCH] Add constants for chromaprinter decode rate & channels. --- src/musicbrainz/chromaprinter.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/musicbrainz/chromaprinter.cpp b/src/musicbrainz/chromaprinter.cpp index 83325786a..dc086b1ad 100644 --- a/src/musicbrainz/chromaprinter.cpp +++ b/src/musicbrainz/chromaprinter.cpp @@ -29,6 +29,8 @@ #include "core/logging.h" #include "core/timeconstants.h" +static const int kDecodeRate = 11025; +static const int kDecodeChannels = 1; Chromaprinter::Chromaprinter(const QString& filename) : filename_(filename), @@ -86,8 +88,8 @@ QString Chromaprinter::CreateFingerprint() { GstCaps* caps = gst_caps_new_simple( "audio/x-raw-int", "width", G_TYPE_INT, 16, - "channels", G_TYPE_INT, 1, - "rate", G_TYPE_INT, 11025, + "channels", G_TYPE_INT, kDecodeChannels, + "rate", G_TYPE_INT, kDecodeRate, NULL); gst_element_link_filtered(resample, sink, caps); gst_caps_unref(caps); @@ -123,7 +125,7 @@ QString Chromaprinter::CreateFingerprint() { QByteArray data = buffer_.data(); ChromaprintContext* chromaprint = chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT); - chromaprint_start(chromaprint, 11025, 1); + chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels); chromaprint_feed(chromaprint, reinterpret_cast(data.data()), data.size() / 2); chromaprint_finish(chromaprint);