当前位置:网站首页>Set the playback speed during the playback of UOB equipment
Set the playback speed during the playback of UOB equipment
2022-07-02 10:46:00 【Small waves-】
background
I used to be a video surveillance client for many years , For a time, it was connected to Dahua , The sea, ,axis, First pass, etc sdk, Use in our own monitoring system .
When the network is unstable , Controlling the playback speed is always a headache .
There are two ways to set the playback speed , One is to transfer and calculate according to speed , One is calculated according to the frame rate .
Because Dahua's sdk By default, the frame rate is used to calculate , If it is converted into rate, the workload is very large , Try not to please . It's better to call the interface directly , Set frame rate .
Set the rate using only the original pause state , There is such a workload .
Code
void CDevReplay::SetPlaySpeed( DOUBLE dOldSpeed, DOUBLE dNewSpeed )
{
if(dOldSpeed == dNewSpeed)// Do not change the original speed
{
return 0;
}
if (dNewSpeed >= (-0.01) && dNewSpeed <= 0.01)
{
PauseOrContinue(1);// If set to 0, Pause ;
return;
}
PauseOrContinue(0);
if (dOldSpeed >= (-0.01) && dOldSpeed <= 0.01)
{
if (dNewSpeed < (-1.01) && dOldSpeed >= -8.00)
{
SetPlayDirection(TRUE);
while(dNewSpeed < -1.01)
{
FastPlay();
dNewSpeed += 1.0;
}
}
else if (dOldSpeed <= -0.99 && dOldSpeed >= -1.01)
{
NormalPlay();
}
else if (dNewSpeed < (-0.01) && dNewSpeed > -0.99)
{
SetPlayDirection(TRUE);
while(dNewSpeed > -1.0)
{
SlowPlay();
dNewSpeed *= 2.0;
}
}
else if ( dNewSpeed > 0.01 && dOldSpeed < 0.99)
{
while(dNewSpeed < 1.0)
{
SlowPlay();
dNewSpeed *= 2.0;
}
}
else if (dOldSpeed >= 0.99 && dOldSpeed <= 1.01)
{
NormalPlay();
}
else if (dOldSpeed > 1.01 && dOldSpeed < 8.00)
{
while(dNewSpeed > -1.01)
{
FastPlay();
dNewSpeed -= 1.0;
}
}
}
else if(dOldSpeed > 0.01)
{
...
}
else if(dOldSpeed < -0.01)
{
...
}
return ;
}
void CDevReplay::SetPlaySpeed( DOUBLE dOldSpeed, DOUBLE dNewSpeed )
{
if(dOldSpeed == dNewSpeed)// Do not change the original speed
{
return 0;
}
if (dNewSpeed >= (-0.01) && dNewSpeed <= 0.01)
{
PauseOrContinue(1);// If set to 0, Pause ;
return;
}
if (dOldSpeed >= (-0.01) && dOldSpeed <= 0.01)
{
dOldSpeed = 1.0;
}
if (dOldSpeed * dNewSpeed < 0)
{
BOOL bBackward = (dNewSpeed < 0);
SetPlayDirection(bBackward);
NormalPlay();
return;
}
PauseOrContinue(0);
LONG nRate = GetFrameRate();
DOUBLE fZoom = dNewSpeed/dOldSpeed;
nRate = nRate*fZoom;
SetFrameRate(nRate);
return ;
}
LONG CDevReplay::GetFrameRate()
{
if(0 == m_lPlayBack)return 10;
int fileframerate = 25;
int playframerate = 25;
BOOL bRet = CLIENT_GetFramePlayBack(m_lPlayBack,&fileframerate,&playframerate);
ATLASSERT(bRet);
return playframerate;
}
LONG CDevReplay::SetFrameRate( LONG nRate )
{
if(0 == m_lPlayBack)return 0;
// Set playback frame rate , The scope of the current definition is (1~120), Beyond this range, return FALSE
if (nRate < 1)nRate = 1;
BOOL bRet = CLIENT_SetFramePlayBack(m_lPlayBack,nRate);
ATLASSERT(bRet);
return 1;
}
边栏推荐
- 2021-10-04
- Flutter——Canvas自定义曲线图
- [Fantasy 4] introduction and use of UMG components (under update...)
- "Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
- Stm32 et développement de moteurs (système supérieur)
- Considerations for Apache deploying static web page projects
- 12.进程同步与信号量
- LeetCode+ 76 - 80 暴搜专题
- MPLS experiment
- 4.随机变量
猜你喜欢
Flink实时计算topN热榜
互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书
使用sqlcipher打开加密的sqlite方法
Pytest-- test report allure configuration
Session cookies and tokens
[TS] 1368 seconds understand typescript generic tool types!
Considerations for Apache deploying static web page projects
12.进程同步与信号量
《MySQL 8 DBA基础教程》简介
Rapid prototyping
随机推荐
Network communication learning
sqoop的表的导入
Flink calculates topn hot list in real time
LeetCode+ 76 - 80 暴搜专题
js promise.all
07数据导入Sqoop
网络通信学习
Rapid prototyping
Record attributeerror: 'nonetype' object has no attribute 'nextcall‘
Merge ordered sequence
Session cookies and tokens
传输优化抽象
Postman -- use
UWA报告使用小技巧,你get了吗?(第四弹)
"Matching" is true love, a new attitude for young people to make friends
Understand the composition of building energy-saving system
互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书
[Lua] summary of common knowledge points (including common interview sites)
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
session-cookie与token