Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mirrorSimulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
mirrorSimulator
Commits
85f0c3a1
Commit
85f0c3a1
authored
Jan 08, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加了对CompositionTime的处理
parent
4549a804
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
7 deletions
+103
-7
lib/service/StreamH264Flv.py
lib/service/StreamH264Flv.py
+20
-4
lib/socket/ClientWebSocket.py
lib/socket/ClientWebSocket.py
+5
-0
ui/CodecArea.py
ui/CodecArea.py
+22
-0
ui/EventAndOtherArea.py
ui/EventAndOtherArea.py
+22
-0
ui/HomeArea.py
ui/HomeArea.py
+22
-0
ui/MainWindow.py
ui/MainWindow.py
+12
-3
No files found.
lib/service/StreamH264Flv.py
View file @
85f0c3a1
...
@@ -3,6 +3,8 @@ import binascii
...
@@ -3,6 +3,8 @@ import binascii
import
json
import
json
import
re
import
re
import
time
import
time
import
traceback
import
requests
import
requests
from
lib.protocal.Protocal_1078
import
Protocal_1078
from
lib.protocal.Protocal_1078
import
Protocal_1078
...
@@ -145,7 +147,7 @@ class StreamH264Flv():
...
@@ -145,7 +147,7 @@ class StreamH264Flv():
AVdata
=
AVtag
[
10
:]
# 视频数据
AVdata
=
AVtag
[
10
:]
# 视频数据
frameInfo
=
self
.
getVideoFrame
(
AVtag
)
frameInfo
=
self
.
getVideoFrame
(
AVtag
)
for
frame
in
frameInfo
[
"frames"
]:
for
frame
in
frameInfo
[
"frames"
]:
self
.
sendVideoFrame
(
frame
,
avTimeStamp
)
self
.
sendVideoFrame
(
frame
,
avTimeStamp
,
AVtag
)
elif
tagType
==
"12"
:
# 脚本
elif
tagType
==
"12"
:
# 脚本
AVdata
=
AVtag
# 脚本数据
AVdata
=
AVtag
# 脚本数据
else
:
else
:
...
@@ -189,10 +191,11 @@ class StreamH264Flv():
...
@@ -189,10 +191,11 @@ class StreamH264Flv():
####################################################
####################################################
# 发送视频帧
# 发送视频帧
####################################################
####################################################
def
sendVideoFrame
(
self
,
fra
,
timeStamp
):
def
sendVideoFrame
(
self
,
fra
,
timeStamp
,
avTag
):
self
.
protocal_1078
.
setSim
(
self
.
mobile
)
self
.
protocal_1078
.
setSim
(
self
.
mobile
)
self
.
protocal_1078
.
setLogcC
(
self
.
channel
)
self
.
protocal_1078
.
setLogcC
(
self
.
channel
)
self
.
protocal_1078
.
setTime
(
timeStamp
)
avTimeStamp
=
timeStamp
+
self
.
getCompositionTime
(
avTag
)
self
.
protocal_1078
.
setTime
(
avTimeStamp
)
frameType
=
fra
[
8
:
10
]
frameType
=
fra
[
8
:
10
]
if
frameType
==
"65"
:
if
frameType
==
"65"
:
self
.
videoLastKeyTime
=
timeStamp
self
.
videoLastKeyTime
=
timeStamp
...
@@ -214,6 +217,7 @@ class StreamH264Flv():
...
@@ -214,6 +217,7 @@ class StreamH264Flv():
try
:
try
:
self
.
client
.
send
(
binascii
.
a2b_hex
(
msg
))
self
.
client
.
send
(
binascii
.
a2b_hex
(
msg
))
except
:
except
:
traceback
.
print_exc
()
print
(
msg
)
print
(
msg
)
time
.
sleep
(
self
.
sendDur
)
time
.
sleep
(
self
.
sendDur
)
...
@@ -306,6 +310,18 @@ class StreamH264Flv():
...
@@ -306,6 +310,18 @@ class StreamH264Flv():
frameData
[
"frames"
]
=
[]
frameData
[
"frames"
]
=
[]
return
frameData
return
frameData
####################################################
# 获取视频帧的CompositionTime
####################################################
def
getCompositionTime
(
self
,
AVTag
):
AVCPkgType
=
int
(
AVTag
[
2
:
4
],
16
)
compositionTime
=
0
if
AVCPkgType
==
0
:
pass
else
:
compositionTime
=
int
(
AVTag
[
4
:
10
],
16
)
return
compositionTime
####################################################
####################################################
# 根据AVtag,获取音频帧数据
# 根据AVtag,获取音频帧数据
####################################################
####################################################
...
@@ -348,7 +364,7 @@ if __name__ == "__main__":
...
@@ -348,7 +364,7 @@ if __name__ == "__main__":
obj
.
setHost
(
"10.100.11.125"
)
obj
.
setHost
(
"10.100.11.125"
)
# obj.setHost("video-test.vandyo.com")
# obj.setHost("video-test.vandyo.com")
obj
.
setPort
(
1078
)
obj
.
setPort
(
1078
)
obj
.
setVideoPath
(
"../../flv/
bbb
3.flv"
)
obj
.
setVideoPath
(
"../../flv/
aaa
3.flv"
)
obj
.
connectServer
()
obj
.
connectServer
()
obj
.
readFlvAndSend
()
obj
.
readFlvAndSend
()
...
...
lib/socket/ClientWebSocket.py
0 → 100644
View file @
85f0c3a1
#coding: utf-8
class
ClientWebSocket
():
def
__init__
(
self
):
pass
\ No newline at end of file
ui/CodecArea.py
0 → 100644
View file @
85f0c3a1
#coding: utf-8
import
wx
class
CodecArea
():
def
__init__
(
self
,
frame
):
self
.
frame
=
frame
self
.
mainPanel
=
None
#################################################
# 创建一个顶级pannel
#################################################
def
create
(
self
):
self
.
mainPanel
=
wx
.
Panel
(
self
.
frame
)
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
topPanel
=
wx
.
Panel
(
self
.
mainPanel
)
topPanel
.
SetBackgroundColour
(
"YELLOW"
)
bottomPanel
=
wx
.
Panel
(
self
.
mainPanel
)
boxSizer
.
Add
(
topPanel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
bottomPanel
,
2
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
5
)
self
.
mainPanel
.
SetSizer
(
boxSizer
)
return
self
.
mainPanel
\ No newline at end of file
ui/EventAndOtherArea.py
0 → 100644
View file @
85f0c3a1
#coding: utf-8
import
wx
class
EventAndOtherArea
():
def
__init__
(
self
,
frame
):
self
.
frame
=
frame
self
.
mainPanel
=
None
#################################################
# 创建一个顶级pannel
#################################################
def
create
(
self
):
self
.
mainPanel
=
wx
.
Panel
(
self
.
frame
)
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
topPanel
=
wx
.
Panel
(
self
.
mainPanel
)
topPanel
.
SetBackgroundColour
(
"GREEN"
)
bottomPanel
=
wx
.
Panel
(
self
.
mainPanel
)
boxSizer
.
Add
(
topPanel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
bottomPanel
,
2
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
5
)
self
.
mainPanel
.
SetSizer
(
boxSizer
)
return
self
.
mainPanel
\ No newline at end of file
ui/HomeArea.py
0 → 100644
View file @
85f0c3a1
#coding: utf-8
import
wx
class
HomeArea
():
def
__init__
(
self
,
frame
):
self
.
frame
=
frame
self
.
mainPanel
=
None
#################################################
# 创建一个顶级pannel
#################################################
def
create
(
self
):
self
.
mainPanel
=
wx
.
Panel
(
self
.
frame
)
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
topPanel
=
wx
.
Panel
(
self
.
mainPanel
)
topPanel
.
SetBackgroundColour
(
"PINK"
)
bottomPanel
=
wx
.
Panel
(
self
.
mainPanel
)
boxSizer
.
Add
(
topPanel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
bottomPanel
,
2
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
5
)
self
.
mainPanel
.
SetSizer
(
boxSizer
)
return
self
.
mainPanel
\ No newline at end of file
ui/MainWindow.py
View file @
85f0c3a1
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
import
wx
import
wx
from
ui.CameraArea
import
CameraArea
from
ui.CameraArea
import
CameraArea
from
ui.CodecArea
import
CodecArea
from
ui.EventAndOtherArea
import
EventAndOtherArea
from
ui.HomeArea
import
HomeArea
'''
'''
定义主窗体
定义主窗体
...
@@ -37,8 +40,11 @@ class MainWindow():
...
@@ -37,8 +40,11 @@ class MainWindow():
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
boxSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
nodeBook
=
wx
.
Notebook
(
mainPanel
)
nodeBook
=
wx
.
Notebook
(
mainPanel
)
cameraArea1
=
CameraArea
(
nodeBook
)
homeArea
=
HomeArea
(
nodeBook
)
page0
=
homeArea
.
create
()
nodeBook
.
AddPage
(
page0
,
"云镜首页"
)
cameraArea1
=
CameraArea
(
nodeBook
)
page1
=
cameraArea1
.
create
()
page1
=
cameraArea1
.
create
()
nodeBook
.
AddPage
(
page1
,
"摄像头1"
)
nodeBook
.
AddPage
(
page1
,
"摄像头1"
)
...
@@ -51,11 +57,14 @@ class MainWindow():
...
@@ -51,11 +57,14 @@ class MainWindow():
cameraArea3
.
setChannel
(
3
)
cameraArea3
.
setChannel
(
3
)
page3
=
cameraArea3
.
create
()
page3
=
cameraArea3
.
create
()
nodeBook
.
AddPage
(
page3
,
"摄像头3"
)
nodeBook
.
AddPage
(
page3
,
"摄像头3"
)
page4
=
wx
.
Panel
(
nodeBook
)
codecArea
=
CodecArea
(
nodeBook
)
page4
=
codecArea
.
create
()
nodeBook
.
AddPage
(
page4
,
"转码工具"
)
nodeBook
.
AddPage
(
page4
,
"转码工具"
)
page5
=
wx
.
Panel
(
nodeBook
)
eventAndOtherArea
=
EventAndOtherArea
(
nodeBook
)
page5
=
eventAndOtherArea
.
create
()
nodeBook
.
AddPage
(
page5
,
"告警与其他功能"
)
nodeBook
.
AddPage
(
page5
,
"告警与其他功能"
)
boxSizer
.
Add
(
nodeBook
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer
.
Add
(
nodeBook
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
nodeBook
.
SetSelection
(
1
)
mainPanel
.
SetSizer
(
boxSizer
)
mainPanel
.
SetSizer
(
boxSizer
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment