Class: kodi::addon::CInstanceAudioDecoder
For audio decoders as binary add-ons. This class implements a way to handle special types of audio files.
The add-on handles loading of the source file and outputting the audio stream for consumption by the player.
The addon.xml defines the capabilities of this add-on.
Here's an example on addon.xml:
Description to audio decoder related addon.xml values:
Name | Description |
---|---|
point | Addon type specification At all addon types and for this kind always "kodi.audiodecoder". |
library_@PLATFORM@ | Sets the used library name, which is automatically set by cmake at addon build. |
name | The name of the decoder used in Kodi for display. |
tags | Boolean to point out that addon can bring own information to replayed file, if false only the file name is used as info.If true , CInstanceAudioDecoder::ReadTag is used and must be implemented. |
tracks | Boolean to in inform one file can contains several different streams. |
<support><extension name="..." /></support> | The file extensions / styles supported by this addon.\nOptional can be with <description> and <icon> additional info added where used for list views in Kodi. |
<support><mimetype name="..." /></support> | A stream URL mimetype where can be used to force to this addon.\nOptional can be with `<description> and <icon> additional info added where used for list views in Kodi. |
Here is a code example how this addon is used:
The destruction of the example class CMyAudioDecoder
is called from Kodi's header. Manually deleting the add-on instance is not required.
Topics | |
Definitions, structures and enumerators | |
Audio decoder add-on instance definition values All audio decoder functions associated data structures. | |
|
inlineexplicit |
Audio decoder class constructor used to support multiple instance types.
[in] | instance | The instance value given to kodi::addon::CAddonBase::CreateInstance(...) . |
Here's example about the use of this:
Checks addon support given file path.
[in] | filename | The file to read |
true
used.
|
pure virtual |
Initialize a decoder.
[in] | filename | The file to read |
[in] | filecache | The file cache size |
[out] | channels | Number of channels in output stream |
[out] | samplerate | Samplerate of output stream |
[out] | bitspersample | Bits per sample in output stream |
[out] | totaltime | Total time for stream |
[out] | bitrate | Average bitrate of input stream |
[out] | format | Data format for output stream, see class AudioEngineFormat for available values |
[out] | channellist | Channel mapping for output stream, see enum AudioEngineChannel for available values |
Produce some noise.
[in] | buffer | Output buffer |
[in] | size | Size of output buffer |
[out] | actualsize | Actual number of bytes written to output buffer |
Possible values are:
Value | enum | Description |
---|---|---|
0 | AUDIODECODER_READ_SUCCESS | on success |
-1 | AUDIODECODER_READ_EOF | on end of stream |
1 | AUDIODECODER_READ_ERROR | on failure |
|
inlinevirtual |
Seek in output stream.
[in] | time | Time position to seek to in milliseconds |
|
inlinevirtual |
Read tag of a file.
[in] | file | File to read tag for |
[out] | tag | Information tag about |
The following table contains values that can be set with class AudioDecoderInfoTag :
Name | Type | Set call | Get call |
---|---|---|---|
Title | std::string | SetTitle | GetTitle |
Artist | std::string | SetArtist | GetArtist |
Album | std::string | SetAlbum | GetAlbum |
Album artist | std::string | SetAlbumArtist | GetAlbumArtist |
Media type | std::string | SetMediaType | GetMediaType |
Genre | std::string | SetGenre | GetGenre |
Duration | int | SetDuration | GetDuration |
Track number | int | SetTrack | GetTrack |
Disc number | int | SetDisc | GetDisc |
Disc subtitle name | std::string | SetDiscSubtitle | GetDiscSubtitle |
Disc total amount | int | SetDiscTotal | GetDiscTotal |
Release date | std::string | SetReleaseDate | GetReleaseDate |
Lyrics | std::string | SetLyrics | GetLyrics |
Samplerate | int | SetSamplerate | GetSamplerate |
Channels amount | int | SetChannels | GetChannels |
Bitrate | int | SetBitrate | GetBitrate |
Comment text | std::string | SetComment | GetComment |
Cover art by path | std::string | SetCoverArtByPath | GetCoverArtByPath |
Cover art by memory | std::string | SetCoverArtByMem | GetCoverArtByMem |
Get number of tracks in a file.
[in] | file | File to read tag for |
|
inlinestatic |
Static auxiliary function to read the track number used from the given path.
If track number is not found in file name, the originally given file name is returned, track number then remains at "0".
[in] | name | The value specified in addon.xml extension under name="???" |
[in] | trackPath | The full path to evaluate |
[out] | track | The track number read out in the path, 0 if not identified as a track path. |