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 #ifndef C_API_ADDONINSTANCE_INPUTSTREAM_H 10 #define C_API_ADDONINSTANCE_INPUTSTREAM_H 11 12 #include "../addon_base.h" 13 #include "inputstream/demux_packet.h" 14 #include "inputstream/stream_codec.h" 15 #include "inputstream/stream_constants.h" 16 #include "inputstream/stream_crypto.h" 17 #include "inputstream/timing_constants.h" 18 19 #include <time.h> 20 21 // Increment this level always if you add features which can lead to compile failures in the addon 22 #define INPUTSTREAM_VERSION_LEVEL 4 23 24 #define INPUTSTREAM_MAX_INFO_COUNT 8 25 #define INPUTSTREAM_MAX_STREAM_COUNT 256 26 #define INPUTSTREAM_MAX_STRING_NAME_SIZE 256 27 #define INPUTSTREAM_MAX_STRING_CODEC_SIZE 32 28 #define INPUTSTREAM_MAX_STRING_LANGUAGE_SIZE 64 29 30 #ifdef __cplusplus 31 extern "C" 32 { 33 #endif /* __cplusplus */ 34 35 //============================================================================== 36 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface_InputstreamCapabilities 37 /// @brief **Capability types of inputstream addon.**\n 38 /// This values are needed to tell Kodi which options are supported on the addon. 39 /// 40 /// If one of this is defined, then the corresponding methods from 41 /// @ref cpp_kodi_addon_inputstream "kodi::addon::CInstanceInputStream" need 42 /// to be implemented. 43 /// 44 /// Used on @ref kodi::addon::CInstanceInputStream::GetCapabilities(). 45 /// 46 ///@{ 47 enum INPUTSTREAM_MASKTYPE 48 { 49 /// @brief **0000 0000 0000 0001 :** Supports interface demuxing. 50 /// 51 /// If set must be @ref cpp_kodi_addon_inputstream_Demux "Demux support" included. 52 INPUTSTREAM_SUPPORTS_IDEMUX = (1 << 0), 53 54 /// @brief **0000 0000 0000 0010 :** Supports interface position time. 55 /// 56 /// This means that the start time and the current stream time are used. 57 /// 58 /// If set must be @ref cpp_kodi_addon_inputstream_Time "Time support" included. 59 INPUTSTREAM_SUPPORTS_IPOSTIME = (1 << 1), 60 61 /// @brief **0000 0000 0000 0100 :** Supports interface for display time. 62 /// 63 /// This will call up the complete stream time information. The start time 64 /// and the individual PTS times are then given using @ref cpp_kodi_addon_inputstream_Defs_Times. 65 /// 66 /// If set must be @ref cpp_kodi_addon_inputstream_Times "Times support" included. 67 INPUTSTREAM_SUPPORTS_IDISPLAYTIME = (1 << 2), 68 69 /// @brief **0000 0000 0000 1000 :** Supports seek 70 INPUTSTREAM_SUPPORTS_SEEK = (1 << 3), 71 72 /// @brief **0000 0000 0001 0000 :** Supports pause 73 INPUTSTREAM_SUPPORTS_PAUSE = (1 << 4), 74 75 /// @brief **0000 0000 0010 0000 :** Supports interface to give position time. 76 /// 77 /// This will only ask for the current time of the stream, not for length or 78 /// start. 79 /// 80 /// If set must be @ref cpp_kodi_addon_inputstream_PosTime "Position time support" included. 81 INPUTSTREAM_SUPPORTS_ITIME = (1 << 5), 82 83 /// @brief **0000 0000 0100 0000 :** Supports interface for chapter selection. 84 /// 85 /// If set must be @ref cpp_kodi_addon_inputstream_Chapter "Chapter support" included. 86 INPUTSTREAM_SUPPORTS_ICHAPTER = (1 << 6), 87 }; 88 ///@} 89 //---------------------------------------------------------------------------- 90 91 /*! 92 * @brief InputStream add-on capabilities. All capabilities are set to "false" as default. 93 */ 94 struct INPUTSTREAM_CAPABILITIES 95 { 96 /// set of supported capabilities 97 uint32_t m_mask; 98 }; 99 100 /*! 101 * @brief structure of key/value pairs passed to addon on Open() 102 */ 103 struct INPUTSTREAM_PROPERTY 104 { 105 const char* m_strURL; 106 const char* m_mimeType; 107 108 unsigned int m_nCountInfoValues; 109 struct LISTITEMPROPERTY 110 { 111 const char* m_strKey; 112 const char* m_strValue; 113 } m_ListItemProperties[STREAM_MAX_PROPERTY_COUNT]; 114 115 const char* m_libFolder; 116 const char* m_profileFolder; 117 }; 118 119 /*! 120 * @brief Array of stream IDs 121 */ 122 struct INPUTSTREAM_IDS 123 { 124 unsigned int m_streamCount; 125 unsigned int m_streamIds[INPUTSTREAM_MAX_STREAM_COUNT]; 126 }; 127 128 /*! 129 * @brief MASTERING Metadata 130 */ 131 struct INPUTSTREAM_MASTERING_METADATA 132 { 133 double primary_r_chromaticity_x; 134 double primary_r_chromaticity_y; 135 double primary_g_chromaticity_x; 136 double primary_g_chromaticity_y; 137 double primary_b_chromaticity_x; 138 double primary_b_chromaticity_y; 139 double white_point_chromaticity_x; 140 double white_point_chromaticity_y; 141 double luminance_max; 142 double luminance_min; 143 }; 144 145 /*! 146 * @brief CONTENTLIGHT Metadata 147 */ 148 struct INPUTSTREAM_CONTENTLIGHT_METADATA 149 { 150 uint64_t max_cll; 151 uint64_t max_fall; 152 }; 153 154 //============================================================================== 155 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_TYPE enum INPUTSTREAM_TYPE 156 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 157 /// @brief **Inputstream types**\n 158 /// To identify type on stream. 159 /// 160 /// Used on @ref kodi::addon::InputstreamInfo::SetStreamType and @ref kodi::addon::InputstreamInfo::GetStreamType. 161 /// 162 ///@{ 163 enum INPUTSTREAM_TYPE 164 { 165 /// @brief **0 :** To set nothing defined 166 INPUTSTREAM_TYPE_NONE = 0, 167 168 /// @brief **1 :** To identify @ref cpp_kodi_addon_inputstream_Defs_Info as Video 169 INPUTSTREAM_TYPE_VIDEO, 170 171 /// @brief **2 :** To identify @ref cpp_kodi_addon_inputstream_Defs_Info as Audio 172 INPUTSTREAM_TYPE_AUDIO, 173 174 /// @brief **3 :** To identify @ref cpp_kodi_addon_inputstream_Defs_Info as Subtitle 175 INPUTSTREAM_TYPE_SUBTITLE, 176 177 /// @brief **4 :** To identify @ref cpp_kodi_addon_inputstream_Defs_Info as Teletext 178 INPUTSTREAM_TYPE_TELETEXT, 179 180 /// @brief **5 :** To identify @ref cpp_kodi_addon_inputstream_Defs_Info as Radio RDS 181 INPUTSTREAM_TYPE_RDS, 182 }; 183 ///@} 184 //------------------------------------------------------------------------------ 185 186 //============================================================================== 187 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_CODEC_FEATURES enum INPUTSTREAM_CODEC_FEATURES 188 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 189 /// @brief **Inputstream codec features**\n 190 /// To identify special extra features used for optional codec on inputstream. 191 /// 192 /// Used on @ref kodi::addon::InputstreamInfo::SetFeatures and @ref kodi::addon::InputstreamInfo::GetFeatures. 193 /// 194 /// @note These variables are bit flags which are created using "|" can be used together. 195 /// 196 ///@{ 197 enum INPUTSTREAM_CODEC_FEATURES 198 { 199 /// @brief **0000 0000 0000 0000 :** Empty to set if nothing is used 200 INPUTSTREAM_FEATURE_NONE = 0, 201 202 /// @brief **0000 0000 0000 0001 :** To set addon decode should used with @ref cpp_kodi_addon_videocodec. 203 INPUTSTREAM_FEATURE_DECODE = (1 << 0) 204 }; 205 ///@} 206 //---------------------------------------------------------------------------- 207 208 //============================================================================ 209 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_FLAGS enum INPUTSTREAM_FLAGS 210 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 211 /// @brief **Inputstream flags**\n 212 /// To identify extra stream flags used on inputstream. 213 /// 214 /// Used on @ref kodi::addon::InputstreamInfo::SetFlags and @ref kodi::addon::InputstreamInfo::GetFlags. 215 /// 216 /// @note These variables are bit flags which are created using "|" can be used together. 217 /// 218 ///@{ 219 enum INPUTSTREAM_FLAGS 220 { 221 /// @brief **0000 0000 0000 0000 :** Empty to set if nothing is used 222 INPUTSTREAM_FLAG_NONE = 0, 223 224 /// @brief **0000 0000 0000 0001 :** Default 225 INPUTSTREAM_FLAG_DEFAULT = (1 << 0), 226 227 /// @brief **0000 0000 0000 0010 :** Dub 228 INPUTSTREAM_FLAG_DUB = (1 << 1), 229 230 /// @brief **0000 0000 0000 0100 :** Original 231 INPUTSTREAM_FLAG_ORIGINAL = (1 << 2), 232 233 /// @brief **0000 0000 0000 1000 :** Comment 234 INPUTSTREAM_FLAG_COMMENT = (1 << 3), 235 236 /// @brief **0000 0000 0001 0000 :** Lyrics 237 INPUTSTREAM_FLAG_LYRICS = (1 << 4), 238 239 /// @brief **0000 0000 0010 0000 :** Karaoke 240 INPUTSTREAM_FLAG_KARAOKE = (1 << 5), 241 242 /// @brief **0000 0000 0100 0000 :** Forced 243 INPUTSTREAM_FLAG_FORCED = (1 << 6), 244 245 /// @brief **0000 0000 1000 0000 :** Hearing impaired 246 INPUTSTREAM_FLAG_HEARING_IMPAIRED = (1 << 7), 247 248 /// @brief **0000 0001 0000 0000 :** Visual impaired 249 INPUTSTREAM_FLAG_VISUAL_IMPAIRED = (1 << 8), 250 }; 251 ///@} 252 //---------------------------------------------------------------------------- 253 254 // Keep in sync with AVColorSpace 255 //============================================================================ 256 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_COLORSPACE enum INPUTSTREAM_COLORSPACE 257 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 258 /// @brief **Inputstream color space flags**\n 259 /// YUV colorspace type. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. 260 /// 261 /// Used on @ref kodi::addon::InputstreamInfo::SetColorSpace and @ref kodi::addon::InputstreamInfo::GetColorSpace. 262 /// 263 ///@{ 264 enum INPUTSTREAM_COLORSPACE 265 { 266 /// @brief **0 :** Order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) 267 INPUTSTREAM_COLORSPACE_RGB = 0, 268 269 /// @brief **1 :** Also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B 270 INPUTSTREAM_COLORSPACE_BT709 = 1, 271 272 /// @brief **2 :** To set stream is unspecified 273 INPUTSTREAM_COLORSPACE_UNSPECIFIED = 2, 274 275 /// @brief **2 :** To set stream is unkown 276 /// @note Same as @ref INPUTSTREAM_COLORSPACE_UNSPECIFIED 277 INPUTSTREAM_COLORSPACE_UNKNOWN = INPUTSTREAM_COLORSPACE_UNSPECIFIED, // compatibility 278 279 /// @brief **3 :** To set colorspace reserved 280 INPUTSTREAM_COLORSPACE_RESERVED = 3, 281 282 /// @brief **4 :** FCC Title 47 Code of Federal Regulations 73.682 (a)(20) 283 INPUTSTREAM_COLORSPACE_FCC = 4, 284 285 /// @brief **5 :** Also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 286 INPUTSTREAM_COLORSPACE_BT470BG = 5, 287 288 /// @brief **6 :** Also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC 289 INPUTSTREAM_COLORSPACE_SMPTE170M = 6, 290 291 /// @brief **7 :** Functionally identical to above @ref INPUTSTREAM_COLORSPACE_SMPTE170M 292 INPUTSTREAM_COLORSPACE_SMPTE240M = 7, 293 294 /// @brief **8 :** Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 295 INPUTSTREAM_COLORSPACE_YCGCO = 8, 296 297 /// @brief **8 :** To set colorspace as YCOCG 298 /// @note Same as @ref INPUTSTREAM_COLORSPACE_YCGCO 299 INPUTSTREAM_COLORSPACE_YCOCG = INPUTSTREAM_COLORSPACE_YCGCO, 300 301 /// @brief **9 :** ITU-R BT2020 non-constant luminance system 302 INPUTSTREAM_COLORSPACE_BT2020_NCL = 9, 303 304 /// @brief **10 :** ITU-R BT2020 constant luminance system 305 INPUTSTREAM_COLORSPACE_BT2020_CL = 10, 306 307 /// @brief **11 :** SMPTE 2085, Y'D'zD'x 308 INPUTSTREAM_COLORSPACE_SMPTE2085 = 11, 309 310 /// @brief **12 :** Chromaticity-derived non-constant luminance system 311 INPUTSTREAM_COLORSPACE_CHROMA_DERIVED_NCL = 12, 312 313 /// @brief **13 :** Chromaticity-derived constant luminance system 314 INPUTSTREAM_COLORSPACE_CHROMA_DERIVED_CL = 13, 315 316 /// @brief **14 :** ITU-R BT.2100-0, ICtCp 317 INPUTSTREAM_COLORSPACE_ICTCP = 14, 318 319 /// @brief The maximum value to use in a list. 320 INPUTSTREAM_COLORSPACE_MAX 321 }; 322 ///@} 323 //------------------------------------------------------------------------------ 324 325 // Keep in sync with AVColorPrimaries 326 //============================================================================== 327 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_COLORPRIMARIES enum INPUTSTREAM_COLORPRIMARIES 328 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 329 /// @brief **Inputstream color primaries flags**\n 330 /// Chromaticity coordinates of the source primaries. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. 331 /// 332 /// Used on @ref kodi::addon::InputstreamInfo::SetColorPrimaries and @ref kodi::addon::InputstreamInfo::GetColorPrimaries. 333 /// 334 ///@{ 335 enum INPUTSTREAM_COLORPRIMARIES 336 { 337 /// @brief **0 :** Reserved 338 INPUTSTREAM_COLORPRIMARY_RESERVED0 = 0, 339 340 /// @brief **1 :** Also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B 341 INPUTSTREAM_COLORPRIMARY_BT709 = 1, 342 343 /// @brief **2 :** Unspecified 344 INPUTSTREAM_COLORPRIMARY_UNSPECIFIED = 2, 345 346 /// @brief **3 :** Reserved 347 INPUTSTREAM_COLORPRIMARY_RESERVED = 3, 348 349 /// @brief **4 :** Also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) 350 INPUTSTREAM_COLORPRIMARY_BT470M = 4, 351 352 /// @brief **5 :** Also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM 353 INPUTSTREAM_COLORPRIMARY_BT470BG = 5, 354 355 /// @brief **6 :** Also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC 356 INPUTSTREAM_COLORPRIMARY_SMPTE170M = 6, 357 358 /// @brief **7 :** Functionally identical to above 359 INPUTSTREAM_COLORPRIMARY_SMPTE240M = 7, 360 361 /// @brief **8 :** Colour filters using Illuminant C 362 INPUTSTREAM_COLORPRIMARY_FILM = 8, 363 364 /// @brief **9 :** ITU-R BT2020 365 INPUTSTREAM_COLORPRIMARY_BT2020 = 9, 366 367 /// @brief **10 :** SMPTE ST 428-1 (CIE 1931 XYZ) 368 INPUTSTREAM_COLORPRIMARY_SMPTE428 = 10, 369 370 /// @brief **10 :** 371 /// @note Same as @ref INPUTSTREAM_COLORPRIMARY_SMPTE428 372 INPUTSTREAM_COLORPRIMARY_SMPTEST428_1 = INPUTSTREAM_COLORPRIMARY_SMPTE428, 373 374 /// @brief **11 :** SMPTE ST 431-2 (2011) / DCI P3 375 INPUTSTREAM_COLORPRIMARY_SMPTE431 = 11, 376 377 /// @brief **12 :** SMPTE ST 432-1 (2010) / P3 D65 / Display P3 378 INPUTSTREAM_COLORPRIMARY_SMPTE432 = 12, 379 380 /// @brief **22 :** JEDEC P22 phosphors 381 INPUTSTREAM_COLORPRIMARY_JEDEC_P22 = 22, 382 383 /// @brief The maximum value to use in a list. 384 INPUTSTREAM_COLORPRIMARY_MAX 385 }; 386 ///@} 387 //------------------------------------------------------------------------------ 388 389 // Keep in sync with AVColorRange 390 //============================================================================== 391 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_COLORRANGE enum INPUTSTREAM_COLORRANGE 392 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 393 /// @brief **Inputstream color range flags**\n 394 /// MPEG vs JPEG YUV range. 395 /// 396 /// Used on @ref kodi::addon::InputstreamInfo::SetColorRange and @ref kodi::addon::InputstreamInfo::GetColorRange. 397 /// 398 ///@{ 399 enum INPUTSTREAM_COLORRANGE 400 { 401 /// @brief **0 :** To define as unkown 402 INPUTSTREAM_COLORRANGE_UNKNOWN = 0, 403 404 /// @brief **1 :** The normal 219*2^(n-8) "MPEG" YUV ranges 405 INPUTSTREAM_COLORRANGE_LIMITED, 406 407 /// @brief **2 :** The normal 2^n-1 "JPEG" YUV ranges 408 INPUTSTREAM_COLORRANGE_FULLRANGE, 409 410 /// @brief The maximum value to use in a list. 411 INPUTSTREAM_COLORRANGE_MAX 412 }; 413 ///@} 414 //------------------------------------------------------------------------------ 415 416 // keep in sync with AVColorTransferCharacteristic 417 //============================================================================== 418 /// @defgroup cpp_kodi_addon_inputstream_Defs_Interface_INPUTSTREAM_COLORTRC enum INPUTSTREAM_COLORTRC 419 /// @ingroup cpp_kodi_addon_inputstream_Defs_Interface 420 /// @brief **Inputstream color TRC flags**\n 421 /// Color Transfer Characteristic. These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. 422 /// 423 /// Used on @ref kodi::addon::InputstreamInfo::SetColorTransferCharacteristic and @ref kodi::addon::InputstreamInfo::GetColorTransferCharacteristic. 424 /// 425 ///@{ 426 enum INPUTSTREAM_COLORTRC 427 { 428 /// @brief **0 :** Reserved 429 INPUTSTREAM_COLORTRC_RESERVED0 = 0, 430 431 /// @brief **1 :** Also ITU-R BT1361 432 INPUTSTREAM_COLORTRC_BT709 = 1, 433 434 /// @brief **2 :** Unspecified 435 INPUTSTREAM_COLORTRC_UNSPECIFIED = 2, 436 437 /// @brief **3 :** Reserved 438 INPUTSTREAM_COLORTRC_RESERVED = 3, 439 440 /// @brief **4 :** Also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM 441 INPUTSTREAM_COLORTRC_GAMMA22 = 4, 442 443 /// @brief **5 :** Also ITU-R BT470BG 444 INPUTSTREAM_COLORTRC_GAMMA28 = 5, 445 446 /// @brief **6 :** Also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC 447 INPUTSTREAM_COLORTRC_SMPTE170M = 6, 448 449 /// @brief **7 :** Functionally identical to above @ref INPUTSTREAM_COLORTRC_SMPTE170M 450 INPUTSTREAM_COLORTRC_SMPTE240M = 7, 451 452 /// @brief **8 :** Linear transfer characteristics 453 INPUTSTREAM_COLORTRC_LINEAR = 8, 454 455 /// @brief **9 :** Logarithmic transfer characteristic (100:1 range) 456 INPUTSTREAM_COLORTRC_LOG = 9, 457 458 /// @brief **10 :** Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range) 459 INPUTSTREAM_COLORTRC_LOG_SQRT = 10, 460 461 /// @brief **11 :** IEC 61966-2-4 462 INPUTSTREAM_COLORTRC_IEC61966_2_4 = 11, 463 464 /// @brief **12 :** ITU-R BT1361 Extended Colour Gamut 465 INPUTSTREAM_COLORTRC_BT1361_ECG = 12, 466 467 /// @brief **13 :** IEC 61966-2-1 (sRGB or sYCC) 468 INPUTSTREAM_COLORTRC_IEC61966_2_1 = 13, 469 470 /// @brief **14 :** ITU-R BT2020 for 10-bit system 471 INPUTSTREAM_COLORTRC_BT2020_10 = 14, 472 473 /// @brief **15 :** ITU-R BT2020 for 12-bit system 474 INPUTSTREAM_COLORTRC_BT2020_12 = 15, 475 476 /// @brief **16 :** SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems 477 INPUTSTREAM_COLORTRC_SMPTE2084 = 16, 478 479 /// @brief **16 :** Same as @ref INPUTSTREAM_COLORTRC_SMPTE2084 480 INPUTSTREAM_COLORTRC_SMPTEST2084 = INPUTSTREAM_COLORTRC_SMPTE2084, 481 482 /// @brief **17 :** SMPTE ST 428-1 483 INPUTSTREAM_COLORTRC_SMPTE428 = 17, 484 485 /// @brief **17 :** Same as @ref INPUTSTREAM_COLORTRC_SMPTE428 486 INPUTSTREAM_COLORTRC_SMPTEST428_1 = INPUTSTREAM_COLORTRC_SMPTE428, 487 488 /// @brief **18 :** ARIB STD-B67, known as "Hybrid log-gamma" 489 INPUTSTREAM_COLORTRC_ARIB_STD_B67 = 18, 490 491 /// @brief The maximum value to use in a list. 492 INPUTSTREAM_COLORTRC_MAX 493 }; 494 ///@} 495 //------------------------------------------------------------------------------ 496 497 /*! 498 * @brief stream properties 499 */ 500 struct INPUTSTREAM_INFO 501 { 502 enum INPUTSTREAM_TYPE m_streamType; 503 uint32_t m_features; 504 uint32_t m_flags; 505 506 //! @brief (optional) name of the stream, \0 for default handling 507 char m_name[INPUTSTREAM_MAX_STRING_NAME_SIZE]; 508 509 //! @brief (required) name of codec according to ffmpeg 510 char m_codecName[INPUTSTREAM_MAX_STRING_CODEC_SIZE]; 511 512 //! @brief (optional) internal name of codec (selectionstream info) 513 char m_codecInternalName[INPUTSTREAM_MAX_STRING_CODEC_SIZE]; 514 515 //! @brief (optional) the profile of the codec 516 enum STREAMCODEC_PROFILE m_codecProfile; 517 518 //! @brief (required) physical index 519 unsigned int m_pID; 520 521 const uint8_t* m_ExtraData; 522 unsigned int m_ExtraSize; 523 524 //! @brief RFC 5646 language code (empty string if undefined) 525 char m_language[INPUTSTREAM_MAX_STRING_LANGUAGE_SIZE]; 526 527 //! Video stream related data 528 //@{ 529 530 //! @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps 531 unsigned int m_FpsScale; 532 533 unsigned int m_FpsRate; 534 535 //! @brief height of the stream reported by the demuxer 536 unsigned int m_Height; 537 538 //! @brief width of the stream reported by the demuxer 539 unsigned int m_Width; 540 541 //! @brief display aspect of stream 542 float m_Aspect; 543 544 //@} 545 546 //! Audio stream related data 547 //@{ 548 549 //! @brief (required) amount of channels 550 unsigned int m_Channels; 551 552 //! @brief (required) sample rate 553 unsigned int m_SampleRate; 554 555 //! @brief (required) bit rate 556 unsigned int m_BitRate; 557 558 //! @brief (required) bits per sample 559 unsigned int m_BitsPerSample; 560 561 unsigned int m_BlockAlign; 562 563 //@} 564 565 struct STREAM_CRYPTO_SESSION m_cryptoSession; 566 567 // new in API version 2.0.8 568 //@{ 569 //! @brief Codec If available, the fourcc code codec 570 unsigned int m_codecFourCC; 571 572 //! @brief definition of colorspace 573 enum INPUTSTREAM_COLORSPACE m_colorSpace; 574 575 //! @brief color range if available 576 enum INPUTSTREAM_COLORRANGE m_colorRange; 577 //@} 578 579 //new in API 2.0.9 / INPUTSTREAM_VERSION_LEVEL 1 580 //@{ 581 enum INPUTSTREAM_COLORPRIMARIES m_colorPrimaries; 582 enum INPUTSTREAM_COLORTRC m_colorTransferCharacteristic; 583 //@} 584 585 //! @brief mastering static Metadata 586 struct INPUTSTREAM_MASTERING_METADATA* m_masteringMetadata; 587 588 //! @brief content light static Metadata 589 struct INPUTSTREAM_CONTENTLIGHT_METADATA* m_contentLightMetadata; 590 }; 591 592 struct INPUTSTREAM_TIMES 593 { 594 time_t startTime; 595 double ptsStart; 596 double ptsBegin; 597 double ptsEnd; 598 }; 599 600 /*! 601 * @brief "C" ABI Structures to transfer the methods from this to Kodi 602 */ 603 604 // this are properties given to the addon on create 605 // at this time we have no parameters for the addon 606 typedef struct AddonProps_InputStream /* internal */ 607 { 608 int dummy; 609 } AddonProps_InputStream; 610 611 typedef struct AddonToKodiFuncTable_InputStream /* internal */ 612 { 613 KODI_HANDLE kodiInstance; 614 struct DEMUX_PACKET* (*allocate_demux_packet)(void* kodiInstance, int data_size); 615 struct DEMUX_PACKET* (*allocate_encrypted_demux_packet)(void* kodiInstance, 616 unsigned int data_size, 617 unsigned int encrypted_subsample_count); 618 void (*free_demux_packet)(void* kodiInstance, struct DEMUX_PACKET* packet); 619 } AddonToKodiFuncTable_InputStream; 620 621 struct AddonInstance_InputStream; 622 typedef struct KodiToAddonFuncTable_InputStream /* internal */ 623 { 624 KODI_HANDLE addonInstance; 625 626 bool(__cdecl* open)(const struct AddonInstance_InputStream* instance, 627 struct INPUTSTREAM_PROPERTY* props); 628 void(__cdecl* close)(const struct AddonInstance_InputStream* instance); 629 const char*(__cdecl* get_path_list)(const struct AddonInstance_InputStream* instance); 630 void(__cdecl* get_capabilities)(const struct AddonInstance_InputStream* instance, 631 struct INPUTSTREAM_CAPABILITIES* capabilities); 632 633 // IDemux 634 bool(__cdecl* get_stream_ids)(const struct AddonInstance_InputStream* instance, 635 struct INPUTSTREAM_IDS* ids); 636 bool(__cdecl* get_stream)(const struct AddonInstance_InputStream* instance, 637 int streamid, 638 struct INPUTSTREAM_INFO* info, 639 KODI_HANDLE* demuxStream, 640 KODI_HANDLE (*transfer_stream)(KODI_HANDLE handle, 641 int streamId, 642 struct INPUTSTREAM_INFO* stream)); 643 void(__cdecl* enable_stream)(const struct AddonInstance_InputStream* instance, 644 int streamid, 645 bool enable); 646 bool(__cdecl* open_stream)(const struct AddonInstance_InputStream* instance, int streamid); 647 void(__cdecl* demux_reset)(const struct AddonInstance_InputStream* instance); 648 void(__cdecl* demux_abort)(const struct AddonInstance_InputStream* instance); 649 void(__cdecl* demux_flush)(const struct AddonInstance_InputStream* instance); 650 struct DEMUX_PACKET*(__cdecl* demux_read)(const struct AddonInstance_InputStream* instance); 651 bool(__cdecl* demux_seek_time)(const struct AddonInstance_InputStream* instance, 652 double time, 653 bool backwards, 654 double* startpts); 655 void(__cdecl* demux_set_speed)(const struct AddonInstance_InputStream* instance, int speed); 656 void(__cdecl* set_video_resolution)(const struct AddonInstance_InputStream* instance, 657 int width, 658 int height); 659 660 // IDisplayTime 661 int(__cdecl* get_total_time)(const struct AddonInstance_InputStream* instance); 662 int(__cdecl* get_time)(const struct AddonInstance_InputStream* instance); 663 664 // ITime 665 bool(__cdecl* get_times)(const struct AddonInstance_InputStream* instance, 666 struct INPUTSTREAM_TIMES* times); 667 668 // IPosTime 669 bool(__cdecl* pos_time)(const struct AddonInstance_InputStream* instance, int ms); 670 671 int(__cdecl* read_stream)(const struct AddonInstance_InputStream* instance, 672 uint8_t* buffer, 673 unsigned int bufferSize); 674 int64_t(__cdecl* seek_stream)(const struct AddonInstance_InputStream* instance, 675 int64_t position, 676 int whence); 677 int64_t(__cdecl* position_stream)(const struct AddonInstance_InputStream* instance); 678 int64_t(__cdecl* length_stream)(const struct AddonInstance_InputStream* instance); 679 bool(__cdecl* is_real_time_stream)(const struct AddonInstance_InputStream* instance); 680 681 // IChapter 682 int(__cdecl* get_chapter)(const struct AddonInstance_InputStream* instance); 683 int(__cdecl* get_chapter_count)(const struct AddonInstance_InputStream* instance); 684 const char*(__cdecl* get_chapter_name)(const struct AddonInstance_InputStream* instance, 685 int ch); 686 int64_t(__cdecl* get_chapter_pos)(const struct AddonInstance_InputStream* instance, int ch); 687 bool(__cdecl* seek_chapter)(const struct AddonInstance_InputStream* instance, int ch); 688 689 int(__cdecl* block_size_stream)(const struct AddonInstance_InputStream* instance); 690 } KodiToAddonFuncTable_InputStream; 691 692 typedef struct AddonInstance_InputStream /* internal */ 693 { 694 struct AddonProps_InputStream* props; 695 struct AddonToKodiFuncTable_InputStream* toKodi; 696 struct KodiToAddonFuncTable_InputStream* toAddon; 697 } AddonInstance_InputStream; 698 699 #ifdef __cplusplus 700 } /* extern "C" */ 701 #endif /* __cplusplus */ 702 703 #endif /* !C_API_ADDONINSTANCE_INPUTSTREAM_H */ 704