Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
18570676
提交
18570676
authored
10月 12, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cloud cmd api for platform client
上级
eaf7fa2b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
21 行增加
和
9 行删除
+21
-9
evslicer.cpp
opencv-motion-detect/evslicer.cpp
+21
-9
没有找到文件。
opencv-motion-detect/evslicer.cpp
浏览文件 @
18570676
...
@@ -46,7 +46,7 @@ private:
...
@@ -46,7 +46,7 @@ private:
void
*
pSubCtx
=
nullptr
,
*
pDealerCtx
=
nullptr
;
// for packets relay
void
*
pSubCtx
=
nullptr
,
*
pDealerCtx
=
nullptr
;
// for packets relay
void
*
pSub
=
nullptr
,
*
pDealer
=
nullptr
,
*
pDaemonCtx
=
nullptr
,
*
pDaemon
=
nullptr
;
void
*
pSub
=
nullptr
,
*
pDealer
=
nullptr
,
*
pDaemonCtx
=
nullptr
,
*
pDaemon
=
nullptr
;
string
urlOut
,
urlPub
,
urlRouter
,
devSn
,
mgrSn
,
selfId
,
pullerGid
,
ipcSn
;
string
urlOut
,
urlPub
,
urlRouter
,
devSn
,
mgrSn
,
selfId
,
pullerGid
,
ipcSn
;
int
iid
,
hours
,
seconds
,
numSlices
,
segHead
=
1
,
segHeadP
=
0
;
int
iid
,
hours
,
seconds
,
numSlices
,
segHead
=
-
1
,
segHeadP
=
0
;
long
bootTime
=
0
;
long
bootTime
=
0
;
bool
enablePush
=
false
,
bSegFull
=
false
;
bool
enablePush
=
false
,
bSegFull
=
false
;
AVFormatContext
*
pAVFormatRemux
=
nullptr
;
AVFormatContext
*
pAVFormatRemux
=
nullptr
;
...
@@ -187,7 +187,7 @@ private:
...
@@ -187,7 +187,7 @@ private:
bProcessed
=
true
;
bProcessed
=
true
;
}
else
if
(
metaValue
==
"debug:list_files"
){
}
else
if
(
metaValue
==
"debug:list_files"
){
// TODO: remove debug feature
// TODO: remove debug feature
debugFilesRing
();
debugFilesRing
(
this
->
vTsActive
);
bProcessed
=
true
;
bProcessed
=
true
;
}
else
if
(
metaValue
==
"debug:toggle_log"
)
{
}
else
if
(
metaValue
==
"debug:toggle_log"
)
{
// TODO: remove debug feature
// TODO: remove debug feature
...
@@ -490,7 +490,11 @@ protected:
...
@@ -490,7 +490,11 @@ protected:
spdlog
::
error
(
"evslicer {} could not open output file {}"
,
selfId
,
name
);
spdlog
::
error
(
"evslicer {} could not open output file {}"
,
selfId
,
name
);
}
}
}
}
av_dict_set
(
&
pOptsRemux
,
"segment_start_number"
,
to_string
(
segHead
).
data
(),
0
);
int
startIdx
=
0
;
if
(
segHead
!=
-
1
)
{
startIdx
=
segHead
;
}
av_dict_set
(
&
pOptsRemux
,
"segment_start_number"
,
to_string
(
startIdx
).
data
(),
0
);
ret
=
avformat_write_header
(
pAVFormatRemux
,
&
pOptsRemux
);
ret
=
avformat_write_header
(
pAVFormatRemux
,
&
pOptsRemux
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
spdlog
::
error
(
"evslicer {} error occurred when opening output file"
,
selfId
);
spdlog
::
error
(
"evslicer {} error occurred when opening output file"
,
selfId
);
...
@@ -619,12 +623,12 @@ protected:
...
@@ -619,12 +623,12 @@ protected:
return
string
(
buffer
);
return
string
(
buffer
);
}
}
void
debugFilesRing
()
void
debugFilesRing
(
vector
<
long
>
&
v
)
{
{
spdlog
::
info
(
"evslicer {} debug files ring. segHead: {}, isFull: {}, max: {}"
,
this
->
selfId
,
this
->
segHead
,
this
->
bSegFull
,
this
->
numSlices
);
spdlog
::
info
(
"evslicer {} debug files ring. segHead: {}, isFull: {}, max: {}"
,
this
->
selfId
,
this
->
segHead
,
this
->
bSegFull
,
this
->
numSlices
);
for
(
int
i
=
1
;
i
<=
numSlices
;
i
++
)
{
for
(
int
i
=
1
;
i
<=
numSlices
;
i
++
)
{
spdlog
::
info
(
"
\t
evslicer {} vector[{}] = {}, {}"
,
selfId
,
i
,
v
TsActive
[
i
],
videoFileTs2Name
(
vTsActive
[
i
]));
spdlog
::
info
(
"
\t
evslicer {} vector[{}] = {}, {}"
,
selfId
,
i
,
v
[
i
],
videoFileTs2Name
(
v
[
i
]));
if
(
v
TsActive
[
segToIdx
(
i
)]
==
0
)
{
if
(
v
[
segToIdx
(
i
)]
==
0
)
{
break
;
break
;
}
}
}
}
...
@@ -676,6 +680,10 @@ protected:
...
@@ -676,6 +680,10 @@ protected:
this
->
bSegFull
=
true
;
this
->
bSegFull
=
true
;
}
}
if
(
tsRing
.
size
()
!=
0
)
{
segHead
=
0
;
}
list
<
long
>::
iterator
pos
=
tsRing
.
begin
();
list
<
long
>::
iterator
pos
=
tsRing
.
begin
();
for
(
auto
&
i
:
tsRing
)
{
for
(
auto
&
i
:
tsRing
)
{
if
(
idx
<
skip
)
{
if
(
idx
<
skip
)
{
...
@@ -717,7 +725,7 @@ protected:
...
@@ -717,7 +725,7 @@ protected:
spdlog
::
info
(
"evslicer {} LoadVideoFiles active:{}, ts1:{}, ts2: {}; toprocess: {}, ts1: {}, ts2:{}"
,
selfId
,
segHead
,
v
.
front
(),
v
.
back
(),
segHeadP
,
tsNeedUpload
.
front
(),
tsNeedUpload
.
back
());
spdlog
::
info
(
"evslicer {} LoadVideoFiles active:{}, ts1:{}, ts2: {}; toprocess: {}, ts1: {}, ts2:{}"
,
selfId
,
segHead
,
v
.
front
(),
v
.
back
(),
segHeadP
,
tsNeedUpload
.
front
(),
tsNeedUpload
.
back
());
}
}
debugFilesRing
();
debugFilesRing
(
v
);
return
v
;
return
v
;
}
}
...
@@ -729,6 +737,10 @@ protected:
...
@@ -729,6 +737,10 @@ protected:
string
ext
=
".mp4"
;
string
ext
=
".mp4"
;
auto
self
=
static_cast
<
EvSlicer
*>
(
pUserData
);
auto
self
=
static_cast
<
EvSlicer
*>
(
pUserData
);
if
(
self
->
segHead
==
-
1
)
{
self
->
segHead
=
1
;
}
for
(
auto
&
i
:
evts
)
{
for
(
auto
&
i
:
evts
)
{
string
fullPath
=
i
.
get_path
();
string
fullPath
=
i
.
get_path
();
size_t
pos
=
fullPath
.
find
(
ext
,
0
);
size_t
pos
=
fullPath
.
find
(
ext
,
0
);
...
@@ -811,7 +823,7 @@ protected:
...
@@ -811,7 +823,7 @@ protected:
vector
<
string
>
findSlicesByRange
(
long
tss
,
long
tse
,
int
offsetS
,
int
offsetE
)
vector
<
string
>
findSlicesByRange
(
long
tss
,
long
tse
,
int
offsetS
,
int
offsetE
)
{
{
debugFilesRing
();
debugFilesRing
(
this
->
vTsActive
);
vector
<
string
>
ret
;
vector
<
string
>
ret
;
int
found
=
0
;
int
found
=
0
;
int
_itss
=
0
;
int
_itss
=
0
;
...
@@ -993,7 +1005,7 @@ public:
...
@@ -993,7 +1005,7 @@ public:
spdlog
::
error
(
"evslicer {} ignore upload videos in range ({}, {})"
,
this
->
selfId
,
this
->
videoFileTs2Name
(
tss
),
this
->
videoFileTs2Name
(
tse
));
spdlog
::
error
(
"evslicer {} ignore upload videos in range ({}, {})"
,
this
->
selfId
,
this
->
videoFileTs2Name
(
tss
),
this
->
videoFileTs2Name
(
tse
));
}
}
else
{
else
{
debugFilesRing
();
debugFilesRing
(
this
->
vTsActive
);
vector
<
tuple
<
string
,
string
>
>
params
=
{{
"startTime"
,
to_string
(
tss
)},{
"endTime"
,
to_string
(
tse
)},{
"cameraId"
,
ipcSn
},
{
"headOffset"
,
to_string
(
offsetS
)},{
"tailOffset"
,
to_string
(
offsetE
)}};
vector
<
tuple
<
string
,
string
>
>
params
=
{{
"startTime"
,
to_string
(
tss
)},{
"endTime"
,
to_string
(
tse
)},{
"cameraId"
,
ipcSn
},
{
"headOffset"
,
to_string
(
offsetS
)},{
"tailOffset"
,
to_string
(
offsetE
)}};
vector
<
string
>
fileNames
;
vector
<
string
>
fileNames
;
string
sf
;
string
sf
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论