整理代码,强化录像转码函数功能
This commit is contained in:
@@ -508,12 +508,12 @@ function scoreValid()
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
function dumpRecording(L)
|
function dumpRecording(list)
|
||||||
local out=""
|
local out=""
|
||||||
local buffer=""
|
local buffer=""
|
||||||
local prevFrm=0
|
local prevFrm=0
|
||||||
local p=1
|
local p=1
|
||||||
while L[p]do
|
while list[p]do
|
||||||
--Check buffer size
|
--Check buffer size
|
||||||
if #buffer>10 then
|
if #buffer>10 then
|
||||||
out=out..buffer
|
out=out..buffer
|
||||||
@@ -521,8 +521,8 @@ function dumpRecording(L)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Encode time
|
--Encode time
|
||||||
local t=L[p]-prevFrm
|
local t=list[p]-prevFrm
|
||||||
prevFrm=L[p]
|
prevFrm=list[p]
|
||||||
while t>=255 do
|
while t>=255 do
|
||||||
buffer=buffer.."\255"
|
buffer=buffer.."\255"
|
||||||
t=t-255
|
t=t-255
|
||||||
@@ -530,7 +530,7 @@ function dumpRecording(L)
|
|||||||
buffer=buffer..char(t)
|
buffer=buffer..char(t)
|
||||||
|
|
||||||
--Encode key
|
--Encode key
|
||||||
t=L[p+1]
|
t=list[p+1]
|
||||||
buffer=buffer..char(t>0 and t or 256+t)
|
buffer=buffer..char(t>0 and t or 256+t)
|
||||||
|
|
||||||
--Step
|
--Step
|
||||||
@@ -538,12 +538,19 @@ function dumpRecording(L)
|
|||||||
end
|
end
|
||||||
return data.encode("string","base64",out..buffer)
|
return data.encode("string","base64",out..buffer)
|
||||||
end
|
end
|
||||||
function parseRecording(str)
|
function pumpRecording(str,L)
|
||||||
str=data.decode("string","base64",str)
|
str=data.decode("string","base64",str)
|
||||||
local len=#str
|
local len=#str
|
||||||
local L={}
|
|
||||||
local p=1
|
local p=1
|
||||||
local curFrm=0
|
|
||||||
|
local list,curFrm
|
||||||
|
if L then
|
||||||
|
list=L
|
||||||
|
curFrm=L[#L-1]
|
||||||
|
else
|
||||||
|
list={}
|
||||||
|
curFrm=0
|
||||||
|
end
|
||||||
|
|
||||||
while p<=len do
|
while p<=len do
|
||||||
--Read delta time
|
--Read delta time
|
||||||
@@ -555,15 +562,15 @@ function parseRecording(str)
|
|||||||
goto nextByte
|
goto nextByte
|
||||||
end
|
end
|
||||||
curFrm=curFrm+b
|
curFrm=curFrm+b
|
||||||
L[#L+1]=curFrm
|
list[#list+1]=curFrm
|
||||||
p=p+1
|
p=p+1
|
||||||
|
|
||||||
b=byte(str,p)
|
b=byte(str,p)
|
||||||
if b>127 then
|
if b>127 then
|
||||||
b=b-256
|
b=b-256
|
||||||
end
|
end
|
||||||
L[#L+1]=b
|
list[#list+1]=b
|
||||||
p=p+1
|
p=p+1
|
||||||
end
|
end
|
||||||
return L
|
return list
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user