Kodi Development  20.0
for Binary and Script based Add-Ons

Detailed Description

Functions required to read streams direct and demux inside Kodi.

This part contains at least the functions necessary for addon that have to be supported. This can only be ignored if you use your own demux.

The data loaded by Kodi is then processed in it itself. The source does not matter, only Kodi must be able to process this stream data itself and is therefore limited in some things.

For more complex things, the addon must integrate its own demuxer and, if necessary, even its own codec processing (see Codec).

Note
These are used and must be set by the addon if the INPUTSTREAM_SUPPORTS_IDEMUX is undefined in the capabilities (see GetCapabilities()). Otherwise becomes demuxing used.

Function Documentation

◆ ReadStream()

virtual int ReadStream ( uint8_t *  buffer,
unsigned int  bufferSize 
)
inlinevirtual

Read from an open stream.

Parameters
[in]bufferThe buffer to store the data in.
[in]bufferSizeThe amount of bytes to read.
Returns
The amount of bytes that were actually read from the stream.

◆ SeekStream()

virtual int64_t SeekStream ( int64_t  position,
int  whence = SEEK_SET 
)
inlinevirtual

Seek in a stream.

Parameters
[in]positionThe position to seek to
[in]whenceoffset 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.
Remarks
Optional and can leaved away or return -1 if this add-on won't provide this function.

◆ PositionStream()

virtual int64_t PositionStream ( )
inlinevirtual

The position in the stream that's currently being read.

Returns
Stream position
Remarks
Optional and can leaved away or return -1 if this add-on won't provide this function.

◆ LengthStream()

virtual int64_t LengthStream ( )
inlinevirtual

The Total length of the stream that's currently being read.

Returns
Length of the stream
Remarks
Optional and can leaved away or return -1 if this add-on won't provide this function.

◆ GetBlockSize()

virtual int GetBlockSize ( )
inlinevirtual

Obtain the chunk size to use when reading streams.

Returns
Block chunk size
Remarks
Optional and can leaved away or return 0 if this add-on won't provide this function.