Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
kodi::addon::CInstanceAudioEncoder Class Referenceabstract

#include <AudioEncoder.h>

Inheritance diagram for kodi::addon::CInstanceAudioEncoder:
kodi::addon::IAddonInstance

Public Member Functions

 CInstanceAudioEncoder (KODI_HANDLE instance)
 Class constructor. More...
 
virtual bool Start (int inChannels, int inRate, int inBits, const std::string &title, const std::string &artist, const std::string &albumartist, const std::string &album, const std::string &year, const std::string &track, const std::string &genre, const std::string &comment, int trackLength)=0
 Start encoder (required) More...
 
virtual int Encode (int numBytesRead, const uint8_t *pbtStream)=0
 Encode a chunk of audio (required) More...
 
virtual bool Finish ()
 Finalize encoding (optional) More...
 
int Write (const uint8_t *data, int length)
 Write block of data. More...
 
int64_t Seek (int64_t position, int whence=SEEK_SET)
 Set the file's current position. More...
 
- Public Member Functions inherited from kodi::addon::IAddonInstance
 IAddonInstance (ADDON_TYPE type)
 
virtual ~IAddonInstance ()=default
 
virtual ADDON_STATUS CreateInstance (int instanceType, std::string instanceID, KODI_HANDLE instance, KODI_HANDLE &addonInstance)
 
virtual ADDON_STATUS CreateInstanceEx (int instanceType, std::string instanceID, KODI_HANDLE instance, KODI_HANDLE &addonInstance, const std::string &version)
 

Additional Inherited Members

- Public Attributes inherited from kodi::addon::IAddonInstance
const ADDON_TYPE m_type
 

Constructor & Destructor Documentation

◆ CInstanceAudioEncoder()

kodi::addon::CInstanceAudioEncoder::CInstanceAudioEncoder ( KODI_HANDLE  instance)
inlineexplicit

Class constructor.

Parameters
[in]instanceThe from Kodi given instance given be add-on CreateInstance call with instance id ADDON_INSTANCE_AUDIOENCODER.

Member Function Documentation

◆ Encode()

virtual int kodi::addon::CInstanceAudioEncoder::Encode ( int  numBytesRead,
const uint8_t pbtStream 
)
pure virtual

Encode a chunk of audio (required)

Parameters
[in]numBytesReadNumber of bytes in input buffer
[in]pbtStreamthe input buffer
Returns
Number of bytes consumed

◆ Finish()

virtual bool kodi::addon::CInstanceAudioEncoder::Finish ( )
inlinevirtual

Finalize encoding (optional)

Returns
True on success, false on failure.

◆ Seek()

int64_t kodi::addon::CInstanceAudioEncoder::Seek ( int64_t  position,
int  whence = SEEK_SET 
)
inline

Set the file's current position.

The whence argument is optional and defaults to SEEK_SET (0)

Parameters
[in]positionthe position that you want to seek to
[in]whence[optional] offset relative to You can set the value of whence to one of three things:
Value int Description
SEEK_SET 0 position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence.
SEEK_CUR 1 position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes."
SEEK_END 2 position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion.
Returns
Returns the resulting offset location as measured in bytes from the beginning of the file. On error, the value -1 is returned.

◆ Start()

virtual bool kodi::addon::CInstanceAudioEncoder::Start ( int  inChannels,
int  inRate,
int  inBits,
const std::string &  title,
const std::string &  artist,
const std::string &  albumartist,
const std::string &  album,
const std::string &  year,
const std::string &  track,
const std::string &  genre,
const std::string &  comment,
int  trackLength 
)
pure virtual

Start encoder (required)

Parameters
[in]inChannelsNumber of channels
[in]inRateSample rate of input data
[in]inBitsBits per sample in input data
[in]titleThe title of the song
[in]artistThe artist of the song
[in]albumartistThe albumartist of the song
[in]yearThe year of the song
[in]trackThe track number of the song
[in]genreThe genre of the song
[in]commentA comment to attach to the song
[in]trackLengthTotal track length in seconds
Returns
True on success, false on failure.

◆ Write()

int kodi::addon::CInstanceAudioEncoder::Write ( const uint8_t data,
int  length 
)
inline

Write block of data.

Parameters
[in]dataPointer to the array of elements to be written
[in]lengthSize in bytes to be written.
Returns
The total number of bytes successfully written is returned.

The documentation for this class was generated from the following file: