diff options
Diffstat (limited to 'xbmc/cores/VideoPlayer/Interface/Addon')
| -rw-r--r-- | xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h | 91 | ||||
| -rw-r--r-- | xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h | 52 | ||||
| -rw-r--r-- | xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h | 31 |
3 files changed, 174 insertions, 0 deletions
diff --git a/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h new file mode 100644 index 0000000..c77d000 --- /dev/null +++ b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2016 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <inttypes.h> | ||
| 24 | #include <string.h> | ||
| 25 | |||
| 26 | //CryptoSession is usually obtained once per stream, but could change if an key expires | ||
| 27 | |||
| 28 | enum CryptoSessionSystem :uint8_t | ||
| 29 | { | ||
| 30 | CRYPTO_SESSION_SYSTEM_NONE, | ||
| 31 | CRYPTO_SESSION_SYSTEM_WIDEVINE, | ||
| 32 | CRYPTO_SESSION_SYSTEM_PLAYREADY | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct DemuxCryptoSession | ||
| 36 | { | ||
| 37 | DemuxCryptoSession(const CryptoSessionSystem sys, const uint16_t sSize, const char *sData, const uint8_t flags) | ||
| 38 | : sessionId(new char[sSize]) | ||
| 39 | , sessionIdSize(sSize) | ||
| 40 | , keySystem(sys) | ||
| 41 | , flags(flags) | ||
| 42 | { | ||
| 43 | memcpy(sessionId, sData, sSize); | ||
| 44 | }; | ||
| 45 | |||
| 46 | ~DemuxCryptoSession() | ||
| 47 | { | ||
| 48 | delete[] sessionId; | ||
| 49 | } | ||
| 50 | |||
| 51 | // encryped stream infos | ||
| 52 | char * sessionId; | ||
| 53 | uint16_t sessionIdSize; | ||
| 54 | CryptoSessionSystem keySystem; | ||
| 55 | |||
| 56 | static const uint8_t FLAG_SECURE_DECODER = 1; | ||
| 57 | uint8_t flags; | ||
| 58 | private: | ||
| 59 | DemuxCryptoSession(const DemuxCryptoSession&) = delete; | ||
| 60 | DemuxCryptoSession& operator=(const DemuxCryptoSession&) = delete; | ||
| 61 | }; | ||
| 62 | |||
| 63 | //CryptoInfo stores the information to decrypt a sample | ||
| 64 | |||
| 65 | struct DemuxCryptoInfo | ||
| 66 | { | ||
| 67 | explicit DemuxCryptoInfo(const unsigned int numSubs) | ||
| 68 | : numSubSamples(numSubs) | ||
| 69 | , flags(0) | ||
| 70 | , clearBytes(new uint16_t[numSubs]) | ||
| 71 | , cipherBytes(new uint32_t[numSubs]) | ||
| 72 | {}; | ||
| 73 | |||
| 74 | ~DemuxCryptoInfo() | ||
| 75 | { | ||
| 76 | delete[] clearBytes; | ||
| 77 | delete[] cipherBytes; | ||
| 78 | } | ||
| 79 | |||
| 80 | uint16_t numSubSamples; //number of subsamples | ||
| 81 | uint16_t flags; //flags for later use | ||
| 82 | |||
| 83 | uint16_t *clearBytes; // numSubSamples uint16_t's wich define the size of clear size of a subsample | ||
| 84 | uint32_t *cipherBytes; // numSubSamples uint32_t's wich define the size of cipher size of a subsample | ||
| 85 | |||
| 86 | uint8_t iv[16]; // initialization vector | ||
| 87 | uint8_t kid[16]; // key id | ||
| 88 | private: | ||
| 89 | DemuxCryptoInfo(const DemuxCryptoInfo&) = delete; | ||
| 90 | DemuxCryptoInfo& operator=(const DemuxCryptoInfo&) = delete; | ||
| 91 | }; | ||
diff --git a/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h new file mode 100644 index 0000000..2d85ed9 --- /dev/null +++ b/xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2012-2013 Team XBMC | ||
| 5 | * http://xbmc.org | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with XBMC; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "TimingConstants.h" | ||
| 24 | #include <cstdint> | ||
| 25 | #include <memory> | ||
| 26 | |||
| 27 | #define DMX_SPECIALID_STREAMINFO -10 | ||
| 28 | #define DMX_SPECIALID_STREAMCHANGE -11 | ||
| 29 | |||
| 30 | struct DemuxCryptoInfo; | ||
| 31 | |||
| 32 | typedef struct DemuxPacket | ||
| 33 | { | ||
| 34 | DemuxPacket() = default; | ||
| 35 | |||
| 36 | uint8_t *pData = nullptr; | ||
| 37 | int iSize = 0; | ||
| 38 | int iStreamId = -1; | ||
| 39 | int64_t demuxerId; // id of the demuxer that created the packet | ||
| 40 | int iGroupId = -1; // the group this data belongs to, used to group data from different streams together | ||
| 41 | |||
| 42 | void *pSideData = nullptr; | ||
| 43 | int iSideDataElems = 0; | ||
| 44 | |||
| 45 | double pts = DVD_NOPTS_VALUE; | ||
| 46 | double dts = DVD_NOPTS_VALUE; | ||
| 47 | double duration = 0; // duration in DVD_TIME_BASE if available | ||
| 48 | int dispTime = 0; | ||
| 49 | bool recoveryPoint = false; | ||
| 50 | |||
| 51 | std::shared_ptr<DemuxCryptoInfo> cryptoInfo; | ||
| 52 | } DemuxPacket; | ||
diff --git a/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h b/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h new file mode 100644 index 0000000..b70128e --- /dev/null +++ b/xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2017 Team XBMC | ||
| 5 | * http://xbmc.org | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with XBMC; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #define DVD_TIME_BASE 1000000 | ||
| 24 | #define DVD_NOPTS_VALUE 0xFFF0000000000000 | ||
| 25 | |||
| 26 | #define DVD_TIME_TO_MSEC(x) ((int)((double)(x) * 1000 / DVD_TIME_BASE)) | ||
| 27 | #define DVD_SEC_TO_TIME(x) ((double)(x) * DVD_TIME_BASE) | ||
| 28 | #define DVD_MSEC_TO_TIME(x) ((double)(x) * DVD_TIME_BASE / 1000) | ||
| 29 | |||
| 30 | #define DVD_PLAYSPEED_PAUSE 0 // frame stepping | ||
| 31 | #define DVD_PLAYSPEED_NORMAL 1000 | ||
