绍兴公厕前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1 lines
10 KiB

var IvsSession=function(){function a(){this.firstTime=0,this.lastMSW=0}function b(a){var b={result:!0,type:0};return b.params=JSON.parse(String.fromCharCode.apply(null,a)),b}function c(a){var b={result:!1},c=0,d=(a[c+1]<<8)+a[c];if(1!==d&&2!==d)return b;b.result=!0,b.type=5,b.params=null,c+=2;var e=a[c];if(0===e)return b;c+=1;var f=a[c];c+=1,b.params={},b.params.coordinate=128&f?8192:1024,b.params.isTrack=127&f?!0:!1,b.params.object=[];for(var g=0;e>g;g++){var h={};h.objectId=(a[c+3]<<24)+(a[c+2]<<16)+(a[c+1]<<8)+a[c],c+=4,h.operateType=a[c],c+=1;var i=a[c];c+=1,h.objectType=a[c],c+=1;var j=a[c];c+=1,c+=1,c+=1,h.classID=a[c],c+=1,h.subType=a[c],c+=1,j>0&&(h.fatherId=[]);for(var k=0;j>k;k++)h.fatherId.push((a[c+3]<<24)+(a[c+2]<<16)+(a[c+1]<<8)+a[c]),c+=4;i>0&&(h.track=[]);for(var l=0;i>l;l++){var m=(a[c+1]<<8)+a[c];c+=2;var n=(a[c+1]<<8)+a[c];c+=2;var o=(a[c+1]<<8)+a[c];c+=2;var p=(a[c+1]<<8)+a[c];c+=2,h.track.push([m-o,n-p,m+o,n+p])}b.params.object.push(h)}return b}function d(a,b){b.hasOwnProperty("attribute80")||(b.attribute80=[]);var c=1,d=a[c];c+=1;var e={};e.color={},e.color.valid=a[c],c+=1,e.carModel=a[c],c+=1,e.color.red=a[c],c+=1,e.color.green=a[c],c+=1,e.color.blue=a[c],c+=1,e.color.alpha=a[c],c+=1,e.brand=(a[c+1]<<8)+a[c],c+=2,e.subBrand=(a[c+1]<<8)+a[c],c+=2,e.year=(a[c+1]<<8)+a[c],c+=2,e.reliability=a[c],c+=1,c+=1;var f=(a[c+1]<<8)+a[c];c+=2;var g=(a[c+1]<<8)+a[c];c+=2;var h=(a[c+1]<<8)+a[c];c+=2;var i=(a[c+1]<<8)+a[c];return c+=2,e.windowPosition=[f-h,g-i,f+h,g+i],b.attribute80.push(e),d}function e(a,b){b.hasOwnProperty("attribute81")||(b.attribute81=[]);var c={},d=1,e=a[d];d+=1;var f=(a[d+1]<<8)+a[d];d+=2;var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];return d+=2,c.mainPosition=[f-h,g-i,f+h,g+i],f=(a[d+1]<<8)+a[d],d+=2,g=(a[d+1]<<8)+a[d],d+=2,h=(a[d+1]<<8)+a[d],d+=2,i=(a[d+1]<<8)+a[d],d+=2,c.coPosition=[f-h,g-i,f+h,g+i],c.mainSafetyBelt=a[d]>>2&3,c.coSafetyBelt=3&a[d],d+=1,c.mainSunvisor=a[d]>>2&3,c.coSunvisor=3&a[d],d+=1,b.attribute81.push(c),e}function f(a,b){b.hasOwnProperty("attribute82")||(b.attribute82=[]);var c={},d=1,e=a[d];return d+=1,c.plateEncode=a[d],d+=1,c.plateInfoLen=a[d],d+=1,c.plateInfo=a.subarray(d,d+c.plateInfoLen),b.attribute82.push(c),e}function g(a,b){b.hasOwnProperty("attribute83")||(b.attribute83=[]);var c={},d=1,e=a[d];return d+=1,c.color={},c.color.valid=a[d],d+=1,c.color.red=a[d],d+=1,c.color.green=a[d],d+=1,c.color.blue=a[d],d+=1,c.color.alpha=a[d],d+=1,c.country=String.fromCharCode.apply(null,a.subarray(d,d+4)),d+=4,c.plateType=(a[d+1]<<8)+a[d],d+=2,d+=1,c.plateWidth=(a[d+1]<<8)+a[d],b.attribute83.push(c),e}function h(a,b){b.hasOwnProperty("attribute84")||(b.attribute84=[]);var c={},d=1,e=a[d];d+=1,c.fatherCount=a[d],d+=1,c.trackCount=a[d],d+=1,c.trackType=a[d],d+=1,d+=3,c.fatherCount>0&&(c.fatherID=[]);for(var f=0;f<c.fatherCount;f++)c.fatherID.push((a[d+3]<<24)+(a[d+2]<<16)+(a[d+1]<<8)+a[d]),d+=4;c.trackCount>0&&(c.track=[]);for(var g=0;g<c.trackCount;g++){var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2;var j=(a[d+1]<<8)+a[d];d+=2;var k=(a[d+1]<<8)+a[d];d+=2,c.track.push([h-j,i-k,h+j,i+k])}return b.attribute84.push(c),e}function i(a,b){b.hasOwnProperty("attribute85")||(b.attribute85=[]);var c={},d=1,e=a[d];d+=1,c.colorSpace=a[d],d+=1,c.mainColorCount=a[d],d+=1,c.mainColorCount>0&&(c.mainColorInfo=[]);for(var f=0;f<c.mainColorCount;f++){var g={},h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2;var j=(a[d+1]<<8)+a[d];d+=2;var k=(a[d+1]<<8)+a[d];d+=2,g.rect=[h-j,i-k,h+j,i+k],g.color=(a[d+3]<<24)+(a[d+2]<<16)+(a[d+1]<<8)+a[d],d+=4,c.mainColorInfo.push(g)}return b.attribute85.push(c),e}function j(a,b){b.hasOwnProperty("attribute86")||(b.attribute86=[]);var c={},d=1,e=a[d];return d+=1,d+=1,c.speedType=a[d],d+=1,c.speed=a[d+1]<<8+a[d],d+=2,c.speedX=a[d+1]<<8+a[d],d+=2,c.speedY=(a[d+1]<<8)+a[d],b.attribute86.push(c),e}function k(a,b){b.hasOwnProperty("attribute87")||(b.attribute87=[]);var c={},d=1,e=a[d];d+=1,d+=2;var f=(a[d+1]<<8)+a[d];d+=2;var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];return c.track=[[f-h,g-i,f+h,g+i]],b.attribute87.push(c),e}function l(a,b){b.hasOwnProperty("attribute88")||(b.attribute88=[]);var c={},d=1;return d+=1,c.age=a[d],d+=1,c.sex=a[d],d+=1,c.face=a[d],d+=1,c.glass=a[d],d+=1,c.hat=a[d],d+=1,c.call=a[d],d+=1,c.backpack=a[d],d+=1,c.umbrella=a[d],d+=1,c.height=a[d],d+=1,c.mask=a[d]>>2&3,c.beard=3&a[d],b.attribute88.push(c),len}function m(a,b){b.hasOwnProperty("attribute89")||(b.attribute89=[]);var c={},d=1,e=a[d];d+=1,c.yawAngle=parseInt((a[d+1]<<8)+a[d]),d+=2,c.rollAngle=parseInt((a[d+1]<<8)+a[d]),d+=2,c.pitchAngle=parseInt((a[d+1]<<8)+a[d]),d+=2;var f=(a[d+1]<<8)+a[d];d+=2;var g=(a[d+1]<<8)+a[d];d+=2,c.lEyePos=[f,g],f=(a[d+1]<<8)+a[d],d+=2,g=(a[d+1]<<8)+a[d],d+=2,c.rEyePos=[f,g],f=(a[d+1]<<8)+a[d],d+=2,g=(a[d+1]<<8)+a[d],d+=2,c.nosePos=[f,g],f=(a[d+1]<<8)+a[d],d+=2,g=(a[d+1]<<8)+a[d],d+=2,c.lMouthPos=[f,g],f=(a[d+1]<<8)+a[d],d+=2,g=(a[d+1]<<8)+a[d],d+=2,c.rMouthPos=[f,g];var h=a[d];d+=3,h>0&&(c.featurePos=[]);for(var i=0;h>i;i++)f=(a[d+1]<<8)+a[d],d+=2,g=(a[d+1]<<8)+a[d],d+=2,c.featurePos.push([f,g]);return b.attribute89.push(c),e}function n(a,b){b.hasOwnProperty("attribute8C")||(b.attribute8C=[]);var c={},d=1,e=a[d];d+=1,c.hangingCount=a[d],d+=1,c.tissueCount=a[d],d+=1,c.sunVisorCount=a[d],d+=1,c.annualInspectionCount=a[d],d+=1,d+=6,c.hangingCount>0&&(c.hangingCount=[]);for(var f=0;f<c.hangingCount;f++){var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2;var j=(a[d+1]<<8)+a[d];d+=2,c.hangingPos.push([g-i,h-j,g+i,h+j])}c.tissueCount>0&&(c.tissueCount=[]);for(var f=0;f<c.tissueCount;f++){var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2;var j=(a[d+1]<<8)+a[d];d+=2,c.tissueCount.push([g-i,h-j,g+i,h+j])}c.sunVisorCount>0&&(c.sunVisorCount=[]);for(var f=0;f<c.tissueCount;f++){var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2;var j=(a[d+1]<<8)+a[d];d+=2,c.sunVisorCount.push([g-i,h-j,g+i,h+j])}c.annualInspectionCount>0&&(c.annualInspectionCount=[]);for(var f=0;f<c.tissueCount;f++){var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2;var j=(a[d+1]<<8)+a[d];d+=2,c.annualInspectionCount.push([g-i,h-j,g+i,h+j])}return b.attribute8C.push(c),e}function o(a,b){b.hasOwnProperty("attribute8E")||(b.attribute8E=[]);var c={},d=1,e=a[d];d+=1,c.nameCodecFormat=a[d],d+=1;var f=a[d];return d+=1,c.name=String.fromCharCode.apply(null,a.subarray(d,f)),b.attribute8E.push(c),e}function p(a,b){for(var c={128:d,129:e,130:f,131:g,132:h,133:i,134:j,135:k,136:l,137:m,140:n,142:o},p=0,q=a[p];p<a.length;){var r=a.subarray(p,a.length),s=c[q].call(null,r,b);p+=s}}function q(a,b){b.hasOwnProperty("vehicleObject")||(b.vehicleObject=[]);var c={},d=0;c.type=a[d],d+=1,d+=1;var e=(a[d+1]<<8)+a[d];d+=2,c.objectId=(a[d+3]<<24)+(a[d+2]<<16)+(a[d+1]<<8)+a[d],d+=4;var f=(a[d+1]<<8)+a[d];d+=2;var g=(a[d+1]<<8)+a[d];d+=2;var h=(a[d+1]<<8)+a[d];d+=2;var i=(a[d+1]<<8)+a[d];d+=2,c.track=[[f-h,g-i,f+h,g+i]],c.valid=a[d],d+=1,c.operateType=a[d],d+=1,d+=2;var j=a.subarray(d,e);return p(j,c),b.vehicleObject.push(c),e}function r(a,b){b.hasOwnProperty("faceObject")||(b.faceObject=[]);var c={},d=0;c.type=a[d],d+=1,d+=1;var e=(a[d+1]<<8)+a[d];return 12>e?0:(d+=2,c.objectId=(a[d+3]<<24)+(a[d+2]<<16)+(a[d+1]<<8)+a[d],d+=4,c.version=a[d],d+=1,d+=3,c.faceData=a.subarray(d,e),b.faceObject.push(c),e)}function s(a,b){b.hasOwnProperty("commonObject")||(b.commonObject=[]);var c={},d=0;c.type=a[d],d+=1,d+=1;var e=(a[d+1]<<8)+a[d];d+=2,c.objectId=(a[d+3]<<24)+(a[d+2]<<16)+(a[d+1]<<8)+a[d],d+=4,c.operateType=a[d],d+=1,d+=3;var f=a.subarray(d,e);return p(f,c),b.commonObject.push(c),e}function t(a,b,c){var d=0,e=(a[d+3]<<24)+(a[d+2]<<16)+(a[d+1]<<8)+a[d];d+=4;var f=a[d];if(d+=1,d+=3,0==f)return d;b.params.groupId=e,b.params.object={};for(var g=0;f>g;g++){var h=a[d],i=a.subarray(d,a.length),j=0;switch(h){case 2:case 5:j=q(i,b.params.object);break;case 15:j=r(i,b.params.object);break;default:j=s(i,b.params.object)}if(0==j)return 0;d+=j}return c({ivsDraw:b,timeStamp:y}),d}function u(a,b,c){var d={result:!1,type:14,params:{coordinate:8192}};if(b.length<32)return d.result=!0,c({ivsDraw:d,timeStamp:y}),!1;var e=4;d.params.classID=a;var f=b[e];if(0==f)return c({ivsDraw:d,timeStamp:y}),!0;d.params.groupCount=f,e+=1,e+=7,d.params.cameral=[];for(var g=0;20>g;g++)d.params.cameral.push(b[e+g]);e+=20;for(var h=0;h<d.params.groupCount;h++){var i=b.subarray(e,b.length),j=t(i,JSON.parse(JSON.stringify(d)),c);if(0>=j)break;e+=j}}function v(a,b){for(var c=a.length,d=0;c>d+4;){var e=a[d],f=(a[d+1],(a[d+3]<<8)+a[d+2]),g=a.subarray(d,f);if(d+=f,161!==e&&!u(A[e-64],g,b))break}}function w(a,d,e){var f=d[22],g=d.subarray(24+f,d.length-8);switch(a){case 0:e({ivsDraw:b(g),timeStamp:y});break;case 5:e({ivsDraw:c(g),timeStamp:y});break;case 6:break;case 14:v(g,e)}}var x,y,z=null,A={1:"VideoSynopsis",2:"TrafficGate",3:"ElectronicPolice",4:"SinglePtzParking",5:"PtzParking",6:"Traffic",7:"Normal",8:"Prison",9:"ATM",10:"MetroIVS",11:"FaceDetection",12:"FaceRecognition",13:"NumberStat",14:"HeatMap",15:"VideoDiagnosis",16:"VideoEnhance",17:"SmokeFireDetect",18:"VehicleAnalyse",19:"PersonFeature",20:"SDFaceDetect",21:"HeatMapPlan",22:"ATMFD",23:"SCR",24:"NumberStatPlan",25:"CourseRecord",26:"Highway",27:"City",28:"LeTrack",29:"ObjectStruct",30:"Stereo",31:"StereoPc",32:"HumanDetect",33:"SDPedestrain",34:"FaceAnalysis",35:"FaceAttribute",36:"FacePicAnalyse",37:"SDEP",38:"XRayDetect",39:"ObjectDetect",40:"CrowdDistriMap",41:"StereoBehavior"};return a.prototype={init:function(){debug.log("init")},parseRTPData:function(a,b){var c=(b[19]<<24)+(b[18]<<16)+(b[17]<<8)+b[16]>>>0,d=Date.UTC("20"+(c>>26),(c>>22&15)-1,c>>17&31,c>>12&31,c>>6&63,63&c)/1e3;if(d-=28800,0==this.firstTime)this.firstTime=d,this.lastMSW=0,z=(b[21]<<8)+b[20],y={timestamp:this.firstTime,timestamp_usec:0};else{var e,f=(b[21]<<8)+b[20];e=f>=z?f-z:f+65535-z,this.lastMSW+=e,d>this.firstTime&&(this.lastMSW-=1e3),this.firstTime=d,y={timestamp:d,timestamp_usec:this.lastMSW},z=f}x=b[5],w(x,b,this.rtpReturnCallback)},setBufferfullCallback:function(){},setReturnCallback:function(a){this.rtpReturnCallback=a}},new a};