Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
18e50a85
提交
18e50a85
authored
9月 16, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
big refacting of communitation architect
上级
aeb3b869
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
31 行增加
和
36 行删除
+31
-36
.gitmodules
.gitmodules
+3
-0
evdaemon.cpp
opencv-motion-detect/evdaemon.cpp
+1
-1
evmgr.cpp
opencv-motion-detect/evmgr.cpp
+2
-3
evmlmotion.cpp
opencv-motion-detect/evmlmotion.cpp
+5
-6
evpuller.cpp
opencv-motion-detect/evpuller.cpp
+6
-9
evpusher.cpp
opencv-motion-detect/evpusher.cpp
+4
-5
evslicer.cpp
opencv-motion-detect/evslicer.cpp
+7
-10
av_common.hpp
opencv-motion-detect/inc/av_common.hpp
+2
-2
curlpp
opencv-motion-detect/vendor/curlpp
+1
-0
没有找到文件。
.gitmodules
浏览文件 @
18e50a85
...
@@ -4,3 +4,6 @@
...
@@ -4,3 +4,6 @@
[submodule "opencv-motion-detect/vendor/leveldb"]
[submodule "opencv-motion-detect/vendor/leveldb"]
path = opencv-motion-detect/vendor/leveldb
path = opencv-motion-detect/vendor/leveldb
url = https://github.com/google/leveldb
url = https://github.com/google/leveldb
[submodule "opencv-motion-detect/vendor/curlpp"]
path = opencv-motion-detect/vendor/curlpp
url = https://github.com/jpbarrette/curlpp
opencv-motion-detect/evdaemon.cpp
浏览文件 @
18e50a85
...
@@ -400,7 +400,7 @@ private:
...
@@ -400,7 +400,7 @@ private:
spdlog
::
info
(
"evdaemon {} received cloud config diff: {}
\n
new: {}"
,
devSn
,
this
->
deltaCfg
.
dump
(
4
),
data
.
dump
());
spdlog
::
info
(
"evdaemon {} received cloud config diff: {}
\n
new: {}"
,
devSn
,
this
->
deltaCfg
.
dump
(
4
),
data
.
dump
());
if
(
this
->
deltaCfg
.
size
()
!=
0
||
this
->
bColdStart
)
{
if
(
this
->
deltaCfg
.
size
()
!=
0
||
this
->
bColdStart
)
{
this
->
config
=
data
;
this
->
config
=
data
;
spdlog
::
info
(
"ev
ad
mon {} reloading config from cloud"
,
devSn
);
spdlog
::
info
(
"ev
dae
mon {} reloading config from cloud"
,
devSn
);
ret
=
reloadCfg
();
ret
=
reloadCfg
();
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
spdlog
::
error
(
"evdameon {} failed to parse new config: {}"
,
devSn
,
data
.
dump
());
spdlog
::
error
(
"evdameon {} failed to parse new config: {}"
,
devSn
,
data
.
dump
());
...
...
opencv-motion-detect/evmgr.cpp
浏览文件 @
18e50a85
...
@@ -56,13 +56,12 @@ private:
...
@@ -56,13 +56,12 @@ private:
int
ret
=
0
;
int
ret
=
0
;
json
jret
;
json
jret
;
bool
inited
=
false
;
bool
inited
=
false
;
spdlog
::
info
(
"evmgr boot {}"
,
devSn
);
int
opt_notify
=
ZMQ_NOTIFY_DISCONNECT
|
ZMQ_NOTIFY_CONNECT
;
int
opt_notify
=
ZMQ_NOTIFY_DISCONNECT
|
ZMQ_NOTIFY_CONNECT
;
string
addr
;
string
addr
;
try
{
try
{
//
//
spdlog
::
info
(
"evmgr
{} starting with configuration:
{}"
,
devSn
,
config
.
dump
());
spdlog
::
info
(
"evmgr
boot configuration: {} ->
{}"
,
devSn
,
config
.
dump
());
if
(
config
[
"proto"
]
!=
"zmq"
)
{
if
(
config
[
"proto"
]
!=
"zmq"
)
{
spdlog
::
warn
(
"evmgr {} unsupported protocol: {}, try fallback to zmq instead now..."
,
devSn
,
config
[
"proto"
].
get
<
string
>
());
spdlog
::
warn
(
"evmgr {} unsupported protocol: {}, try fallback to zmq instead now..."
,
devSn
,
config
[
"proto"
].
get
<
string
>
());
...
...
opencv-motion-detect/evmlmotion.cpp
浏览文件 @
18e50a85
...
@@ -85,15 +85,14 @@ private:
...
@@ -85,15 +85,14 @@ private:
thread
thEvent
;
thread
thEvent
;
string
drport
=
"5549"
;
string
drport
=
"5549"
;
//
//
int
init
()
int
init
()
{
{
int
ret
=
0
;
int
ret
=
0
;
spdlog
::
info
(
"evmlmotion boot {}"
,
selfId
);
// TODO: req config
// TODO: req config
bool
found
=
false
;
bool
found
=
false
;
try
{
try
{
spdlog
::
info
(
"evmlmotion
{} config: {}"
,
devSn
,
config
.
dump
());
spdlog
::
info
(
"evmlmotion
boot config: {} -> {}"
,
selfId
,
config
.
dump
());
json
evmlmotion
;
json
evmlmotion
;
json
&
evmgr
=
this
->
config
;
json
&
evmgr
=
this
->
config
;
json
ipc
;
json
ipc
;
...
@@ -623,7 +622,7 @@ protected:
...
@@ -623,7 +622,7 @@ protected:
}
}
zmq_msg_close
(
&
msg
);
zmq_msg_close
(
&
msg
);
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
spdlog
::
info
(
"
seq: {}, pts: {}, dts: {}, idx: {}"
,
pktCnt
,
packet
.
pts
,
packet
.
dts
,
packet
.
stream_index
);
spdlog
::
info
(
"
evmlmotion {} seq: {}, pts: {}, dts: {}, idx: {}"
,
selfId
,
pktCnt
,
packet
.
pts
,
packet
.
dts
,
packet
.
stream_index
);
}
}
pktCnt
++
;
pktCnt
++
;
...
@@ -712,7 +711,7 @@ public:
...
@@ -712,7 +711,7 @@ public:
int
main
(
int
argc
,
const
char
*
argv
[])
int
main
(
int
argc
,
const
char
*
argv
[])
{
{
spdlog
::
set_level
(
spdlog
::
level
::
debug
);
spdlog
::
set_level
(
spdlog
::
level
::
info
);
av_log_set_level
(
AV_LOG_ERROR
);
av_log_set_level
(
AV_LOG_ERROR
);
queue
<
string
>
evtQueue
;
queue
<
string
>
evtQueue
;
EvMLMotion
es
(
&
evtQueue
);
EvMLMotion
es
(
&
evtQueue
);
...
@@ -736,7 +735,7 @@ int main(int argc, const char *argv[])
...
@@ -736,7 +735,7 @@ int main(int argc, const char *argv[])
while
(
true
)
{
while
(
true
)
{
if
(
evtQueue
.
size
()
>
0
)
{
if
(
evtQueue
.
size
()
>
0
)
{
string
p
=
evtQueue
.
front
();
string
p
=
evtQueue
.
front
();
spdlog
::
info
(
"event: {}"
,
p
);
spdlog
::
info
(
"ev
mlmotion ev
ent: {}"
,
p
);
evtQueue
.
pop
();
evtQueue
.
pop
();
}
}
else
{
else
{
...
...
opencv-motion-detect/evpuller.cpp
浏览文件 @
18e50a85
...
@@ -144,14 +144,11 @@ private:
...
@@ -144,14 +144,11 @@ private:
int
init
()
int
init
()
{
{
bool
inited
=
false
;
bool
inited
=
false
;
int
ret
=
0
;
int
ret
=
0
;
spdlog
::
info
(
"evpuller: {}"
,
selfId
);
bool
found
=
false
;
bool
found
=
false
;
string
user
,
passwd
,
addr
;
string
user
,
passwd
,
addr
;
try
{
try
{
spdlog
::
info
(
"
config dump: {:s}"
,
config
.
dump
());
spdlog
::
info
(
"
evpuller boot config: {} -> {}"
,
selfId
,
config
.
dump
());
json
evpuller
;
json
evpuller
;
json
&
evmgr
=
this
->
config
;
json
&
evmgr
=
this
->
config
;
json
ipc
;
json
ipc
;
...
@@ -237,7 +234,7 @@ private:
...
@@ -237,7 +234,7 @@ private:
}
}
inited
=
true
;
inited
=
true
;
spdlog
::
info
(
"successfully load config"
);
spdlog
::
info
(
"
evpuller
successfully load config"
);
return
0
;
return
0
;
}
}
...
@@ -309,7 +306,7 @@ protected:
...
@@ -309,7 +306,7 @@ protected:
ret
=
av_read_frame
(
pAVFormatInput
,
&
packet
);
ret
=
av_read_frame
(
pAVFormatInput
,
&
packet
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
spdlog
::
error
(
"
failed read packet: {}"
,
av_err2str
(
ret
));
spdlog
::
error
(
"
evpuller {} failed read packet: {}"
,
selfId
,
av_err2str
(
ret
));
break
;
break
;
}
}
in_stream
=
pAVFormatInput
->
streams
[
packet
.
stream_index
];
in_stream
=
pAVFormatInput
->
streams
[
packet
.
stream_index
];
...
@@ -318,7 +315,7 @@ protected:
...
@@ -318,7 +315,7 @@ protected:
continue
;
continue
;
}
}
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
spdlog
::
info
(
"
pktCnt: {:d}"
,
pktCnt
);
spdlog
::
info
(
"
evpuller {} pktCnt: {:d}"
,
selfId
,
pktCnt
);
}
}
pktCnt
++
;
pktCnt
++
;
...
@@ -405,7 +402,7 @@ public:
...
@@ -405,7 +402,7 @@ public:
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
av_log_set_level
(
AV_LOG_ERROR
);
av_log_set_level
(
AV_LOG_ERROR
);
spdlog
::
set_level
(
spdlog
::
level
::
debug
);
spdlog
::
set_level
(
spdlog
::
level
::
info
);
//DB::exec(NULL, NULL, NULL,NULL);
//DB::exec(NULL, NULL, NULL,NULL);
auto
evp
=
EvPuller
();
auto
evp
=
EvPuller
();
evp
.
join
();
evp
.
join
();
...
...
opencv-motion-detect/evpusher.cpp
浏览文件 @
18e50a85
...
@@ -54,10 +54,9 @@ private:
...
@@ -54,10 +54,9 @@ private:
int
init
()
int
init
()
{
{
int
ret
=
0
;
int
ret
=
0
;
spdlog
::
info
(
"evpusher startup {}"
,
selfId
);
bool
found
=
false
;
bool
found
=
false
;
try
{
try
{
spdlog
::
info
(
"
config: {:s}"
,
config
.
dump
());
spdlog
::
info
(
"
evpusher boot config: {} -> {}"
,
selfId
,
config
.
dump
());
json
evpusher
;
json
evpusher
;
json
&
evmgr
=
this
->
config
;
json
&
evmgr
=
this
->
config
;
json
ipc
;
json
ipc
;
...
@@ -131,7 +130,7 @@ private:
...
@@ -131,7 +130,7 @@ private:
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
spdlog
::
error
(
"evpusher {} failed to set config: {}"
,
selfId
,
config
.
dump
());
spdlog
::
error
(
"evpusher {} failed to set config: {}"
,
selfId
,
config
.
dump
());
}
}
spdlog
::
info
(
"new config: {}"
,
config
.
dump
());
spdlog
::
info
(
"
evpusher
new config: {}"
,
config
.
dump
());
ping
();
ping
();
}
}
catch
(
exception
&
e
)
{
catch
(
exception
&
e
)
{
...
@@ -262,7 +261,7 @@ private:
...
@@ -262,7 +261,7 @@ private:
}
}
for
(
int
i
=
0
;
i
<
pAVFormatInput
->
nb_streams
;
i
++
)
{
for
(
int
i
=
0
;
i
<
pAVFormatInput
->
nb_streams
;
i
++
)
{
spdlog
::
info
(
"
streamList[{:d}]: {:d}"
,
i
,
streamList
[
i
]);
spdlog
::
info
(
"
evpusher {} streamList[{:d}]: {:d}"
,
selfId
,
i
,
streamList
[
i
]);
}
}
av_dump_format
(
pAVFormatRemux
,
0
,
urlOut
.
c_str
(),
1
);
av_dump_format
(
pAVFormatRemux
,
0
,
urlOut
.
c_str
(),
1
);
...
@@ -341,7 +340,7 @@ protected:
...
@@ -341,7 +340,7 @@ protected:
}
}
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
spdlog
::
info
(
"
seq: {}, pts: {}, dts: {}, idx: {}"
,
pktCnt
,
packet
.
pts
,
packet
.
dts
,
packet
.
stream_index
);
spdlog
::
info
(
"
evpusher {} seq: {}, pts: {}, dts: {}, idx: {}"
,
selfId
,
pktCnt
,
packet
.
pts
,
packet
.
dts
,
packet
.
stream_index
);
}
}
pktCnt
++
;
pktCnt
++
;
...
...
opencv-motion-detect/evslicer.cpp
浏览文件 @
18e50a85
...
@@ -32,6 +32,7 @@ namespace fs = std::filesystem;
...
@@ -32,6 +32,7 @@ namespace fs = std::filesystem;
#include "inc/tinythread.hpp"
#include "inc/tinythread.hpp"
#include "inc/common.hpp"
#include "inc/common.hpp"
#include "inc/database.h"
#include "inc/database.h"
#include "postfile.h"
using
namespace
std
;
using
namespace
std
;
using
namespace
zmqhelper
;
using
namespace
zmqhelper
;
...
@@ -62,13 +63,9 @@ private:
...
@@ -62,13 +63,9 @@ private:
int
init
()
int
init
()
{
{
int
ret
=
0
;
int
ret
=
0
;
spdlog
::
info
(
"evslicer boot {}"
,
selfId
);
// TODO: req config
bool
found
=
false
;
bool
found
=
false
;
try
{
try
{
spdlog
::
info
(
"
config: {:s}"
,
config
.
dump
());
spdlog
::
info
(
"
evslicer boot config: {} -> {}"
,
selfId
,
config
.
dump
());
json
evslicer
;
json
evslicer
;
json
&
evmgr
=
this
->
config
;
json
&
evmgr
=
this
->
config
;
json
ipc
;
json
ipc
;
...
@@ -130,7 +127,7 @@ private:
...
@@ -130,7 +127,7 @@ private:
sliceIdxToName
=
new
vector
<
int
>
(
numSlices
);
sliceIdxToName
=
new
vector
<
int
>
(
numSlices
);
// TODO: load db
// TODO: load db
// DB::exec(NULL, "select id, ts, last from slices;", DB::get_slices, sliceIdxToName);
// DB::exec(NULL, "select id, ts, last from slices;", DB::get_slices, sliceIdxToName);
spdlog
::
info
(
"
mkdir -p {}"
,
urlOut
);
spdlog
::
info
(
"
evslicer mkdir -p {}"
,
selfId
,
urlOut
);
ret
=
system
((
string
(
"mkdir -p "
)
+
urlOut
).
c_str
());
ret
=
system
((
string
(
"mkdir -p "
)
+
urlOut
).
c_str
());
// if(ret == -1) {
// if(ret == -1) {
// spdlog::error("failed to create {} dir", urlOut);
// spdlog::error("failed to create {} dir", urlOut);
...
@@ -280,7 +277,7 @@ private:
...
@@ -280,7 +277,7 @@ private:
}
}
for
(
int
i
=
0
;
i
<
pAVFormatInput
->
nb_streams
;
i
++
)
{
for
(
int
i
=
0
;
i
<
pAVFormatInput
->
nb_streams
;
i
++
)
{
spdlog
::
info
(
"
streamList[{:d}]: {:d}"
,
i
,
streamList
[
i
]);
spdlog
::
info
(
"
evslicer {} streamList[{:d}]: {:d}"
,
selfId
,
i
,
streamList
[
i
]);
}
}
//av_dict_set(&pOptsRemux, "movflags", "frag_keyframe+empty_moov+default_base_moof", 0);
//av_dict_set(&pOptsRemux, "movflags", "frag_keyframe+empty_moov+default_base_moof", 0);
...
@@ -357,7 +354,7 @@ protected:
...
@@ -357,7 +354,7 @@ protected:
// TODO:
// TODO:
spdlog
::
info
(
"
writing new slice {}"
,
name
.
c_str
());
spdlog
::
info
(
"
evslicer {} writing new slice {}"
,
selfId
,
name
.
c_str
());
while
(
chrono
::
duration_cast
<
chrono
::
seconds
>
(
end
-
start
).
count
()
<
minutes
*
60
)
{
while
(
chrono
::
duration_cast
<
chrono
::
seconds
>
(
end
-
start
).
count
()
<
minutes
*
60
)
{
if
(
checkStop
()
==
true
)
{
if
(
checkStop
()
==
true
)
{
bStopSig
=
true
;
bStopSig
=
true
;
...
@@ -393,7 +390,7 @@ protected:
...
@@ -393,7 +390,7 @@ protected:
//calc pts
//calc pts
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
if
(
pktCnt
%
EV_LOG_PACKET_CNT
==
0
)
{
spdlog
::
info
(
"
seq: {}, pts: {}, dts: {}, idx: {}"
,
pktCnt
,
packet
.
pts
,
packet
.
dts
,
packet
.
stream_index
);
spdlog
::
info
(
"
evslicer {} seq: {}, pts: {}, dts: {}, idx: {}"
,
selfId
,
pktCnt
,
packet
.
pts
,
packet
.
dts
,
packet
.
stream_index
);
}
}
/* copy packet */
/* copy packet */
if
(
pktCnt
==
0
)
{
if
(
pktCnt
==
0
)
{
...
@@ -504,7 +501,7 @@ public:
...
@@ -504,7 +501,7 @@ public:
int
main
(
int
argc
,
const
char
*
argv
[])
int
main
(
int
argc
,
const
char
*
argv
[])
{
{
av_log_set_level
(
AV_LOG_ERROR
);
av_log_set_level
(
AV_LOG_ERROR
);
spdlog
::
set_level
(
spdlog
::
level
::
debug
);
spdlog
::
set_level
(
spdlog
::
level
::
info
);
EvSlicer
es
;
EvSlicer
es
;
es
.
join
();
es
.
join
();
return
0
;
return
0
;
...
...
opencv-motion-detect/inc/av_common.hpp
浏览文件 @
18e50a85
...
@@ -191,7 +191,7 @@ int encode(AVFormatContext *ctx, char **bytes)
...
@@ -191,7 +191,7 @@ int encode(AVFormatContext *ctx, char **bytes)
wholeSize
+=
strlen
(
PS_MARK_S
);
wholeSize
+=
strlen
(
PS_MARK_S
);
// num streams
// num streams
wholeSize
+=
sizeof
(
ctx
->
nb_streams
);
wholeSize
+=
sizeof
(
ctx
->
nb_streams
);
spdlog
::
info
(
"encode num of streams: {:d}"
,
ctx
->
nb_streams
);
spdlog
::
debug
(
"encode num of streams: {:d}"
,
ctx
->
nb_streams
);
for
(
int
i
=
0
;
i
<
ctx
->
nb_streams
;
i
++
)
for
(
int
i
=
0
;
i
<
ctx
->
nb_streams
;
i
++
)
{
{
wholeSize
+=
sizeof
(
AVStream
);
wholeSize
+=
sizeof
(
AVStream
);
...
@@ -246,7 +246,7 @@ int decode(char *bytes, int len, AVFormatContext *pCtx)
...
@@ -246,7 +246,7 @@ int decode(char *bytes, int len, AVFormatContext *pCtx)
spdlog
::
error
(
"invalid avformatctx: {} {}"
,
ret
,
len
);
spdlog
::
error
(
"invalid avformatctx: {} {}"
,
ret
,
len
);
return
-
1
;
return
-
1
;
}
}
spdlog
::
info
(
"decode len: {}"
,
ret
);
spdlog
::
debug
(
"decode len: {}"
,
ret
);
got
+=
strlen
(
PS_MARK_S
);
got
+=
strlen
(
PS_MARK_S
);
memcpy
(
&
ret
,
bytes
+
got
,
sizeof
(
ret
));
memcpy
(
&
ret
,
bytes
+
got
,
sizeof
(
ret
));
got
+=
sizeof
(
ret
);
got
+=
sizeof
(
ret
);
...
...
curlpp
@
8810334c
Subproject commit 8810334c830faa3b38bcd94f5b1ab695a4f05eb9
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论