Add compatibility with chromaprint >= 1.4
This commit is contained in:
parent
5e7dd00024
commit
ded3126857
@ -143,16 +143,24 @@ QString Chromaprinter::CreateFingerprint() {
|
|||||||
ChromaprintContext* chromaprint =
|
ChromaprintContext* chromaprint =
|
||||||
chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT);
|
chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT);
|
||||||
chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels);
|
chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels);
|
||||||
chromaprint_feed(chromaprint, reinterpret_cast<void*>(data.data()),
|
chromaprint_feed(chromaprint, reinterpret_cast<int16_t *>(data.data()),
|
||||||
data.size() / 2);
|
data.size() / 2);
|
||||||
chromaprint_finish(chromaprint);
|
chromaprint_finish(chromaprint);
|
||||||
|
|
||||||
void* fprint = nullptr;
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
|
#if CHROMAPRINT_VERSION_MAJOR >= 1 && CHROMAPRINT_VERSION_MINOR >= 4
|
||||||
|
u_int32_t *fprint = nullptr;
|
||||||
|
char *encoded = nullptr;
|
||||||
|
#else
|
||||||
|
void *fprint = nullptr;
|
||||||
|
void *encoded = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size);
|
int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size);
|
||||||
|
|
||||||
QByteArray fingerprint;
|
QByteArray fingerprint;
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
void* encoded = nullptr;
|
|
||||||
int encoded_size = 0;
|
int encoded_size = 0;
|
||||||
chromaprint_encode_fingerprint(fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT,
|
chromaprint_encode_fingerprint(fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT,
|
||||||
&encoded, &encoded_size, 1);
|
&encoded, &encoded_size, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user