This class handles the received audio buffers. More...
#include <adorestreamer.h>
Public Member Functions | |
| AdoreStreamer () | |
| ~AdoreStreamer () | |
| void | SetEngine (GstEngine *engine) |
Pass the GStreamer Engine object to the class and get a BufferConsumer hook. More... | |
| void | ConsumeBuffer (GstBuffer *buffer, int pipeline_id) |
| void | StartProbing () |
| tell ConsumeBuffer() to start collecting audio buffers for later fingerprinting More... | |
| void | StopProbing () |
| stops collecting buffers and erases existing audio data from the fingerprinting buffer More... | |
| QString & | GetLastFingerprint () |
public read-only access to the private fingerprint_ member variable. More... | |
| QString & | GetFingerprintingAlgorithm () |
public read-only access to the private fingerprinting_algorithm_ member variable. More... | |
| QString & | GetFingerprintingAlgorithmVersion () |
public read-only access to the private fingerprinting_algorithm_version_ member variable. More... | |
| void | ResetLastFingerprint () |
| erases a previously created fingerprint. More... | |
Private Member Functions | |
| void | MonoMix (const short *source_buffer, int source_numsamples, int source_numberofchannels, int source_samplingrate, short *target_buffer, int target_buffer_size) |
| void | GetFingerprint (QString &fingerprint) |
| QString | ChromaPrint (short *data, int size) |
| QString | EchoPrint (short *data, int size) |
Private Attributes | |
| GstEngine * | engine_ |
| the GStreamer engine object, necessary to peek into the audio stream More... | |
| QBuffer | buffer_ |
| fingerprinting buffer to collect audio buffers for some seconds before creating a fingerprint More... | |
| bool | probing_ |
| controls the collection. More... | |
| QTime | probing_start_time |
| used to measure when MINIMUM_PROBING_DURATION has been reached and then create a fingerprint More... | |
| int | samplerate_ |
| computed in ConsumeBuffer() and stored to determine whether the rate has changed and the audio buffer collection needs a restart. More... | |
| QString | fingerprint_ |
| ascii (base64) representation of the result created by GetFingerprint(). More... | |
| QString | fingerprinting_algorithm_ |
either 'echoprint' or 'chromapint', depending on the #define uncommented in the cpp file. This is set in the constructor. More... | |
| QString | fingerprinting_algorithm_version_ |
| current version of the fingerprinting algorithm. This is set in the constructor. More... | |
This class handles the received audio buffers.
It computes the sample rate, converts the stereo stream to mono, and draws a fingerprint from the probed audio data.
| AdoreStreamer::AdoreStreamer | ( | ) |
| AdoreStreamer::~AdoreStreamer | ( | ) |
|
private |
Creates a ChromaPrint audio fingerprint as used by MusicBrainz. The parameter size holds the number of shorts in data.
| void AdoreStreamer::ConsumeBuffer | ( | GstBuffer * | buffer, |
| int | pipeline_id | ||
| ) |
Callback for receiving audio buffers. This member function collects audio data for MINIMUM_PROBING_DURATION seconds after StartProbing() was initiated, then GetFingerprint() is being called.
|
private |
Creates a EchoPrint audio fingerprint as used by EchoNest/last.fm. The parameter size holds the number of shorts in data. Note that the short int samples in the mono buffer have to be converted to floats before passing to the fingerprinting algorithm.
|
private |
After enough audio data has been collected in buffer_ a fingerprint is being created from a mono downmix. Currently, EchoPrint and ChromaPrint are implemented. Just uncomment the corresponding #define at the start of the cpp file.
|
inline |
public read-only access to the private fingerprinting_algorithm_ member variable.
|
inline |
public read-only access to the private fingerprinting_algorithm_version_ member variable.
|
inline |
public read-only access to the private fingerprint_ member variable.
|
private |
This private member is called by GetFingerprint() and creates a mono mix from stereo or multichannel audio data. Note: target_buffer has to be source_numsamples / source_numberofchannels in size
|
inline |
erases a previously created fingerprint.
| void AdoreStreamer::SetEngine | ( | GstEngine * | engine | ) |
Pass the GStreamer Engine object to the class and get a BufferConsumer hook.
| void AdoreStreamer::StartProbing | ( | ) |
tell ConsumeBuffer() to start collecting audio buffers for later fingerprinting
| void AdoreStreamer::StopProbing | ( | ) |
stops collecting buffers and erases existing audio data from the fingerprinting buffer
|
private |
fingerprinting buffer to collect audio buffers for some seconds before creating a fingerprint
|
private |
the GStreamer engine object, necessary to peek into the audio stream
|
private |
ascii (base64) representation of the result created by GetFingerprint().
|
private |
either 'echoprint' or 'chromapint', depending on the #define uncommented in the cpp file. This is set in the constructor.
|
private |
current version of the fingerprinting algorithm. This is set in the constructor.
|
private |
controls the collection.
|
private |
used to measure when MINIMUM_PROBING_DURATION has been reached and then create a fingerprint
|
private |
computed in ConsumeBuffer() and stored to determine whether the rate has changed and the audio buffer collection needs a restart.
1.8.6