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)> |
This section contains APIs related to Audio Transcoder operation.
class telux::audio::ITranscodeListener |
Public Member Functions | |
virtual void | onReadyForWrite () |
virtual | ~ITranscodeListener () |
|
virtual |
Destructor of ITranscodeListener
|
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< IAudioBuffer > | getWriteBuffer ()=0 |
virtual std::shared_ptr< IAudioBuffer > | getReadBuffer ()=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 () |
|
virtual |
|
pure virtual |
Get a buffer to be used for writing samples for transcoding operation.
|
pure virtual |
Get a buffer to be used for reading samples from transcoding operation.
|
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.
[in] | buffer | buffer that needs to be transcoded. |
[in] | isLastBuffer | represents whether this buffer is last buffer or not. Once last buffer is set no more write operations are required. |
[in] | callback | callback to get the response of write. |
|
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.
[in] | callback | callback to get the response of tearDown. |
|
pure virtual |
Reads samples/Frames from transcoder during transcoding operation.
[in] | buffer | stream buffer for read. |
[in] | bytesToRead | specifying how many bytes to be read from stream. |
[in] | callback | callback to get the response of read. |
|
pure virtual |
Register a listener to get notified for events of Transcoder.
[in] | listener | Pointer of ITranscodeListener object that processes the notification. |
|
pure virtual |
Remove a previously registered listener.
[in] | listener | Previously registered ITranscodeListener that needs to be removed. |
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.
[in] | buffer | Buffer 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] | isLastBuffer | represents whether the transcoded buffer is last buffer or not. Once the last buffer is received no more further read operations are required. |
[in] | error | Return 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.
[in] | buffer | Buffer 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] | bytesWritten | Return how many bytes are sent for transcoding. |
[in] | error | Return code which indicates whether the operation succeeded or not. ErrorCode |