libgroove  5.0.0
fingerprinter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Andrew Kelley
3  *
4  * This file is part of libgroove, which is MIT licensed.
5  * See http://opensource.org/licenses/MIT
6  */
7 
8 #ifndef GROOVE_FINGERPRINTER_H
9 #define GROOVE_FINGERPRINTER_H
10 
11 #include <groove/groove.h>
12 
16  int32_t *fingerprint;
19 
21  double duration;
22 
27 };
28 
36 
40 
43 };
44 
45 GROOVE_EXPORT struct GrooveFingerprinter *groove_fingerprinter_create(void);
46 GROOVE_EXPORT void groove_fingerprinter_destroy(struct GrooveFingerprinter *printer);
47 
49 GROOVE_EXPORT int groove_fingerprinter_attach(struct GrooveFingerprinter *printer,
50  struct GroovePlaylist *playlist);
51 GROOVE_EXPORT int groove_fingerprinter_detach(struct GrooveFingerprinter *printer);
52 
56 GROOVE_EXPORT int groove_fingerprinter_info_get(struct GrooveFingerprinter *printer,
57  struct GrooveFingerprinterInfo *info, int block);
58 
59 GROOVE_EXPORT void groove_fingerprinter_free_info(struct GrooveFingerprinterInfo *info);
60 
63 GROOVE_EXPORT int groove_fingerprinter_info_peek(struct GrooveFingerprinter *printer,
64  int block);
65 
70 GROOVE_EXPORT void groove_fingerprinter_position(struct GrooveFingerprinter *printer,
71  struct GroovePlaylistItem **item, double *seconds);
72 
88 GROOVE_EXPORT int groove_fingerprinter_encode(int32_t *fp, int size, char **encoded_fp);
89 
105 GROOVE_EXPORT int groove_fingerprinter_decode(char *encoded_fp, int32_t **fp, int *size);
106 
107 GROOVE_EXPORT void groove_fingerprinter_dealloc(void *ptr);
108 
109 #endif
void groove_fingerprinter_free_info(struct GrooveFingerprinterInfo *info)
int groove_fingerprinter_info_peek(struct GrooveFingerprinter *printer, int block)
returns < 0 on error, 0 on no info ready, 1 on info ready if block is 1, block until info is ready ...
void groove_fingerprinter_destroy(struct GrooveFingerprinter *printer)
int groove_fingerprinter_encode(int32_t *fp, int size, char **encoded_fp)
Compress and base64-encode a raw fingerprint.
struct GroovePlaylist * playlist
read-only. set when attached and cleared when detached
Definition: fingerprinter.h:42
int fingerprint_size
the number of 32-bit integers in the fingerprint array
Definition: fingerprinter.h:18
void groove_fingerprinter_dealloc(void *ptr)
use this to find out the unique id of an audio track
Definition: fingerprinter.h:14
double duration
how many seconds long this song is
Definition: fingerprinter.h:21
int sink_buffer_size
how big the sink buffer should be, in sample frames.
Definition: fingerprinter.h:39
int32_t * fingerprint
raw fingerprint. A fingerprint is an array of signed 32-bit integers.
Definition: fingerprinter.h:16
int groove_fingerprinter_attach(struct GrooveFingerprinter *printer, struct GroovePlaylist *playlist)
once you attach, you must detach before destroying the playlist
void groove_fingerprinter_position(struct GrooveFingerprinter *printer, struct GroovePlaylistItem **item, double *seconds)
get the position of the printer head both the current playlist item and the position in seconds in th...
Definition: groove.h:118
struct GrooveFingerprinter * groove_fingerprinter_create(void)
int info_queue_size
maximum number of GrooveFingerprinterInfo items to store in this fingerprinter's queue.
Definition: fingerprinter.h:35
int groove_fingerprinter_detach(struct GrooveFingerprinter *printer)
int groove_fingerprinter_info_get(struct GrooveFingerprinter *printer, struct GrooveFingerprinterInfo *info, int block)
returns < 0 on error, 0 on aborted (block=1) or no info ready (block=0), 1 on info returned...
struct GroovePlaylistItem * item
the playlist item that this info applies to.
Definition: fingerprinter.h:26
Definition: groove.h:144
int groove_fingerprinter_decode(char *encoded_fp, int32_t **fp, int *size)
Uncompress and base64-decode an encoded fingerprint.
Definition: fingerprinter.h:29