From a51f51db67e3eab80ac2ed28d403a6d77f7acc45 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 1 Jan 2018 16:26:10 +0100 Subject: sync with upstream --- .../cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | 55 ------------- xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h | 85 -------------------- .../VideoPlayer/Interface/Addon/DemuxCrypto.h | 91 ++++++++++++++++++++++ .../VideoPlayer/Interface/Addon/DemuxPacket.h | 52 +++++++++++++ .../VideoPlayer/Interface/Addon/TimingConstants.h | 31 ++++++++ 5 files changed, 174 insertions(+), 140 deletions(-) delete mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h delete mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h create mode 100644 xbmc/cores/VideoPlayer/Interface/Addon/DemuxCrypto.h create mode 100644 xbmc/cores/VideoPlayer/Interface/Addon/DemuxPacket.h create mode 100644 xbmc/cores/VideoPlayer/Interface/Addon/TimingConstants.h (limited to 'xbmc/cores') diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h deleted file mode 100644 index 77d796e..0000000 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2012-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include -#include - -#define DMX_SPECIALID_STREAMINFO -10 -#define DMX_SPECIALID_STREAMCHANGE -11 - -struct DemuxCryptoInfo; - -typedef struct DemuxPacket -{ - DemuxPacket() = default; - - DemuxPacket(unsigned char *pData, int const iSize, double const pts, double const dts) - : pData(pData) - , iSize(iSize) - , pts(pts) - , dts(dts) - {}; - - unsigned char *pData; // data - int iSize; // data size - int iStreamId; // integer representing the stream index - int64_t demuxerId; // id of the demuxer that created the packet - int iGroupId; // the group this data belongs to, used to group data from different streams together - - double pts; // pts in DVD_TIME_BASE - double dts; // dts in DVD_TIME_BASE - double duration; // duration in DVD_TIME_BASE if available - - int dispTime; - - std::shared_ptr cryptoInfo; -} DemuxPacket; diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h deleted file mode 100644 index a32f4fe..0000000 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -* Copyright (C) 2005-2016 Team XBMC -* http://xbmc.org -* -* This Program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2, or (at your option) -* any later version. -* -* This Program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with XBMC; see the file COPYING. If not, see -* . -* -*/ - -#pragma once - -#include -#include - -//CryptoSession is usually obtained once per stream, but could change if an key expires - -enum CryptoSessionSystem :uint8_t -{ - CRYPTO_SESSION_SYSTEM_NONE, - CRYPTO_SESSION_SYSTEM_WIDEVINE, - CRYPTO_SESSION_SYSTEM_PLAYREADY -}; - -struct DemuxCryptoSession -{ - DemuxCryptoSession(const CryptoSessionSystem sys, const uint16_t sSize, const char *sData, const uint8_t flags) - : sessionId(new char[sSize]) - , sessionIdSize(sSize) - , keySystem(sys) - , flags(flags) - { - memcpy(sessionId, sData, sSize); - }; - - ~DemuxCryptoSession() - { - delete[] sessionId; - } - - // encryped stream infos - char * sessionId; - uint16_t sessionIdSize; - CryptoSessionSystem keySystem; - - static const uint8_t FLAG_SECURE_DECODER = 1; - uint8_t flags; -}; - -//CryptoInfo stores the information to decrypt a sample - -struct DemuxCryptoInfo -{ - explicit DemuxCryptoInfo(const unsigned int numSubs) - : numSubSamples(numSubs) - , flags(0) - , clearBytes(new uint16_t[numSubs]) - , cipherBytes(new uint32_t[numSubs]) - {}; - - ~DemuxCryptoInfo() - { - delete[] clearBytes; - delete[] cipherBytes; - } - - uint16_t numSubSamples; //number of subsamples - uint16_t flags; //flags for later use - - uint16_t *clearBytes; // numSubSamples uint16_t's wich define the size of clear size of a subsample - uint32_t *cipherBytes; // numSubSamples uint32_t's wich define the size of cipher size of a subsample - - uint8_t iv[16]; // initialization vector - uint8_t kid[16]; // key id -}; 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 @@ +/* +* Copyright (C) 2005-2016 Team XBMC +* http://xbmc.org +* +* This Program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This Program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XBMC; see the file COPYING. If not, see +* . +* +*/ + +#pragma once + +#include +#include + +//CryptoSession is usually obtained once per stream, but could change if an key expires + +enum CryptoSessionSystem :uint8_t +{ + CRYPTO_SESSION_SYSTEM_NONE, + CRYPTO_SESSION_SYSTEM_WIDEVINE, + CRYPTO_SESSION_SYSTEM_PLAYREADY +}; + +struct DemuxCryptoSession +{ + DemuxCryptoSession(const CryptoSessionSystem sys, const uint16_t sSize, const char *sData, const uint8_t flags) + : sessionId(new char[sSize]) + , sessionIdSize(sSize) + , keySystem(sys) + , flags(flags) + { + memcpy(sessionId, sData, sSize); + }; + + ~DemuxCryptoSession() + { + delete[] sessionId; + } + + // encryped stream infos + char * sessionId; + uint16_t sessionIdSize; + CryptoSessionSystem keySystem; + + static const uint8_t FLAG_SECURE_DECODER = 1; + uint8_t flags; +private: + DemuxCryptoSession(const DemuxCryptoSession&) = delete; + DemuxCryptoSession& operator=(const DemuxCryptoSession&) = delete; +}; + +//CryptoInfo stores the information to decrypt a sample + +struct DemuxCryptoInfo +{ + explicit DemuxCryptoInfo(const unsigned int numSubs) + : numSubSamples(numSubs) + , flags(0) + , clearBytes(new uint16_t[numSubs]) + , cipherBytes(new uint32_t[numSubs]) + {}; + + ~DemuxCryptoInfo() + { + delete[] clearBytes; + delete[] cipherBytes; + } + + uint16_t numSubSamples; //number of subsamples + uint16_t flags; //flags for later use + + uint16_t *clearBytes; // numSubSamples uint16_t's wich define the size of clear size of a subsample + uint32_t *cipherBytes; // numSubSamples uint32_t's wich define the size of cipher size of a subsample + + uint8_t iv[16]; // initialization vector + uint8_t kid[16]; // key id +private: + DemuxCryptoInfo(const DemuxCryptoInfo&) = delete; + DemuxCryptoInfo& operator=(const DemuxCryptoInfo&) = delete; +}; 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 @@ +#pragma once + +/* + * Copyright (C) 2012-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "TimingConstants.h" +#include +#include + +#define DMX_SPECIALID_STREAMINFO -10 +#define DMX_SPECIALID_STREAMCHANGE -11 + +struct DemuxCryptoInfo; + +typedef struct DemuxPacket +{ + DemuxPacket() = default; + + uint8_t *pData = nullptr; + int iSize = 0; + int iStreamId = -1; + int64_t demuxerId; // id of the demuxer that created the packet + int iGroupId = -1; // the group this data belongs to, used to group data from different streams together + + void *pSideData = nullptr; + int iSideDataElems = 0; + + double pts = DVD_NOPTS_VALUE; + double dts = DVD_NOPTS_VALUE; + double duration = 0; // duration in DVD_TIME_BASE if available + int dispTime = 0; + bool recoveryPoint = false; + + std::shared_ptr cryptoInfo; +} 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 @@ +#pragma once + +/* +* Copyright (C) 2017 Team XBMC +* http://xbmc.org +* +* This Program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This Program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XBMC; see the file COPYING. If not, see +* . +* +*/ + +#define DVD_TIME_BASE 1000000 +#define DVD_NOPTS_VALUE 0xFFF0000000000000 + +#define DVD_TIME_TO_MSEC(x) ((int)((double)(x) * 1000 / DVD_TIME_BASE)) +#define DVD_SEC_TO_TIME(x) ((double)(x) * DVD_TIME_BASE) +#define DVD_MSEC_TO_TIME(x) ((double)(x) * DVD_TIME_BASE / 1000) + +#define DVD_PLAYSPEED_PAUSE 0 // frame stepping +#define DVD_PLAYSPEED_NORMAL 1000 -- cgit v1.2.3