Facade class for audio playing. More...
#include <audio_decoder.h>
Public Member Functions | |
AudioDecoder (float threshold, size_t length, int type=PLAYER_AAC) | |
Constructor of AudioDecoder. More... | |
virtual | ~AudioDecoder () |
void | RemoveSink (AbstractSink *sink) |
Removes sink. More... | |
AbstractSink * | AddSink (AbstractSink *sink) |
Adds new sink. More... | |
size_t | Write (uint8_t *buffer, size_t length) |
Writes into internal ring buffer, could override oldest data when full. More... | |
void | LastFrame () |
Should be called when current portion of data is last one. More... | |
void | RegisterTagsMapCallback (TagsMapCallback cb_func, void *cb_data) |
Registers tags map callback. More... | |
void | RegisterReadCallback (ReadCallback cb_func, void *cb_data) |
Registers read callback. More... | |
void | Process () |
Starts audio processing. More... | |
int | PlayerType () const |
Gets Player current type. More... | |
void | Flush () |
Flushes Player state. More... | |
Private Attributes | |
RingSrc * | src_ |
Pointer to RingSrc feeder object. More... | |
NullSink * | sink_ |
Pointer to NullSink consumer object. More... | |
Player * | player_ |
Pointer to Player object. More... | |
Detailed Description
Facade class for audio playing.
- Date
- 7 July 2015 - version 1.0 beta
- 7 July 2016 - version 2.0 beta
- 1 November 2016 - version 2.0
- Version
- 2.0
- Copyright
- Copyright (c) 2015 Jaroslaw Bulat, Kacper Patro
- License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library 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. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Definition at line 38 of file audio_decoder.h.
Constructor & Destructor Documentation
AudioDecoder::AudioDecoder | ( | float | threshold, |
size_t | length, | ||
int | type = PLAYER_AAC |
||
) |
Constructor of AudioDecoder.
- Parameters
-
[in] threshold Relative to 0.5, indicates values for which audio time-stretching will take place [in] length Length of internal blocking ring buffer [in] type Player type: mpeg or aac
Definition at line 31 of file audio_decoder.cc.

|
virtual |
Definition at line 39 of file audio_decoder.cc.
Member Function Documentation
AbstractSink * AudioDecoder::AddSink | ( | AbstractSink * | sink | ) |
Adds new sink.
- Parameters
-
[in,out] sink Pointer to sink object
- Returns
- Added sink, NULL if already present
Definition at line 49 of file audio_decoder.cc.


void AudioDecoder::Flush | ( | ) |
Flushes Player state.
Definition at line 73 of file audio_decoder.cc.


void AudioDecoder::LastFrame | ( | ) |
Should be called when current portion of data is last one.
Definition at line 57 of file audio_decoder.cc.


int AudioDecoder::PlayerType | ( | ) | const |
Gets Player current type.
- Returns
- Player type
Definition at line 69 of file audio_decoder.cc.

void AudioDecoder::Process | ( | ) |
Starts audio processing.
Definition at line 65 of file audio_decoder.cc.


void AudioDecoder::RegisterReadCallback | ( | ReadCallback | cb_func, |
void * | cb_data | ||
) |
Registers read callback.
cb_func will be called with cb_data passed when reading from internal buffer
- Parameters
-
[in] cb_func Function to be called. Must match ReadCallback signature [in,out] cb_data Data which will be passed to cb_func when called
Definition at line 77 of file audio_decoder.cc.


void AudioDecoder::RegisterTagsMapCallback | ( | TagsMapCallback | cb_func, |
void * | cb_data | ||
) |
Registers tags map callback.
cb_func will be called with cb_data passed when tags received
- Parameters
-
[in] cb_func Function to be called. Must match TagsMapCallback signature [in,out] cb_data Data which will be passed to cb_func when called
Definition at line 61 of file audio_decoder.cc.

void AudioDecoder::RemoveSink | ( | AbstractSink * | sink | ) |
Removes sink.
- Parameters
-
[in] sink Pointer to sink object
Definition at line 45 of file audio_decoder.cc.

size_t AudioDecoder::Write | ( | uint8_t * | buffer, |
size_t | length | ||
) |
Writes into internal ring buffer, could override oldest data when full.
- Parameters
-
[in] buffer Pointer to source buffer [in] length Length of source buffer to read from
- Returns
- Number of elements written into internal buffer
Definition at line 53 of file audio_decoder.cc.


Member Data Documentation
|
private |
Pointer to Player object.
Definition at line 108 of file audio_decoder.h.
|
private |
Pointer to NullSink consumer object.
Definition at line 107 of file audio_decoder.h.
|
private |
Pointer to RingSrc feeder object.
Definition at line 106 of file audio_decoder.h.
The documentation for this class was generated from the following files: