downloadDecklink.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. downloadDecklink() {
  3. local _ver=11.6
  4. local _arch=Windows
  5. local _referid=fbbb2af999e546cfb86389978700480a
  6. local _downloadid=761a49d851a24c20bb54f6ab010a8909
  7. local _siteurl="https://www.blackmagicdesign.com/api/register/us/download/${_downloadid}"
  8. local _useragent='User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0'
  9. local _reqjson="{ \
  10. \"platform\": \"Windows\", \
  11. \"country\": \"us\", \
  12. \"firstname\": \"Deck\", \
  13. \"lastname\": \"Link\", \
  14. \"email\": \"mail@example.org\", \
  15. \"phone\": \"202-555-0194\", \
  16. \"state\": \"New York\", \
  17. \"city\": \"MABS\", \
  18. \"hasAgreedToTerms\": true, \
  19. \"product\": \"Desktop Video ${_ver} SDK\" \
  20. }"
  21. local _filename="Blackmagic_DeckLink_SDK_${_ver}.zip"
  22. local _srcurl="$(curl -s -H "$_useragent" -H 'Content-Type: application/json;charset=UTF-8' \
  23. -H "Referer: https://www.blackmagicdesign.com/support/download/${_referid}/Linux" \
  24. --data-ascii "$_reqjson" --compressed "$_siteurl")"
  25. local _root=$(pwd)
  26. create_build_dir
  27. curl -gqb '' -C - --retry 3 --retry-delay 3 -H 'Upgrade-Insecure-Requests: 1' -o "${_filename}" --compressed "${_srcurl}"
  28. do_extract "$_filename"
  29. cd_safe Win/include
  30. # add newline at the end of file if it's missing, otherwise widl whines about it
  31. sed -i -e '$a\' *.idl
  32. widl -I"$MINGW_PREFIX/$MINGW_CHOST/include" -h -u DeckLinkAPI.idl
  33. sed -n '2,24 s/^\*\*//p' DeckLinkAPI.idl > DeckLinkAPI.LICENSE
  34. cp DeckLinkAPI{.h,_i.c,Version.h} "$_root"/include/
  35. cp DeckLinkAPI.LICENSE "$_root"/'SDK License.txt'
  36. cd_safe "$_root"
  37. }
  38. downloadDecklink