Module: Groove::Fingerprinter
- Extended by:
- FFI::Library
- Defined in:
- lib/groove/fingerprinter.rb
Defined Under Namespace
Classes: GrooveFingerprinter, GrooveFingerprinterInfo
Class Method Summary collapse
- .attach_function(name, *_) ⇒ Object
-
.fingerprinter_attach(printer, playlist) ⇒ Integer
once you attach, you must detach before destroying the playlist.
-
.fingerprinter_create ⇒ GrooveFingerprinter
(Not documented).
-
.fingerprinter_dealloc(ptr) ⇒ nil
(Not documented).
-
.fingerprinter_decode(encoded_fp, fp, size) ⇒ Integer
Uncompress and base64-decode an encoded fingerprint.
-
.fingerprinter_destroy(printer) ⇒ nil
(Not documented).
-
.fingerprinter_detach(printer) ⇒ Integer
(Not documented).
-
.fingerprinter_encode(fp, size, encoded_fp) ⇒ Integer
Compress and base64-encode a raw fingerprint.
-
.fingerprinter_free_info(info) ⇒ nil
(Not documented).
-
.fingerprinter_info_get(printer, info, block) ⇒ Integer
returns < 0 on error, 0 on aborted (block=1) or no info ready (block=0), 1 on info returned.
-
.fingerprinter_info_peek(printer, block) ⇒ Integer
returns < 0 on error, 0 on no info ready, 1 on info ready if block is 1, block until info is ready.
-
.fingerprinter_position(printer, item, seconds) ⇒ nil
get the position of the printer head both the current playlist item and the position in seconds in the playlist item are given.
Class Method Details
.attach_function(name, *_) ⇒ Object
9 10 11 12 13 |
# File 'lib/groove/fingerprinter.rb', line 9 def self.attach_function(name, *_) begin; super; rescue FFI::NotFoundError => e (class << self; self; end).class_eval { define_method(name) { |*_| raise e } } end end |
.fingerprinter_attach(printer, playlist) ⇒ Integer
once you attach, you must detach before destroying the playlist
77 |
# File 'lib/groove/fingerprinter.rb', line 77 attach_function :fingerprinter_attach, :groove_fingerprinter_attach, [GrooveFingerprinter, :pointer], :int |
.fingerprinter_create ⇒ GrooveFingerprinter
(Not documented)
60 |
# File 'lib/groove/fingerprinter.rb', line 60 attach_function :fingerprinter_create, :groove_fingerprinter_create, [], GrooveFingerprinter |
.fingerprinter_dealloc(ptr) ⇒ nil
(Not documented)
182 |
# File 'lib/groove/fingerprinter.rb', line 182 attach_function :fingerprinter_dealloc, :groove_fingerprinter_dealloc, [:pointer], :void |
.fingerprinter_decode(encoded_fp, fp, size) ⇒ Integer
Uncompress and base64-decode an encoded fingerprint
The caller is responsible for freeing the returned pointer using groove_fingerprinter_dealloc().
Parameters:
- encoded_fp: Pointer to an encoded fingerprint
- encoded_size: Size of the encoded fingerprint in bytes
- fp: Pointer to a pointer, where the decoded raw fingerprint (array
of signed 32-bit integers) will be stored
- size: Number of items in the returned raw fingerprint
Returns:
- 0 on success, < 0 on error
174 |
# File 'lib/groove/fingerprinter.rb', line 174 attach_function :fingerprinter_decode, :groove_fingerprinter_decode, [:string, :pointer, :pointer], :int |
.fingerprinter_destroy(printer) ⇒ nil
(Not documented)
68 |
# File 'lib/groove/fingerprinter.rb', line 68 attach_function :fingerprinter_destroy, :groove_fingerprinter_destroy, [GrooveFingerprinter], :void |
.fingerprinter_detach(printer) ⇒ Integer
(Not documented)
85 |
# File 'lib/groove/fingerprinter.rb', line 85 attach_function :fingerprinter_detach, :groove_fingerprinter_detach, [GrooveFingerprinter], :int |
.fingerprinter_encode(fp, size, encoded_fp) ⇒ Integer
Compress and base64-encode a raw fingerprint
The caller is responsible for freeing the returned pointer using groove_fingerprinter_dealloc().
Parameters:
- fp: pointer to an array of signed 32-bit integers representing the raw
fingerprint to be encoded
- size: number of items in the raw fingerprint
- encoded_fp: pointer to a pointer, where the encoded fingerprint will be
stored
Returns:
- 0 on success, < 0 on error
151 |
# File 'lib/groove/fingerprinter.rb', line 151 attach_function :fingerprinter_encode, :groove_fingerprinter_encode, [:pointer, :int, :pointer], :int |
.fingerprinter_free_info(info) ⇒ nil
(Not documented)
105 |
# File 'lib/groove/fingerprinter.rb', line 105 attach_function :fingerprinter_free_info, :groove_fingerprinter_free_info, [GrooveFingerprinterInfo], :void |
.fingerprinter_info_get(printer, info, block) ⇒ Integer
returns < 0 on error, 0 on aborted (block=1) or no info ready (block=0), 1 on info returned. When you get info you must free it with groove_fingerprinter_free_info.
97 |
# File 'lib/groove/fingerprinter.rb', line 97 attach_function :fingerprinter_info_get, :groove_fingerprinter_info_get, [GrooveFingerprinter, GrooveFingerprinterInfo, :int], :int |
.fingerprinter_info_peek(printer, block) ⇒ Integer
returns < 0 on error, 0 on no info ready, 1 on info ready if block is 1, block until info is ready
115 |
# File 'lib/groove/fingerprinter.rb', line 115 attach_function :fingerprinter_info_peek, :groove_fingerprinter_info_peek, [GrooveFingerprinter, :int], :int |
.fingerprinter_position(printer, item, seconds) ⇒ nil
get the position of the printer head both the current playlist item and the position in seconds in the playlist item are given. item will be set to NULL if the playlist is empty you may pass NULL for item or seconds
128 |
# File 'lib/groove/fingerprinter.rb', line 128 attach_function :fingerprinter_position, :groove_fingerprinter_position, [GrooveFingerprinter, :pointer, :pointer], :void |