Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
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
22namespace kodi
23{
24namespace 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
108class CInstanceInputStream;
109
110//==============================================================================
124class ATTR_DLL_LOCAL InputstreamProperty
125 : public CStructHdl<InputstreamProperty, INPUTSTREAM_PROPERTY>
126{
128 friend class CInstanceInputStream;
131public:
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 { return m_cStructure->m_nCountInfoValues; }
156
158 const std::map<std::string, std::string> GetProperties() const
159 {
160 std::map<std::string, std::string> props;
161 for (unsigned int i = 0; i < m_cStructure->m_nCountInfoValues; ++i)
162 {
163 props.emplace(m_cStructure->m_ListItemProperties[i].m_strKey,
164 m_cStructure->m_ListItemProperties[i].m_strValue);
165 }
166 return props;
167 }
168
172 std::string GetLibFolder() const { return m_cStructure->m_libFolder; }
173
177 std::string GetProfileFolder() const { return m_cStructure->m_profileFolder; }
178
180
181private:
182 InputstreamProperty() = delete;
183 InputstreamProperty(const InputstreamProperty& stream) = delete;
184 InputstreamProperty(const INPUTSTREAM_PROPERTY* stream) : CStructHdl(stream) {}
185 InputstreamProperty(INPUTSTREAM_PROPERTY* stream) : CStructHdl(stream) {}
186};
188//------------------------------------------------------------------------------
189
190//==============================================================================
201class ATTR_DLL_LOCAL InputstreamCapabilities
202 : public CStructHdl<InputstreamCapabilities, INPUTSTREAM_CAPABILITIES>
203{
205 friend class CInstanceInputStream;
208public:
210 InputstreamCapabilities() = default;
221
224
226 void SetMask(uint32_t mask) const { m_cStructure->m_mask = mask; }
227
229 uint32_t GetMask() const { return m_cStructure->m_mask; }
230
232
233private:
235 InputstreamCapabilities(INPUTSTREAM_CAPABILITIES* stream) : CStructHdl(stream) {}
236};
238//------------------------------------------------------------------------------
239
240//==============================================================================
258 : public CStructHdl<InputstreamMasteringMetadata, INPUTSTREAM_MASTERING_METADATA>
259{
261 friend class CInstanceInputStream;
262 friend class InputstreamInfo;
265public:
270
289
292
299 {
300 if (memcmp(m_cStructure, right.m_cStructure, sizeof(INPUTSTREAM_MASTERING_METADATA)) == 0)
301 return true;
302 return false;
303 }
304
309 void SetPrimaryR_ChromaticityX(double value) { m_cStructure->primary_r_chromaticity_x = value; }
310
312 double GetPrimaryR_ChromaticityX() { return m_cStructure->primary_r_chromaticity_x; }
313
318 void SetPrimaryR_ChromaticityY(double value) { m_cStructure->primary_r_chromaticity_y = value; }
319
321 double GetPrimaryR_ChromaticityY() { return m_cStructure->primary_r_chromaticity_y; }
322
327 void SetPrimaryG_ChromaticityX(double value) { m_cStructure->primary_g_chromaticity_x = value; }
328
330 double GetPrimaryG_ChromaticityX() { return m_cStructure->primary_g_chromaticity_x; }
331
336 void SetPrimaryG_ChromaticityY(double value) { m_cStructure->primary_g_chromaticity_y = value; }
337
339 double GetPrimaryG_ChromaticityY() { return m_cStructure->primary_g_chromaticity_y; }
340
345 void SetPrimaryB_ChromaticityX(double value) { m_cStructure->primary_b_chromaticity_x = value; }
346
348 double GetPrimaryB_ChromaticityX() { return m_cStructure->primary_b_chromaticity_x; }
349
354 void SetPrimaryB_ChromaticityY(double value) { m_cStructure->primary_b_chromaticity_y = value; }
355
357 double GetPrimaryB_ChromaticityY() { return m_cStructure->primary_b_chromaticity_y; }
358
364 {
365 m_cStructure->white_point_chromaticity_x = value;
366 }
367
369 double GetWhitePoint_ChromaticityX() { return m_cStructure->white_point_chromaticity_x; }
370
376 {
377 m_cStructure->white_point_chromaticity_y = value;
378 }
379
381 double GetWhitePoint_ChromaticityY() { return m_cStructure->white_point_chromaticity_y; }
382
386 void SetLuminanceMax(double value) { m_cStructure->luminance_max = value; }
387
389 double GetLuminanceMax() { return m_cStructure->luminance_max; }
390
394 void SetLuminanceMin(double value) { m_cStructure->luminance_min = value; }
395
397 double GetLuminanceMin() { return m_cStructure->luminance_min; }
398
400
401private:
403 InputstreamMasteringMetadata(INPUTSTREAM_MASTERING_METADATA* stream) : CStructHdl(stream) {}
404};
406//------------------------------------------------------------------------------
407
408//==============================================================================
423 : public CStructHdl<InputstreamContentlightMetadata, INPUTSTREAM_CONTENTLIGHT_METADATA>
424{
426 friend class CInstanceInputStream;
427 friend class InputstreamInfo;
430public:
434 : CStructHdl(stream)
435 {
436 }
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
484private:
486 : CStructHdl(stream)
487 {
488 }
489 InputstreamContentlightMetadata(INPUTSTREAM_CONTENTLIGHT_METADATA* stream) : CStructHdl(stream) {}
490};
492//------------------------------------------------------------------------------
493
494//==============================================================================
507class ATTR_DLL_LOCAL InputstreamInfo : public CStructHdl<InputstreamInfo, INPUTSTREAM_INFO>
508{
510 friend class CInstanceInputStream;
513public:
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 = static_cast<unsigned int>(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 = static_cast<unsigned int>(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 = static_cast<unsigned int>(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
907private:
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//==============================================================================
950class ATTR_DLL_LOCAL InputstreamTimes : public CStructHdl<InputstreamTimes, INPUTSTREAM_TIMES>
951{
953 friend class CInstanceInputStream;
956public:
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
1003private:
1004 InputstreamTimes(const INPUTSTREAM_TIMES* stream) : CStructHdl(stream) {}
1005 InputstreamTimes(INPUTSTREAM_TIMES* stream) : CStructHdl(stream) {}
1006};
1008//------------------------------------------------------------------------------
1009
1010//============================================================================
1146//------------------------------------------------------------------------------
1147class ATTR_DLL_LOCAL CInstanceInputStream : public IAddonInstance
1148{
1149public:
1150 //============================================================================
1161 explicit CInstanceInputStream(const IInstanceInfo& instance) : IAddonInstance(instance)
1162 {
1163 if (CPrivateBase::m_interface->globalSingleInstance != nullptr)
1164 throw std::logic_error("kodi::addon::CInstanceInputStream: Creation of multiple together "
1165 "with single instance way is not allowed!");
1166
1167 SetAddonStruct(instance);
1168 }
1169 //----------------------------------------------------------------------------
1170
1171 //============================================================================
1175 ~CInstanceInputStream() override = default;
1176 //----------------------------------------------------------------------------
1177
1178 //============================================================================
1209 //----------------------------------------------------------------------------
1210
1211 //============================================================================
1240 virtual bool Open(const kodi::addon::InputstreamProperty& props) = 0;
1241 //----------------------------------------------------------------------------
1242
1243 //============================================================================
1253 virtual void Close() = 0;
1254 //----------------------------------------------------------------------------
1255
1256 //============================================================================
1262 virtual bool IsRealTimeStream() { return true; }
1263 //----------------------------------------------------------------------------
1264
1265 //############################################################################
1285
1286 //============================================================================
1293 virtual int ReadStream(uint8_t* buffer, unsigned int bufferSize) { return -1; }
1294 //----------------------------------------------------------------------------
1295
1296 //============================================================================
1314 virtual int64_t SeekStream(int64_t position, int whence = SEEK_SET) { return -1; }
1315 //----------------------------------------------------------------------------
1316
1317 //============================================================================
1325 virtual int64_t PositionStream() { return -1; }
1326 //----------------------------------------------------------------------------
1327
1328 //============================================================================
1336 virtual int64_t LengthStream() { return -1; }
1337 //--------------------------------------------------------------------------
1338
1339 //==========================================================================
1347 virtual int GetBlockSize() { return 0; }
1348 //--------------------------------------------------------------------------
1349
1351
1352 //############################################################################
1360
1361 //============================================================================
1402 virtual bool GetStreamIds(std::vector<unsigned int>& ids) { return false; }
1403 //----------------------------------------------------------------------------
1404
1405 //============================================================================
1454 virtual bool GetStream(int streamid, kodi::addon::InputstreamInfo& stream) { return false; }
1455 //----------------------------------------------------------------------------
1456
1457 //============================================================================
1471 virtual void EnableStream(int streamid, bool enable) {}
1472 //----------------------------------------------------------------------------
1473
1474 //============================================================================
1485 virtual bool OpenStream(int streamid) { return false; }
1486 //----------------------------------------------------------------------------
1487
1488 //============================================================================
1493 virtual void DemuxReset() {}
1494 //----------------------------------------------------------------------------
1495
1496 //============================================================================
1501 virtual void DemuxAbort() {}
1502 //----------------------------------------------------------------------------
1503
1504 //============================================================================
1509 virtual void DemuxFlush() {}
1510 //----------------------------------------------------------------------------
1511
1512 //============================================================================
1526 virtual DEMUX_PACKET* DemuxRead() { return nullptr; }
1527 //----------------------------------------------------------------------------
1528
1529 //============================================================================
1541 virtual bool DemuxSeekTime(double time, bool backwards, double& startpts) { return false; }
1542 //----------------------------------------------------------------------------
1543
1544 //============================================================================
1551 virtual void DemuxSetSpeed(int speed) {}
1552 //----------------------------------------------------------------------------
1553
1554 //============================================================================
1560 virtual void SetVideoResolution(unsigned int width, unsigned int height) {}
1561 //----------------------------------------------------------------------------
1562
1563 //============================================================================
1571 virtual void SetVideoResolution(unsigned int width,
1572 unsigned int height,
1573 unsigned int maxWidth,
1574 unsigned int maxHeight)
1575 {
1576 }
1577 //----------------------------------------------------------------------------
1578
1579 //=============================================================================
1588 {
1589 return m_instanceData->toKodi->allocate_demux_packet(m_instanceData->toKodi->kodiInstance,
1590 dataSize);
1591 }
1592 //----------------------------------------------------------------------------
1593
1594 //============================================================================
1603 DEMUX_PACKET* AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount)
1604 {
1605 return m_instanceData->toKodi->allocate_encrypted_demux_packet(
1606 m_instanceData->toKodi->kodiInstance, dataSize, encryptedSubsampleCount);
1607 }
1608 //----------------------------------------------------------------------------
1609
1610 //============================================================================
1618 {
1619 return m_instanceData->toKodi->free_demux_packet(m_instanceData->toKodi->kodiInstance, packet);
1620 }
1621 //----------------------------------------------------------------------------
1622
1624
1625 //############################################################################
1633
1634 //==========================================================================
1641 virtual int GetTotalTime() { return -1; }
1642 //--------------------------------------------------------------------------
1643
1644 //==========================================================================
1651 virtual int GetTime() { return -1; }
1652 //--------------------------------------------------------------------------
1653
1655
1656 //############################################################################
1664
1665 //============================================================================
1675 virtual bool GetTimes(InputstreamTimes& times) { return false; }
1676 //----------------------------------------------------------------------------
1677
1679
1680 //############################################################################
1688
1689 //============================================================================
1696 virtual bool PosTime(int ms) { return false; }
1697 //----------------------------------------------------------------------------
1698
1700
1701 //############################################################################
1709
1710 //==========================================================================
1718 virtual int GetChapter() { return -1; }
1719 //--------------------------------------------------------------------------
1720
1721 //==========================================================================
1729 virtual int GetChapterCount() { return 0; }
1730 //--------------------------------------------------------------------------
1731
1732 //==========================================================================
1741 virtual const char* GetChapterName(int ch) { return nullptr; }
1742 //--------------------------------------------------------------------------
1743
1744 //==========================================================================
1753 virtual int64_t GetChapterPos(int ch) { return 0; }
1754 //--------------------------------------------------------------------------
1755
1756 //==========================================================================
1765 virtual bool SeekChapter(int ch) { return false; }
1766 //--------------------------------------------------------------------------
1767
1769
1770private:
1771 static int compareVersion(const int v1[3], const int v2[3])
1772 {
1773 for (unsigned i(0); i < 3; ++i)
1774 if (v1[i] != v2[i])
1775 return v1[i] - v2[i];
1776 return 0;
1777 }
1778
1779 void SetAddonStruct(KODI_ADDON_INSTANCE_STRUCT* instance)
1780 {
1781 int api[3] = {0, 0, 0};
1782 sscanf(GetInstanceAPIVersion().c_str(), "%d.%d.%d", &api[0], &api[1], &api[2]);
1783
1784 instance->hdl = this;
1785 instance->inputstream->toAddon->open = ADDON_Open;
1786 instance->inputstream->toAddon->close = ADDON_Close;
1787 instance->inputstream->toAddon->get_capabilities = ADDON_GetCapabilities;
1788
1789 instance->inputstream->toAddon->get_stream_ids = ADDON_GetStreamIds;
1790 instance->inputstream->toAddon->get_stream = ADDON_GetStream;
1791 instance->inputstream->toAddon->enable_stream = ADDON_EnableStream;
1792 instance->inputstream->toAddon->open_stream = ADDON_OpenStream;
1793 instance->inputstream->toAddon->demux_reset = ADDON_DemuxReset;
1794 instance->inputstream->toAddon->demux_abort = ADDON_DemuxAbort;
1795 instance->inputstream->toAddon->demux_flush = ADDON_DemuxFlush;
1796 instance->inputstream->toAddon->demux_read = ADDON_DemuxRead;
1797 instance->inputstream->toAddon->demux_seek_time = ADDON_DemuxSeekTime;
1798 instance->inputstream->toAddon->demux_set_speed = ADDON_DemuxSetSpeed;
1799 instance->inputstream->toAddon->set_video_resolution = ADDON_SetVideoResolution;
1800
1801 instance->inputstream->toAddon->get_total_time = ADDON_GetTotalTime;
1802 instance->inputstream->toAddon->get_time = ADDON_GetTime;
1803
1804 instance->inputstream->toAddon->get_times = ADDON_GetTimes;
1805 instance->inputstream->toAddon->pos_time = ADDON_PosTime;
1806
1807 instance->inputstream->toAddon->read_stream = ADDON_ReadStream;
1808 instance->inputstream->toAddon->seek_stream = ADDON_SeekStream;
1809 instance->inputstream->toAddon->position_stream = ADDON_PositionStream;
1810 instance->inputstream->toAddon->length_stream = ADDON_LengthStream;
1811 instance->inputstream->toAddon->is_real_time_stream = ADDON_IsRealTimeStream;
1812
1813 // Added on 2.0.10
1814 instance->inputstream->toAddon->get_chapter = ADDON_GetChapter;
1815 instance->inputstream->toAddon->get_chapter_count = ADDON_GetChapterCount;
1816 instance->inputstream->toAddon->get_chapter_name = ADDON_GetChapterName;
1817 instance->inputstream->toAddon->get_chapter_pos = ADDON_GetChapterPos;
1818 instance->inputstream->toAddon->seek_chapter = ADDON_SeekChapter;
1819
1820 // Added on 2.0.12
1821 instance->inputstream->toAddon->block_size_stream = ADDON_GetBlockSize;
1822
1823 /*
1824 // Way to include part on new API version
1825 int minPartVersion[3] = { 3, 0, 0 };
1826 if (compareVersion(api, minPartVersion) >= 0)
1827 {
1828
1829 }
1830 */
1831
1832 m_instanceData = instance->inputstream;
1833 m_instanceData->toAddon->addonInstance = this;
1834 }
1835
1836 inline static bool ADDON_Open(const AddonInstance_InputStream* instance,
1837 INPUTSTREAM_PROPERTY* props)
1838 {
1839 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->Open(props);
1840 }
1841
1842 inline static void ADDON_Close(const AddonInstance_InputStream* instance)
1843 {
1844 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->Close();
1845 }
1846
1847 inline static void ADDON_GetCapabilities(const AddonInstance_InputStream* instance,
1848 INPUTSTREAM_CAPABILITIES* capabilities)
1849 {
1850 InputstreamCapabilities caps(capabilities);
1851 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetCapabilities(caps);
1852 }
1853
1854 // IDemux
1855 inline static bool ADDON_GetStreamIds(const AddonInstance_InputStream* instance,
1856 struct INPUTSTREAM_IDS* ids)
1857 {
1858 std::vector<unsigned int> idList;
1859 bool ret =
1860 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetStreamIds(idList);
1861 if (ret)
1862 {
1863 for (size_t i = 0; i < idList.size() && i < INPUTSTREAM_MAX_STREAM_COUNT; ++i)
1864 {
1865 ids->m_streamCount++;
1866 ids->m_streamIds[i] = idList[i];
1867 }
1868 }
1869 return ret;
1870 }
1871
1872 inline static bool ADDON_GetStream(
1873 const AddonInstance_InputStream* instance,
1874 int streamid,
1875 struct INPUTSTREAM_INFO* info,
1876 KODI_HANDLE* demuxStream,
1877 KODI_HANDLE (*transfer_stream)(KODI_HANDLE handle,
1878 int streamId,
1879 struct INPUTSTREAM_INFO* stream))
1880 {
1881 InputstreamInfo infoData(info);
1882 bool ret = static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1883 ->GetStream(streamid, infoData);
1884 if (ret && transfer_stream)
1885 {
1886 // Do this with given callback to prevent memory problems and leaks. This
1887 // then create on Kodi the needed class where then given back on demuxStream.
1888 *demuxStream = transfer_stream(instance->toKodi->kodiInstance, streamid, info);
1889 }
1890 return ret;
1891 }
1892
1893 inline static void ADDON_EnableStream(const AddonInstance_InputStream* instance,
1894 int streamid,
1895 bool enable)
1896 {
1897 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1898 ->EnableStream(streamid, enable);
1899 }
1900
1901 inline static bool ADDON_OpenStream(const AddonInstance_InputStream* instance, int streamid)
1902 {
1903 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1904 ->OpenStream(streamid);
1905 }
1906
1907 inline static void ADDON_DemuxReset(const AddonInstance_InputStream* instance)
1908 {
1909 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxReset();
1910 }
1911
1912 inline static void ADDON_DemuxAbort(const AddonInstance_InputStream* instance)
1913 {
1914 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxAbort();
1915 }
1916
1917 inline static void ADDON_DemuxFlush(const AddonInstance_InputStream* instance)
1918 {
1919 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxFlush();
1920 }
1921
1922 inline static DEMUX_PACKET* ADDON_DemuxRead(const AddonInstance_InputStream* instance)
1923 {
1924 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxRead();
1925 }
1926
1927 inline static bool ADDON_DemuxSeekTime(const AddonInstance_InputStream* instance,
1928 double time,
1929 bool backwards,
1930 double* startpts)
1931 {
1932 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1933 ->DemuxSeekTime(time, backwards, *startpts);
1934 }
1935
1936 inline static void ADDON_DemuxSetSpeed(const AddonInstance_InputStream* instance, int speed)
1937 {
1938 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->DemuxSetSpeed(speed);
1939 }
1940
1941 inline static void ADDON_SetVideoResolution(const AddonInstance_InputStream* instance,
1942 unsigned int width,
1943 unsigned int height,
1944 unsigned int maxWidth,
1945 unsigned int maxHeight)
1946 {
1947 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1948 ->SetVideoResolution(width, height);
1949 static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
1950 ->SetVideoResolution(width, height, maxWidth, maxHeight);
1951 }
1952
1953 // IDisplayTime
1954 inline static int ADDON_GetTotalTime(const AddonInstance_InputStream* instance)
1955 {
1956 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTotalTime();
1957 }
1958
1959 inline static int ADDON_GetTime(const AddonInstance_InputStream* instance)
1960 {
1961 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTime();
1962 }
1963
1964 // ITime
1965 inline static bool ADDON_GetTimes(const AddonInstance_InputStream* instance,
1966 INPUTSTREAM_TIMES* times)
1967 {
1968 InputstreamTimes cppTimes(times);
1969 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetTimes(cppTimes);
1970 }
1971
1972 // IPosTime
1973 inline static bool ADDON_PosTime(const AddonInstance_InputStream* instance, int ms)
1974 {
1975 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->PosTime(ms);
1976 }
1977
1978 inline static int ADDON_GetChapter(const AddonInstance_InputStream* instance)
1979 {
1980 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapter();
1981 }
1982
1983 inline static int ADDON_GetChapterCount(const AddonInstance_InputStream* instance)
1984 {
1985 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapterCount();
1986 }
1987
1988 inline static const char* ADDON_GetChapterName(const AddonInstance_InputStream* instance, int ch)
1989 {
1990 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapterName(ch);
1991 }
1992
1993 inline static int64_t ADDON_GetChapterPos(const AddonInstance_InputStream* instance, int ch)
1994 {
1995 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetChapterPos(ch);
1996 }
1997
1998 inline static bool ADDON_SeekChapter(const AddonInstance_InputStream* instance, int ch)
1999 {
2000 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->SeekChapter(ch);
2001 }
2002
2003 inline static int ADDON_ReadStream(const AddonInstance_InputStream* instance,
2004 uint8_t* buffer,
2005 unsigned int bufferSize)
2006 {
2007 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
2008 ->ReadStream(buffer, bufferSize);
2009 }
2010
2011 inline static int64_t ADDON_SeekStream(const AddonInstance_InputStream* instance,
2012 int64_t position,
2013 int whence)
2014 {
2015 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)
2016 ->SeekStream(position, whence);
2017 }
2018
2019 inline static int64_t ADDON_PositionStream(const AddonInstance_InputStream* instance)
2020 {
2021 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->PositionStream();
2022 }
2023
2024 inline static int64_t ADDON_LengthStream(const AddonInstance_InputStream* instance)
2025 {
2026 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->LengthStream();
2027 }
2028
2029 inline static int ADDON_GetBlockSize(const AddonInstance_InputStream* instance)
2030 {
2031 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->GetBlockSize();
2032 }
2033
2034 inline static bool ADDON_IsRealTimeStream(const AddonInstance_InputStream* instance)
2035 {
2036 return static_cast<CInstanceInputStream*>(instance->toAddon->addonInstance)->IsRealTimeStream();
2037 }
2038
2039 AddonInstance_InputStream* m_instanceData;
2040};
2041//------------------------------------------------------------------------------
2042
2043} /* namespace addon */
2044} /* namespace kodi */
2045
2046#endif /* __cplusplus */
Definition Inputstream.h:1148
Definition AddonBase.h:206
Definition AddonBase.h:565
Definition AddonBase.h:498
Definition Inputstream.h:203
Definition Inputstream.h:508
Definition Inputstream.h:259
Definition Inputstream.h:126
Definition Inputstream.h:951
Definition StreamCrypto.h:43
virtual const char * GetChapterName(int ch)
Return name of chapter.
Definition Inputstream.h:1741
virtual int GetChapterCount()
Return number of available chapters.
Definition Inputstream.h:1729
virtual int64_t GetChapterPos(int ch)
Return position if chapter # ch in milliseconds.
Definition Inputstream.h:1753
virtual int GetChapter()
Return currently selected chapter.
Definition Inputstream.h:1718
virtual bool SeekChapter(int ch)
Seek to the beginning of chapter # ch.
Definition Inputstream.h:1765
std::string GetLibFolder() const
Get addon library folder.
Definition Inputstream.h:172
std::string GetMimeType() const
Stream mime type.
Definition Inputstream.h:152
std::string GetURL() const
Stream URL to open.
Definition Inputstream.h:149
const std::map< std::string, std::string > GetProperties() const
List of available properties-.
Definition Inputstream.h:158
unsigned int GetPropertiesAmount() const
Amount of available properties.
Definition Inputstream.h:155
std::string GetProfileFolder() const
Get addon profile/user folder.
Definition Inputstream.h:177
Definition demux_packet.h:46
INPUTSTREAM_COLORPRIMARIES
Definition inputstream.h:339
INPUTSTREAM_COLORRANGE
Definition inputstream.h:403
INPUTSTREAM_COLORSPACE
Definition inputstream.h:268
INPUTSTREAM_COLORTRC
Definition inputstream.h:430
INPUTSTREAM_TYPE
Definition inputstream.h:164
void SetMask(uint32_t mask) const
Set of supported capabilities.
Definition Inputstream.h:226
uint32_t GetMask() const
Get of supported capabilities.
Definition Inputstream.h:229
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
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
const kodi::addon::InputstreamContentlightMetadata & GetContentLightMetadata() const
To get with SetContentLightMetadata changed values.
Definition Inputstream.h:897
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
const kodi::addon::InputstreamMasteringMetadata & GetMasteringMetadata() const
To get with SetMasteringMetadata changed values.
Definition Inputstream.h:875
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
const kodi::addon::StreamCryptoSession & GetCryptoSession() const
To get with GetCryptoSession changed values.
Definition Inputstream.h:809
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 information.
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
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
const std::vector< uint8_t > & GetExtraData()
To get with SetExtraData changed values.
Definition Inputstream.h:673
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
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
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:330
double GetLuminanceMin()
Get the minimum number of bits of the display.
Definition Inputstream.h:397
double GetPrimaryG_ChromaticityY()
Get the chromaticity Y coordinates of the green value.
Definition Inputstream.h:339
double GetPrimaryR_ChromaticityY()
Get the chromaticity Y coordinates of the red value.
Definition Inputstream.h:321
double GetPrimaryB_ChromaticityY()
Get the chromaticity Y coordinates of the blue value.
Definition Inputstream.h:357
void SetWhitePoint_ChromaticityY(double value)
Set the chromaticity coordinates of the white point in the CIE1931 color space.
Definition Inputstream.h:375
void SetWhitePoint_ChromaticityX(double value)
Set the chromaticity coordinates of the white point in the CIE1931 color space.
Definition Inputstream.h:363
void SetPrimaryB_ChromaticityY(double value)
The chromaticity coordinates of the blue value in the CIE1931 color space.
Definition Inputstream.h:354
double GetLuminanceMax()
Get the maximum number of bits of the display.
Definition Inputstream.h:389
void SetPrimaryG_ChromaticityY(double value)
Set the chromaticity coordinates of the green value in the CIE1931 color space.
Definition Inputstream.h:336
void SetPrimaryR_ChromaticityX(double value)
Set the chromaticity coordinates of the red value in the CIE1931 color space.
Definition Inputstream.h:309
void SetLuminanceMin(double value)
Set the minimum number of bits of the display used to master the content.
Definition Inputstream.h:394
void SetPrimaryG_ChromaticityX(double value)
Set the chromaticity coordinates of the green value in the CIE1931 color space.
Definition Inputstream.h:327
void SetLuminanceMax(double value)
Set the maximum number of bits of the display used to master the content.
Definition Inputstream.h:386
void SetPrimaryR_ChromaticityY(double value)
The chromaticity coordinates of the red value in the CIE1931 color space.
Definition Inputstream.h:318
double GetPrimaryB_ChromaticityX()
Get the chromaticity X coordinates of the blue value.
Definition Inputstream.h:348
double GetWhitePoint_ChromaticityX()
Get the chromaticity X coordinates of the white point.
Definition Inputstream.h:369
void SetPrimaryB_ChromaticityX(double value)
The chromaticity coordinates of the blue value in the CIE1931 color space.
Definition Inputstream.h:345
double GetPrimaryR_ChromaticityX()
Get the chromaticity X coordinates of the red value.
Definition Inputstream.h:312
double GetWhitePoint_ChromaticityY()
Get the chromaticity Y coordinates of the white point.
Definition Inputstream.h:381
bool operator==(const kodi::addon::InputstreamMasteringMetadata &right) const
Metadata class compare.
Definition Inputstream.h:298
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:1485
virtual void SetVideoResolution(unsigned int width, unsigned int height, unsigned int maxWidth, unsigned int maxHeight)
Notify current screen resolution and max screen resolution allowed.
Definition Inputstream.h:1571
virtual void EnableStream(int streamid, bool enable)
Enable or disable a stream.
Definition Inputstream.h:1471
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:1541
void FreeDemuxPacket(DEMUX_PACKET *packet)
Free a packet that was allocated with AllocateDemuxPacket.
Definition Inputstream.h:1617
virtual void DemuxReset()
Reset the demultiplexer in the add-on.
Definition Inputstream.h:1493
DEMUX_PACKET * AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount)
Allocate a encrypted demux packet. Free with FreeDemuxPacket.
Definition Inputstream.h:1603
virtual void DemuxSetSpeed(int speed)
Notify the InputStream addon/demuxer that Kodi wishes to change playback speed.
Definition Inputstream.h:1551
virtual DEMUX_PACKET * DemuxRead()
Read the next packet from the demultiplexer, if there is one.
Definition Inputstream.h:1526
virtual bool GetStream(int streamid, kodi::addon::InputstreamInfo &stream)
Function for giving detailed stream information.
Definition Inputstream.h:1454
virtual void DemuxAbort()
Abort the demultiplexer thread in the add-on.
Definition Inputstream.h:1501
virtual bool GetStreamIds(std::vector< unsigned int > &ids)
Get IDs of available streams.
Definition Inputstream.h:1402
virtual void DemuxFlush()
Flush all data that's currently in the demultiplexer buffer in the add-on.
Definition Inputstream.h:1509
DEMUX_PACKET * AllocateDemuxPacket(int dataSize)
Allocate a demux packet. Free with FreeDemuxPacket.
Definition Inputstream.h:1587
virtual void SetVideoResolution(unsigned int width, unsigned int height)
Notify current screen resolution.
Definition Inputstream.h:1560
virtual bool PosTime(int ms)
Positions inputstream to playing time given in ms.
Definition Inputstream.h:1696
virtual int GetBlockSize()
Obtain the chunk size to use when reading streams.
Definition Inputstream.h:1347
virtual int64_t PositionStream()
The position in the stream that's currently being read.
Definition Inputstream.h:1325
virtual int64_t LengthStream()
The Total length of the stream that's currently being read.
Definition Inputstream.h:1336
virtual int64_t SeekStream(int64_t position, int whence=SEEK_SET)
Seek in a stream.
Definition Inputstream.h:1314
virtual int ReadStream(uint8_t *buffer, unsigned int bufferSize)
Read from an open stream.
Definition Inputstream.h:1293
virtual int GetTotalTime()
Totel time in ms.
Definition Inputstream.h:1641
virtual int GetTime()
Playing time in ms.
Definition Inputstream.h:1651
virtual bool GetTimes(InputstreamTimes &times)
Get current timing values in PTS scale.
Definition Inputstream.h:1675
virtual bool Open(const kodi::addon::InputstreamProperty &props)=0
Open a stream.
CInstanceInputStream(const IInstanceInfo &instance)
Inputstream class constructor used to support multiple instance types.
Definition Inputstream.h:1161
~CInstanceInputStream() override=default
Destructor.
virtual void Close()=0
Close an open stream.
virtual bool IsRealTimeStream()
Check for real-time streaming.
Definition Inputstream.h:1262
virtual void GetCapabilities(kodi::addon::InputstreamCapabilities &capabilities)=0
Get the list of features that this add-on provides.
Definition inputstream.h:698
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:504
MASTERING Metadata.
Definition inputstream.h:132
structure of key/value pairs passed to addon on Open()
Definition inputstream.h:104
Definition inputstream.h:596
Definition addon_base.h:268
Definition stream_crypto.h:121