Telematics SDK - API Reference  v1.55.0

Data Structures

class  telux::audio::ITranscodeListener
 
class  telux::audio::ITranscoder
 

Typedefs

using telux::audio::TranscoderReadResponseCb = std::function< void(std::shared_ptr< IAudioBuffer > buffer, uint32_t isLastBuffer, telux::common::ErrorCode error)>
 
using telux::audio::TranscoderWriteResponseCb = std::function< void(std::shared_ptr< IAudioBuffer > buffer, uint32_t bytesWritten, telux::common::ErrorCode error)>
 

Detailed Description

This section contains APIs related to Audio Transcoder operation.


Data Structure Documentation

class telux::audio::ITranscodeListener

Listener for events during transcoding.

Public Member Functions

virtual void onReadyForWrite ()
 
virtual ~ITranscodeListener ()
 

Constructor & Destructor Documentation

virtual telux::audio::ITranscodeListener::~ITranscodeListener ( )
virtual

Destructor of ITranscodeListener.

Member Function Documentation

virtual void telux::audio::ITranscodeListener::onReadyForWrite ( )
virtual

Called when the audio pipeline is ready to accept the next buffer containing data to transcode.

class telux::audio::ITranscoder

Provides the methods for transcoding the compressed audio data.

Public Member Functions

virtual std::shared_ptr< IAudioBuffergetWriteBuffer ()=0
 
virtual std::shared_ptr< IAudioBuffergetReadBuffer ()=0
 
virtual telux::common::Status write (std::shared_ptr< IAudioBuffer > buffer, uint32_t isLastBuffer, TranscoderWriteResponseCb callback=nullptr)=0
 
virtual telux::common::Status tearDown (telux::common::ResponseCallback callback=nullptr)=0
 
virtual telux::common::Status read (std::shared_ptr< IAudioBuffer > buffer, uint32_t bytesToRead, TranscoderReadResponseCb callback=nullptr)=0
 
virtual telux::common::Status registerListener (std::weak_ptr< ITranscodeListener > listener)=0
 
virtual telux::common::Status deRegisterListener (std::weak_ptr< ITranscodeListener > listener)=0
 
virtual ~ITranscoder ()
 

Constructor & Destructor Documentation

virtual telux::audio::ITranscoder::~ITranscoder ( )
virtual

Destructor of the ITranscoder.

Member Function Documentation

virtual std::shared_ptr<IAudioBuffer> telux::audio::ITranscoder::getWriteBuffer ( )
pure virtual

Gets a buffer for sending the data for transcoding.

Returns
IAudioBuffer instance representing the buffer or nullptr if allocation failed
virtual std::shared_ptr<IAudioBuffer> telux::audio::ITranscoder::getReadBuffer ( )
pure virtual

Gets a buffer that will contain the transcoded data.

Returns
IAudioBuffer instance representing the buffer or nullptr if allocation failed
virtual telux::common::Status telux::audio::ITranscoder::write ( std::shared_ptr< IAudioBuffer buffer,
uint32_t  isLastBuffer,
TranscoderWriteResponseCb  callback = nullptr 
)
pure virtual

Sends the compressed data for transcoding. First write starts the transcoding operation.

Internally, a pipeline is maintained for the data to transcode. The application should send the next data for transcoding only when the pipeline can accomodate more data. This readiness is indicated by calling the ITranscodeListener::onReadyForWrite() method.

Parameters
[in]bufferContains the data to transcode
[in]isLastBufferMarks that this is the last chunk of the data to transcode
[in]callbackOptional, invoked to pass the status of pushing the data in the pipeline
Returns
telux::common::Status::SUCCESS if the data is sent, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::ITranscoder::tearDown ( telux::common::ResponseCallback  callback = nullptr)
pure virtual

Destroys the ITranscoder instance created with IAudioManager::createTranscoder(). This must be called after the transcoding is finished.

Parameters
[in]callbackOptional, invoked to pass the result of the destruction
Returns
telux::common::Status::SUCCESS if the teardown was initiated, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::ITranscoder::read ( std::shared_ptr< IAudioBuffer buffer,
uint32_t  bytesToRead,
TranscoderReadResponseCb  callback = nullptr 
)
pure virtual

Initiates a read request to fetch the transcoded data. Transcoded data will be by the TranscoderReadResponseCb callback.

Parameters
[in]bufferBuffer that will contain the transcoded data
[in]bytesToReadLength of the data to fetch
[in]callbackOptional, invoked to pass the transcoded data
Returns
telux::common::Status::SUCCESS if the request is sent, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::ITranscoder::registerListener ( std::weak_ptr< ITranscodeListener listener)
pure virtual

Registers the given listener to know 'when the pipeline is ready to accept the next buffer' for transcoding. Event is received by the ITranscodeListener::onReadyForWrite() method.

Parameters
[in]listenerReceives the events during transcoding
Returns
telux::common::Status::SUCCESS if the listener is registered, otherwise, an appropriate error code
virtual telux::common::Status telux::audio::ITranscoder::deRegisterListener ( std::weak_ptr< ITranscodeListener listener)
pure virtual

Unregisters the given listener registered with ITranscoder::registerListener().

Parameters
[in]listenerListener to unregister
Returns
telux::common::Status::SUCCESS if the listener is unregistered, otherwise, an appropriate error code

Typedef Documentation

using telux::audio::TranscoderReadResponseCb = typedef std::function<void(std::shared_ptr<IAudioBuffer> buffer, uint32_t isLastBuffer, telux::common::ErrorCode error)>

Called to pass the transcoded audio data. Used with ITranscoder:read().

Parameters
[in]bufferContains the transcoded data with IAudioBuffer::getDataSize() giving the actual number of data bytes in this buffer. Should be cleared using IAudioBuffer::reset() before reusing it for sending the next compressed data for transcoding.
[in]isLastBufferIndicates that this is the last chunk of the transcoded data
[in]errortelux::common::ErrorCode::SUCCESS if the transcoding was successful, an appropriate error code otherwise
using telux::audio::TranscoderWriteResponseCb = typedef std::function<void(std::shared_ptr<IAudioBuffer> buffer, uint32_t bytesWritten, telux::common::ErrorCode error)>

Called when the compressed data has been sent for transcoding. Used with ITranscoder:write().

Parameters
[in]bufferBuffer that is passed to ITranscoder::write(). To reuse it for sending the next compressed data for transcoding, clear it using IAudioBuffer::reset().
[in]bytesWrittenNumber of data bytes sent for transcoding
[in]errortelux::common::ErrorCode::SUCCESS if the data was sent successfully, an appropriate error code otherwise