-
Notifications
You must be signed in to change notification settings - Fork 11
/
fooid.h
121 lines (94 loc) · 2.93 KB
/
fooid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
libFooID - Free audio fingerprinting library
Copyright (C) 2006 Gian-Carlo Pascutto, Hogeschool Gent
Use of this software is allowed under either:
1) The GNU General Public License (GPL), as described
in LICENSE.GPL.
2) A modified BSD License, as described in LICENSE.BSDA.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef FOOID_H
#define FOOID_H
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(_WIN32) && defined(DYNAMIC)
#ifdef LIBFOOID_EXPORTS
#define FOOIDAPI _declspec(dllexport)
#else
#define FOOIDAPI _declspec(dllimport)
#endif
#else
#define FOOIDAPI
#endif
typedef struct t_fooid t_fooid;
/*
Set up library for generating fingerprints for
file with a given sampling rate and number of
channels.
input * sampling rate in Hz
* number of channels
output * handle to fingerprinter
(NULL on error)
*/
FOOIDAPI t_fooid * fp_init(int samplerate, int channels);
/*
Free a fingerprinter handle.
*/
FOOIDAPI void fp_free(t_fooid * fid);
/*
Feed a buffer of samples to the fingerprinting
generator. The sample buffer size should be a
multiple of the number of channels indicated
earlier. Buffer layout is data[length][channels].
You should keep feeding data as long as this
function returns TRUE, or until you have no
more data to feed.
input * fingerprinter handle
* pointer to buffer of 16-bit signed shorts
* length of buffer
output * 1 if more data should be fed
0 if enough is availabled to generate the fingerprint
< 0 on error
*/
FOOIDAPI int fp_feed_short(t_fooid * fi, short *data, int size);
/*
As above, but for 32-bit IEEE floats.
*/
FOOIDAPI int fp_feed_float(t_fooid * fi, float *data, int size);
/*
Returns the size of the fingerprint
that this library will generate.
input * fingerprinter handle
output * > 0 size of fingerprint in bytes
< 0 on error
*/
FOOIDAPI int fp_getsize(t_fooid *fi);
/*
Returns the fingerprint version number that
this library will generate
input * fingerprinter handle
output * version number
*/
FOOIDAPI int fp_getversion(t_fooid *fi);
/*
Calculate the fingerprint.
You should allocate or provide a buffer
of suitable length (fg_getsize),
and provide the real, total length of the song.
Songs which do not contain enough usable data
to generate a meaningful fingerprint will cause
an error to be returned.
input * fingerprinter handle
* total length of song in centiseconds
* buffer to store fingerprint in
output * 0 on success
< 0 on error
*/
FOOIDAPI int fp_calculate(t_fooid *fi, int songlen, unsigned char* buff);
#if defined(__cplusplus)
} // extern "C"
#endif
#endif