Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Stream.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/addon-instance/pvr/pvr_stream.h"
13
14//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
15// "C++" Definitions group 9 - PVR stream definitions (NOTE: Becomes replaced
16// in future by inputstream addon instance way)
17
18#ifdef __cplusplus
19
20namespace kodi
21{
22namespace addon
23{
24
25//==============================================================================
38class PVRCodec : public CStructHdl<PVRCodec, PVR_CODEC>
39{
40 friend class CInstancePVRClient;
41
42public:
44 PVRCodec()
45 {
46 m_cStructure->codec_type = PVR_CODEC_TYPE_UNKNOWN;
47 m_cStructure->codec_id = PVR_INVALID_CODEC_ID;
48 }
49 PVRCodec(const PVRCodec& type) : CStructHdl(type) {}
61
64
66 void SetCodecType(PVR_CODEC_TYPE codecType) { m_cStructure->codec_type = codecType; }
67
69 PVR_CODEC_TYPE GetCodecType() const { return m_cStructure->codec_type; }
70
74 void SetCodecId(unsigned int codecId) { m_cStructure->codec_id = codecId; }
75
77 unsigned int GetCodecId() const { return m_cStructure->codec_id; }
79
80private:
81 PVRCodec(const PVR_CODEC& type) : CStructHdl(&type) {}
82 PVRCodec(const PVR_CODEC* type) : CStructHdl(type) {}
83 PVRCodec(PVR_CODEC* type) : CStructHdl(type) {}
84};
86//------------------------------------------------------------------------------
87
88//==============================================================================
101 : public CStructHdl<PVRStreamProperties, PVR_STREAM_PROPERTIES::PVR_STREAM>
102{
103 friend class CInstancePVRClient;
104
105public:
107 PVRStreamProperties() { memset(m_cStructure, 0, sizeof(PVR_STREAM_PROPERTIES::PVR_STREAM)); }
134
137
139 void SetPID(unsigned int pid) { m_cStructure->iPID = pid; }
140
142 unsigned int GetPID() const { return m_cStructure->iPID; }
143
145 void SetCodecType(PVR_CODEC_TYPE codecType) { m_cStructure->iCodecType = codecType; }
146
148 PVR_CODEC_TYPE GetCodecType() const { return m_cStructure->iCodecType; }
149
151 void SetCodecId(unsigned int codecId) { m_cStructure->iCodecId = codecId; }
152
154 unsigned int GetCodecId() const { return m_cStructure->iCodecId; }
155
157 void SetLanguage(const std::string& language)
158 {
159 if (language.size() > 3)
160 {
162 "PVRStreamProperties::%s: Language string size '%li' higher as needed 3", __func__,
163 language.size());
164 return;
165 }
166 m_cStructure->strLanguage[0] = language[0];
167 m_cStructure->strLanguage[1] = language[1];
168 m_cStructure->strLanguage[2] = language[2];
169 m_cStructure->strLanguage[3] = 0;
170 }
171
173 std::string GetLanguage() const { return m_cStructure->strLanguage; }
174
176 void SetSubtitleInfo(int subtitleInfo) { m_cStructure->iSubtitleInfo = subtitleInfo; }
177
179 int GetSubtitleInfo() const { return m_cStructure->iSubtitleInfo; }
180
182 void SetFPSScale(int fpsScale) { m_cStructure->iFPSScale = fpsScale; }
183
185 int GetFPSScale() const { return m_cStructure->iFPSScale; }
186
188 void SetFPSRate(int fpsRate) { m_cStructure->iFPSRate = fpsRate; }
189
191 int GetFPSRate() const { return m_cStructure->iFPSRate; }
192
194 void SetHeight(int height) { m_cStructure->iHeight = height; }
195
197 int GetHeight() const { return m_cStructure->iHeight; }
198
200 void SetWidth(int width) { m_cStructure->iWidth = width; }
201
203 int GetWidth() const { return m_cStructure->iWidth; }
204
206 void SetAspect(float aspect) { m_cStructure->fAspect = aspect; }
207
209 float GetAspect() const { return m_cStructure->fAspect; }
210
212 void SetChannels(int channels) { m_cStructure->iChannels = channels; }
213
215 int GetChannels() const { return m_cStructure->iChannels; }
216
218 void SetSampleRate(int sampleRate) { m_cStructure->iSampleRate = sampleRate; }
219
221 int GetSampleRate() const { return m_cStructure->iSampleRate; }
222
224 void SetBlockAlign(int blockAlign) { m_cStructure->iBlockAlign = blockAlign; }
225
227 int GetBlockAlign() const { return m_cStructure->iBlockAlign; }
228
230 void SetBitRate(int bitRate) { m_cStructure->iBitRate = bitRate; }
231
233 int GetBitRate() const { return m_cStructure->iBitRate; }
234
236 void SetBitsPerSample(int bitsPerSample) { m_cStructure->iBitsPerSample = bitsPerSample; }
237
239 int GetBitsPerSample() const { return m_cStructure->iBitsPerSample; }
241
242private:
244 PVRStreamProperties(PVR_STREAM_PROPERTIES::PVR_STREAM* type) : CStructHdl(type) {}
245};
247//------------------------------------------------------------------------------
248
249//==============================================================================
261class PVRStreamTimes : public CStructHdl<PVRStreamTimes, PVR_STREAM_TIMES>
262{
263 friend class CInstancePVRClient;
264
265public:
267 PVRStreamTimes() { memset(m_cStructure, 0, sizeof(PVR_STREAM_TIMES)); }
268 PVRStreamTimes(const PVRStreamTimes& type) : CStructHdl(type) {}
283
286
290 void SetStartTime(time_t startTime) { m_cStructure->startTime = startTime; }
291
293 time_t GetStartTime() const { return m_cStructure->startTime; }
294
296 void SetPTSStart(int64_t ptsStart) { m_cStructure->ptsStart = ptsStart; }
297
299 int64_t GetPTSStart() const { return m_cStructure->ptsStart; }
300
305 void SetPTSBegin(int64_t ptsBegin) { m_cStructure->ptsBegin = ptsBegin; }
306
308 int64_t GetPTSBegin() const { return m_cStructure->ptsBegin; }
309
314 void SetPTSEnd(int64_t ptsEnd) { m_cStructure->ptsEnd = ptsEnd; }
315
317 int64_t GetPTSEnd() const { return m_cStructure->ptsEnd; }
319
320private:
321 PVRStreamTimes(const PVR_STREAM_TIMES* type) : CStructHdl(type) {}
322 PVRStreamTimes(PVR_STREAM_TIMES* type) : CStructHdl(type) {}
323};
325//------------------------------------------------------------------------------
326
327} /* namespace addon */
328} /* namespace kodi */
329
330#endif /* __cplusplus */
Definition AddonBase.h:206
Definition Stream.h:39
Definition Stream.h:102
Definition Stream.h:262
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition addon_base.h:193
PVR_CODEC_TYPE
Definition pvr_stream.h:60
@ PVR_CODEC_TYPE_UNKNOWN
To set nothing defined.
Definition pvr_stream.h:62
enum PVR_CODEC_TYPE codec_type
Used codec type for stream.
Definition pvr_stream.h:99
unsigned int codec_id
Related codec identifier, normally match the ffmpeg id's.
Definition pvr_stream.h:102
Definition pvr_stream.h:97
void SetCodecType(PVR_CODEC_TYPE codecType)
Codec type.
Definition Stream.h:66
void SetCodecId(unsigned int codecId)
Codec id.
Definition Stream.h:74
PVR_CODEC_TYPE GetCodecType() const
To get with SetCodecType() changed values.
Definition Stream.h:69
unsigned int GetCodecId() const
To get with SetCodecId() changed values.
Definition Stream.h:77
unsigned int GetPID() const
To get with SetPID() changed values.
Definition Stream.h:142
void SetHeight(int height)
Height of the stream reported by the demuxer.
Definition Stream.h:194
int GetFPSScale() const
To get with SetFPSScale() changed values.
Definition Stream.h:185
int GetWidth() const
To get with SetWidth() changed values.
Definition Stream.h:203
void SetCodecType(PVR_CODEC_TYPE codecType)
Codec type this stream.
Definition Stream.h:145
int GetHeight() const
To get with SetHeight() changed values.
Definition Stream.h:197
void SetBitsPerSample(int bitsPerSample)
Bits per sample.
Definition Stream.h:236
void SetBitRate(int bitRate)
Bit rate.
Definition Stream.h:230
void SetCodecId(unsigned int codecId)
Codec id of this stream.
Definition Stream.h:151
int GetFPSRate() const
To get with SetFPSRate() changed values.
Definition Stream.h:191
int GetBitRate() const
To get with SetBitRate() changed values.
Definition Stream.h:233
void SetSubtitleInfo(int subtitleInfo)
Subtitle Info.
Definition Stream.h:176
float GetAspect() const
To get with SetAspect() changed values.
Definition Stream.h:209
void SetChannels(int channels)
Amount of channels.
Definition Stream.h:212
int GetBitsPerSample() const
To get with SetBitsPerSample() changed values.
Definition Stream.h:239
PVR_CODEC_TYPE GetCodecType() const
To get with SetCodecType() changed values.
Definition Stream.h:148
void SetFPSRate(int fpsRate)
FPS rate.
Definition Stream.h:188
void SetFPSScale(int fpsScale)
To set scale of 1000 and a rate of 29970 will result in 29.97 fps.
Definition Stream.h:182
void SetAspect(float aspect)
Display aspect ratio of the stream.
Definition Stream.h:206
void SetWidth(int width)
Width of the stream reported by the demuxer.
Definition Stream.h:200
void SetLanguage(const std::string &language)
3 letter language id.
Definition Stream.h:157
unsigned int GetCodecId() const
To get with SetCodecId() changed values.
Definition Stream.h:154
int GetSubtitleInfo() const
To get with SetSubtitleInfo() changed values.
Definition Stream.h:179
void SetBlockAlign(int blockAlign)
Block alignment.
Definition Stream.h:224
std::string GetLanguage() const
To get with SetLanguage() changed values.
Definition Stream.h:173
int GetBlockAlign() const
To get with SetBlockAlign() changed values.
Definition Stream.h:227
int GetSampleRate() const
To get with SetSampleRate() changed values.
Definition Stream.h:221
void SetSampleRate(int sampleRate)
Sample rate.
Definition Stream.h:218
void SetPID(unsigned int pid)
PID.
Definition Stream.h:139
int GetChannels() const
To get with SetChannels() changed values.
Definition Stream.h:215
int64_t GetPTSStart() const
To get with SetPTSStart() changed values.
Definition Stream.h:299
int64_t GetPTSBegin() const
To get with SetPTSBegin() changed values.
Definition Stream.h:308
void SetStartTime(time_t startTime)
For recordings, this must be zero. For Live TV, this is a reference time in units of time_t (UTC) fro...
Definition Stream.h:290
void SetPTSStart(int64_t ptsStart)
The pts of startTime.
Definition Stream.h:296
int64_t GetPTSEnd() const
To get with SetPTSEnd() changed values.
Definition Stream.h:317
time_t GetStartTime() const
To get with SetStartTime() changed values.
Definition Stream.h:293
void SetPTSBegin(int64_t ptsBegin)
Earliest pts player can seek back. Value is in micro seconds, relative to PTS start....
Definition Stream.h:305
void SetPTSEnd(int64_t ptsEnd)
Latest pts player can seek forward. Value is in micro seconds, relative to PTS start....
Definition Stream.h:314
#define PVR_INVALID_CODEC_ID
Invalid codec identifier.
Definition pvr_stream.h:37
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1938
Definition pvr_stream.h:118
"C" Times of playing stream (Live TV and recordings)
Definition pvr_stream.h:145