Explorar el Código

第一次上传

xsh hace 1 año
padre
commit
dfb70eeb8f
Se han modificado 100 ficheros con 0 adiciones y 3520 borrados
  1. 0 1
      nkApp/assets/Ai-0aba0dcf.css
  2. 0 1
      nkApp/assets/Ai-0c5f1be6.js
  3. 0 1
      nkApp/assets/ChartDrink-eec63ef4.js
  4. 0 1
      nkApp/assets/ChartTemp-739236cb.js
  5. 0 1
      nkApp/assets/Daily-2393572e.css
  6. 0 1
      nkApp/assets/Daily-e095d0ad.js
  7. 0 1
      nkApp/assets/DailyDetail-0d54de28.js
  8. 0 1
      nkApp/assets/DailyDetail-c94068de.css
  9. 0 1
      nkApp/assets/Energy-8cfee6e0.js
  10. 0 1
      nkApp/assets/Energy-aeeabcb8.css
  11. 0 1
      nkApp/assets/Env-0b01c9cb.js
  12. 0 1
      nkApp/assets/Env-5d9b444d.css
  13. 0 1
      nkApp/assets/Feed-1e58ee44.css
  14. 0 1
      nkApp/assets/Feed-7f1eafa0.js
  15. 0 1
      nkApp/assets/FeedDetail-7fad8eb0.js
  16. 0 1
      nkApp/assets/FeedDetail-e581bb1d.css
  17. 0 1
      nkApp/assets/History-8aeca408.css
  18. 0 1
      nkApp/assets/History-d6f51ac2.js
  19. 0 1
      nkApp/assets/Home-15311072.js
  20. 0 1
      nkApp/assets/Home-c5757787.css
  21. 0 1
      nkApp/assets/Login-98a43231.css
  22. 0 1
      nkApp/assets/Login-e3a69f73.js
  23. 0 1
      nkApp/assets/MainLayout-1b566c2c.css
  24. 0 1
      nkApp/assets/MainLayout-c0974419.js
  25. 0 1
      nkApp/assets/Mine-6fb78fd0.css
  26. 0 1
      nkApp/assets/Mine-8f5d2e81.js
  27. BIN
      nkApp/assets/OPPOSans_M_2-44c41d8a.ttf
  28. 0 2
      nkApp/assets/Production-7a5d98aa.js
  29. 0 1
      nkApp/assets/Production-f86f016f.css
  30. 0 1
      nkApp/assets/Task-165a963a.css
  31. 0 1
      nkApp/assets/Task-ce888d97.js
  32. 0 1
      nkApp/assets/TaskDetail-289b457f.css
  33. 0 1
      nkApp/assets/TaskDetail-2e9d35d4.js
  34. 0 1
      nkApp/assets/Video-2b35466f.css
  35. 0 1
      nkApp/assets/Video-d9ec973a.js
  36. 0 1
      nkApp/assets/Warn-749de039.css
  37. 0 1
      nkApp/assets/Warn-e753a0e2.js
  38. 0 1
      nkApp/assets/XLine-4e3d5a57.js
  39. 0 1
      nkApp/assets/XLine-7c694dc2.css
  40. 0 3
      nkApp/assets/api-e0b7dcb1.js
  41. BIN
      nkApp/assets/bu-51b51b77.png
  42. BIN
      nkApp/assets/bu_select-487ffc90.png
  43. BIN
      nkApp/assets/chuang-5f27ee71.png
  44. BIN
      nkApp/assets/chuang_select-e567e3fb.png
  45. BIN
      nkApp/assets/dai-16fd8df2.png
  46. BIN
      nkApp/assets/duan-021c30c7.png
  47. BIN
      nkApp/assets/ele-d409646e.png
  48. BIN
      nkApp/assets/fan-68373b79.png
  49. BIN
      nkApp/assets/fan_select-42dcdba7.png
  50. BIN
      nkApp/assets/feed-f909dd30.png
  51. BIN
      nkApp/assets/fen-bb027340.png
  52. BIN
      nkApp/assets/hum-6abf524e.png
  53. BIN
      nkApp/assets/icon1-69693894.png
  54. BIN
      nkApp/assets/icon2-09711966.png
  55. BIN
      nkApp/assets/icon3-f9f5586b.png
  56. BIN
      nkApp/assets/icon4-a6b48a9f.png
  57. BIN
      nkApp/assets/icon6-ba419753.png
  58. BIN
      nkApp/assets/iconfont.1686788249013-749fb6d4.woff
  59. BIN
      nkApp/assets/iconfont.1686788249013-eabee844.ttf
  60. 0 1
      nkApp/assets/index-4e65cdb1.css
  61. 0 1
      nkApp/assets/index-56daa4e6.js
  62. 0 1
      nkApp/assets/index-6290f871.js
  63. 0 1
      nkApp/assets/index-6860a79a.js
  64. 0 1
      nkApp/assets/index-6cf74614.js
  65. 0 1
      nkApp/assets/index-a7615baa.js
  66. 0 1
      nkApp/assets/index-c9653467.js
  67. 0 79
      nkApp/assets/index-ee85f8a3.js
  68. BIN
      nkApp/assets/lian-de280e5a.png
  69. BIN
      nkApp/assets/lian_select-69e49b5b.png
  70. BIN
      nkApp/assets/liao-ec3287dc.png
  71. BIN
      nkApp/assets/menu-07a35cb0.png
  72. BIN
      nkApp/assets/menuSelect-fcb96348.png
  73. BIN
      nkApp/assets/mine-40bcc01a.png
  74. BIN
      nkApp/assets/mineSelect-7cfdecd9.png
  75. 0 1
      nkApp/assets/on-popup-reopen-28b79f93.js
  76. BIN
      nkApp/assets/production-97996914.png
  77. BIN
      nkApp/assets/productionSelect-0667278d.png
  78. BIN
      nkApp/assets/ren-1f3edec0.png
  79. BIN
      nkApp/assets/tai-11b7a56e.png
  80. BIN
      nkApp/assets/temp-9a5e8fb1.png
  81. 0 1
      nkApp/assets/use-route-c6e6fb0f.js
  82. BIN
      nkApp/assets/video-767c79cb.png
  83. BIN
      nkApp/assets/warn-eb1379d5.png
  84. BIN
      nkApp/assets/warnOrgin-e2d069be.png
  85. BIN
      nkApp/assets/warnSelect-900585ef.png
  86. BIN
      nkApp/assets/water-be833077.png
  87. BIN
      nkApp/assets/water1-51a1f941.png
  88. BIN
      nkApp/assets/zhen-0deafb75.png
  89. 0 15
      nkApp/index.html
  90. BIN
      nkApp/static/h265/image/siagn.png
  91. 0 284
      nkApp/static/h265/index.html
  92. 0 1153
      nkApp/static/h265/src/Decoder.js
  93. BIN
      nkApp/static/h265/src/Decoder.wasm
  94. 0 180
      nkApp/static/h265/src/H2642.js
  95. 0 387
      nkApp/static/h265/src/H264SPSParser.js
  96. 0 582
      nkApp/static/h265/src/H264Session.js
  97. 0 86
      nkApp/static/h265/src/H265.js
  98. 0 287
      nkApp/static/h265/src/H265SPSParser.js
  99. 0 416
      nkApp/static/h265/src/H265Session.js
  100. 0 0
      nkApp/static/h265/src/H265Session2.js

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Ai-0aba0dcf.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Ai-0c5f1be6.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/ChartDrink-eec63ef4.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/ChartTemp-739236cb.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Daily-2393572e.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Daily-e095d0ad.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/DailyDetail-0d54de28.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/DailyDetail-c94068de.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Energy-8cfee6e0.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Energy-aeeabcb8.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Env-0b01c9cb.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Env-5d9b444d.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Feed-1e58ee44.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Feed-7f1eafa0.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/FeedDetail-7fad8eb0.js


+ 0 - 1
nkApp/assets/FeedDetail-e581bb1d.css

@@ -1 +0,0 @@
-.monitor[data-v-5f80fd6c]{box-sizing:border-box;padding:0 .26667rem;border-radius:.26667rem;margin-bottom:.26667rem;position:relative}.padding[data-v-5f80fd6c]{padding:0 .26667rem}.monitor_box[data-v-5f80fd6c]{box-sizing:border-box;padding:.26667rem;border-radius:.26667rem;margin-bottom:.26667rem;position:relative;background:white}.chart_content[data-v-5f80fd6c]{width:100%;height:8rem}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/History-8aeca408.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/History-d6f51ac2.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Home-15311072.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Home-c5757787.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Login-98a43231.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Login-e3a69f73.js


+ 0 - 1
nkApp/assets/MainLayout-1b566c2c.css

@@ -1 +0,0 @@
-.main[data-v-0c2f4fca]{width:100%;height:100%}.main_header[data-v-0c2f4fca]{width:100%}.arrow_back[data-v-0c2f4fca]{font-size:.42667rem;color:#1998fa}.main_content[data-v-0c2f4fca]{width:100%;box-sizing:border-box;overflow:auto}.main_tab[data-v-0c2f4fca]{height:calc(100% - 2.61333rem)}.main_no_tab[data-v-0c2f4fca]{height:calc(100% - 1.22667rem)}.main_footer[data-v-0c2f4fca]{width:100%}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/MainLayout-c0974419.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Mine-6fb78fd0.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Mine-8f5d2e81.js


BIN
nkApp/assets/OPPOSans_M_2-44c41d8a.ttf


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 2
nkApp/assets/Production-7a5d98aa.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Production-f86f016f.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Task-165a963a.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Task-ce888d97.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/TaskDetail-289b457f.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/TaskDetail-2e9d35d4.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Video-2b35466f.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Video-d9ec973a.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Warn-749de039.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/Warn-e753a0e2.js


+ 0 - 1
nkApp/assets/XLine-4e3d5a57.js

@@ -1 +0,0 @@
-import{_ as t,t as _,i as s,U as a}from"./index-ee85f8a3.js";const n={class:"text"},c={name:"XLine"},o=Object.assign(c,{props:{text:{type:String,default:()=>""}},setup(e){return(i,p)=>(_(),s("div",n,a(e.text),1))}}),d=t(o,[["__scopeId","data-v-ee3ad296"]]);export{d as X};

+ 0 - 1
nkApp/assets/XLine-7c694dc2.css

@@ -1 +0,0 @@
-.text[data-v-ee3ad296]{width:100%;height:.66667rem;line-height:.66667rem;box-sizing:border-box;padding-left:.53333rem;position:relative}.text[data-v-ee3ad296]:before{content:"";position:absolute;width:.13333rem;height:.42667rem;background-color:#6c3;border-radius:.13333rem;top:.13333rem;left:.13333rem}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 3
nkApp/assets/api-e0b7dcb1.js


BIN
nkApp/assets/bu-51b51b77.png


BIN
nkApp/assets/bu_select-487ffc90.png


BIN
nkApp/assets/chuang-5f27ee71.png


BIN
nkApp/assets/chuang_select-e567e3fb.png


BIN
nkApp/assets/dai-16fd8df2.png


BIN
nkApp/assets/duan-021c30c7.png


BIN
nkApp/assets/ele-d409646e.png


BIN
nkApp/assets/fan-68373b79.png


BIN
nkApp/assets/fan_select-42dcdba7.png


BIN
nkApp/assets/feed-f909dd30.png


BIN
nkApp/assets/fen-bb027340.png


BIN
nkApp/assets/hum-6abf524e.png


BIN
nkApp/assets/icon1-69693894.png


BIN
nkApp/assets/icon2-09711966.png


BIN
nkApp/assets/icon3-f9f5586b.png


BIN
nkApp/assets/icon4-a6b48a9f.png


BIN
nkApp/assets/icon6-ba419753.png


BIN
nkApp/assets/iconfont.1686788249013-749fb6d4.woff


BIN
nkApp/assets/iconfont.1686788249013-eabee844.ttf


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/index-4e65cdb1.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/index-56daa4e6.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/index-6290f871.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/index-6860a79a.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/index-6cf74614.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
nkApp/assets/index-a7615baa.js


+ 0 - 1
nkApp/assets/index-c9653467.js

@@ -1 +0,0 @@
-import{a0 as r}from"./index-ee85f8a3.js";const o=r("keep",{state:()=>({keepAlive:[]}),getters:{},actions:{SET_KEEPALIVE(e){this.$patch(t=>{t.keepAlive=e})}}});export{o as u};

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 79
nkApp/assets/index-ee85f8a3.js


BIN
nkApp/assets/lian-de280e5a.png


BIN
nkApp/assets/lian_select-69e49b5b.png


BIN
nkApp/assets/liao-ec3287dc.png


BIN
nkApp/assets/menu-07a35cb0.png


BIN
nkApp/assets/menuSelect-fcb96348.png


BIN
nkApp/assets/mine-40bcc01a.png


BIN
nkApp/assets/mineSelect-7cfdecd9.png


+ 0 - 1
nkApp/assets/on-popup-reopen-28b79f93.js

@@ -1 +0,0 @@
-import{P as T,R as c}from"./index-a7615baa.js";import{Y as f,w as l}from"./index-ee85f8a3.js";const i="van-hairline",E=`${i}--bottom`,R=`${i}--top-bottom`,_="van-haptics-feedback",r=500,m=5;function u(s,{args:t=[],done:o,canceled:a}){if(s){const n=s.apply(null,t);T(n)?n.then(p=>{p?o():a&&a()}).catch(c):n?o():a&&a()}else o()}const O=Symbol();function B(s){const t=f(O,null);t&&l(t,o=>{o&&s()})}export{E as B,_ as H,r as L,O as P,m as T,R as a,u as c,B as o};

BIN
nkApp/assets/production-97996914.png


BIN
nkApp/assets/productionSelect-0667278d.png


BIN
nkApp/assets/ren-1f3edec0.png


BIN
nkApp/assets/tai-11b7a56e.png


BIN
nkApp/assets/temp-9a5e8fb1.png


+ 0 - 1
nkApp/assets/use-route-c6e6fb0f.js

@@ -1 +0,0 @@
-import{g as n}from"./index-ee85f8a3.js";const c={to:[String,Object],url:String,replace:Boolean};function a({to:e,url:o,replace:t,$router:r}){e&&r?r[t?"replace":"push"](e):o&&(t?location.replace(o):location.href=o)}function i(){const e=n().proxy;return()=>a(e)}export{a,c as r,i as u};

BIN
nkApp/assets/video-767c79cb.png


BIN
nkApp/assets/warn-eb1379d5.png


BIN
nkApp/assets/warnOrgin-e2d069be.png


BIN
nkApp/assets/warnSelect-900585ef.png


BIN
nkApp/assets/water-be833077.png


BIN
nkApp/assets/water1-51a1f941.png


BIN
nkApp/assets/zhen-0deafb75.png


+ 0 - 15
nkApp/index.html

@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-  <head>
-    <meta charset="UTF-8" />
-    <link rel="icon" type="image/svg+xml" href="./vite.svg" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
-    <title>农科院</title>
-    <script type="module" crossorigin src="./assets/index-ee85f8a3.js"></script>
-    <link rel="stylesheet" href="./assets/index-4e65cdb1.css">
-  </head>
-  <body>
-    <div id="app"></div>
-    
-  </body>
-</html>

BIN
nkApp/static/h265/image/siagn.png


+ 0 - 284
nkApp/static/h265/index.html

@@ -1,284 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>player</title>
-    <script type="text/javascript" src="./src/SuperRender_20.js"></script>
-    <style>
-        .container {
-            position: absolute;
-            top: 0;
-            left: 0;
-        }
-
-        #canvas {
-            position: absolute;
-        }
-        .sk-chase {
-        width: 40px;
-        height: 40px;
-        position: absolute;
-        top: 50%;
-        left: 50%;
-        transform: translate(-50%, -50%);
-        display: block;
-        animation: sk-chase 2.5s infinite linear both;
-      }
-
-      .sk-chase-dot {
-        width: 100%;
-        height: 100%;
-        position: absolute;
-        left: 0;
-        top: 0;
-        animation: sk-chase-dot 2.0s infinite ease-in-out both;
-      }
-
-      .sk-chase-dot:before {
-        content: '';
-        display: block;
-        width: 25%;
-        height: 25%;
-        background-color: #8cc5ff;
-        border-radius: 100%;
-        animation: sk-chase-dot-before 2.0s infinite ease-in-out both;
-      }
-
-      .sk-chase-dot:nth-child(1) { animation-delay: -1.1s; }
-      .sk-chase-dot:nth-child(2) { animation-delay: -1.0s; }
-      .sk-chase-dot:nth-child(3) { animation-delay: -0.9s; }
-      .sk-chase-dot:nth-child(4) { animation-delay: -0.8s; }
-      .sk-chase-dot:nth-child(5) { animation-delay: -0.7s; }
-      .sk-chase-dot:nth-child(6) { animation-delay: -0.6s; }
-      .sk-chase-dot:nth-child(1):before { animation-delay: -1.1s; }
-      .sk-chase-dot:nth-child(2):before { animation-delay: -1.0s; }
-      .sk-chase-dot:nth-child(3):before { animation-delay: -0.9s; }
-      .sk-chase-dot:nth-child(4):before { animation-delay: -0.8s; }
-      .sk-chase-dot:nth-child(5):before { animation-delay: -0.7s; }
-      .sk-chase-dot:nth-child(6):before { animation-delay: -0.6s; }
-
-      @keyframes sk-chase {
-        100% { transform: rotate(360deg); }
-      }
-
-      @keyframes sk-chase-dot {
-        80%, 100% { transform: rotate(360deg); }
-      }
-
-      @keyframes sk-chase-dot-before {
-        50% {
-          transform: scale(0.4);
-        } 100%, 0% {
-            transform: scale(1.0);
-          }
-      }
-      #error_text {
-          width: 170px;
-          height: 170px;
-          background: url("./image/siagn.png") no-repeat;
-          background-size: 100%;
-          position: absolute;
-          top: 50%;
-          left: 50%;
-          transform: translate(-50%, -50%);
-          display: none;
-      }
-      body::-webkit-scrollbar {
-          display: none;
-      }
-    </style>
-</head>
-<body style="margin: 0; padding: 0; width: 100%; height: 100%; z-index:999; background-color: transparent; overflow: hidden">
-    <video id="video"></video>
-    <div class="container">
-        <canvas id="canvas"></canvas>
-        <canvas id="videoCanvas"></canvas>
-    </div>
-    <canvas id="draw" ></canvas>
-    <div class="sk-chase" id="sk-chase">
-        <div class="sk-chase-dot"></div>
-        <div class="sk-chase-dot"></div>
-        <div class="sk-chase-dot"></div>
-        <div class="sk-chase-dot"></div>
-        <div class="sk-chase-dot"></div>
-        <div class="sk-chase-dot"></div>
-    </div>
-    <div id="error_text"></div>
-</body>
-<!-- <script src="./node_modules/file-saver/FileSaver.js"/> -->
-<script src="./src/md5.js" type="text/javascript"></script>
-<script type="module">
-    import Player from "./src/player.js";
-
-    var clickTimeId;
-    let str  = location.href;
-    let num = str.indexOf('?');
-    str = str.substr(num+1);
-    let data = str.split(',');
-    console.log(data);
-
-    // 下标0 wsUrl, 1 rtspUrl, 2 canvas 宽度, 3 canvas高度
-
-    let video = document.getElementById('video');
-    let height = video.clientHeight;
-    video.dblclick = function () {
-    };
-    // function onDocumentClick(event) {
-    //     // 取消上次延时未执行的方法
-    //     clearTimeout(clickTimeId);
-    //     //执行延时
-    //     clickTimeId = setTimeout(function() {
-    //         //此处为单击事件要执行的代码
-    //         console.log("鼠标单击");
-    //     }, 250);
-    // }
-
-    // 设置高度宽度
-    document.getElementById('canvas').width = data[2];
-    document.getElementById('canvas').height = data[3];
-    document.getElementById('videoCanvas').width = data[2];
-    document.getElementById('videoCanvas').height = data[3];
-
-    const options = {
-        video: document.getElementById('video'),
-        canvas: document.getElementById('canvas'),
-        drawer: document.getElementById('draw'),
-        wsUrl: '',
-        rtspUrl: '',
-        user: '',
-        pwd: ''
-    }
-
-    options.wsUrl = data[0];
-    options.rtspUrl = data[1];
-
-    let player = new Player(options);
-    player.init();
-    player.on('error', function () {
-        console.log('连接失败')
-        let er = document.getElementById('error_text');
-        er.style.display = 'block';
-
-        let sk = document.getElementById('sk-chase');
-        sk.style.display = 'none';
-    });
-    player.on('noStream', function () {
-        console.log('noStream');
-        player.close();
-        player = null;
-        player = new Player(options);
-        player.init();
-        player.connect();
-    });
-
-    player.on('canplay', function () {
-        console.log('首次播放')
-        //player.close();
-    });
-
-    player.on('initialCompleted', function () {
-        let data = [[
-            {x: 2861, y: 4395},
-            {x: 6403, y: 4013},
-            {x: 3260, y: 7986},
-            {x: 640, y: 6252}
-        ]];
-        console.log('initialCompleted')
-        player.setROI(data);
-    });
-
-    player.on('ROIFinished', function () {
-       console.log('ROIFinished');
-    });
-
-    player.connect();
-
-    let sk = document.getElementById('sk-chase');
-    sk.style.display = 'none';
-
-    // document.getElementById('close').onclick = ()=>{
-    //     player.close();
-    // };
-
-    // document.getElementById('ROIreset').onclick = () =>{
-    //     player.resetROI();
-    // };
-    //
-    // document.getElementById('ROIset').onclick = () =>{
-    //     let data = [[
-    //         {x: 2861, y: 4395},
-    //         {x: 6403, y: 4013},
-    //         {x: 3260, y: 7986},
-    //         {x: 640, y: 6252}
-    //     ]];
-    //     player.setROI(data);
-    // };
-    //
-    // document.getElementById('ROIdata').onclick = () =>{
-    //     let result = player.getROIData();
-    //     console.log(result)
-    // };
-    //
-    // document.getElementById('ROIsetNum').onclick = ()=> {
-    //     let num = document.getElementById('ROINum').value;
-    //     player.setPolygonNum(num);
-    // }
-
-    function onDocumenDblClick(event) {
-       show = !show;
-       let width = window.screen.width;
-       let height = window.screen.height;
-       let canvas = document.getElementById('canvas');
-       if(show) {
-         if (document.body.requestFullscreen) { //解决兼容性问题
-           document.body.requestFullscreen();
-         } else if (document.body.webkitRequestFullScreen) { //兼容谷歌 /Edge
-           document.body.webkitRequestFullScreen();
-         } else if (document.body.mozRequestFullScreen) { //Firefox
-           document.body.mozRequestFullScreen();
-         }else if(document.body.msRequestFullscreen){//ie
-           document.body.msRequestFullscreen();
-         }
-         canvas.style.position = 'fixed';
-         canvas.style.top = 0;
-         canvas.style.left = 0;
-         document.getElementById('canvas').width = width;
-         document.getElementById('canvas').height = height;
-         document.getElementById('videoCanvas').width = width;
-         document.getElementById('videoCanvas').height = height;
-       } else {
-         if(document.exitFullscreen) {
-           document.exitFullscreen();
-         } else if(document.mozCancelFullScreen) {
-           document.mozCancelFullScreen();
-         } else if(document.webkitExitFullscreen) {
-           document.webkitExitFullscreen();
-         }else if(document.msExitFullscreen) {
-           document.msExitFullscreen();
-         }
-         document.getElementById('canvas').width = data[2];
-         document.getElementById('canvas').height = data[3];
-         document.getElementById('videoCanvas').width = data[2];
-         document.getElementById('videoCanvas').height = data[3];
-       }
-
-
-
-    }
-
-    let cloc = 0;
-    let show = false;
-    document.getElementById('canvas').onclick = function (e) {
-      e.preventDefault();
-      cloc++;
-      setTimeout(() => {
-        cloc = 0;
-      }, 500)
-      if(cloc == 2) {
-        onDocumenDblClick()
-      }
-    }
-
-
-</script>
-</html>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1153
nkApp/static/h265/src/Decoder.js


BIN
nkApp/static/h265/src/Decoder.wasm


+ 0 - 180
nkApp/static/h265/src/H2642.js

@@ -1,180 +0,0 @@
-
-importScripts('./jsFFMPEG.js');
-let initDecoder = null;
-let decoderContext = null;
-let decodeByFFMPEG = null;
-let getWidth = null;
-let getHeight = null;
-let closeContext = null;
-let context = null;
-let outpic = null;
-let outpicptr = null;
-let ID = 264;
-let initialized = false;
-let firstIFrame = true;
-
-class H264Decoder {
-    constructor() {
-
-
-
-       //Module.onRuntimeInitialized = () => {
-            console.log('h264 decoder init')
-
-            initDecoder = Module.cwrap('init_jsFFmpeg', 'void', []);
-            decoderContext = Module.cwrap('context_jsFFmpeg', 'number', ['number']);
-            decodeByFFMPEG = Module.cwrap('decode_video_jsFFmpeg', 'number', ['number', 'array', 'number', 'number']);
-            getWidth = Module.cwrap('get_width', 'number', ['number']);
-            getHeight = Module.cwrap('get_height', 'number', ['number']);
-            closeContext = Module.cwrap('close_jsFFmpeg', 'number', ['number']);
-        initDecoder();
-            this.init();
-            initialized = true;
-        //};
-    }
-    init() {
-        if (context !== null) {
-            closeContext(context);
-            context = null;
-        }
-        context = decoderContext(ID);
-    }
-
-    setOutputSize(size) {
-        console.log("H264 Decoder setOutputSize");
-        let outpicsize = size * 1.5;
-        outpicptr = Module._malloc(outpicsize);
-        outpic = new Uint8Array(Module.HEAPU8.buffer, outpicptr, outpicsize);
-    }
-
-    decode(data) {
-        if(!initialized) {
-            console.log('未初始化完成')
-            return null;
-        }
-        console.log(data.subarray(0, 100))
-        let frameType = ((data[4] & 0x1f) === 7 || (data[4] & 0x1f) === 5) ? 'I' : 'P';
-    //console.log(data[4] & 0x1f)
-        if(frameType === 'I' && initialized) {
-            firstIFrame = true;
-        }
-        if(!firstIFrame) {
-            console.log('非 firstIFrame')
-            return null;
-        }
-        let beforeDecoding = null;
-        let decodingTime = null;
-        let frameData = null;
-        let bufferIdx = null;
-        var dataHeap = null;
-
-        beforeDecoding = Date.now();
-
-        decodeByFFMPEG(context, data, data.length, outpic.byteOffset);
-        decodingTime = Date.now() - beforeDecoding;
-
-
-
-        let width = getWidth(context);
-        let height = getHeight(context);
-
-        console.log(width, height)
-        if (width > 0 && height > 0) {
-            let copyOutput = new Uint8Array(outpic);
-
-            frameData = {
-                'data': copyOutput,
-                'bufferIdx': bufferIdx,
-                'width': width,
-                'height': height,
-                'codecType': 'h264',
-                'decodingTime': decodingTime,
-                'frameType': frameType,
-            };
-            console.log(frameData)
-
-            return frameData;
-        }
-
-        // if(decodeby) {
-        //     //avcodec_decode_video2(context, outpicptr, size, data);
-        //     //console.log(Module.HEAP8.subarray(outpicptr, outpicptr+20))
-        //
-        //     //
-        //     var memoryData = Module._malloc(data.byteLength);
-        //     Module.HEAPU8.set(data, memoryData);
-        //     var ptr = Module._video_decode_frame(video_decoder_ctx, memoryData, data.byteLength);
-        //     Module._free(memoryData);
-        //     if(ptr === 0) {
-        //         console.error("[ERROR] no Frame Data!");
-        //         return null;
-        //     }else {
-        //     }
-        // }else {
-        //     try {
-        //         //outpic = Module.HEAPU8.length - data.length - 1000;
-        //         Module.HEAPU8.set(data, outpic);
-        //         console.log(data.length, data.subarray(0, 30), outpic,  Module.HEAPU8.subarray(outpic))
-        //         //let result = avcodec_decode_video2(context, outpic, size/8, data);
-        //         console.log(h264_decode_frame(context, data, data.length, outpic));
-        //         //dataHeap = new Uint8Array(Module.HEAPU8.buffer, outpic, size);
-        //         //dataHeap.set(data);
-        //         //outpic.set(data);
-        //         //console.log(data.length, data.subarray(0, 30), outpic.byteOffset, outpic.subarray(0, 30), Module.HEAPU8.subarray(outpic.byteOffset))
-        //         //let result = avcodec_decode_video2(context, outpic.byteOffset, 0, data);
-        //         //console.log('result: ', result)
-        //     } catch (e) {
-        //         console.log(e)
-        //     }
-        //
-        // }
-
-
-        // if (!Constructor.prototype.isFirstFrame()) {
-        //     Constructor.prototype.setIsFirstFrame(true);
-        //     frameData = {
-        //         'firstFrame': true,
-        //     };
-        //     return frameData;
-        // }
-        // draw picture in canvas.
-        //console.log(outpic)
-
-        //console.log(width, height)
-        // if (width > 0 && height > 0) {
-        let copyOutput;
-        // if(decodeby) {
-        //     var width = Module.HEAPU32[ptr / 4],
-        //         height = Module.HEAPU32[ptr / 4 + 1],
-        //         YimgBufferPtr = Module.HEAPU32[ptr / 4 + 2],
-        //         UimgBufferPtr = Module.HEAPU32[ptr / 4 + 3],
-        //         VimgBufferPtr = Module.HEAPU32[ptr / 4 + 4],
-        //         YimageBuffer = Module.HEAPU8.subarray(YimgBufferPtr, YimgBufferPtr + width * height),
-        //         UimageBuffer = Module.HEAPU8.subarray(UimgBufferPtr, UimgBufferPtr + width * height / 4),
-        //         VimageBuffer = Module.HEAPU8.subarray(VimgBufferPtr, VimgBufferPtr + width * height / 4);
-        //
-        //     var ydata = new Uint8Array(YimageBuffer);
-        //     var udata = new Uint8Array(UimageBuffer);
-        //     var vdata = new Uint8Array(VimageBuffer);
-        //
-        //     frameData = {
-        //         'bufferIdx': bufferIdx,
-        //         'width': width,
-        //         'height': height,
-        //         'codecType': 'h264',
-        //         'decodingTime': decodingTime,
-        //         'frameType': frameType,
-        //         YData:ydata.buffer,
-        //         UData:udata.buffer,
-        //         VData:vdata.buffer,
-        //     };
-        //
-        //     return frameData;
-        // } else {
-        //     //console.log(outpic)
-        //     copyOutput = new Uint8Array(Module.HEAPU8.buffer, outpic, data.size);
-        //     //console.log(outpic)
-        //
-        // }
-    }
-}

+ 0 - 387
nkApp/static/h265/src/H264SPSParser.js

@@ -1,387 +0,0 @@
-//import Map from './Map.js';
-
-let BITWISE0x00000007 = 0x00000007;
-let BITWISE0x7 = 0x7;
-let BITWISE2 = 2;
-let BITWISE3 = 3;
-let BITWISE4 = 4;
-let BITWISE5 = 5;
-let BITWISE6 = 6;
-let BITWISE8 = 8;
-let BITWISE12 = 12;
-let BITWISE15 = 15;
-let BITWISE16 = 16;
-let BITWISE32 = 32;
-let BITWISE64 = 64;
-let BITWISE255 = 255;
-let BITWISE256 = 256;
-
-function H264SPSParser() {
-    let vBitCount = 0;
-    let spsMap = null;
-    let fps = null;
-
-
-    function constructor() {
-        spsMap = new Map();
-    }
-
-    constructor.prototype = {
-        parse (pSPSBytes) {
-            //console.log("=========================SPS START=========================");
-            vBitCount = 0;
-            spsMap.clear();
-
-            // forbidden_zero_bit, nal_ref_idc, nal_unit_type
-            spsMap.set("forbidden_zero_bit", readBits(pSPSBytes, 1));
-            spsMap.set("nal_ref_idc", readBits(pSPSBytes, BITWISE2));
-            spsMap.set("nal_unit_type", readBits(pSPSBytes, BITWISE5));
-
-            // profile_idc
-            spsMap.set("profile_idc", readBits(pSPSBytes, BITWISE8));
-            spsMap.set("profile_compatibility", readBits(pSPSBytes, BITWISE8));
-
-            // spsMap.set("constrained_set0_flag", readBits(pSPSBytes, 1));
-            // spsMap.set("constrained_set1_flag", readBits(pSPSBytes, 1));
-            // spsMap.set("constrained_set2_flag", readBits(pSPSBytes, 1));
-            // spsMap.set("constrained_set3_flag", readBits(pSPSBytes, 1));
-            // spsMap.set("constrained_set4_flag", readBits(pSPSBytes, 1));
-            // spsMap.set("constrained_set5_flag", readBits(pSPSBytes, 1));
-            // spsMap.set("reserved_zero_2bits", readBits(pSPSBytes, 2));
-
-            // level_idc
-            spsMap.set("level_idc", readBits(pSPSBytes, BITWISE8));
-            spsMap.set("seq_parameter_set_id", ue(pSPSBytes, 0));
-
-            let profileIdc = spsMap.get("profile_idc");
-            let BITWISE100 = 100;
-            let BITWISE110 = 110;
-            let BITWISE122 = 122;
-            let BITWISE244 = 244;
-            let BITWISE44 = 44;
-            let BITWISE83 = 83;
-            let BITWISE86 = 86;
-            let BITWISE118 = 118;
-            let BITWISE128 = 128;
-            let BITWISE138 = 138;
-            let BITWISE139 = 139;
-            let BITWISE134 = 134;
-
-            if ((profileIdc === BITWISE100) || (profileIdc === BITWISE110) ||
-                (profileIdc === BITWISE122) || (profileIdc === BITWISE244) ||
-                (profileIdc === BITWISE44) || (profileIdc === BITWISE83) ||
-                (profileIdc === BITWISE86) || (profileIdc === BITWISE118) ||
-                (profileIdc === BITWISE128) || (profileIdc === BITWISE138) ||
-                (profileIdc === BITWISE139) || (profileIdc === BITWISE134)) {
-                spsMap.set("chroma_format_idc", ue(pSPSBytes, 0));
-                if (spsMap.get("chroma_format_idc") === BITWISE3) {
-                    spsMap.set("separate_colour_plane_flag", readBits(pSPSBytes, 1));
-                }
-
-                spsMap.set("bit_depth_luma_minus8", ue(pSPSBytes, 0));
-                spsMap.set("bit_depth_chroma_minus8", ue(pSPSBytes, 0));
-                spsMap.set("qpprime_y_zero_transform_bypass_flag", readBits(pSPSBytes, 1));
-                spsMap.set("seq_scaling_matrix_present_flag", readBits(pSPSBytes, 1));
-
-                if (spsMap.get("seq_scaling_matrix_present_flag")) {
-                    let num = spsMap.get("chroma_format_idc") !== BITWISE3 ? BITWISE8 : BITWISE12;
-                    let seqScalingListPresentFlag = new Array(num);
-                    for (let i = 0; i < num; i++) {
-                        seqScalingListPresentFlag[i] = readBits(pSPSBytes, 1);
-
-                        if (seqScalingListPresentFlag[i]) {
-                            let slNumber = i < BITWISE6 ? BITWISE16 : BITWISE64;
-                            let lastScale = 8;
-                            let nextScale = 8;
-                            let deltaScale = 0;
-
-                            for (let j = 0; j < slNumber; j++) {
-                                if (nextScale) {
-                                    deltaScale = se(pSPSBytes, 0);
-                                    nextScale = (lastScale + deltaScale + BITWISE256) % BITWISE256;
-                                }
-                                lastScale = (nextScale === 0) ? lastScale : nextScale;
-                            }
-                        }
-                    }
-                    spsMap.set("seq_scaling_list_present_flag", seqScalingListPresentFlag);
-                }
-            }
-            spsMap.set("log2_max_frame_num_minus4", ue(pSPSBytes, 0));
-            spsMap.set("pic_order_cnt_type", ue(pSPSBytes, 0));
-
-            if (spsMap.get("pic_order_cnt_type") === 0) {
-                spsMap.set("log2_max_pic_order_cnt_lsb_minus4", ue(pSPSBytes, 0));
-            } else if (spsMap.get("pic_order_cnt_type") === 1) {
-                spsMap.set("delta_pic_order_always_zero_flag", readBits(pSPSBytes, 1));
-                spsMap.set("offset_for_non_ref_pic", se(pSPSBytes, 0));
-                spsMap.set("offset_for_top_to_bottom_field", se(pSPSBytes, 0));
-                spsMap.set("num_ref_frames_in_pic_order_cnt_cycle", ue(pSPSBytes, 0));
-                for (let numR = 0; numR < spsMap.get("num_ref_frames_in_pic_order_cnt_cycle"); numR++) {
-                    spsMap.set("num_ref_frames_in_pic_order_cnt_cycle", se(pSPSBytes, 0));
-                }
-            }
-            spsMap.set("num_ref_frames", ue(pSPSBytes, 0));
-            spsMap.set("gaps_in_frame_num_value_allowed_flag", readBits(pSPSBytes, 1));
-            spsMap.set("pic_width_in_mbs_minus1", ue(pSPSBytes, 0));
-            spsMap.set("pic_height_in_map_units_minus1", ue(pSPSBytes, 0));
-            spsMap.set("frame_mbs_only_flag", readBits(pSPSBytes, 1));
-
-            if (spsMap.get("frame_mbs_only_flag") === 0) {
-                spsMap.set("mb_adaptive_frame_field_flag", readBits(pSPSBytes, 1));
-            }
-            spsMap.set("direct_8x8_interence_flag", readBits(pSPSBytes, 1));
-            spsMap.set("frame_cropping_flag", readBits(pSPSBytes, 1));
-            if (spsMap.get("frame_cropping_flag") === 1) {
-                spsMap.set("frame_cropping_rect_left_offset", ue(pSPSBytes, 0));
-                spsMap.set("frame_cropping_rect_right_offset", ue(pSPSBytes, 0));
-                spsMap.set("frame_cropping_rect_top_offset", ue(pSPSBytes, 0));
-                spsMap.set("frame_cropping_rect_bottom_offset", ue(pSPSBytes, 0));
-            }
-
-            //vui parameters
-            spsMap.set("vui_parameters_present_flag", readBits(pSPSBytes, 1));
-            if (spsMap.get("vui_parameters_present_flag")) {
-                vuiParameters(pSPSBytes);
-            }
-
-            //console.log("=========================SPS END=========================");
-
-
-            return true;
-        },
-        getSizeInfo () {
-            let SubWidthC = 0;
-            let SubHeightC = 0;
-
-            if (spsMap.get("chroma_format_idc") === 0) { //monochrome
-                SubWidthC = SubHeightC = 0;
-            } else if (spsMap.get("chroma_format_idc") === 1) { //4:2:0
-                SubWidthC = SubHeightC = BITWISE2;
-            } else if (spsMap.get("chroma_format_idc") === BITWISE2) { //4:2:2
-                SubWidthC = BITWISE2;
-                SubHeightC = 1;
-            } else if (spsMap.get("chroma_format_idc") === BITWISE3) { //4:4:4
-                if (spsMap.get("separate_colour_plane_flag") === 0) {
-                    SubWidthC = SubHeightC = 1;
-                } else if (spsMap.get("separate_colour_plane_flag") === 1) {
-                    SubWidthC = SubHeightC = 0;
-                }
-            }
-
-            let PicWidthInMbs = spsMap.get("pic_width_in_mbs_minus1") + 1;
-
-            let PicHeightInMapUnits = spsMap.get("pic_height_in_map_units_minus1") + 1;
-            let FrameHeightInMbs = (BITWISE2 - spsMap.get("frame_mbs_only_flag")) * PicHeightInMapUnits;
-
-            let cropLeft = 0;
-            let cropRight = 0;
-            let cropTop = 0;
-            let cropBottom = 0;
-
-            if (spsMap.get("frame_cropping_flag") === 1) {
-                cropLeft = spsMap.get("frame_cropping_rect_left_offset");
-                cropRight = spsMap.get("frame_cropping_rect_right_offset");
-                cropTop = spsMap.get("frame_cropping_rect_top_offset");
-                cropBottom = spsMap.get("frame_cropping_rect_bottom_offset");
-            }
-            let decodeSize = (PicWidthInMbs * BITWISE16) * (FrameHeightInMbs * BITWISE16);
-            let width = (PicWidthInMbs * BITWISE16) - (SubWidthC * (cropLeft + cropRight));
-            let height = (FrameHeightInMbs * BITWISE16) -
-                (SubHeightC * (BITWISE2 - spsMap.get("frame_mbs_only_flag")) * (cropTop + cropBottom));
-
-            let sizeInfo = {
-                'width': width,
-                'height': height,
-                'decodeSize': decodeSize,
-            };
-
-            return sizeInfo;
-        },
-        getSpsValue (key) {
-            return spsMap.get(key);
-        },
-        getCodecInfo () {
-            let profileIdc = spsMap.get("profile_idc").toString(BITWISE16);
-            let profileCompatibility = spsMap.get("profile_compatibility") < BITWISE15 ?
-                "0" + spsMap.get("profile_compatibility").toString(BITWISE16) :
-                spsMap.get("profile_compatibility").toString(BITWISE16);
-
-            let levelIdc = spsMap.get("level_idc").toString(BITWISE16);
-
-            //console.log("getCodecInfo = " + (profile_idc + profile_compatibility + level_idc));
-            return profileIdc + profileCompatibility + levelIdc;
-
-        },
-
-        getSpsMap() {
-            return spsMap;
-        },
-
-        getFPS() {
-            return fps;
-        }
-    }
-
-    return new constructor();
-
-    function getBit(base, offset) {
-        let offsetData = offset;
-        let vCurBytes = (vBitCount + offsetData) >> BITWISE3;
-        offsetData = (vBitCount + offset) & BITWISE0x00000007;
-        return (((base[(vCurBytes)])) >> (BITWISE0x7 - (offsetData & BITWISE0x7))) & 0x1;
-    }
-
-    function readBits(pBuf, vReadBits) {
-        let vOffset = 0;
-        let vTmp = 0,
-            vTmp2 = 0;
-
-        if (vReadBits === 1) {
-            vTmp = getBit(pBuf, vOffset);
-        } else {
-            for (let i = 0; i < vReadBits; i++) {
-                vTmp2 = getBit(pBuf, i);
-                vTmp = (vTmp << 1) + vTmp2;
-            }
-        }
-
-        vBitCount += vReadBits;
-        return vTmp;
-    }
-
-    function ue(base, offset) {
-        let zeros = 0,
-            vTmp = 0,
-            vReturn = 0;
-        let vIdx = offset;
-        do {
-            vTmp = getBit(base, vIdx++);
-            if (vTmp === 0) {
-                zeros++;
-            }
-        } while (0 === vTmp);
-
-        if (zeros === 0) {
-            vBitCount += 1;
-            return 0;
-        }
-
-        vReturn = 1 << zeros;
-
-        for (let i = zeros - 1; i >= 0; i--, vIdx++) {
-            vTmp = getBit(base, vIdx);
-            vReturn |= vTmp << i;
-        }
-
-        let addBitCount = (zeros * BITWISE2) + 1;
-        vBitCount += addBitCount;
-
-        return (vReturn - 1);
-    }
-
-    function se(base, offset) {
-        let vReturn = ue(base, offset);
-
-        if (vReturn & 0x1) {
-            return (vReturn + 1) / BITWISE2;
-        } else {
-            return -vReturn / BITWISE2;
-        }
-    }
-
-    function hrdParameters(pSPSBytes) {
-        spsMap.set("cpb_cnt_minus1", ue(pSPSBytes, 0));
-        spsMap.set("bit_rate_scale", readBits(pSPSBytes, BITWISE4));
-        spsMap.set("cpb_size_scale", readBits(pSPSBytes, BITWISE4));
-        let cpdCntMinus1 = spsMap.get("cpb_cnt_minus1");
-        let bitRateValueMinus1 = new Array(cpdCntMinus1);
-        let cpbSizeValueMinus1 = new Array(cpdCntMinus1);
-        let cbrFlag = new Array(cpdCntMinus1);
-        //Todo: 原本为i <= cpdCntMinus1,运行到此处时直接停住,原因不明,改为<后正常
-        for (let i = 0; i < cpdCntMinus1; i++) {
-            bitRateValueMinus1[i] = ue(pSPSBytes, 0);
-            cpbSizeValueMinus1[i] = ue(pSPSBytes, 0);
-            cbrFlag[i] = readBits(pSPSBytes, 1);
-        }
-        spsMap.set("bit_rate_value_minus1", bitRateValueMinus1);
-        spsMap.set("cpb_size_value_minus1", cpbSizeValueMinus1);
-        spsMap.set("cbr_flag", cbrFlag);
-
-        spsMap.set("initial_cpb_removal_delay_length_minus1", readBits(pSPSBytes, BITWISE4));
-        spsMap.set("cpb_removal_delay_length_minus1", readBits(pSPSBytes, BITWISE4));
-        spsMap.set("dpb_output_delay_length_minus1", readBits(pSPSBytes, BITWISE4));
-        spsMap.set("time_offset_length", readBits(pSPSBytes, BITWISE4));
-    }
-
-    function vuiParameters(pSPSBytes) {
-        spsMap.set("aspect_ratio_info_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("aspect_ratio_info_present_flag")) {
-            spsMap.set("aspect_ratio_idc", readBits(pSPSBytes, BITWISE8));
-            //Extended_SAR
-            if (spsMap.get("aspect_ratio_idc") === BITWISE255) {
-                spsMap.set("sar_width", readBits(pSPSBytes, BITWISE16));
-                spsMap.set("sar_height", readBits(pSPSBytes, BITWISE16));
-            }
-        }
-
-        spsMap.set("overscan_info_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("overscan_info_present_flag")) {
-            spsMap.set("overscan_appropriate_flag", readBits(pSPSBytes, 1));
-        }
-        spsMap.set("video_signal_type_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("video_signal_type_present_flag")) {
-            spsMap.set("video_format", readBits(pSPSBytes, BITWISE3));
-            spsMap.set("video_full_range_flag", readBits(pSPSBytes, 1));
-            spsMap.set("colour_description_present_flag", readBits(pSPSBytes, 1));
-            if (spsMap.get("colour_description_present_flag")) {
-                spsMap.set("colour_primaries", readBits(pSPSBytes, BITWISE8));
-                spsMap.set("transfer_characteristics", readBits(pSPSBytes, BITWISE8));
-                spsMap.set("matrix_coefficients", readBits(pSPSBytes, BITWISE8));
-            }
-        }
-        spsMap.set("chroma_loc_info_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("chroma_loc_info_present_flag")) {
-            spsMap.set("chroma_sample_loc_type_top_field", ue(pSPSBytes, 0));
-            spsMap.set("chroma_sample_loc_type_bottom_field", ue(pSPSBytes, 0));
-        }
-        spsMap.set("timing_info_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("timing_info_present_flag")) {
-            spsMap.set("num_units_in_tick", readBits(pSPSBytes, BITWISE32));
-            spsMap.set("time_scale", readBits(pSPSBytes, BITWISE32));
-            spsMap.set("fixed_frame_rate_flag", readBits(pSPSBytes, 1));
-
-            fps =  spsMap.get("time_scale") / spsMap.get("num_units_in_tick");
-            if(spsMap.get("fixed_frame_rate_flag")) {
-                fps = fps / 2;
-            }
-        }
-        spsMap.set("nal_hrd_parameters_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("nal_hrd_parameters_present_flag")) {
-            hrdParameters(pSPSBytes);
-        }
-        spsMap.set("vcl_hrd_parameters_present_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("vcl_hrd_parameters_present_flag")) {
-            hrdParameters(pSPSBytes);
-        }
-        if (spsMap.get("nal_hrd_parameters_present_flag") ||
-            spsMap.get("vcl_hrd_parameters_present_flag")) {
-            spsMap.set("low_delay_hrd_flag", readBits(pSPSBytes, 1));
-        }
-        spsMap.set("pic_struct_present_flag", readBits(pSPSBytes, 1));
-        spsMap.set("bitstream_restriction_flag", readBits(pSPSBytes, 1));
-        if (spsMap.get("bitstream_restriction_flag")) {
-            spsMap.set("motion_vectors_over_pic_boundaries_flag", readBits(pSPSBytes, 1));
-            spsMap.set("max_bytes_per_pic_denom", ue(pSPSBytes, 0));
-            spsMap.set("max_bits_per_mb_denom", ue(pSPSBytes, 0));
-            spsMap.set("log2_max_mv_length_horizontal", ue(pSPSBytes, 0));
-            spsMap.set("log2_max_mv_length_vertical", ue(pSPSBytes, 0));
-            spsMap.set("max_num_reorder_frames", ue(pSPSBytes, 0));
-            spsMap.set("max_dec_frame_buffering", ue(pSPSBytes, 0));
-        }
-    }
-}
-
-
-
-//export default H264SPSParser;

+ 0 - 582
nkApp/static/h265/src/H264Session.js

@@ -1,582 +0,0 @@
-function H264Session() {
-    let rtpTimeStamp = 0;
-    let size1M = 1048576; //1024 * 1024
-    let inputBuffer = new Uint8Array(size1M);
-    let spsSegment = null;
-    let ppsSegment = null;
-
-    let SPSParser = null;
-
-    let width = 0;
-    let height = 0;
-    let inputLength = 0;
-
-    let initalSegmentFlag = true; //用于确定是否是initSegment
-    let initalMediaFrameFlag = true;
-
-    let frameRate = null; //根据SDP或者SPS设置
-    let preSample = null; //上一个Sample
-
-    let inputSegBufferSub = null;
-
-    //MSE使用的数据以及相关配置,顺序codecInfo -> initSegmentData -> mediaSample -> frameData
-    //时间戳用于绘制人脸框
-    let decodedData = {
-        frameData: null, //视频数据
-        timeStamp: null, //时间戳
-        initSegmentData: null, //MP4配置,用于initsegment
-        mediaSample: null, //使用duration控制每一帧的播放时间
-        codecInfo: "", //MSE init时传入,用于创建mediasource
-    };
-    let FRAMETYPE = {
-        1: 'P',
-        5: 'I',
-        6: 'SEI',
-        7: 'I'
-    };
-    let frameType = '';
-    let decodeMode = 'canvas';
-    let outputSize = 0;
-    let curSize = 0;
-
-    const PREFIX = new Uint8Array(['0x00', '0x00', '0x00', '0x01']);
-
-    let firstIframe = false;
-
-    let SEIInfo = {
-        ivs: null,
-        timestamp:null,
-    };
-
-    let preWidth = null,
-        preHeight = null;
-    let resetTimeCount = 0;
-    let lastTimeStamp = 0;
-    //const RESETTIME = 162000000;
-    const RESETTIME = 4320000;
-    let SEIBuffer = null;
-    let lastTime =0;
-    let decoder = null;
-    function constructor() {
-
-    }
-
-    constructor.prototype = {
-        init() {
-            SPSParser = new H264SPSParser();
-            decoder = new H264Decoder();
-            this.resolutionChangedCallback = ()=>{};
-        },
-
-        remuxRTPData(rtspInterleaved, rtpHeader, rtpPayload) {
-            //console.log(rtspInterleaved)
-            //console.log(rtpHeader)
-            let PaddingSize = 0;
-            let extensionHeaderLen = 0; //如果RtpHeader.X=1,则在RTP报头后跟有一个扩展报头
-            let PAYLOAD = null;
-//console.log(rtpHeader)
-//console.log(rtspInterleaved, rtpHeader, rtpPayload.subarray(0,5))
-            let RtpHeader = {
-                V: rtpHeader[0] >>> 6,
-                P: rtpHeader[0] & 0x20,
-                X: rtpHeader[0] & 0x10,
-                CC: rtpHeader[0] & 0x0F,
-                M: (rtpHeader[1] & 0x80) >> 7,
-                PT: rtpHeader[1] & 127,
-                SN: (rtpHeader[2] << 8) + rtpHeader[3],
-                timeStamp: (rtpHeader[4] << 24) + (rtpHeader[5] << 16) + (rtpHeader[6] << 8) + rtpHeader[7],
-                SSRC: (rtpHeader[8] << 24) + (rtpHeader[9] << 16) + (rtpHeader[10] << 8) + rtpHeader[11],
-            };
-            if (RtpHeader.P) { //填充
-                PaddingSize = rtpPayload[rtpPayload.length - 1];
-                //console.log("Padding - " + PaddingSize);
-            }
-
-            if (RtpHeader.X) { //扩展
-                extensionHeaderLen = (((rtpPayload[2] << 8) | rtpPayload[3]) * 4) + 4;
-                console.log('X: ' + rtpPayload[0])
-            }
-//console.log('extensionHeaderLen: '+ extensionHeaderLen)
-            PAYLOAD = rtpPayload.subarray(extensionHeaderLen, rtpPayload.length - PaddingSize);
-            rtpTimeStamp = RtpHeader.timeStamp;
-
-            //console.log(rtpTimeStamp, rtpHeader[4], rtpHeader[5], rtpHeader[6] , rtpHeader[7], PAYLOAD[0] & 0x1f)
-            /* 载荷结构(https://blog.csdn.net/davebobo/article/details/52994596)
-            +---------------+
-            |0|1|2|3|4|5|6|7|
-            +-+-+-+-+-+-+-+-+
-            |F|NRI|  Type   |
-            +---------------+
-            Type = 1-23 单个NAL单元包
-            Type = 24,25, 26, 27聚合包
-            Type = 28,29, 分片单元
-            */
-            //console.log(rtspInterleaved,rtpHeader, PAYLOAD[0]);
-            let nalType = (PAYLOAD[0] & 0x1f);
-            //console.log(PAYLOAD[0] + ' nalType: ' + nalType);
-
-//console.log('rtpPayload.length: ' + rtpPayload.length)
-//console.log(nalType, PAYLOAD[0])
-//console.log('nalType: ' + nalType, RtpHeader.M, rtpTimeStamp)
-            //console.log('nalType: ', nalType, ' timestamp: ', rtpTimeStamp);
-            switch (nalType) {
-                case 6: //SEI
-                    //console.log(PAYLOAD, String.fromCharCode.apply(null, PAYLOAD))
-                    if(SEIParse(PAYLOAD) === null) {
-                        return;
-                    }
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    break;
-                case 7: //SPS
-                    //console.log('SPS');
-                    SPSParser.parse(removeH264or5EmulationBytes(PAYLOAD));
-                    let sizeInfo = SPSParser.getSizeInfo();
-                    //console.log(SPSParser.getSpsMap())
-                    width = sizeInfo.width;
-                    height = sizeInfo.height;
-
-                    if(preWidth !== width || preHeight !== height) {
-                        console.log('resolution changed!');
-                        console.log('preWidth: ', preWidth, ' preHeight: ', preHeight, ' width: ', width, ' height: ', height);
-                        preWidth = width;
-                        preHeight = height;
-                    }
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    spsSegment = PAYLOAD;
-                    //console.log('width: ',width, 'height: ', height)
-                    curSize = sizeInfo.decodeSize;
-                    firstIframe = true;
-//console.log(spsSegment)
-                    if (frameRate === null) {
-                        frameRate = SPSParser.getFPS();
-                    }
-                    break;
-                case 8: //PPS
-                    //console.log('PPS')
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    ppsSegment = PAYLOAD;
-//console.log(ppsSegment)
-                    break;
-                case 28: //FU
-                    //console.log('FU');
-                    let startBit = ((PAYLOAD[1] & 0x80) === 0x80),
-                        endBit = ((PAYLOAD[1] & 0x40) === 0x40),
-                        fuType = PAYLOAD[1] & 0x1f,
-                        payloadStartIndex = 2;
-                    //console.log('startBit: ' + startBit + ' endBit: ' + endBit)
-                    //console.log('fuType: ' + fuType)
-                    if (startBit === true && endBit === false) {
-                        let newNalHeader = new Uint8Array(1);
-                        newNalHeader[0] = ((PAYLOAD[0] & 0xe0) | fuType);
-                        //console.log('newNalHeader: ', newNalHeader[0])
-                        //console.log('fuType: ' + fuType)
-                        //console.log((PAYLOAD[2] << 8) + PAYLOAD[3])
-//console.log(new Uint8Array(PAYLOAD.subarray(0, 100)));
-                        if (false) { //赛兰摄像头,SPS,PPS,I帧打在一个RTP包中
-                            PAYLOAD[1] = newNalHeader[0];
-                            SPSParser.parse(removeH264or5EmulationBytes(PAYLOAD.subarray(1, 27)));
-                            let sizeInfo = SPSParser.getSizeInfo();
-//console.log(sizeInfo, SPSParser.getSpsMap())
-                            //SPS
-                            width = sizeInfo.width;
-                            height = sizeInfo.height;
-                            inputBuffer = setBuffer(inputBuffer, PREFIX);
-                            inputBuffer = setBuffer(inputBuffer, PAYLOAD.subarray(1, 27));
-                            spsSegment = PAYLOAD.subarray(1, 27);
-                            //console.log('width: ',width, 'height: ', height)
-                            curSize = sizeInfo.decodeSize;
-                            firstIframe = true;
-
-                            //PPS
-                            inputBuffer = setBuffer(inputBuffer, PREFIX);
-                            inputBuffer = setBuffer(inputBuffer, PAYLOAD.subarray(30, 34));
-                            ppsSegment = PAYLOAD.subarray(30, 34);
-
-                            //I
-                            inputBuffer = setBuffer(inputBuffer, PREFIX);
-                            inputBuffer = setBuffer(inputBuffer, PAYLOAD.subarray(38, PAYLOAD.length));
-
-                        } else {
-                            //console.log(newNalHeader[0] & 0x1f)
-                            inputBuffer = setBuffer(inputBuffer, PREFIX);
-                            inputBuffer = setBuffer(inputBuffer, newNalHeader);
-                            inputBuffer = setBuffer(inputBuffer, PAYLOAD.subarray(payloadStartIndex, PAYLOAD.length));
-                        }
-
-                    } else {
-                        //console.log(startBit, endBit, 'endBit')
-                        inputBuffer = setBuffer(inputBuffer,
-                            PAYLOAD.subarray(payloadStartIndex, PAYLOAD.length));
-                    }
-//console.log(startBit,endBit)
-                    // if(endBit === true) {
-                    //     end = true;
-                    // }
-                    break;
-                case 1:
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    break;
-                default:
-                    //console.log('nalType: ' + nalType);
-                    //console.log(PAYLOAD)
-                    break;
-            }
-
-            //console.log('ppsSegment: ', ppsSegment)
-            //console.log('nalType: ' + nalType);
-//console.log('M: ' + RtpHeader.M + ' ' + (rtpHeader[1] & 0x80))
-            //console.log(RtpHeader)
-
-
-//console.log('RtpHeader.M: ', RtpHeader.M)
-            //check marker bit
-            if (RtpHeader.M) {
-                if (!firstIframe) {
-                    inputLength = 0;
-                    return;
-                }
-                let inputBufferSub = inputBuffer.subarray(0, inputLength);
-                frameType = FRAMETYPE[inputBufferSub[4] & 0x1f];
-
-                //只根据视频帧计算resetTimeCount
-                if(frameType !== 'SEI') {
-                    // rtp时间戳周期为RESETTIME,如果单向递增,设为0
-                    if(lastTimeStamp - rtpTimeStamp > (RESETTIME / 2)) { //判断lastTimeStamp远大于rtpTimeStamp,防止后一帧比前一帧先到的情况
-                        //console.log(lastTimeStamp - rtpTimeStamp)
-                        console.warn('时间戳重置', lastTimeStamp, rtpTimeStamp, frameType, new Date())
-                        resetTimeCount ++;
-                    }
-                    rtpTimeStamp = rtpTimeStamp + RESETTIME * resetTimeCount;
-                } else {
-                    //同一帧的SEI比视频发送慢时
-                    if (rtpTimeStamp - lastTimeStamp > (RESETTIME / 2)) {
-                        console.warn('SEI翻转', rtpTimeStamp , lastTimeStamp);
-                        rtpTimeStamp = rtpTimeStamp + RESETTIME * (resetTimeCount - 1);
-                    } else {
-                        rtpTimeStamp = rtpTimeStamp + RESETTIME * resetTimeCount;
-                    }
-                    //console.log('SEI', rtpTimeStamp, 'video', lastTimeStamp, lastTimeStamp+ RESETTIME * resetTimeCount - rtpTimeStamp)
-                    // //同一帧的SEI比视频发送快时
-                    // if(rtpTimeStamp - lastTimeStamp === 3600) {
-                    //     if(rtpTimeStamp === 0 ) {
-                    //         rtpTimeStamp = rtpTimeStamp + RESETTIME * (resetTimeCount + 1);
-                    //     } else {
-                    //         rtpTimeStamp = rtpTimeStamp + RESETTIME * resetTimeCount;
-                    //     }
-                    // }
-                }
-
-                if(frameType === 'SEI') {
-                    //SEI被分片(nal === 28)时,分片包发送完后marker为1,不会和视频帧一起
-                    SEIBuffer = inputBuffer.subarray(4, inputLength);
-                    //console.log(SEIBuffer)
-                    inputBufferSub = new Uint8Array();
-                }
-                if(SEIBuffer) {
-                    let SEI = SEIParse(SEIBuffer);
-                    if (SEI) {
-                        SEIInfo.ivs = SEI;
-                        SEIInfo.timestamp = rtpTimeStamp;
-                        //console.log('GET SEI', rtpTimeStamp)
-                        //SEI信息
-                        decodedData.SEIInfo = SEIInfo;
-
-                        if (!(rtpTimeStamp - lastTime)) {
-                            console.log('上个SET包时间和本次相等');
-                            console.log('lastTime: ', lastTime, ' rtpTimeStamp: ', rtpTimeStamp, RtpHeader.timeStamp, rtpHeader[4], rtpHeader[5], rtpHeader[6], rtpHeader[7])
-                        }
-                        if ((rtpTimeStamp - lastTime) !== 3600) {
-                            //console.log('SEI 时间差:', (rtpTimeStamp - lastTime), rtpTimeStamp, lastTime)
-                        }
-                        lastTime = rtpTimeStamp;
-                        SEIInfo = {
-                            ivs: null,
-                            timestamp: 0,
-                        };
-                    }
-                    SEIBuffer = null;
-                }
-
-                if(decodeMode === 'canvas' && (frameType !== 'SEI')) {
-                    if (outputSize !== curSize) {
-                        outputSize = curSize;
-                        decoder.setOutputSize(curSize);
-                    }
-
-                    decodedData.frameData = decoder.decode(inputBufferSub);
-                    decodedData.decodeMode = 'canvas';
-                    decodedData.timeStamp = rtpTimeStamp;
-                    decodedData.width = width;
-                    decodedData.height = height;
-                    this.handleDecodedData(decodedData)
-                } else {
-                    if (!initalSegmentFlag) {
-                        decodedData.initSegmentData = null;
-                        decodedData.codecInfo = null;
-                    } else {
-                        initalSegmentFlag = false;
-                        const info = {
-                            id: 1,
-                            width: width,
-                            height: height,
-                            type: "video",
-                            profileIdc: SPSParser.getSpsValue("profile_idc"),
-                            profileCompatibility: 0,
-                            levelIdc: SPSParser.getSpsValue("level_idc"),
-                            sps: [spsSegment],
-                            pps: [ppsSegment],
-                            timescale: 1e3,
-                            fps: frameRate
-                        };
-                        decodedData.initSegmentData = info;
-                        decodedData.codecInfo = SPSParser.getCodecInfo();
-                        //console.log(info.pps)
-                    }
-
-                    if (frameType === 'I') {
-//console.log('ppsSegment: ', ppsSegment)
-                        let h264parameterLength = spsSegment.length + ppsSegment.length + 8;
-                        inputSegBufferSub = inputBufferSub.subarray(h264parameterLength, inputBufferSub.length);
-                    } else {
-                        inputSegBufferSub = inputBufferSub.subarray(0, inputBufferSub.length);
-                    }
-
-                    let segSize = inputSegBufferSub.length - 4;
-                    //mp4 box头
-                    inputSegBufferSub[0] = (segSize & 0xFF000000) >>> 24;
-                    inputSegBufferSub[1] = (segSize & 0xFF0000) >>> 16;
-                    inputSegBufferSub[2] = (segSize & 0xFF00) >>> 8;
-                    inputSegBufferSub[3] = (segSize & 0xFF);
-
-                    decodedData.frameData = new Uint8Array(inputSegBufferSub);
-
-                    let sample = {
-                        duration: Math.round((1 / frameRate) * 1000),
-                        size: inputSegBufferSub.length,
-                        frame_time_stamp: null,
-                        frameDuration: null,
-                    };
-                    sample.frame_time_stamp = rtpTimeStamp; //Todo:暂时为null,通过帧率控制duration
-                    if (initalMediaFrameFlag) {
-                        sample.frameDuration = 0;
-                        initalMediaFrameFlag = false;
-                    } else {
-                        if(frameRate) {
-                            sample.frameDuration = Math.round(1000 / frameRate);
-                        }else {
-                            sample.frameDuration = (sample.frame_time_stamp - preSample.frame_time_stamp) / 90; // 时钟频率90000,timescale=1000
-                        }
-                    }
-                    preSample = sample;
-
-                    decodedData.mediaSample = sample;
-
-                    decodedData.timeStamp = rtpTimeStamp;
-
-                    this.handleDecodedData(decodedData);
-                }
-
-
-                inputLength = 0;
-                decodedData.SEIInfo = null;
-                inputSegBufferSub = null;
-                if(frameType !== 'SEI') {
-                    lastTimeStamp = RtpHeader.timeStamp;
-                }
-                frameType = '';
-            }
-            //console.log('xxxxxxxxxxxxxxxxxxxxxxxxx')
-        },
-
-        set rtpSessionCallback(func) {
-            this.handleDecodedData = func;
-        },
-
-        setFrameRate(fps) {
-            frameRate = fps;
-            //console.log('frameRate: ', frameRate)
-        },
-
-        setResolutionChangedCallback(callback) {
-            this.resolutionChangedCallback = callback;
-        }
-    }
-
-    return new constructor();
-
-    function setBuffer(buffer1, buffer2) {
-        let bufferTemp = buffer1;
-        if ((inputLength + buffer2.length) > buffer1.length) {
-            bufferTemp = new Uint8Array(buffer1.length + size1M);
-        }
-
-        bufferTemp.set(buffer2, inputLength);
-        inputLength += buffer2.length;
-        return bufferTemp;
-    }
-}
-
-
-
-
-/**
- * 去除SPS中的Emulation字节
- * @param data SPS源数据
- * @returns {Array} 去除后Emulation字节后的SPS
- */
-function removeH264or5EmulationBytes(data) {
-    let toSize = 0;
-    let i = 0;
-    let to = [];
-    let dataLength = data.length;
-    while (i < dataLength) {
-        if (i + 2 < dataLength && data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 3) {
-            to[toSize] = to[toSize + 1] = 0;
-            toSize += 2;
-            i += 3;
-        } else {
-            to[toSize] = data[i];
-            toSize += 1;
-            i += 1;
-        }
-    }
-    return to;
-}
-
-/**
- * 解析SEI信息
- * @param data
- * @return {Array}
- */
-function SEIParse(data) {
-    //console.log(data)
-    if((data[0] & 0x1f) !== 6) {
-        //非SEI
-        return null;
-    }
-
-    if(data[1] !== 0x55 || data[2] !== 0x4C ||data[3] !== 0x53 ||data[4] !== 0x40) {
-        //ULS@开头
-        console.warn('unknown SEI type');
-        return null;
-    }
-
-    let dataLength = data.length;
-    let type = (data[5] << 8) + data[6];
-    let checkSum = (data[7] << 8) + data[8];
-    // if(dataLength !== (checkSum + 1 + 4 + 4)) {
-    //     console.log('SEI check fail!');
-    //     return null;
-    // }
-    let result;
-    data = data.subarray(9);
-    switch(type) {
-        case 0:
-            result = parseRect(data);
-            break;
-        case 1:
-            //console.log(parseBody(data))
-            result = parseBody(data);
-            break;
-        default:
-            result = null;
-            break;
-    }
-    return result;
-}
-
-function parseRect(data) {
-    //console.log(data)
-    let dataLength = data.length;
-    let contents = [];
-    while(dataLength > 0) {
-        //console.log('dataLength: ', dataLength)
-        let x0 = ((data[4] & 0x7f) << 8) + data[5],
-            y0 = ((data[6] & 0x7f) << 8) + data[7],
-            width = ((data[8] & 0x7f) << 8) + data[9] - x0,
-            height = ((data[10] & 0x7f) << 8) + data[11] - y0;
-        let content = {
-            type: 'rect',
-            id: (data[2] << 8) + data[3],
-            rect: [x0, y0, width, height],
-            state: data[1] & 0x01,
-            quality: (data[1] & 0x02) >> 1,
-        };
-        Array.prototype.push.apply(contents, [content]);
-        data = data.subarray(12);
-        dataLength = data.length;
-    }
-
-    return contents;
-}
-
-function parseBody(data) {
-    let dataLength = data.length;
-    let contents = [];
-    while(dataLength > 0) {
-        //console.log('dataLength: ', dataLength)
-        let x0 = ((data[4] & 0x7f) << 8) + data[5],
-            y0 = ((data[6] & 0x7f) << 8) + data[7],
-            width = ((data[8] & 0x7f) << 8) + data[9] - x0,
-            height = ((data[10] & 0x7f) << 8) + data[11] - y0,
-            boxConfidence = ((data[12] & 0x7f) << 8) + data[13];
-        let points = [];
-
-        for(let i = 0; i < 17; i++) {
-            let point = {
-                x: ((data[16 + i * 8] & 0x7f) << 8) + data[17 + i * 8],
-                y: ((data[18 + i * 8] & 0x7f) << 8) + data[19 + i * 8],
-                confidence: ((data[20 + i * 8] & 0x7f) << 8) + data[21 + i * 8],
-                // x: Math.random() * 8191,
-                // y: Math.random() * 8191,
-                // confidence: 1,
-            };
-            points.push(point);
-        }
-        let content = {
-            type: 'coco-pose',
-            id: (data[2] << 8) + data[3],
-            handsUp: data[1] & 0x04,
-            boundingBox: [x0, y0, width, height],
-            boxConfidence,
-            points: parseBodyToTree(points),
-            state: data[1] & 0x01,
-        };
-        Array.prototype.push.apply(contents, [content]);
-        data = data.subarray(152);
-        dataLength = data.length;
-
-    }
-    return contents;
-}
-
-/**
- * 将智能帧中的人体姿态点转化为树结构(双亲表示法)
- * @param points
- */
-function parseBodyToTree(points) {
-    let newPoints = [];
-    newPoints[0] = {...points[0], parent: -1, pointColor:'#FF0002', lineColor: '#FF0002'};
-    newPoints[1] = {...points[1], parent: 0, pointColor:'#FF0002', lineColor: '#FF0002'};
-    newPoints[2] = {...points[2], parent: 0, pointColor:'#FF0002', lineColor: '#FF0002'};
-    newPoints[3] = {...points[5], parent: 17, pointColor:'#D9E34F', lineColor: '#FF0002'};
-    newPoints[4] = {...points[6], parent: 17, pointColor:'#D9E34F', lineColor: '#FF0002'};
-    newPoints[5] = {...points[3], parent: 1, pointColor:'#00FF00', lineColor: '#FF0002'};
-    newPoints[6] = {...points[4], parent: 2, pointColor:'#FFAC00', lineColor: '#FF0002'};
-    newPoints[7] = {...points[7], parent: 3, pointColor:'#00FF45', lineColor: '#'};
-    newPoints[8] = {...points[11], parent: 17, pointColor:'#EEC446', lineColor: '#'};
-    newPoints[9] = {...points[8], parent: 4, pointColor:'#43D3AF', lineColor: '#'};
-    newPoints[10] = {...points[12], parent: 17, pointColor:'#7A93E8', lineColor: '#'};
-    newPoints[11] = {...points[9], parent: 7, pointColor:'#EFB842', lineColor: '#'};
-    newPoints[12] = {...points[13], parent: 8, pointColor:'#E56C00', lineColor: '#'};
-    newPoints[13] = {...points[10], parent: 9, pointColor:'#47CD43', lineColor: '#0096FF'};
-    newPoints[14] = {...points[14], parent: 10, pointColor:'#3868D2', lineColor: '#00FF51'};
-    newPoints[15] = {...points[15], parent: 12, pointColor:'#DF4D01', lineColor: '#5100FF'};
-    newPoints[16] = {...points[16], parent: 14, pointColor:'#1E48D4', lineColor: '#00FFA0'};
-    newPoints[17] = {x: (points[5].x + points[6].x) / 2,y: (points[5].y + points[6].y) / 2, parent: -1, pointColor:'#D9E34F', lineColor: '#00FFA0'};
-    return newPoints;
-}

+ 0 - 86
nkApp/static/h265/src/H265.js

@@ -1,86 +0,0 @@
-
-importScripts('./jsFFMPEG.js');
-let initDecoder = null;
-let decoderContext = null;
-let decodeByFFMPEG = null;
-let getWidth = null;
-let getHeight = null;
-let closeContext = null;
-let context = null;
-let outpic = null;
-let outpicptr = null;
-let ID = 265;
-let initialized = false;
-let firstIFrame = true;
-
-class H265Decoder {
-    constructor() {
-
-        initDecoder = Module.cwrap('init_jsFFmpeg', 'void', []);
-        decoderContext = Module.cwrap('context_jsFFmpeg', 'number', ['number']);
-        decodeByFFMPEG = Module.cwrap('decode_video_jsFFmpeg', 'number', ['number', 'array', 'number', 'number']);
-        getWidth = Module.cwrap('get_width', 'number', ['number']);
-        getHeight = Module.cwrap('get_height', 'number', ['number']);
-        closeContext = Module.cwrap('close_jsFFmpeg', 'number', ['number']);
-
-        initDecoder();
-        this.init();
-        initialized = true;
-    }
-    init() {
-        console.log("H265 Decoder init");
-        if (context !== null) {
-            closeContext(context);
-            context = null;
-        }
-        context = decoderContext(ID);
-    }
-
-    setOutputSize(size) {
-        console.log("H265 Decoder setOutputSize");
-        let outpicsize = size * 1.5;
-        outpicptr = Module._malloc(outpicsize);
-        outpic = new Uint8Array(Module.HEAPU8.buffer, outpicptr, outpicsize);
-    }
-
-    decode(data) {
-        if(!initialized) {
-            console.log('未初始化完成')
-            return null;
-        }
-
-        let frameType = (data[4] == 0x40) ? 'I' : 'P';
-        //console.log(data[4] & 0x1f)
-        if(frameType === 'I' && initialized) {
-            firstIFrame = true;
-        }
-        if(!firstIFrame) {
-            console.log('非 firstIFrame')
-            return null;
-        }
-        let beforeDecoding = Date.now();
-        let decodingTime = null;
-        let frameData = null;
-        decodeByFFMPEG(context, data, data.length, outpic.byteOffset);
-        decodingTime = Date.now() - beforeDecoding;
-
-        let width = getWidth(context);
-        let height = getHeight(context);
-
-        //console.log(width, height)
-        if (width > 0 && height > 0) {
-            let copyOutput = new Uint8Array(outpic);
-            frameData = {
-                'data': copyOutput,
-                'width': width,
-                'height': height,
-                'codecType': 'h264',
-                'decodingTime': decodingTime,
-                'frameType': frameType,
-            };
-
-            return frameData;
-        }
-
-    }
-}

+ 0 - 287
nkApp/static/h265/src/H265SPSParser.js

@@ -1,287 +0,0 @@
-"use strict";
-
-
-
-function H265SPSParser() {
-    var vBitCount = 0;
-    var spsMap = null;
-    var pSPSBytes = null;
-
-    function Constructor() {
-        vBitCount = 0;
-        spsMap = new Map();
-    }
-
-    function get_bit(base, offset) {
-        var vCurBytes = (vBitCount + offset) >> 3;
-        offset = (vBitCount + offset) & 0x00000007;
-        return (((base[(vCurBytes)])) >> (0x7 - (offset & 0x7))) & 0x1;
-    }
-
-    function read_bits(pBuf, vReadBits) {
-        var vCurBytes = vBitCount / 8;
-        var vCurBits = vBitCount % 8;
-        var vOffset = 0;
-        var vTmp = 0,
-            vTmp2 = 0;
-
-        if (vReadBits == 1) {
-            vTmp = get_bit(pBuf, vOffset);
-        } else {
-            for (var i = 0; i < vReadBits; i++) {
-                vTmp2 = get_bit(pBuf, i);
-                vTmp = (vTmp << 1) + vTmp2;
-            }
-        }
-
-        vBitCount += vReadBits;
-        return vTmp;
-    }
-
-    function ue(base, offset) {
-        var zeros = 0,
-            vTmp = 0,
-            vReturn = 0;
-        var vIdx = offset;
-        do {
-            vTmp = get_bit(base, vIdx++);
-            if (vTmp == 0)
-                zeros++;
-        } while (0 == vTmp);
-
-        if (zeros == 0) {
-            vBitCount += 1;
-            return 0;
-        }
-
-        // insert first 1 bit
-        vReturn = 1 << zeros;
-
-        for (var i = zeros - 1; i >= 0; i-- , vIdx++) {
-            vTmp = get_bit(base, vIdx);
-            vReturn |= vTmp << i;
-        }
-
-        vBitCount += zeros * 2 + 1;
-
-        return (vReturn - 1);
-    }
-
-    function se(base, offset) {
-        var vReturn = ue(base, offset);
-
-        if (vReturn & 0x1) {
-            return (vReturn + 1) / 2;
-        } else {
-            return -vReturn / 2;
-        }
-    }
-
-    function byte_aligned() {
-        if ((vBitCount & 0x00000007) == 0)
-            return 1;
-        else
-            return 0;
-    }
-
-    function profile_tier_level(profilePresentFlag, maxNumSubLayersMinus1) {
-        if (profilePresentFlag) {
-            spsMap.set("general_profile_space", read_bits(pSPSBytes, 2));
-            spsMap.set("general_tier_flag", read_bits(pSPSBytes, 1));
-            spsMap.set("general_profile_idc", read_bits(pSPSBytes, 5));
-            var generalProfileCompatibilityFlag = new Array(32);
-
-            for (var j = 0; j < 32; j++) {
-                generalProfileCompatibilityFlag[j] = read_bits(pSPSBytes, 1);
-            }
-
-            spsMap.set("general_progressive_source_flag", read_bits(pSPSBytes, 1));
-            spsMap.set("general_interlaced_source_flag", read_bits(pSPSBytes, 1));
-            spsMap.set("general_non_packed_constraint_flag", read_bits(pSPSBytes, 1));
-            spsMap.set("general_frame_only_constraint_flag", read_bits(pSPSBytes, 1));
-
-            var generalProfileIdc = spsMap.get("general_profile_idc");
-            if (generalProfileIdc === 4 || generalProfileCompatibilityFlag[4] ||
-                generalProfileIdc === 5 || generalProfileCompatibilityFlag[5] ||
-                generalProfileIdc === 6 || generalProfileCompatibilityFlag[6] ||
-                generalProfileIdc === 7 || generalProfileCompatibilityFlag[7]) {
-                spsMap.set("general_max_12bit_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_max_10bit_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_max_8bit_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_max_422chroma_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_max_420chroma_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_max_monochrome_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_intra_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_one_picture_only_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_lower_bit_rate_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("general_reserved_zero_34bits", read_bits(pSPSBytes, 34));
-            } else {
-                spsMap.set("general_reserved_zero_43bits", read_bits(pSPSBytes, 43));
-            }
-
-            if ((generalProfileIdc >= 1 && generalProfileIdc <= 5) ||
-                generalProfileCompatibilityFlag[1] || generalProfileCompatibilityFlag[2] ||
-                generalProfileCompatibilityFlag[3] || generalProfileCompatibilityFlag[4] ||
-                generalProfileCompatibilityFlag[5]) {
-                /* The number of bits in this syntax structure is not affected by this condition */
-                spsMap.set("general_inbld_flag", read_bits(pSPSBytes, 1));
-            } else {
-                spsMap.set("general_reserved_zero_bit", read_bits(pSPSBytes, 1));
-            }
-        }
-
-        spsMap.set("general_level_idc", read_bits(pSPSBytes, 8));
-        var subLayerProfilePresentFlag = new Array(maxNumSubLayersMinus1);
-        var subLayerLevelPresentFlag = new Array(maxNumSubLayersMinus1);
-
-        for (i = 0; i < maxNumSubLayersMinus1; i++) {
-            subLayerProfilePresentFlag[i] = read_bits(pSPSBytes, 1);
-            subLayerLevelPresentFlag[i] = read_bits(pSPSBytes, 1);
-        }
-
-        var reservedZero2bits = new Array(8);
-        var subLayerProfileIdc = new Array(maxNumSubLayersMinus1);
-
-        if (maxNumSubLayersMinus1 > 0) {
-            for (var i = maxNumSubLayersMinus1; i < 8; i++) {
-                reservedZero2bits[i] = read_bits(pSPSBytes, 2);
-            }
-        }
-
-        for (var i = 0; i < maxNumSubLayersMinus1; i++) {
-            if (subLayerProfilePresentFlag[i]) {
-                spsMap.set("sub_layer_profile_space", read_bits(pSPSBytes, 2));
-                spsMap.set("sub_layer_tier_flag", read_bits(pSPSBytes, 1));
-                subLayerProfileIdc[i] = read_bits(pSPSBytes, 5);
-
-                for (var j = 0; j < 32; j++) {
-                    subLayerProfileCompatibilityFlag[i][j] = read_bits(pSPSBytes, 1);
-                }
-
-                spsMap.set("sub_layer_progressive_source_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("sub_layer_interlaced_source_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("sub_layer_non_packed_constraint_flag", read_bits(pSPSBytes, 1));
-                spsMap.set("sub_layer_frame_only_constraint_flag", read_bits(pSPSBytes, 1));
-
-                if (subLayerProfileIdc[i] === 4 || subLayerProfileCompatibilityFlag[i][4] ||
-                    subLayerProfileIdc[i] === 5 || subLayerProfileCompatibilityFlag[i][5] ||
-                    subLayerProfileIdc[i] === 6 || subLayerProfileCompatibilityFlag[i][6] ||
-                    subLayerProfileIdc[i] === 7 || subLayerProfileCompatibilityFlag[i][7]) {
-                    /* The number of bits in this syntax structure is not affected by this condition */
-                    spsMap.set("sub_layer_max_12bit_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_max_10bit_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_max_8bit_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_max_422chroma_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_max_420chroma_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_max_monochrome_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_intra_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_one_picture_only_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_lower_bit_rate_constraint_flag", read_bits(pSPSBytes, 1));
-                    spsMap.set("sub_layer_reserved_zero_34bits", read_bits(pSPSBytes, 34));
-                } else {
-                    spsMap.set("sub_layer_reserved_zero_43bits", read_bits(pSPSBytes, 43));
-                }
-
-                if ((subLayerProfileIdc[i] >= 1 && subLayerProfileIdc[i] <= 5) ||
-                    subLayerProfileCompatibilityFlag[1] || subLayerProfileCompatibilityFlag[2] ||
-                    subLayerProfileCompatibilityFlag[3] || subLayerProfileCompatibilityFlag[4] ||
-                    subLayerProfileCompatibilityFlag[5]) {
-                    /* The number of bits in this syntax structure is not affected by this condition */
-                    spsMap.set("sub_layer_inbld_flag", read_bits(pSPSBytes, 1));
-                } else {
-                    spsMap.set("sub_layer_reserved_zero_bit", read_bits(pSPSBytes, 1));
-                }
-            }
-
-            if (subLayerLevelPresentFlag[i]) {
-                spsMap.set("sub_layer_level_idc", read_bits(pSPSBytes, 8));
-            }
-        }
-    }
-
-    Constructor.prototype = {
-        parse: function (spsPayload) {
-            pSPSBytes = spsPayload;
-            //console.log("=========================SPS START=========================");
-            vBitCount = 0;
-            spsMap.clear();
-
-            spsMap.set("forbidden_zero_bit", read_bits(pSPSBytes, 1));
-            spsMap.set("nal_unit_type", read_bits(pSPSBytes, 6));
-            spsMap.set("nuh_layer_id", read_bits(pSPSBytes, 6));
-            spsMap.set("nuh_temporal_id_plus1", read_bits(pSPSBytes, 3));
-
-            spsMap.set("sps_video_parameter_set_id", read_bits(pSPSBytes, 4));
-            if (spsMap.get("nuh_layer_id") === 0) {
-                spsMap.set("sps_max_sub_layers_minus1", read_bits(pSPSBytes, 3));
-            } else {
-                spsMap.set("sps_ext_or_max_sub_layers_minus1", read_bits(pSPSBytes, 3));
-            }
-            var MultiLayerExtSpsFlag = (spsMap.get("nuh_layer_id") !== 0 && spsMap.get("sps_ext_or_max_sub_layers_minus1") === 7);
-
-            if (!MultiLayerExtSpsFlag) {
-                spsMap.set("sps_max_sub_layers_minus1", read_bits(pSPSBytes, 1));
-                //profile_tier_level(1, spsMap.get("sps_max_sub_layers_minus1"));
-            }
-
-            read_bits(pSPSBytes, 84);
-
-            spsMap.set("sps_seq_parameter_set_id", ue(pSPSBytes, 0));
-            if (MultiLayerExtSpsFlag) {
-                spsMap.set("update_rep_format_flag", read_bits(pSPSBytes, 1));
-                if (spsMap.get("update_rep_format_flag")) {
-                    spsMap.set("sps_rep_format_idx", read_bits(pSPSBytes, 8));
-                }
-            } else {
-                spsMap.set("chroma_format_idc", ue(pSPSBytes, 0));
-
-                if (spsMap.get("chroma_format_idc") === 3) {
-                    spsMap.set("separate_colour_plane_flag", read_bits(pSPSBytes, 1));
-                }
-
-                spsMap.set("pic_width_in_luma_samples", ue(pSPSBytes, 0));
-                spsMap.set("pic_height_in_luma_samples", ue(pSPSBytes, 0));
-
-                spsMap.set("conformance_window_flag", read_bits(pSPSBytes, 1));
-
-                if (spsMap.get("conformance_window_flag")) {
-                    spsMap.set("conf_win_left_offset", ue(pSPSBytes, 0));
-                    spsMap.set("conf_win_right_offset", ue(pSPSBytes, 0));
-                    spsMap.set("conf_win_top_offset", ue(pSPSBytes, 0));
-                    spsMap.set("conf_win_bottom_offset", ue(pSPSBytes, 0));
-                }
-            }
-
-            //console.log("=========================SPS END=========================");
-            return true;
-        },
-        getSizeInfo: function () {
-            var width = spsMap.get("pic_width_in_luma_samples");
-            var height = spsMap.get("pic_height_in_luma_samples");
-            if (spsMap.get("conformance_window_flag")) {
-                var chromaFormatIdc = spsMap.get("chroma_format_idc");
-                var separateColourPlaneFlag = spsMap.get("separate_colour_plane_flag");
-                if (typeof separateColourPlaneFlag === "undefined") {
-                    separateColourPlaneFlag = 0;
-                }
-                var subWidthC = ((1 === chromaFormatIdc) || (2 === chromaFormatIdc)) && (0 === separateColourPlaneFlag) ? 2 : 1;
-                var subHeightC = (1 === chromaFormatIdc) && (0 === separateColourPlaneFlag) ? 2 : 1;
-                width -= (subWidthC * spsMap.get("conf_win_right_offset") + subWidthC * spsMap.get("conf_win_left_offset"));
-                height -= (subHeightC * spsMap.get("conf_win_bottom_offset") + subHeightC * spsMap.get("conf_win_top_offset"));
-            }
-            var decodeSize = width * height;
-
-            var sizeInfo = {
-                'width': width,
-                'height': height,
-                'decodeSize': decodeSize
-            };
-
-            return sizeInfo;
-        },
-        getSpsValue: function (key) {
-            return spsMap.get(key);
-        },
-    };
-    return new Constructor();
-}

+ 0 - 416
nkApp/static/h265/src/H265Session.js

@@ -1,416 +0,0 @@
-/* exported H265Session */
-/* global Uint8Array, H265SPSParser, H265Decoder, inheritObject,
-  RtpSession, VideoBufferList, ArrayBuffer, decodeMode */
-/* eslint-disable no-magic-numbers */
-
-var H265Session = function () {
-    'use strict';
-    var rtpTimeStamp = 0,
-        inputLength = 0,
-        size1K = 1024,
-        size1M = size1K * size1K,
-        playback = false,
-        outputSize = 0,
-        curSize = 0,
-        inputBuffer = new Uint8Array(size1M),
-        PREFIX = new Uint8Array(4),
-        SPSParser = null,
-        privIRtpTime = 0,
-        // frameDiffTime = 0,
-        // needDropCnt = 0,
-        delayingTime = 0,
-        DELAY_LIMIT = 8000,
-        decodedData = {
-            frameData: null,
-            timeStamp: null,
-        },
-        timeData = {
-            'timestamp': null,
-            'timezone': null,
-        },
-        frameRate = 0;
-    var width = 0,
-        height = 0;
-
-    PREFIX[0] = '0x00';
-    PREFIX[1] = '0x00';
-    PREFIX[2] = '0x00';
-    PREFIX[3] = '0x01';
-
-    var setBuffer = function (buffer1, buffer2) {
-        var tempBuffer = buffer1;
-        if ((inputLength + buffer2.length) > tempBuffer.length) {
-            tempBuffer = new Uint8Array(tempBuffer.length + size1M);
-        }
-
-        tempBuffer.set(buffer2, inputLength);
-        inputLength += buffer2.length;
-        return tempBuffer;
-    };
-
-    var decodeMode = 'canvas';
-
-    function Constructor() {
-        this.decoder = new H265Decoder();
-    }
-
-    Constructor.prototype = {
-        init: function () {
-            SPSParser = new H265SPSParser();
-            console.log(SPSParser.parse)
-            //this.decoder.setIsFirstFrame(false);
-            this.videoBufferList = new VideoBufferList();
-            this.firstDiffTime = 0;
-            this.checkDelay = true;
-        },
-        setFrameRate(fps) {
-            frameRate = fps;
-            //console.log('frameRate: ', frameRate)
-        },
-        remuxRTPData: function (rtspInterleaved, rtpHeader, rtpPayload, isBackup) {
-            var HEADER = rtpHeader,
-                PAYLOAD = null,
-                timeData = {
-                    'timestamp': null,
-                    'timezone': null,
-                },
-                extensionHeaderLen = 0,
-                PaddingSize = 0,
-                data = {};
-
-            if (rtspInterleaved[0] !== 0x24) {
-                console.log("H265Session::it is not valid interleave header (RTSP over TCP)");
-                return;
-            } else if ((rtpHeader[0] & 0x0F) === 0x0F) {
-                console.log("H265Session::There is additional CSRC which is not handled in this version");
-                return;
-            } else if ((rtpHeader[0] & 0x20) === 0x20) {
-                PaddingSize = rtpPayload[rtpPayload.length - 1];
-                console.log("H265Session::PaddingSize - " + PaddingSize);
-            }
-
-            //Extension bit check in RTPHeader
-            if ((rtpHeader[0] & 0x10) === 0x10) {
-                extensionHeaderLen = (((rtpPayload[2] << 8) | rtpPayload[3]) * 4) + 4;
-
-                //Playback check
-                if (rtpPayload[0] === 0xAB && rtpPayload[1] === 0xAD) {
-                    var startHeader = 4,
-                        NTPmsw = new Uint8Array(new ArrayBuffer(4)),
-                        NTPlsw = new Uint8Array(new ArrayBuffer(4)),
-                        gmt = new Uint8Array(new ArrayBuffer(2)),
-                        fsynctime = {
-                            'seconds': null,
-                            'useconds': null,
-                        },
-                        microseconds = null;
-
-                    NTPmsw.set(rtpPayload.subarray(startHeader, startHeader + 4), 0);
-                    startHeader += 4;
-
-                    NTPlsw.set(rtpPayload.subarray(startHeader, startHeader + 4), 0);
-                    startHeader += 6;
-
-                    gmt.set(rtpPayload.subarray(startHeader, startHeader + 2), 0);
-
-                    microseconds = (this.ntohl(NTPlsw) / 0xffffffff) * 1000;
-                    fsynctime.seconds = ((this.ntohl(NTPmsw) - 0x83AA7E80) >>> 0);
-                    fsynctime.useconds = microseconds;
-                    gmt = (((gmt[0] << 8) | gmt[1]) << 16) >> 16;
-
-                    timeData = {
-                        timestamp: fsynctime.seconds,
-                        timestamp_usec: fsynctime.useconds,
-                        timezone: gmt,
-                    };
-
-                    if ((this.getFramerate() === 0 || typeof this.getFramerate() === "undefined") &&
-                        (typeof this.getTimeStamp() !== "undefined")) {
-                        var diffUsec = timeData.timestamp_usec - this.getTimeStamp().timestamp_usec;
-                        this.setFramerate(Math.round(1000 / (((timeData.timestamp -
-                            this.getTimeStamp().timestamp) === 0 ? 0 : 1000) + (diffUsec))));
-                    }
-                    this.setTimeStamp(timeData);
-                    playback = true;
-                }
-            }
-
-            PAYLOAD = rtpPayload.subarray(extensionHeaderLen, rtpPayload.length - PaddingSize);
-            rtpTimeStamp = this.ntohl(rtpHeader.subarray(4, 8));
-
-            var nalType = (PAYLOAD[0] >> 1) & 0x3f;
-
-            switch (nalType) {
-                default:
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    break;
-                // Fragmentation unit(FU)
-                case 49:
-                    var startBit = ((PAYLOAD[2] & 0x80) === 0x80);
-                    var endBit = ((PAYLOAD[2] & 0x40) === 0x40);
-                    var fuType = PAYLOAD[2] & 0x3f;
-                    var payloadStartIndex = 3;
-
-                    if (startBit === true && endBit === false) {
-                        var newNalHeader = new Uint8Array(2);
-                        newNalHeader[0] = (PAYLOAD[0] & 0x81) | (fuType << 1);
-                        newNalHeader[1] = PAYLOAD[1];
-
-                        inputBuffer = setBuffer(inputBuffer, PREFIX);
-                        inputBuffer = setBuffer(inputBuffer, newNalHeader);
-                        inputBuffer = setBuffer(inputBuffer,
-                            PAYLOAD.subarray(payloadStartIndex, PAYLOAD.length));
-                    } else {
-                        inputBuffer = setBuffer(inputBuffer,
-                            PAYLOAD.subarray(payloadStartIndex, PAYLOAD.length));
-                    }
-                    break;
-                //SPS
-                case 33:
-                    SPSParser.parse(PAYLOAD);
-                    var resolution = SPSParser.getSizeInfo();
-                    curSize = resolution.width * resolution.height;
-                    if (playback && !isBackup) {
-                        var limitSize = 1280 * 720;
-                        if (curSize > limitSize) {
-                            data.error = {
-                                errorCode: "998",
-                                description: "Resolution is too big",
-                                place: "h265Session.js",
-                            };
-                            this.rtpReturnCallback(data);
-                            return; // data;
-                        }
-                    }
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    width = resolution.width;
-                    height = resolution.height;
-                    break;
-            } //end of switch(nalType)
-            //case 48 Remove because not use more
-
-            //check marker bit
-            var frameType = '';
-            if ((HEADER[1] & 0x80) === 0x80) {
-                // var DepacketizingTime = Date.now() - beforeDepacketizing;
-                if (outputSize !== curSize) {
-                    outputSize = curSize;
-                    this.decoder.setOutputSize(outputSize);
-                }
-
-                var inputBufferSub = inputBuffer.subarray(0, inputLength);
-                if (inputBufferSub[4] === 0x40) {
-                    frameType = 'I';
-                    if (this.firstDiffTime == 0) {
-                        privIRtpTime = rtpTimeStamp;
-                        delayingTime = 0;
-                        this.firstDiffTime = (Date.now() - (rtpTimeStamp / 90).toFixed(0));
-                        // needDropCnt = 0;
-                    } else {
-                        // frameDiffTime = Math.round(((rtpTimeStamp / 90).toFixed(0) - privIRtpTime) / this.getGovLength());
-                        if((rtpTimeStamp - privIRtpTime) < 0){
-                            this.firstDiffTime = delayingTime + (Date.now() - (rtpTimeStamp / 90).toFixed(0));
-                            // console.log("firstDiffTime = " + this.firstDiffTime + " rtpTimeStamp = " + rtpTimeStamp + " privIRtpTime = " + privIRtpTime );
-                        }
-                        delayingTime = (Date.now() - (rtpTimeStamp / 90).toFixed(0)) - this.firstDiffTime;
-                        privIRtpTime = rtpTimeStamp;
-                        if (delayingTime > DELAY_LIMIT) {
-                            if (this.checkDelay === true && playback === false) {
-                                data.error = {
-                                    errorCode: "997",
-                                    description: "Delay time is too long",
-                                    place: "h265Session.js",
-                                };
-                                // console.log("h265Session::Delay time is too long 997 error ");
-
-                                this.rtpReturnCallback(data);
-                                return; // data;
-                            }
-                        }
-                        // needDropCnt = (needDropCnt > 0) ? Math.round(needDropCnt / frameDiffTime) : 0;
-                    }
-                } else {
-                    frameType = 'P';
-                }
-
-                decodedData.frameData = null;
-                if (isBackup !== true || playback !== true) {
-                    console.log('frameType', frameType)
-                    decodedData.frameData = this.decoder.decode(inputBufferSub);
-                }
-
-                decodedData.timeStamp = null;
-                inputLength = 0;
-                if (playback === true) {
-                    timeData = (timeData.timestamp === null ? this.getTimeStamp() : timeData);
-                    decodedData.timeStamp = timeData;
-                }
-                if (isBackup) {
-                    data.backupData = {
-                        'stream': inputBufferSub,
-                        'frameType': frameType,
-                        'width': width,
-                        'height': height,
-                        'codecType': 'h265',
-                    };
-                    if (timeData.timestamp !== null && typeof timeData.timestamp !== "undefined") {
-                        data.backupData.timestamp_usec = timeData.timestamp_usec;
-                    } else {
-                        data.backupData.timestamp = (rtpTimeStamp / 90).toFixed(0);
-                    }
-                }
-                data.decodedData = decodedData;
-                if (decodeMode !== "canvas") {
-                    data.decodeMode = "canvas";
-                }
-                console.log(data)
-                this.rtpReturnCallback(data);
-                return; // data;
-            }
-        },
-        bufferingRtpData: function (rtspInterleaved, rtpHeader, rtpPayload) {
-            var HEADER = rtpHeader,
-                PAYLOAD = null,
-                extensionHeaderLen = 0,
-                PaddingSize = 0;
-
-            if (rtspInterleaved[0] !== 0x24) {
-                console.log("H265Session::it is not valid interleave header (RTSP over TCP)");
-                return;
-            } else if ((rtpHeader[0] & 0x0F) === 0x0F) {
-                console.log("H265Session::There is additional CSRC which is not handled in this version");
-                return;
-            } else if ((rtpHeader[0] & 0x20) === 0x20) {
-                PaddingSize = rtpPayload[rtpPayload.length - 1];
-                console.log("H265Session::PaddingSize - " + PaddingSize);
-            }
-
-            //Extension bit check in RTPHeader
-            if ((rtpHeader[0] & 0x10) === 0x10) {
-                extensionHeaderLen = (((rtpPayload[2] << 8) | rtpPayload[3]) * 4) + 4;
-
-                //Playback check
-                if (rtpPayload[0] === 0xAB && rtpPayload[1] === 0xAD) {
-                    var startHeader = 4,
-                        NTPmsw = new Uint8Array(new ArrayBuffer(4)),
-                        NTPlsw = new Uint8Array(new ArrayBuffer(4)),
-                        gmt = new Uint8Array(new ArrayBuffer(2)),
-                        fsynctime = {
-                            'seconds': null,
-                            'useconds': null,
-                        },
-                        microseconds = null;
-
-                    NTPmsw.set(rtpPayload.subarray(startHeader, startHeader + 4), 0);
-                    startHeader += 4;
-
-                    NTPlsw.set(rtpPayload.subarray(startHeader, startHeader + 4), 0);
-                    startHeader += 6;
-
-                    gmt.set(rtpPayload.subarray(startHeader, startHeader + 2), 0);
-
-                    microseconds = (this.ntohl(NTPlsw) / 0xffffffff) * 1000;
-                    fsynctime.seconds = ((this.ntohl(NTPmsw) - 0x83AA7E80) >>> 0);
-                    fsynctime.useconds = microseconds;
-                    gmt = (((gmt[0] << 8) | gmt[1]) << 16) >> 16;
-
-                    timeData = {
-                        timestamp: fsynctime.seconds,
-                        timestamp_usec: fsynctime.useconds,
-                        timezone: gmt,
-                    };
-                    playback = true;
-                }
-            }
-
-            PAYLOAD = rtpPayload.subarray(extensionHeaderLen, rtpPayload.length - PaddingSize);
-
-            rtpTimeStamp = new Uint8Array(new ArrayBuffer(4));
-            rtpTimeStamp.set(rtpHeader.subarray(4, 8), 0);
-            rtpTimeStamp = this.ntohl(rtpTimeStamp);
-
-            var nalType = (PAYLOAD[0] >> 1) & 0x3f;
-
-            switch (nalType) {
-                default:
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    break;
-                // Fragmentation unit(FU)
-                case 49:
-                    var startBit = ((PAYLOAD[2] & 0x80) === 0x80);
-                    var endBit = ((PAYLOAD[2] & 0x40) === 0x40);
-                    var fuType = PAYLOAD[2] & 0x3f;
-                    var payloadStartIndex = 3;
-
-                    if (startBit === true && endBit === false) {
-                        var newNalHeader = new Uint8Array(2);
-                        newNalHeader[0] = (PAYLOAD[0] & 0x81) | (fuType << 1);
-                        newNalHeader[1] = PAYLOAD[1];
-
-                        inputBuffer = setBuffer(inputBuffer, PREFIX);
-                        inputBuffer = setBuffer(inputBuffer, newNalHeader);
-                        inputBuffer = setBuffer(inputBuffer,
-                            PAYLOAD.subarray(payloadStartIndex, PAYLOAD.length));
-                    } else {
-                        inputBuffer = setBuffer(inputBuffer,
-                            PAYLOAD.subarray(payloadStartIndex, PAYLOAD.length));
-                    }
-                    break;
-                //SPS
-                case 33:
-                    SPSParser.parse(PAYLOAD);
-                    var resolution = SPSParser.getSizeInfo();
-                    curSize = resolution.width * resolution.height;
-                    inputBuffer = setBuffer(inputBuffer, PREFIX);
-                    inputBuffer = setBuffer(inputBuffer, PAYLOAD);
-                    width = resolution.width;
-                    height = resolution.height;
-                    break;
-            } //end of switch(nalType)
-            //case 48 Remove because not use more
-
-            //check marker bit
-            if ((HEADER[1] & 0x80) === 0x80) {
-                if (outputSize !== curSize) {
-                    outputSize = curSize;
-                    this.decoder.setOutputSize(outputSize);
-                }
-
-                var stepBufferSub = new Uint8Array(inputBuffer.subarray(0, inputLength));
-
-                if (this.videoBufferList !== null) {
-                    this.videoBufferList.push(stepBufferSub, width, height,
-                        'h265', (stepBufferSub[4] === 0x40) ? 'I' : 'P', timeData);
-                }
-                inputLength = 0;
-            }
-        },
-        findIFrame: function () {
-            if (this.videoBufferList !== null) {
-                var bufferNode = this.videoBufferList.findIFrame();
-                if (bufferNode === null || typeof bufferNode === "undefined") {
-                    return false;
-                } else {
-                    var data = {};
-                    this.setTimeStamp(bufferNode.timeStamp);
-                    data.frameData = this.decoder.decode(bufferNode.buffer);
-                    data.timeStamp = bufferNode.timeStamp;
-                    return data;
-                }
-            }
-        },
-        ntohl: function (buffer) {
-            return (((buffer[0] << 24) + (buffer[1] << 16) +
-                (buffer[2] << 8) + buffer[3]) >>> 0);
-        },
-        set rtpSessionCallback(func) {
-            this.rtpReturnCallback = func;
-        },
-    };
-
-    return new Constructor();
-};
-/* eslint-enable no-magic-numbers */

+ 0 - 0
nkApp/static/h265/src/H265Session2.js


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio