diff -Nru kodi-inputstream-adaptive-2.0.19/debian/changelog kodi-inputstream-adaptive-2.0.20/debian/changelog --- kodi-inputstream-adaptive-2.0.19/debian/changelog 2017-11-14 21:40:26.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/debian/changelog 2018-05-06 06:51:35.000000000 +0000 @@ -1,4 +1,4 @@ -kodi-inputstream-adaptive (2.0.19-1~trusty) trusty; urgency=low +kodi-inputstream-adaptive (2.0.20-1~trusty) trusty; urgency=low [ kodi ] * autogenerated dummy changelog @@ -6,4 +6,4 @@ [ wsnipex ] * no upstream changelog available - -- wsnipex Tue, 14 Nov 2017 22:40:26 +0100 + -- wsnipex Sun, 06 May 2018 08:51:35 +0200 diff -Nru kodi-inputstream-adaptive-2.0.19/debian/changelog.tmp kodi-inputstream-adaptive-2.0.20/debian/changelog.tmp --- kodi-inputstream-adaptive-2.0.19/debian/changelog.tmp 2017-11-14 21:39:07.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/debian/changelog.tmp 2018-05-06 06:50:25.000000000 +0000 @@ -1,4 +1,4 @@ -kodi-inputstream-adaptive (2.0.19-1~#DIST#) #DIST#; urgency=low +kodi-inputstream-adaptive (2.0.20-1~#DIST#) #DIST#; urgency=low [ kodi ] * autogenerated dummy changelog diff -Nru kodi-inputstream-adaptive-2.0.19/inputstream.adaptive/addon.xml.in kodi-inputstream-adaptive-2.0.20/inputstream.adaptive/addon.xml.in --- kodi-inputstream-adaptive-2.0.19/inputstream.adaptive/addon.xml.in 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/inputstream.adaptive/addon.xml.in 2018-03-29 11:18:46.000000000 +0000 @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff -Nru kodi-inputstream-adaptive-2.0.19/README.md kodi-inputstream-adaptive-2.0.20/README.md --- kodi-inputstream-adaptive-2.0.19/README.md 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/README.md 2018-03-29 11:18:46.000000000 +0000 @@ -1,4 +1,4 @@ -# inputstream.adaptive (2.0.19) +# inputstream.adaptive (2.0.20) This is an adaptive file addon for kodi's new InputStream Interface. diff -Nru kodi-inputstream-adaptive-2.0.19/src/main.cpp kodi-inputstream-adaptive-2.0.20/src/main.cpp --- kodi-inputstream-adaptive-2.0.19/src/main.cpp 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/src/main.cpp 2018-03-29 11:18:46.000000000 +0000 @@ -35,6 +35,8 @@ #include "parser/TTML.h" #include "TSReader.h" +#include "Ap4Utils.h" + #ifdef _WIN32 // windows #include "p8-platform/windows/dlfcn-win32.h" #else // windows @@ -1609,13 +1611,15 @@ return false; } - AP4_DataBuffer init_data; - const char *optionalKeyParameter(nullptr); - for (size_t ses(1); ses < cdm_sessions_.size(); ++ses) { + AP4_DataBuffer init_data; + const char *optionalKeyParameter(nullptr); + if (adaptiveTree_->psshSets_[ses].pssh_ == "FILE") { + xbmc->Log(ADDON::LOG_DEBUG, "Searching PSSH data in FILE"); + if (license_data_.empty()) { std::string strkey(adaptiveTree_->supportedKeySystem_.substr(9)); @@ -1736,6 +1740,10 @@ if (decrypter_ && defkid) { + char hexkid[36]; + AP4_FormatHex(reinterpret_cast(defkid), 16, hexkid), hexkid[32]=0; + xbmc->Log(ADDON::LOG_DEBUG, "Initializing stream with KID: %s", hexkid); + for (unsigned int i(1); i < ses; ++i) if (decrypter_ && decrypter_->HasLicenseKey(cdm_sessions_[i].single_sample_decryptor_, (const uint8_t *)defkid)) { @@ -1743,6 +1751,8 @@ session.shared_single_sample_decryptor_ = true; } } + else if (!defkid) + xbmc->Log(ADDON::LOG_DEBUG, "Initializing stream with unknown KID!"); if (decrypter_ && init_data.GetDataSize() >= 4 && (session.single_sample_decryptor_ || (session.single_sample_decryptor_ = decrypter_->CreateSingleSampleDecrypter(init_data, optionalKeyParameter)) != 0)) diff -Nru kodi-inputstream-adaptive-2.0.19/src/parser/DASHTree.cpp kodi-inputstream-adaptive-2.0.20/src/parser/DASHTree.cpp --- kodi-inputstream-adaptive-2.0.19/src/parser/DASHTree.cpp 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/src/parser/DASHTree.cpp 2018-03-29 11:18:46.000000000 +0000 @@ -278,7 +278,10 @@ tpl.initialization = (const char*)*(attr + 1); attr += 2; } - tpl.media = baseURL + tpl.media; + + if (tpl.media.compare(0, 7, "http://") != 0 + && tpl.media.compare(0, 8, "https://") != 0) + tpl.media = baseURL + tpl.media; return startNumber; } diff -Nru kodi-inputstream-adaptive-2.0.19/src/parser/HLSTree.cpp kodi-inputstream-adaptive-2.0.20/src/parser/HLSTree.cpp --- kodi-inputstream-adaptive-2.0.19/src/parser/HLSTree.cpp 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/src/parser/HLSTree.cpp 2018-03-29 11:18:46.000000000 +0000 @@ -327,7 +327,8 @@ { if (rep->containerType_ == CONTAINERTYPE_NOTYPE) { - std::string::size_type ext = line.rfind('.'); + std::string::size_type paramPos = line.rfind('?'); + std::string::size_type ext = line.rfind('.', paramPos); if (ext != std::string::npos) { if (strncmp(line.c_str() + ext, ".ts", 3) == 0) @@ -387,24 +388,27 @@ if (!rep->pssh_set_) { parseLine(line, 11, map); - if (map["METHOD"] != "AES-128") + if (map["METHOD"] != "NONE") { - Log(LOGLEVEL_ERROR, "Unsupported encryption method: ", map["METHOD"].c_str()); - return false; - } - if (map["URI"].empty()) - { - Log(LOGLEVEL_ERROR, "Unsupported encryption method: ", map["METHOD"].c_str()); - return false; - } - current_pssh_ = map["URI"]; - if (current_pssh_[0] == '/') - current_pssh_ = base_domain_ + current_pssh_; - else if (current_pssh_.find("://", 0) == std::string::npos) - current_pssh_ = base_url + current_pssh_; + if (map["METHOD"] != "AES-128") + { + Log(LOGLEVEL_ERROR, "Unsupported encryption method: ", map["METHOD"].c_str()); + return false; + } + if (map["URI"].empty()) + { + Log(LOGLEVEL_ERROR, "Unsupported encryption method: ", map["METHOD"].c_str()); + return false; + } + current_pssh_ = map["URI"]; + if (current_pssh_[0] == '/') + current_pssh_ = base_domain_ + current_pssh_; + else if (current_pssh_.find("://", 0) == std::string::npos) + current_pssh_ = base_url + current_pssh_; - current_iv_ = m_decrypter->convertIV(map["IV"]); - segment.pssh_set_ = insert_psshset(NOTYPE); + current_iv_ = m_decrypter->convertIV(map["IV"]); + segment.pssh_set_ = insert_psshset(NOTYPE); + } } } else if (line.compare(0, 14, "#EXT-X-ENDLIST") == 0) diff -Nru kodi-inputstream-adaptive-2.0.19/.travis.yml kodi-inputstream-adaptive-2.0.20/.travis.yml --- kodi-inputstream-adaptive-2.0.19/.travis.yml 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/.travis.yml 2018-03-29 11:18:46.000000000 +0000 @@ -1,47 +1,45 @@ -language: cpp - -# -# Define the build matrix -# -# Travis defaults to building on Ubuntu Precise when building on -# Linux. We need Trusty in order to get up to date versions of -# cmake and g++. -# -env: - global: - - app_id=inputstream.adaptive - -matrix: - include: - - os: linux - dist: trusty - sudo: required - compiler: gcc - - os: linux - dist: trusty - sudo: required - compiler: clang - - os: osx - osx_image: xcode7.3 - - os: osx - osx_image: xcode6.4 - -# -# Some of the OS X images don't have cmake, contrary to what people -# on the Internet say -# -before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which cmake || brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which cmake || brew install cmake ; fi - -# -# The addon source is automatically checked out in $TRAVIS_BUILD_DIR, -# we'll put the Kodi source on the same level -# -before_script: - - cd $TRAVIS_BUILD_DIR/.. - - git clone -b Krypton --depth=1 https://github.com/xbmc/xbmc.git - - cd ${app_id} && mkdir build && cd build - - cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/project/cmake/addons - -script: make +language: cpp + +# +# Define the build matrix +# +# Travis defaults to building on Ubuntu Precise when building on +# Linux. We need Trusty in order to get up to date versions of +# cmake and g++. +# +env: + global: + - app_id=inputstream.adaptive + +matrix: + include: + - os: linux + dist: trusty + sudo: required + compiler: gcc + - os: linux + dist: trusty + sudo: required + compiler: clang + - os: osx + osx_image: xcode9.2 + +# +# Some of the OS X images don't have cmake, contrary to what people +# on the Internet say +# +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which cmake || brew update ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which cmake || brew install cmake ; fi + +# +# The addon source is automatically checked out in $TRAVIS_BUILD_DIR, +# we'll put the Kodi source on the same level +# +before_script: + - cd $TRAVIS_BUILD_DIR/.. + - git clone -b Krypton --depth=1 https://github.com/xbmc/xbmc.git + - cd ${app_id} && mkdir build && cd build + - cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/project/cmake/addons + +script: make diff -Nru kodi-inputstream-adaptive-2.0.19/wvdecrypter/wvdecrypter_android.cpp kodi-inputstream-adaptive-2.0.20/wvdecrypter/wvdecrypter_android.cpp --- kodi-inputstream-adaptive-2.0.19/wvdecrypter/wvdecrypter_android.cpp 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/wvdecrypter/wvdecrypter_android.cpp 2018-03-29 11:18:46.000000000 +0000 @@ -464,6 +464,9 @@ //Process body if (!blocks[2].empty()) { + if (blocks[2][0] == '%') + blocks[2] = url_decode(blocks[2]); + insPos = blocks[2].find("{SSM}"); if (insPos != std::string::npos) { @@ -601,6 +604,27 @@ goto SSMFAIL; } } + else if (blocks[3][0] == 'H' && blocks[3].size() >= 2) + { + //Find the payload + std::string::size_type payloadPos = response.find("\r\n\r\n"); + if (payloadPos != std::string::npos) + { + payloadPos += 4; + if (blocks[3][1] == 'B') + status = AMediaDrm_provideKeyResponse(media_drm_.GetMediaDrm(), &session_id, reinterpret_cast(response.c_str() + payloadPos), response.size() - payloadPos, &dummy_ksid); + else + { + Log(SSD_HOST::LL_ERROR, "Unsupported HTTP payload data type definition"); + goto SSMFAIL; + } + } + else + { + Log(SSD_HOST::LL_ERROR, "Unable to find HTTP payload in response"); + goto SSMFAIL; + } + } else { Log(SSD_HOST::LL_ERROR, "Unsupported License request template (response)"); diff -Nru kodi-inputstream-adaptive-2.0.19/wvdecrypter/wvdecrypter.cpp kodi-inputstream-adaptive-2.0.20/wvdecrypter/wvdecrypter.cpp --- kodi-inputstream-adaptive-2.0.19/wvdecrypter/wvdecrypter.cpp 2017-11-08 14:46:40.000000000 +0000 +++ kodi-inputstream-adaptive-2.0.20/wvdecrypter/wvdecrypter.cpp 2018-03-29 11:18:46.000000000 +0000 @@ -411,7 +411,7 @@ strBasePath += cSep; host->CreateDirectory(strBasePath.c_str()); - wv_adapter = std::shared_ptr(new media::CdmAdapter("com.widevine.alpha", strLibPath, strBasePath, media::CdmConfig(false, true), (dynamic_cast(this)))); + wv_adapter = std::shared_ptr(new media::CdmAdapter("com.widevine.alpha", strLibPath, strBasePath, media::CdmConfig(false, false), (dynamic_cast(this)))); if (!wv_adapter->valid()) { Log(SSD_HOST::LL_ERROR, "Unable to load widevine shared library (%s)", strLibPath.c_str()); @@ -664,6 +664,9 @@ //Process body if (!blocks[2].empty()) { + if (blocks[2][0] == '%') + blocks[2] = url_decode(blocks[2]); + insPos = blocks[2].find("{SSM}"); if (insPos != std::string::npos) { @@ -751,7 +754,7 @@ jsmn_init(&jsn); int i(0), numTokens = jsmn_parse(&jsn, response.c_str(), response.size(), tokens, 256); - std::vector jsonVals = split(blocks[3].c_str()+2, ';'); + std::vector jsonVals = split(blocks[3].c_str() + 2, ';'); // Find HDCP limit if (jsonVals.size() > 1) @@ -793,6 +796,28 @@ goto SSMFAIL; } } + else if (blocks[3][0] == 'H' && blocks[3].size() >= 2) + { + //Find the payload + std::string::size_type payloadPos = response.find("\r\n\r\n"); + if (payloadPos != std::string::npos) + { + payloadPos += 4; + if (blocks[3][1] == 'B') + drm_.GetCdmAdapter()->UpdateSession(++promise_id_, session_.data(), session_.size(), + reinterpret_cast(response.c_str() + payloadPos), response.size() - payloadPos); + else + { + Log(SSD_HOST::LL_ERROR, "Unsupported HTTP payload data type definition"); + goto SSMFAIL; + } + } + else + { + Log(SSD_HOST::LL_ERROR, "Unable to find HTTP payload in response"); + goto SSMFAIL; + } + } else { Log(SSD_HOST::LL_ERROR, "Unsupported License request template (response)");