Kodi Development  20.0
for Binary and Script based Add-Ons
Inputstream.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/inputstream.h"
13 #include "inputstream/StreamCodec.h"
14 #include "inputstream/StreamConstants.h"
15 #include "inputstream/StreamCrypto.h"
16 #include "inputstream/TimingConstants.h"
17 
18 #ifdef __cplusplus
19 
20 #include <map>
21 
22 namespace kodi
23 {
24 namespace addon
25 {
26 
27 //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
28 // "C++" Doxygen group set for the definitions
29 //{{{
30 
31 //==============================================================================
44 
45 //##############################################################################
51 
52 //##############################################################################
83 
84 //##############################################################################
90 
91 //##############################################################################
97 
98 //##############################################################################
104 
105 //}}}
106 //______________________________________________________________________________
107 
108 class CInstanceInputStream;
109 
110 //==============================================================================
124 class ATTRIBUTE_HIDDEN InputstreamProperty
125  : public CStructHdl<InputstreamProperty, INPUTSTREAM_PROPERTY>
126 {
128  friend class CInstanceInputStream;
131 public:
144 
147 
149  std::string GetURL() const { return m_cStructure->m_strURL; }
150 
152  std::string GetMimeType() const { return m_cStructure->m_mimeType; }
153 
155  unsigned int GetPropertiesAmount() const
156  {
157  return m_cStructure->m_nCountInfoValues;
158  }
159 
161  const std::map<std::string, std::string> GetProperties() const
162  {
163  std::map<std::string, std::string> props;
164  for (unsigned int i = 0; i < m_cStructure->m_nCountInfoValues; ++i)
165  {
166  props.emplace(m_cStructure->m_ListItemProperties[i].m_strKey,
167  m_cStructure->m_ListItemProperties[i].m_strValue);
168  }
169  return props;
170  }
171 
175  std::string GetLibFolder() const { return m_cStructure->m_libFolder; }
176 
180  std::string GetProfileFolder() const { return m_cStructure->m_profileFolder; }
181 
183 
184 private:
185  InputstreamProperty() = delete;
186  InputstreamProperty(const InputstreamProperty& stream) = delete;
187  InputstreamProperty(const INPUTSTREAM_PROPERTY* stream) : CStructHdl(stream) {}
188  InputstreamProperty(INPUTSTREAM_PROPERTY* stream) : CStructHdl(stream) {}
189 };
191 //------------------------------------------------------------------------------
192 
193 //==============================================================================
204 class ATTRIBUTE_HIDDEN InputstreamCapabilities
205  : public CStructHdl<InputstreamCapabilities, INPUTSTREAM_CAPABILITIES>
206 {
208  friend class CInstanceInputStream;
211 public:
213  InputstreamCapabilities() = default;
224 
227 
229  void SetMask(uint32_t mask) const { m_cStructure->m_mask = mask; }
230 
232  uint32_t GetMask() const { return m_cStructure->m_mask; }
233 
235 
236 private:
238  InputstreamCapabilities(INPUTSTREAM_CAPABILITIES* stream) : CStructHdl(stream) {}
239 };
241 //------------------------------------------------------------------------------
242 
243 //==============================================================================
260 class ATTRIBUTE_HIDDEN InputstreamMasteringMetadata
261  : public CStructHdl<InputstreamMasteringMetadata, INPUTSTREAM_MASTERING_METADATA>
262 {
264  friend class CInstanceInputStream;
265  friend class InputstreamInfo;
268 public:
270  InputstreamMasteringMetadata() = default;
290 
293 
300  {
301  if (memcmp(m_cStructure, right.m_cStructure, sizeof(INPUTSTREAM_MASTERING_METADATA)) == 0)
302  return true;
303  return false;
304  }
305 
310  void SetPrimaryR_ChromaticityX(double value) { m_cStructure->primary_r_chromaticity_x = value; }
311 
313  double GetPrimaryR_ChromaticityX() { return m_cStructure->primary_r_chromaticity_x; }
314 
319  void SetPrimaryR_ChromaticityY(double value) { m_cStructure->primary_r_chromaticity_y = value; }
320 
322  double GetPrimaryR_ChromaticityY() { return m_cStructure->primary_r_chromaticity_y; }
323 
328  void SetPrimaryG_ChromaticityX(double value) { m_cStructure->primary_g_chromaticity_x = value; }
329 
331  double GetPrimaryG_ChromaticityX() { return m_cStructure->primary_g_chromaticity_x; }
332 
337  void SetPrimaryG_ChromaticityY(double value) { m_cStructure->primary_g_chromaticity_y = value; }
338 
340  double GetPrimaryG_ChromaticityY() { return m_cStructure->primary_g_chromaticity_y; }
341 
346  void SetPrimaryB_ChromaticityX(double value) { m_cStructure->primary_b_chromaticity_x = value; }
347 
349  double GetPrimaryB_ChromaticityX() { return m_cStructure->primary_b_chromaticity_x; }
350 
355  void SetPrimaryB_ChromaticityY(double value) { m_cStructure->primary_b_chromaticity_y = value; }
356 
358  double GetPrimaryB_ChromaticityY() { return m_cStructure->primary_b_chromaticity_y; }
359 
364  void SetWhitePoint_ChromaticityX(double value)
365  {
366  m_cStructure->white_point_chromaticity_x = value;
367  }
368 
370  double GetWhitePoint_ChromaticityX() { return m_cStructure->white_point_chromaticity_x; }
371 
376  void SetWhitePoint_ChromaticityY(double value)
377  {
378  m_cStructure->white_point_chromaticity_y = value;
379  }
380 
382  double GetWhitePoint_ChromaticityY() { return m_cStructure->white_point_chromaticity_y; }
383 
387  void SetLuminanceMax(double value) { m_cStructure->luminance_max = value; }
388 
390  double GetLuminanceMax() { return m_cStructure->luminance_max; }
391 
395  void SetLuminanceMin(double value) { m_cStructure->luminance_min = value; }
396 
398  double GetLuminanceMin() { return m_cStructure->luminance_min; }
399 
401 
402 private:
404  InputstreamMasteringMetadata(INPUTSTREAM_MASTERING_METADATA* stream) : CStructHdl(stream) {}
405 };
407 //------------------------------------------------------------------------------
408 
409 //==============================================================================
423 class ATTRIBUTE_HIDDEN InputstreamContentlightMetadata
424  : public CStructHdl<InputstreamContentlightMetadata, INPUTSTREAM_CONTENTLIGHT_METADATA>
425 {
427  friend class CInstanceInputStream;
428  friend class InputstreamInfo;
431 public:
435  : CStructHdl(stream)
436  {
437  }
448 
451 
458  {
459  if (memcmp(m_cStructure, right.m_cStructure, sizeof(INPUTSTREAM_CONTENTLIGHT_METADATA)) == 0)
460  return true;
461  return false;
462  }
463 
468  void SetMaxCll(uint64_t value) { m_cStructure->max_cll = value; }
469 
471  uint64_t GetMaxCll() { return m_cStructure->max_cll; }
472 
477  void SetMaxFall(uint64_t value) { m_cStructure->max_fall = value; }
478 
480  uint64_t GetMaxFall() { return m_cStructure->max_fall; }
481 
483 
484 private:
486  : CStructHdl(stream)
487  {
488  }
489  InputstreamContentlightMetadata(INPUTSTREAM_CONTENTLIGHT_METADATA* stream) : CStructHdl(stream) {}
490 };
492 //------------------------------------------------------------------------------
493 
494 //==============================================================================
507 class ATTRIBUTE_HIDDEN InputstreamInfo : public CStructHdl<InputstreamInfo, INPUTSTREAM_INFO>
508 {
510  friend class CInstanceInputStream;
513 public:
515  InputstreamInfo() = default;
516  InputstreamInfo(const InputstreamInfo& stream) : CStructHdl(stream)
517  {
518  SetCryptoSession(stream.GetCryptoSession());
519  CopyExtraData();
520  }
558 
561 
565  void SetStreamType(INPUTSTREAM_TYPE streamType) { m_cStructure->m_streamType = streamType; }
566 
568  INPUTSTREAM_TYPE GetStreamType() const { return m_cStructure->m_streamType; }
569 
573  void SetFeatures(uint32_t features) { m_cStructure->m_features = features; }
574 
576  uint32_t GetFeatures() const { return m_cStructure->m_features; }
577 
581  void SetFlags(uint32_t flags) { m_cStructure->m_flags = flags; }
582 
584  uint32_t GetFlags() const { return m_cStructure->m_flags; }
585 
589  void SetName(const std::string& name)
590  {
591  strncpy(m_cStructure->m_name, name.c_str(), INPUTSTREAM_MAX_STRING_NAME_SIZE);
592  }
593 
595  std::string GetName() const { return m_cStructure->m_name; }
596 
606  void SetCodecName(const std::string& codecName)
607  {
608  strncpy(m_cStructure->m_codecName, codecName.c_str(), INPUTSTREAM_MAX_STRING_CODEC_SIZE);
609  }
610 
612  std::string GetCodecName() const { return m_cStructure->m_codecName; }
613 
617  void SetCodecInternalName(const std::string& codecName)
618  {
619  strncpy(m_cStructure->m_codecInternalName, codecName.c_str(),
620  INPUTSTREAM_MAX_STRING_CODEC_SIZE);
621  }
622 
624  std::string GetCodecInternalName() const { return m_cStructure->m_codecInternalName; }
625 
630  {
631  m_cStructure->m_codecProfile = codecProfile;
632  }
633 
635  STREAMCODEC_PROFILE GetCodecProfile() const { return m_cStructure->m_codecProfile; }
636 
640  void SetPhysicalIndex(unsigned int id) { m_cStructure->m_pID = id; }
641 
643  unsigned int GetPhysicalIndex() const { return m_cStructure->m_pID; }
644 
648  void SetExtraData(const std::vector<uint8_t>& extraData)
649  {
650  m_extraData = extraData;
651  m_cStructure->m_ExtraData = m_extraData.data();
652  m_cStructure->m_ExtraSize = m_extraData.size();
653  }
654 
659  void SetExtraData(const uint8_t* extraData, size_t extraSize)
660  {
661  m_extraData.clear();
662  if (extraData && extraSize > 0)
663  {
664  for (size_t i = 0; i < extraSize; ++i)
665  m_extraData.emplace_back(extraData[i]);
666  }
667 
668  m_cStructure->m_ExtraData = m_extraData.data();
669  m_cStructure->m_ExtraSize = m_extraData.size();
670  }
671 
673  const std::vector<uint8_t>& GetExtraData() { return m_extraData; }
674 
676  size_t GetExtraDataSize() { return m_extraData.size(); }
677 
683  bool CompareExtraData(const uint8_t* extraData, size_t extraSize) const
684  {
685  if (!extraData || m_extraData.size() != extraSize)
686  return false;
687  for (size_t i = 0; i < extraSize; ++i)
688  {
689  if (m_extraData[i] != extraData[i])
690  return false;
691  }
692  return true;
693  }
694 
697  {
698  m_extraData.clear();
699  m_cStructure->m_ExtraData = m_extraData.data();
700  m_cStructure->m_ExtraSize = m_extraData.size();
701  }
702 
706  void SetLanguage(const std::string& language)
707  {
708  strncpy(m_cStructure->m_language, language.c_str(), INPUTSTREAM_MAX_STRING_LANGUAGE_SIZE);
709  }
710 
712  std::string GetLanguage() const { return m_cStructure->m_language; }
713 
717  void SetFpsScale(unsigned int fpsScale) { m_cStructure->m_FpsScale = fpsScale; }
718 
720  unsigned int GetFpsScale() const { return m_cStructure->m_FpsScale; }
721 
725  void SetFpsRate(unsigned int fpsRate) { m_cStructure->m_FpsRate = fpsRate; }
726 
728  unsigned int GetFpsRate() const { return m_cStructure->m_FpsRate; }
729 
733  void SetHeight(unsigned int height) { m_cStructure->m_Height = height; }
734 
736  unsigned int GetHeight() const { return m_cStructure->m_Height; }
737 
741  void SetWidth(unsigned int width) { m_cStructure->m_Width = width; }
742 
744  unsigned int GetWidth() const { return m_cStructure->m_Width; }
745 
749  void SetAspect(float aspect) { m_cStructure->m_Aspect = aspect; }
750 
752  float GetAspect() const { return m_cStructure->m_Aspect; }
753 
757  void SetChannels(unsigned int channels) { m_cStructure->m_Channels = channels; }
758 
760  unsigned int GetChannels() const { return m_cStructure->m_Channels; }
761 
765  void SetSampleRate(unsigned int sampleRate) { m_cStructure->m_SampleRate = sampleRate; }
766 
768  unsigned int GetSampleRate() const { return m_cStructure->m_SampleRate; }
769 
773  void SetBitRate(unsigned int bitRate) { m_cStructure->m_BitRate = bitRate; }
774 
776  unsigned int GetBitRate() const { return m_cStructure->m_BitRate; }
777 
781  void SetBitsPerSample(unsigned int bitsPerSample)
782  {
783  m_cStructure->m_BitsPerSample = bitsPerSample;
784  }
785 
787  unsigned int GetBitsPerSample() const { return m_cStructure->m_BitsPerSample; }
788 
792  void SetBlockAlign(unsigned int blockAlign) { m_cStructure->m_BlockAlign = blockAlign; }
793 
795  unsigned int GetBlockAlign() const { return m_cStructure->m_BlockAlign; }
796 
802  {
803  m_cryptoSession = cryptoSession;
804  memcpy(&m_cStructure->m_cryptoSession, m_cryptoSession.GetCStructure(),
805  sizeof(STREAM_CRYPTO_SESSION));
806  }
807 
809  const kodi::addon::StreamCryptoSession& GetCryptoSession() const { return m_cryptoSession; }
810 
814  void SetCodecFourCC(unsigned int codecFourCC) { m_cStructure->m_codecFourCC = codecFourCC; }
815 
817  unsigned int GetCodecFourCC() const { return m_cStructure->m_codecFourCC; }
818 
822  void SetColorSpace(INPUTSTREAM_COLORSPACE colorSpace) { m_cStructure->m_colorSpace = colorSpace; }
823 
825  INPUTSTREAM_COLORSPACE GetColorSpace() const { return m_cStructure->m_colorSpace; }
826 
830  void SetColorRange(INPUTSTREAM_COLORRANGE colorRange) { m_cStructure->m_colorRange = colorRange; }
831 
833  INPUTSTREAM_COLORRANGE GetColorRange() const { return m_cStructure->m_colorRange; }
834 
839  {
840  m_cStructure->m_colorPrimaries = colorPrimaries;
841  }
842 
844  INPUTSTREAM_COLORPRIMARIES GetColorPrimaries() const { return m_cStructure->m_colorPrimaries; }
845 
849  void SetColorTransferCharacteristic(INPUTSTREAM_COLORTRC colorTransferCharacteristic)
850  {
851  m_cStructure->m_colorTransferCharacteristic = colorTransferCharacteristic;
852  }
853 
856  {
857  return m_cStructure->m_colorTransferCharacteristic;
858  }
859 
869  {
870  m_masteringMetadata = masteringMetadata;
871  m_cStructure->m_masteringMetadata = m_masteringMetadata;
872  }
873 
876  {
877  return m_masteringMetadata;
878  }
879 
881  void ClearMasteringMetadata() { m_cStructure->m_masteringMetadata = nullptr; }
882 
890  const kodi::addon::InputstreamContentlightMetadata& contentLightMetadata)
891  {
892  m_contentLightMetadata = contentLightMetadata;
893  m_cStructure->m_contentLightMetadata = m_contentLightMetadata;
894  }
895 
898  {
899  return m_contentLightMetadata;
900  }
901 
903  void ClearContentLightMetadata() { m_cStructure->m_contentLightMetadata = nullptr; }
904 
906 
907 private:
908  InputstreamInfo(const INPUTSTREAM_INFO* stream) : CStructHdl(stream)
909  {
910  SetCryptoSession(StreamCryptoSession(&stream->m_cryptoSession));
911  CopyExtraData();
912  }
913  InputstreamInfo(INPUTSTREAM_INFO* stream) : CStructHdl(stream)
914  {
915  SetCryptoSession(StreamCryptoSession(&stream->m_cryptoSession));
916  CopyExtraData();
917  }
918 
919  void CopyExtraData()
920  {
921  if (m_cStructure->m_ExtraData && m_cStructure->m_ExtraSize > 0)
922  {
923  for (unsigned int i = 0; i < m_cStructure->m_ExtraSize; ++i)
924  m_extraData.emplace_back(m_cStructure->m_ExtraData[i]);
925  }
926  if (m_cStructure->m_masteringMetadata)
927  m_masteringMetadata = m_cStructure->m_masteringMetadata;
928  if (m_cStructure->m_contentLightMetadata)
929  m_contentLightMetadata = m_cStructure->m_contentLightMetadata;
930  }
931  std::vector<uint8_t> m_extraData;
932  StreamCryptoSession m_cryptoSession;
933  InputstreamMasteringMetadata m_masteringMetadata;
934  InputstreamContentlightMetadata m_contentLightMetadata;
935 };
937 //------------------------------------------------------------------------------
938 
939 //==============================================================================
950 class ATTRIBUTE_HIDDEN InputstreamTimes : public CStructHdl<InputstreamTimes, INPUTSTREAM_TIMES>
951 {
953  friend class CInstanceInputStream;
956 public:
958  InputstreamTimes() = default;
959  InputstreamTimes(const InputstreamTimes& stream) : CStructHdl(stream) {}
973 
976 
978  void SetStartTime(time_t startTime) const { m_cStructure->startTime = startTime; }
979 
981  time_t GetStartTime() const { return m_cStructure->startTime; }
982 
984  void SetPtsStart(double ptsStart) const { m_cStructure->ptsStart = ptsStart; }
985 
987  double GetPtsStart() const { return m_cStructure->ptsStart; }
988 
990  void SetPtsBegin(double ptsBegin) const { m_cStructure->ptsBegin = ptsBegin; }
991 
993  double GetPtsBegin() const { return m_cStructure->ptsBegin; }
994 
996  void SetPtsEnd(double ptsEnd) const { m_cStructure->ptsEnd = ptsEnd; }
997 
999  double GetPtsEnd() const { return m_cStructure->ptsEnd; }
1000 
1002 
1003 private:
1004  InputstreamTimes(const INPUTSTREAM_TIMES* stream) : CStructHdl(stream) {}
1005  InputstreamTimes(INPUTSTREAM_TIMES* stream) : CStructHdl(stream) {}
1006 };
1008 //------------------------------------------------------------------------------
1009 
1010 //============================================================================
1152 //------------------------------------------------------------------------------
1153 class ATTRIBUTE_HIDDEN CInstanceInputStream : public IAddonInstance
1154 {
1155 public:
1156  //============================================================================
1167  explicit CInstanceInputStream(KODI_HANDLE instance, const std::string& kodiVersion = "")
1169  !kodiVersion.empty() ? kodiVersion
1171  {
1172  if (CAddonBase::m_interface->globalSingleInstance != nullptr)
1173  throw std::logic_error("kodi::addon::CInstanceInputStream: Creation of multiple together "
1174  "with single instance way is not allowed!");
1175 
1176  SetAddonStruct(instance, m_kodiVersion);
1177  }
1178  //----------------------------------------------------------------------------
1179 
1180  //============================================================================
1184  ~CInstanceInputStream() override = default;
1185  //----------------------------------------------------------------------------
1186 
1187  //============================================================================
1218  //----------------------------------------------------------------------------
1219 
1220  //============================================================================
1249  virtual bool Open(const kodi::addon::InputstreamProperty& props) = 0;
1250  //----------------------------------------------------------------------------
1251 
1252  //============================================================================
1262  virtual void Close() = 0;
1263  //----------------------------------------------------------------------------
1264 
1265  //============================================================================
1271  virtual bool IsRealTimeStream() { return true; }
1272  //----------------------------------------------------------------------------
1273 
1274  //############################################################################
1294 
1295  //============================================================================
1302  virtual int ReadStream(uint8_t* buffer, unsigned int bufferSize) { return -1; }
1303  //----------------------------------------------------------------------------
1304 
1305  //============================================================================
1323  virtual int64_t SeekStream(int64_t position, int whence = SEEK_SET) { return -1; }
1324  //----------------------------------------------------------------------------
1325 
1326  //============================================================================
1334  virtual int64_t PositionStream() { return -1; }
1335  //----------------------------------------------------------------------------
1336 
1337  //============================================================================
1345  virtual int64_t LengthStream() { return -1; }
1346  //--------------------------------------------------------------------------
1347 
1348  //==========================================================================
1356  virtual int GetBlockSize() { return 0; }
1357  //--------------------------------------------------------------------------
1358 
1360 
1361  //############################################################################
1369 
1370  //============================================================================
1411  virtual bool GetStreamIds(std::vector<unsigned int>& ids) { return false; }
1412  //----------------------------------------------------------------------------
1413 
1414  //============================================================================
1463  virtual bool GetStream(int streamid, kodi::addon::InputstreamInfo& stream) { return false; }
1464  //----------------------------------------------------------------------------
1465 
1466  //============================================================================
1480  virtual void EnableStream(int streamid, bool enable) {}
1481  //----------------------------------------------------------------------------
1482 
1483  //============================================================================
1494  virtual bool OpenStream(int streamid) { return false; }
1495  //----------------------------------------------------------------------------
1496 
1497  //============================================================================
1502  virtual void DemuxReset() {}
1503  //----------------------------------------------------------------------------
1504 
1505  //============================================================================
1510  virtual void DemuxAbort() {}
1511  //----------------------------------------------------------------------------
1512 
1513  //============================================================================
1518  virtual void DemuxFlush() {}
1519  //----------------------------------------------------------------------------
1520 
1521  //============================================================================
1535  virtual DEMUX_PACKET* DemuxRead() { return nullptr; }
1536  //----------------------------------------------------------------------------
1537 
1538  //============================================================================
1550  virtual bool DemuxSeekTime(double time, bool backwards, double& startpts) { return false; }
1551  //----------------------------------------------------------------------------
1552 
1553  //============================================================================
1560  virtual void DemuxSetSpeed(int speed) {}
1561  //----------------------------------------------------------------------------
1562 
1563  //============================================================================
1569  virtual void SetVideoResolution(int width, int height) {}
1570  //----------------------------------------------------------------------------
1571 
1572  //=============================================================================
1581  {
1582  return m_instanceData->toKodi->allocate_demux_packet(m_instanceData->toKodi->kodiInstance,
1583  dataSize);
1584  }
1585  //----------------------------------------------------------------------------
1586 
1587  //============================================================================
1596  DEMUX_PACKET* AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount)
1597  {
1598  return m_instanceData->toKodi->allocate_encrypted_demux_packet(
1599  m_instanceData->toKodi->kodiInstance, dataSize, encryptedSubsampleCount);
1600  }
1601  //----------------------------------------------------------------------------
1602 
1603  //============================================================================
1611  {
1612  return m_instanceData->toKodi->free_demux_packet(m_instanceData->toKodi->kodiInstance, packet);
1613  }
1614  //----------------------------------------------------------------------------
1615 
1617 
1618  //############################################################################
1626 
1627  //==========================================================================
1634  virtual int GetTotalTime() { return -1; }
1635  //--------------------------------------------------------------------------
1636 
1637  //==========================================================================
1644  virtual int GetTime() { return -1; }
1645  //--------------------------------------------------------------------------
1646 
1648 
1649  //############################################################################
1657 
1658  //============================================================================
1668  virtual bool GetTimes(InputstreamTimes& times) { return false; }
1669  //----------------------------------------------------------------------------
1670 
1672 
1673  //############################################################################
1681 
1682  //============================================================================
1689  virtual bool PosTime(int ms) { return false; }
1690  //----------------------------------------------------------------------------
1691 
1693 
1694  //############################################################################
1702 
1703  //==========================================================================
1711  virtual int GetChapter() { return -1; }
1712  //--------------------------------------------------------------------------
1713 
1714  //==========================================================================
1722  virtual int GetChapterCount() { return 0; }
1723  //--------------------------------------------------------------------------
1724 
1725  //==========================================================================
1734  virtual const char* GetChapterName(int ch) { return nullptr; }
1735  //--------------------------------------------------------------------------
1736 
1737  //==========================================================================
1746  virtual int64_t GetChapterPos(int ch) { return 0; }
1747  //--------------------------------------------------------------------------
1748 
1749  //==========================================================================
1758  virtual bool SeekChapter(int ch) { return false; }
1759  //--------------------------------------------------------------------------
1760 
1762 
1763 private:
1764  static int compareVersion(const int v1[3], const int v2[3])
1765  {
1766  for (unsigned i(0); i < 3; ++i)
1767  if (v1[i] != v2[i])
1768  return v1[i] - v2[i];
1769  return 0;
1770  }
1771 
1772  void SetAddonStruct(KODI_HANDLE instance, const std::string& kodiVersion)
1773  {
1774  if (instance == nullptr)
1775  throw std::logic_error("kodi::addon::CInstanceInputStream: Creation with empty addon "
1776  "structure not allowed, table must be given from Kodi!");
1777  int api[3] = { 0, 0, 0 };
1778  sscanf(kodiVersion.c_str(), "%d.%d.%d", &api[0], &api[1], &api[2]);
1779 
1780  m_instanceData = static_cast<AddonInstance_InputStream*>(instance);
1781  m_instanceData->toAddon->addonInstance = this;
1782  m_instanceData->toAddon->open = ADDON_Open;
1783  m_instanceData->toAddon->close = ADDON_Close;
1784  m_instanceData->toAddon->get_capabilities = ADDON_GetCapabilities;
1785 
1786  m_instanceData->toAddon->get_stream_ids = ADDON_GetStreamIds;
1787  m_instanceData->toAddon->get_stream = ADDON_GetStream;
1788  m_instanceData->toAddon->enable_stream = ADDON_EnableStream;
1789  m_instanceData->toAddon->open_stream = ADDON_OpenStream;
1790  m_instanceData->toAddon->demux_reset = ADDON_DemuxReset;
1791  m_instanceData->toAddon->demux_abort = ADDON_DemuxAbort;
1792  m_instanceData->toAddon->demux_flush = ADDON_DemuxFlush;
1793  m_instanceData->toAddon->demux_read = ADDON_DemuxRead;
1794  m_instanceData->toAddon->demux_seek_time = ADDON_DemuxSeekTime;
1795  m_instanceData->toAddon->demux_set_speed = ADDON_DemuxSetSpeed;
1796  m_instanceData->toAddon->set_video_resolution = ADDON_SetVideoResolution;
1797 
1798  m_instanceData->toAddon->get_total_time = ADDON_GetTotalTime;
1799  m_instanceData->toAddon->get_time = ADDON_GetTime;
1800 
1801  m_instanceData->toAddon->get_times = ADDON_GetTimes;
1802  m_instanceData->toAddon->pos_time = ADDON_PosTime;
1803 
1804  m_instanceData->toAddon->read_stream = ADDON_ReadStream;
1805  m_instanceData->toAddon->seek_stream = ADDON_SeekStream;
1806  m_instanceData->toAddon->position_stream = ADDON_PositionStream;
1807  m_instanceData->toAddon->length_stream = ADDON_LengthStream;
1808  m_instanceData->toAddon->is_real_time_stream = ADDON_IsRealTimeStream;
1809 
1810  // Added on 2.0.10
1811  m_instanceData->toAddon->get_chapter = ADDON_GetChapter;
1812  m_instanceData->toAddon->get_chapter_count = ADDON_GetChapterCount;
1813  m_instanceData->toAddon->get_chapter_name = ADDON_GetChapterName;
1814  m_instanceData->toAddon->get_chapter_pos = ADDON_GetChapterPos;
1815  m_instanceData->toAddon->seek_chapter = ADDON_SeekChapter;
1816 
1817  // Added on 2.0.12
1818  m_instanceData->toAddon->block_size_stream = ADDON_GetBlockSize;
1819 
1820  /*
1821  // Way to include part on new API version
1822  int minPartVersion[3] = { 3, 0, 0 };
1823  if (compareVersion(api, minPartVersion) >= 0)
1824  {
1825 
1826  }
1827  */
1828  }
1829 
1830  inline static bool ADDON_Open(const AddonInstance_InputStream* instance,
1831  INPUTSTREAM_PROPERTY* props)
1832  {
1833  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->Open(props);
1834  }
1835 
1836  inline static void ADDON_Close(const AddonInstance_InputStream* instance)
1837  {
1838  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->Close();
1839  }
1840 
1841  inline static void ADDON_GetCapabilities(const AddonInstance_InputStream* instance,
1842  INPUTSTREAM_CAPABILITIES* capabilities)
1843  {
1844  InputstreamCapabilities caps(capabilities);
1845  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetCapabilities(caps);
1846  }
1847 
1848 
1849  // IDemux
1850  inline static bool ADDON_GetStreamIds(const AddonInstance_InputStream* instance,
1851  struct INPUTSTREAM_IDS* ids)
1852  {
1853  std::vector<unsigned int> idList;
1854  bool ret =
1855  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetStreamIds(idList);
1856  if (ret)
1857  {
1858  for (size_t i = 0; i < idList.size() && i < INPUTSTREAM_MAX_STREAM_COUNT; ++i)
1859  {
1860  ids->m_streamCount++;
1861  ids->m_streamIds[i] = idList[i];
1862  }
1863  }
1864  return ret;
1865  }
1866 
1867  inline static bool ADDON_GetStream(
1868  const AddonInstance_InputStream* instance,
1869  int streamid,
1870  struct INPUTSTREAM_INFO* info,
1871  KODI_HANDLE* demuxStream,
1872  KODI_HANDLE (*transfer_stream)(KODI_HANDLE handle,
1873  int streamId,
1874  struct INPUTSTREAM_INFO* stream))
1875  {
1876  InputstreamInfo infoData(info);
1877  bool ret = static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1878  ->GetStream(streamid, infoData);
1879  if (ret && transfer_stream)
1880  {
1881  // Do this with given callback to prevent memory problems and leaks. This
1882  // then create on Kodi the needed class where then given back on demuxStream.
1883  *demuxStream = transfer_stream(instance->toKodi->kodiInstance, streamid, info);
1884  }
1885  return ret;
1886  }
1887 
1888  inline static void ADDON_EnableStream(const AddonInstance_InputStream* instance,
1889  int streamid,
1890  bool enable)
1891  {
1892  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1893  ->EnableStream(streamid, enable);
1894  }
1895 
1896  inline static bool ADDON_OpenStream(const AddonInstance_InputStream* instance, int streamid)
1897  {
1898  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1899  ->OpenStream(streamid);
1900  }
1901 
1902  inline static void ADDON_DemuxReset(const AddonInstance_InputStream* instance)
1903  {
1904  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxReset();
1905  }
1906 
1907  inline static void ADDON_DemuxAbort(const AddonInstance_InputStream* instance)
1908  {
1909  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxAbort();
1910  }
1911 
1912  inline static void ADDON_DemuxFlush(const AddonInstance_InputStream* instance)
1913  {
1914  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxFlush();
1915  }
1916 
1917  inline static DEMUX_PACKET* ADDON_DemuxRead(const AddonInstance_InputStream* instance)
1918  {
1919  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxRead();
1920  }
1921 
1922  inline static bool ADDON_DemuxSeekTime(const AddonInstance_InputStream* instance,
1923  double time,
1924  bool backwards,
1925  double* startpts)
1926  {
1927  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1928  ->DemuxSeekTime(time, backwards, *startpts);
1929  }
1930 
1931  inline static void ADDON_DemuxSetSpeed(const AddonInstance_InputStream* instance, int speed)
1932  {
1933  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxSetSpeed(speed);
1934  }
1935 
1936  inline static void ADDON_SetVideoResolution(const AddonInstance_InputStream* instance,
1937  int width,
1938  int height)
1939  {
1940  static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1941  ->SetVideoResolution(width, height);
1942  }
1943 
1944 
1945  // IDisplayTime
1946  inline static int ADDON_GetTotalTime(const AddonInstance_InputStream* instance)
1947  {
1948  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTotalTime();
1949  }
1950 
1951  inline static int ADDON_GetTime(const AddonInstance_InputStream* instance)
1952  {
1953  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTime();
1954  }
1955 
1956  // ITime
1957  inline static bool ADDON_GetTimes(const AddonInstance_InputStream* instance,
1958  INPUTSTREAM_TIMES* times)
1959  {
1960  InputstreamTimes cppTimes(times);
1961  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTimes(cppTimes);
1962  }
1963 
1964  // IPosTime
1965  inline static bool ADDON_PosTime(const AddonInstance_InputStream* instance, int ms)
1966  {
1967  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->PosTime(ms);
1968  }
1969 
1970  inline static int ADDON_GetChapter(const AddonInstance_InputStream* instance)
1971  {
1972  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapter();
1973  }
1974 
1975  inline static int ADDON_GetChapterCount(const AddonInstance_InputStream* instance)
1976  {
1977  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapterCount();
1978  }
1979 
1980  inline static const char* ADDON_GetChapterName(const AddonInstance_InputStream* instance, int ch)
1981  {
1982  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapterName(ch);
1983  }
1984 
1985  inline static int64_t ADDON_GetChapterPos(const AddonInstance_InputStream* instance, int ch)
1986  {
1987  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapterPos(ch);
1988  }
1989 
1990  inline static bool ADDON_SeekChapter(const AddonInstance_InputStream* instance, int ch)
1991  {
1992  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->SeekChapter(ch);
1993  }
1994 
1995  inline static int ADDON_ReadStream(const AddonInstance_InputStream* instance,
1996  uint8_t* buffer,
1997  unsigned int bufferSize)
1998  {
1999  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
2000  ->ReadStream(buffer, bufferSize);
2001  }
2002 
2003  inline static int64_t ADDON_SeekStream(const AddonInstance_InputStream* instance,
2004  int64_t position,
2005  int whence)
2006  {
2007  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
2008  ->SeekStream(position, whence);
2009  }
2010 
2011  inline static int64_t ADDON_PositionStream(const AddonInstance_InputStream* instance)
2012  {
2013  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->PositionStream();
2014  }
2015 
2016  inline static int64_t ADDON_LengthStream(const AddonInstance_InputStream* instance)
2017  {
2018  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->LengthStream();
2019  }
2020 
2021  inline static int ADDON_GetBlockSize(const AddonInstance_InputStream* instance)
2022  {
2023  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetBlockSize();
2024  }
2025 
2026  inline static bool ADDON_IsRealTimeStream(const AddonInstance_InputStream* instance)
2027  {
2028  return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->IsRealTimeStream();
2029  }
2030 
2031  AddonInstance_InputStream* m_instanceData;
2032 };
2033 //------------------------------------------------------------------------------
2034 
2035 } /* namespace addon */
2036 } /* namespace kodi */
2037 
2038 #endif /* __cplusplus */
Definition: Inputstream.h:1154
Definition: AddonBase.h:250
Definition: AddonBase.h:186
Definition: Inputstream.h:206
Definition: Inputstream.h:508
Definition: Inputstream.h:262
Definition: Inputstream.h:126
Definition: Inputstream.h:951
Definition: StreamCrypto.h:43
@ ADDON_INSTANCE_INPUTSTREAM
Input stream instance, see kodi::addon::CInstanceInputStream.
Definition: versions.h:226
virtual const char * GetChapterName(int ch)
Return name of chapter.
Definition: Inputstream.h:1734
virtual int GetChapterCount()
Return number of available chapters.
Definition: Inputstream.h:1722
virtual int64_t GetChapterPos(int ch)
Return position if chapter # ch in milliseconds.
Definition: Inputstream.h:1746
virtual int GetChapter()
Return currently selected chapter.
Definition: Inputstream.h:1711
virtual bool SeekChapter(int ch)
Seek to the beginning of chapter # ch.
Definition: Inputstream.h:1758
std::string GetLibFolder() const
Get addon library folder.
Definition: Inputstream.h:175
std::string GetMimeType() const
Stream mime type.
Definition: Inputstream.h:152
const std::map< std::string, std::string > GetProperties() const
List of available properties-.
Definition: Inputstream.h:161
std::string GetURL() const
Stream URL to open.
Definition: Inputstream.h:149
unsigned int GetPropertiesAmount() const
Amount of available properties.
Definition: Inputstream.h:155
std::string GetProfileFolder() const
Get addon profile/user folder.
Definition: Inputstream.h:180
Definition: demux_packet.h:46
INPUTSTREAM_COLORPRIMARIES
Definition: inputstream.h:336
INPUTSTREAM_COLORRANGE
Definition: inputstream.h:400
INPUTSTREAM_COLORSPACE
Definition: inputstream.h:265
INPUTSTREAM_COLORTRC
Definition: inputstream.h:427
INPUTSTREAM_TYPE
Definition: inputstream.h:164
void SetMask(uint32_t mask) const
Set of supported capabilities.
Definition: Inputstream.h:229
uint32_t GetMask() const
Get of supported capabilities.
Definition: Inputstream.h:232
void SetMaxCll(uint64_t value)
Set the maximum content light level (MaxCLL).
Definition: Inputstream.h:468
uint64_t GetMaxCll()
Get the maximum content light level (MaxCLL).
Definition: Inputstream.h:471
bool operator==(const kodi::addon::InputstreamContentlightMetadata &right) const
Metadata class compare.
Definition: Inputstream.h:457
void SetMaxFall(uint64_t value)
Set the maximum frame average light level (MaxFALL).
Definition: Inputstream.h:477
uint64_t GetMaxFall()
Get the maximum frame average light level (MaxFALL).
Definition: Inputstream.h:480
unsigned int GetHeight() const
To get with SetHeight changed values.
Definition: Inputstream.h:736
void SetHeight(unsigned int height)
Height of the stream reported by the demuxer.
Definition: Inputstream.h:733
unsigned int GetBitRate() const
To get with SetBitRate changed values.
Definition: Inputstream.h:776
void SetColorPrimaries(INPUTSTREAM_COLORPRIMARIES colorPrimaries)
Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 2300...
Definition: Inputstream.h:838
unsigned int GetFpsScale() const
To get with SetFpsScale changed values.
Definition: Inputstream.h:720
void SetPhysicalIndex(unsigned int id)
(required) Physical index.
Definition: Inputstream.h:640
void SetExtraData(const uint8_t *extraData, size_t extraSize)
Additional data where can needed on streams.
Definition: Inputstream.h:659
void SetChannels(unsigned int channels)
(required) Amount of channels.
Definition: Inputstream.h:757
void SetFpsScale(unsigned int fpsScale)
Scale of 1000 and a rate of 29970 will result in 29.97 fps.
Definition: Inputstream.h:717
const kodi::addon::StreamCryptoSession & GetCryptoSession() const
To get with GetCryptoSession changed values.
Definition: Inputstream.h:809
void SetFpsRate(unsigned int fpsRate)
Rate to use for stream.
Definition: Inputstream.h:725
INPUTSTREAM_COLORTRC GetColorTransferCharacteristic() const
To get with SetColorTransferCharacteristic changed values.
Definition: Inputstream.h:855
void ClearContentLightMetadata()
Clear content light static Metadata.
Definition: Inputstream.h:903
void SetMasteringMetadata(const kodi::addon::InputstreamMasteringMetadata &masteringMetadata)
Mastering static Metadata.
Definition: Inputstream.h:868
void SetCodecName(const std::string &codecName)
(required) Name of codec according to ffmpeg.
Definition: Inputstream.h:606
void SetFlags(uint32_t flags)
Set supported flags of inputstream.
Definition: Inputstream.h:581
void SetStreamType(INPUTSTREAM_TYPE streamType)
Set the wanted stream type.
Definition: Inputstream.h:565
void ClearExtraData()
Clear additional data.
Definition: Inputstream.h:696
unsigned int GetWidth() const
To get with SetWidth changed values.
Definition: Inputstream.h:744
void SetColorRange(INPUTSTREAM_COLORRANGE colorRange)
Color range if available.
Definition: Inputstream.h:830
unsigned int GetFpsRate() const
To get with SetFpsRate changed values.
Definition: Inputstream.h:728
void SetCodecInternalName(const std::string &codecName)
(optional) Internal name of codec (selectionstream info).
Definition: Inputstream.h:617
unsigned int GetBitsPerSample() const
To get with SetBitsPerSample changed values.
Definition: Inputstream.h:787
void SetCryptoSession(const kodi::addon::StreamCryptoSession &cryptoSession)
To set stream crypto session informations.
Definition: Inputstream.h:801
void ClearMasteringMetadata()
Clear mastering static Metadata.
Definition: Inputstream.h:881
void SetCodecProfile(STREAMCODEC_PROFILE codecProfile)
(optional) The profile of the codec.
Definition: Inputstream.h:629
float GetAspect() const
To get with SetAspect changed values.
Definition: Inputstream.h:752
void SetBitRate(unsigned int bitRate)
Bit rate.
Definition: Inputstream.h:773
const kodi::addon::InputstreamContentlightMetadata & GetContentLightMetadata() const
To get with SetContentLightMetadata changed values.
Definition: Inputstream.h:897
std::string GetCodecName() const
To get with SetCodecName changed values.
Definition: Inputstream.h:612
void SetExtraData(const std::vector< uint8_t > &extraData)
Additional data where can needed on streams.
Definition: Inputstream.h:648
STREAMCODEC_PROFILE GetCodecProfile() const
To get with SetCodecProfile changed values.
Definition: Inputstream.h:635
void SetColorTransferCharacteristic(INPUTSTREAM_COLORTRC colorTransferCharacteristic)
Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7....
Definition: Inputstream.h:849
unsigned int GetChannels() const
To get with SetChannels changed values.
Definition: Inputstream.h:760
unsigned int GetSampleRate() const
To get with SetSampleRate changed values.
Definition: Inputstream.h:768
void SetName(const std::string &name)
(optional) Name of the stream, leave empty for default handling.
Definition: Inputstream.h:589
void SetAspect(float aspect)
Display aspect of stream.
Definition: Inputstream.h:749
std::string GetName() const
To get with SetName changed values.
Definition: Inputstream.h:595
uint32_t GetFeatures() const
To get with SetFeatures changed values.
Definition: Inputstream.h:576
void SetLanguage(const std::string &language)
RFC 5646 language code (empty string if undefined).
Definition: Inputstream.h:706
void SetContentLightMetadata(const kodi::addon::InputstreamContentlightMetadata &contentLightMetadata)
Content light static Metadata.
Definition: Inputstream.h:889
unsigned int GetCodecFourCC() const
To get with SetCodecFourCC changed values.
Definition: Inputstream.h:817
void SetColorSpace(INPUTSTREAM_COLORSPACE colorSpace)
Definition of colorspace.
Definition: Inputstream.h:822
void SetSampleRate(unsigned int sampleRate)
(required) Sample rate.
Definition: Inputstream.h:765
void SetCodecFourCC(unsigned int codecFourCC)
Codec If available, the fourcc code codec.
Definition: Inputstream.h:814
unsigned int GetBlockAlign() const
To get with SetBlockAlign changed values.
Definition: Inputstream.h:795
void SetBitsPerSample(unsigned int bitsPerSample)
(required) Bits per sample.
Definition: Inputstream.h:781
void SetBlockAlign(unsigned int blockAlign)
To set the necessary stream block alignment size.
Definition: Inputstream.h:792
unsigned int GetPhysicalIndex() const
To get with SetPhysicalIndex changed values.
Definition: Inputstream.h:643
void SetWidth(unsigned int width)
Width of the stream reported by the demuxer.
Definition: Inputstream.h:741
std::string GetLanguage() const
To get with SetLanguage changed values.
Definition: Inputstream.h:712
const kodi::addon::InputstreamMasteringMetadata & GetMasteringMetadata() const
To get with SetMasteringMetadata changed values.
Definition: Inputstream.h:875
uint32_t GetFlags() const
To get with SetFeatures changed values.
Definition: Inputstream.h:584
INPUTSTREAM_COLORRANGE GetColorRange() const
To get with SetColorRange changed values.
Definition: Inputstream.h:833
std::string GetCodecInternalName() const
To get with SetCodecInternalName changed values.
Definition: Inputstream.h:624
INPUTSTREAM_COLORPRIMARIES GetColorPrimaries() const
To get with SetColorPrimaries changed values.
Definition: Inputstream.h:844
bool CompareExtraData(const uint8_t *extraData, size_t extraSize) const
Compare extra data from outside with class.
Definition: Inputstream.h:683
INPUTSTREAM_COLORSPACE GetColorSpace() const
To get with SetColorSpace changed values.
Definition: Inputstream.h:825
size_t GetExtraDataSize()
To get size with SetExtraData changed values.
Definition: Inputstream.h:676
INPUTSTREAM_TYPE GetStreamType() const
To get with SetStreamType changed values.
Definition: Inputstream.h:568
const std::vector< uint8_t > & GetExtraData()
To get with SetExtraData changed values.
Definition: Inputstream.h:673
void SetFeatures(uint32_t features)
Set special supported feature flags of inputstream.
Definition: Inputstream.h:573
double GetPrimaryG_ChromaticityX()
Get the chromaticity X coordinates of the green value.
Definition: Inputstream.h:331
double GetLuminanceMin()
Get the minimum number of bits of the display.
Definition: Inputstream.h:398
double GetPrimaryG_ChromaticityY()
Get the chromaticity Y coordinates of the green value.
Definition: Inputstream.h:340
double GetPrimaryR_ChromaticityY()
Get the chromaticity Y coordinates of the red value.
Definition: Inputstream.h:322
double GetPrimaryB_ChromaticityY()
Get the chromaticity Y coordinates of the blue value.
Definition: Inputstream.h:358
void SetWhitePoint_ChromaticityY(double value)
Set the chromaticity coordinates of the white point in the CIE1931 color space.
Definition: Inputstream.h:376
void SetWhitePoint_ChromaticityX(double value)
Set the chromaticity coordinates of the white point in the CIE1931 color space.
Definition: Inputstream.h:364
void SetPrimaryB_ChromaticityY(double value)
The chromaticity coordinates of the blue value in the CIE1931 color space.
Definition: Inputstream.h:355
double GetLuminanceMax()
Get the maximum number of bits of the display.
Definition: Inputstream.h:390
void SetPrimaryG_ChromaticityY(double value)
Set the chromaticity coordinates of the green value in the CIE1931 color space.
Definition: Inputstream.h:337
void SetPrimaryR_ChromaticityX(double value)
Set the chromaticity coordinates of the red value in the CIE1931 color space.
Definition: Inputstream.h:310
void SetLuminanceMin(double value)
Set the minimum number of bits of the display used to master the content.
Definition: Inputstream.h:395
void SetPrimaryG_ChromaticityX(double value)
Set the chromaticity coordinates of the green value in the CIE1931 color space.
Definition: Inputstream.h:328
void SetLuminanceMax(double value)
Set the maximum number of bits of the display used to master the content.
Definition: Inputstream.h:387
void SetPrimaryR_ChromaticityY(double value)
The chromaticity coordinates of the red value in the CIE1931 color space.
Definition: Inputstream.h:319
double GetPrimaryB_ChromaticityX()
Get the chromaticity X coordinates of the blue value.
Definition: Inputstream.h:349
double GetWhitePoint_ChromaticityX()
Get the chromaticity X coordinates of the white point.
Definition: Inputstream.h:370
void SetPrimaryB_ChromaticityX(double value)
The chromaticity coordinates of the blue value in the CIE1931 color space.
Definition: Inputstream.h:346
double GetPrimaryR_ChromaticityX()
Get the chromaticity X coordinates of the red value.
Definition: Inputstream.h:313
double GetWhitePoint_ChromaticityY()
Get the chromaticity Y coordinates of the white point.
Definition: Inputstream.h:382
bool operator==(const kodi::addon::InputstreamMasteringMetadata &right) const
Metadata class compare.
Definition: Inputstream.h:299
double GetPtsEnd() const
To get with SetPtsEnd changed values.
Definition: Inputstream.h:999
void SetPtsStart(double ptsStart) const
Start PTS.
Definition: Inputstream.h:984
void SetStartTime(time_t startTime) const
Start time in milliseconds.
Definition: Inputstream.h:978
void SetPtsBegin(double ptsBegin) const
Begin PTS.
Definition: Inputstream.h:990
double GetPtsStart() const
To get with SetPtsStart changed values.
Definition: Inputstream.h:987
time_t GetStartTime() const
To get with SetStartTime changed values.
Definition: Inputstream.h:981
double GetPtsBegin() const
To get with SetPtsBegin changed values.
Definition: Inputstream.h:993
void SetPtsEnd(double ptsEnd) const
End PTS.
Definition: Inputstream.h:996
STREAMCODEC_PROFILE
Definition: stream_codec.h:25
virtual bool OpenStream(int streamid)
Opens a stream for playback.
Definition: Inputstream.h:1494
virtual void EnableStream(int streamid, bool enable)
Enable or disable a stream.
Definition: Inputstream.h:1480
virtual bool DemuxSeekTime(double time, bool backwards, double &startpts)
Notify the InputStream addon/demuxer that Kodi wishes to seek the stream by time.
Definition: Inputstream.h:1550
void FreeDemuxPacket(DEMUX_PACKET *packet)
Free a packet that was allocated with AllocateDemuxPacket.
Definition: Inputstream.h:1610
virtual void DemuxReset()
Reset the demultiplexer in the add-on.
Definition: Inputstream.h:1502
virtual void SetVideoResolution(int width, int height)
Sets desired width / height.
Definition: Inputstream.h:1569
DEMUX_PACKET * AllocateDemuxPacket(int dataSize)
Allocate a demux packet. Free with FreeDemuxPacket.
Definition: Inputstream.h:1580
virtual void DemuxSetSpeed(int speed)
Notify the InputStream addon/demuxer that Kodi wishes to change playback speed.
Definition: Inputstream.h:1560
DEMUX_PACKET * AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount)
Allocate a encrypted demux packet. Free with FreeDemuxPacket.
Definition: Inputstream.h:1596
virtual bool GetStream(int streamid, kodi::addon::InputstreamInfo &stream)
Function for giving detailed stream information.
Definition: Inputstream.h:1463
virtual void DemuxAbort()
Abort the demultiplexer thread in the add-on.
Definition: Inputstream.h:1510
virtual bool GetStreamIds(std::vector< unsigned int > &ids)
Get IDs of available streams.
Definition: Inputstream.h:1411
virtual DEMUX_PACKET * DemuxRead()
Read the next packet from the demultiplexer, if there is one.
Definition: Inputstream.h:1535
virtual void DemuxFlush()
Flush all data that's currently in the demultiplexer buffer in the add-on.
Definition: Inputstream.h:1518
virtual bool PosTime(int ms)
Positions inputstream to playing time given in ms.
Definition: Inputstream.h:1689
virtual int GetBlockSize()
Obtain the chunk size to use when reading streams.
Definition: Inputstream.h:1356
virtual int64_t PositionStream()
The position in the stream that's currently being read.
Definition: Inputstream.h:1334
virtual int64_t LengthStream()
The Total length of the stream that's currently being read.
Definition: Inputstream.h:1345
virtual int64_t SeekStream(int64_t position, int whence=SEEK_SET)
Seek in a stream.
Definition: Inputstream.h:1323
virtual int ReadStream(uint8_t *buffer, unsigned int bufferSize)
Read from an open stream.
Definition: Inputstream.h:1302
virtual int GetTotalTime()
Totel time in ms.
Definition: Inputstream.h:1634
virtual int GetTime()
Playing time in ms.
Definition: Inputstream.h:1644
virtual bool GetTimes(InputstreamTimes &times)
Get current timing values in PTS scale.
Definition: Inputstream.h:1668
virtual bool Open(const kodi::addon::InputstreamProperty &props)=0
Open a stream.
~CInstanceInputStream() override=default
Destructor.
virtual void Close()=0
Close an open stream.
virtual bool IsRealTimeStream()
Check for real-time streaming.
Definition: Inputstream.h:1271
CInstanceInputStream(KODI_HANDLE instance, const std::string &kodiVersion="")
Inputstream class constructor used to support multiple instance types.
Definition: Inputstream.h:1167
virtual void GetCapabilities(kodi::addon::InputstreamCapabilities &capabilities)=0
Get the list of features that this add-on provides.
std::string ATTRIBUTE_HIDDEN GetKodiTypeVersion(int type)
To get used version inside Kodi itself about asked type.
Definition: AddonBase.h:630
Definition: inputstream.h:693
InputStream add-on capabilities. All capabilities are set to "false" as default.
Definition: inputstream.h:95
CONTENTLIGHT Metadata.
Definition: inputstream.h:149
Array of stream IDs.
Definition: inputstream.h:123
stream properties
Definition: inputstream.h:501
MASTERING Metadata.
Definition: inputstream.h:132
structure of key/value pairs passed to addon on Open()
Definition: inputstream.h:104
Definition: inputstream.h:593
Definition: stream_crypto.h:109