Telematics SDK - API Reference  v1.54.0

Data Structures

class  telux::audio::ITranscodeListener
 
class  telux::audio::ITranscoder
 ITranscoder is used to convert one audio format to another audio format using the transcoding operation. More...
 

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

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

This function is called when pipeline is ready to accept new buffer. It is applicable only for compressed audio format type where a client can write and queue buffers for transcoding.

class telux::audio::ITranscoder

ITranscoder is used to convert one audio format to another audio format using the transcoding operation.

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

Member Function Documentation

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

Get a buffer to be used for writing samples for transcoding operation.

Returns
a buffer or nullptr in case of failure.
virtual std::shared_ptr<IAudioBuffer> telux::audio::ITranscoder::getReadBuffer ( )
pure virtual

Get a buffer to be used for reading samples from transcoding operation.

Returns
a buffer or nullptr in case of failure.
virtual telux::common::Status telux::audio::ITranscoder::write ( std::shared_ptr< IAudioBuffer buffer,
uint32_t  isLastBuffer,
TranscoderWriteResponseCb  callback = nullptr 
)
pure virtual

Write Samples/Frames to transcode stream. First write starts transcoding operation.

Write in case of compressed audio format maintains a pipeline, if the callback returns with same number of bytes written as requested and no error occured, user can send next buffer. If the number of bytes returned are not equal to the requested write size, then user needs to resend the buffer again from the leftover offset after waiting for the ITranscodeListener::onReadyForWrite() event.

Parameters
[in]bufferbuffer that needs to be transcoded.
[in]isLastBufferrepresents whether this buffer is last buffer or not. Once last buffer is set no more write operations are required.
[in]callbackcallback to get the response of write.
Returns
Status of the request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::ITranscoder::tearDown ( telux::common::ResponseCallback  callback = nullptr)
pure virtual

It is mandatory to call this API after the end of a transcode operation or to abort a transcode operation. After this API call the ITranscoder object is no longer usable.

Parameters
[in]callbackcallback to get the response of tearDown.
Returns
Status of the request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::ITranscoder::read ( std::shared_ptr< IAudioBuffer buffer,
uint32_t  bytesToRead,
TranscoderReadResponseCb  callback = nullptr 
)
pure virtual

Reads samples/Frames from transcoder during transcoding operation.

Parameters
[in]bufferstream buffer for read.
[in]bytesToReadspecifying how many bytes to be read from stream.
[in]callbackcallback to get the response of read.
Returns
Status of the request i.e. success or suitable status code.
virtual telux::common::Status telux::audio::ITranscoder::registerListener ( std::weak_ptr< ITranscodeListener listener)
pure virtual

Register a listener to get notified for events of Transcoder.

Parameters
[in]listenerPointer of ITranscodeListener object that processes the notification.
Returns
Status of registerListener i.e success or suitable status code.
virtual telux::common::Status telux::audio::ITranscoder::deRegisterListener ( std::weak_ptr< ITranscodeListener listener)
pure virtual

Remove a previously registered listener.

Parameters
[in]listenerPreviously registered ITranscodeListener that needs to be removed.
Returns
Status of deRegisterListener, success or suitable status code.

Typedef Documentation

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

This function is called with the response to ITranscoder::read().

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]bufferBuffer that was used to capture the data from the transcode read operation. Applications could call IAudioBuffer::reset() and reuse this buffer for subsequent read operations on the same transcoder instance. Also buffer.getDataSize() will represent the number of bytes contained in a buffer.
[in]isLastBufferrepresents whether the transcoded buffer is last buffer or not. Once the last buffer is received no more further read operations are required.
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode
using telux::audio::TranscoderWriteResponseCb = typedef std::function<void(std::shared_ptr<IAudioBuffer> buffer, uint32_t bytesWritten, telux::common::ErrorCode error)>

This function is called with the response to ITranscoder::write().

The callback can be invoked from multiple different threads. The implementation should be thread safe.

Parameters
[in]bufferBuffer that was used for the write operation for transcoding. Application could call IAudioBuffer::reset() and reuse this buffer for subsequent write operations on the same transcoder instance.
[in]bytesWrittenReturn how many bytes are sent for transcoding.
[in]errorReturn code which indicates whether the operation succeeded or not. ErrorCode