PVR TV stream
Stream processing regarding live TV.
TV stream parts in interface:
Copy this to your project and extend with your parts or leave functions complete away where not used or supported.
Header parts:
int ReadLiveStream(
unsigned char* buffer,
unsigned int size)
override;
bool SeekTime(
double time,
bool backwards,
double& startpts)
override;
Definition: Channels.h:39
PVR_ERROR
Definition: pvr_general.h:35
virtual PVR_ERROR GetStreamProperties(std::vector< kodi::addon::PVRStreamProperties > &properties)
Get the stream properties of the stream that's currently being read.
Definition: PVR.h:2427
virtual void DemuxReset()
Reset the demultiplexer in the add-on.
Definition: PVR.h:2455
virtual void DemuxAbort()
Abort the demultiplexer thread in the add-on.
Definition: PVR.h:2463
virtual DEMUX_PACKET * DemuxRead()
Read the next packet from the demultiplexer, if there is one.
Definition: PVR.h:2447
virtual void DemuxFlush()
Flush all data that's currently in the demultiplexer buffer in the add-on.
Definition: PVR.h:2472
virtual bool SeekTime(double time, bool backwards, double &startpts)
Notify the pvr addon/demuxer that Kodi wishes to seek the stream by time.
Definition: PVR.h:2508
virtual void SetSpeed(int speed)
Notify the pvr addon/demuxer that Kodi wishes to change playback speed.
Definition: PVR.h:2483
virtual void FillBuffer(bool mode)
Notify the pvr addon/demuxer that Kodi wishes to fill demux queue.
Definition: PVR.h:2493
virtual void CloseLiveStream()
Close an open live stream.
Definition: PVR.h:2351
virtual bool OpenLiveStream(const kodi::addon::PVRChannel &channel)
Open a live stream on the backend.
Definition: PVR.h:2342
virtual int64_t SeekLiveStream(int64_t position, int whence)
Seek in a live stream on a backend that supports timeshifting.
Definition: PVR.h:2384
virtual int ReadLiveStream(unsigned char *buffer, unsigned int size)
Read from an open live stream.
Definition: PVR.h:2364
virtual int64_t LengthLiveStream()
Obtain the length of a live stream.
Definition: PVR.h:2395
Source parts:
{
return false;
}
void CMyInstance::CloseLiveStream()
{
}
int CMyInstance::ReadLiveStream(unsigned char* buffer, unsigned int size)
{
return 0;
}
int64_t CMyInstance::SeekLiveStream(int64_t position, int whence)
{
return 0;
}
int64_t CMyInstance::LengthLiveStream()
{
return 0;
}
PVR_ERROR CMyInstance::GetStreamProperties(std::vector<kodi::addon::PVRStreamProperties>& properties)
{
}
{
return nullptr;
}
void CMyInstance::DemuxReset()
{
}
void CMyInstance::DemuxAbort()
{
}
void CMyInstance::DemuxFlush()
{
}
void CMyInstance::SetSpeed(int speed)
{
}
void CMyInstance::FillBuffer(bool mode)
{
}
bool CMyInstance::SeekTime(double time, bool backwards, double& startpts)
{
return false;
}
@ PVR_ERROR_NOT_IMPLEMENTED
-2 : The method that Kodi called is not implemented by the add-on.
Definition: pvr_general.h:43
◆ OpenLiveStream()
Open a live stream on the backend.
- Parameters
-
[in] | channel | The channel to stream. |
- Returns
- True if the stream has been opened successfully, false otherwise.
The following table contains values that can be set with class PVRChannel :
◆ CloseLiveStream()
virtual void CloseLiveStream |
( |
| ) |
|
|
inlinevirtual |
Close an open live stream.
◆ ReadLiveStream()
virtual int ReadLiveStream |
( |
unsigned char * |
buffer, |
|
|
unsigned int |
size |
|
) |
| |
|
inlinevirtual |
Read from an open live stream.
- Parameters
-
[in] | pBuffer | The buffer to store the data in. |
[in] | iBufferSize | The amount of bytes to read. |
- Returns
- The amount of bytes that were actually read from the stream.
◆ SeekLiveStream()
virtual int64_t SeekLiveStream |
( |
int64_t |
position, |
|
|
int |
whence |
|
) |
| |
|
inlinevirtual |
Seek in a live stream on a backend that supports timeshifting.
- Parameters
-
[in] | position | The position 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
- The new position.
◆ LengthLiveStream()
virtual int64_t LengthLiveStream |
( |
| ) |
|
|
inlinevirtual |
Obtain the length of a live stream.
- Returns
- The total length of the stream that's currently being read.