Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
QT_PAIR_RECEIVE
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
lenz su
QT_PAIR_RECEIVE
Commits
b04e98a8
Commit
b04e98a8
authored
Jan 02, 2020
by
lenz su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复停止之后屏幕不变黑的问题,原因是停止的时候,已经有之前的视频帧数据在队列中进行解码,解码完成后会继续被送去显示
parent
323b29fd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
hid_thread.cpp
VideoDecoder/src/VideoReader/hid_thread.cpp
+12
-2
hid_thread.h
VideoDecoder/src/VideoReader/hid_thread.h
+3
-0
VideoDecode.exe
bin32/VideoDecode.exe
+0
-0
mainwindow.cpp
src/mainwindow.cpp
+3
-0
No files found.
VideoDecoder/src/VideoReader/hid_thread.cpp
View file @
b04e98a8
#include "hid_thread.h"
#include "hid_thread.h"
#include <QDebug>
#include <QDebug>
#include "usb/USBOperator.h"
#include "usb/USBOperator.h"
#include<QApplication>
#include<QApplication>
#define MAX_PAYLOAD 1012
#define MAX_PAYLOAD 1012
typedef
struct
USB_FRAM_S
{
typedef
struct
USB_FRAM_S
{
int
head
;
int
head
;
int
id
;
int
id
;
...
@@ -67,6 +67,7 @@ void hid_thread::run()
...
@@ -67,6 +67,7 @@ void hid_thread::run()
//开始投屏
//开始投屏
if
(
pUsbFram1
->
buff
[
0
]
==
0x01
&&
pUsbFram1
->
buff
[
1
]
==
0x01
){
if
(
pUsbFram1
->
buff
[
0
]
==
0x01
&&
pUsbFram1
->
buff
[
1
]
==
0x01
){
cout
<<
"start screen shot"
<<
endl
;
cout
<<
"start screen shot"
<<
endl
;
isPlay
=
true
;
char
usb_buf_re
[
2049
]
=
{
0
};
char
usb_buf_re
[
2049
]
=
{
0
};
memcpy
(
&
usb_buf_re
[
1
],
buffer
,
2048
);
memcpy
(
&
usb_buf_re
[
1
],
buffer
,
2048
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
...
@@ -74,6 +75,7 @@ void hid_thread::run()
...
@@ -74,6 +75,7 @@ void hid_thread::run()
}
}
if
(
pUsbFram1
->
buff
[
0
]
==
0x02
&&
pUsbFram1
->
buff
[
1
]
==
0x02
){
if
(
pUsbFram1
->
buff
[
0
]
==
0x02
&&
pUsbFram1
->
buff
[
1
]
==
0x02
){
cout
<<
"stop screen shot"
<<
endl
;
cout
<<
"stop screen shot"
<<
endl
;
isPlay
=
false
;
char
usb_buf_re
[
2049
]
=
{
0
};
char
usb_buf_re
[
2049
]
=
{
0
};
memcpy
(
&
usb_buf_re
[
1
],
buffer
,
2048
);
memcpy
(
&
usb_buf_re
[
1
],
buffer
,
2048
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
...
@@ -99,13 +101,16 @@ void hid_thread::run()
...
@@ -99,13 +101,16 @@ void hid_thread::run()
//开始投屏
//开始投屏
if
(
pUsbFram2
->
buff
[
0
]
==
0x01
&&
pUsbFram2
->
buff
[
1
]
==
0x01
){
if
(
pUsbFram2
->
buff
[
0
]
==
0x01
&&
pUsbFram2
->
buff
[
1
]
==
0x01
){
cout
<<
"start screen shot"
<<
endl
;
cout
<<
"start screen shot"
<<
endl
;
isPlay
=
true
;
char
usb_buf_re
[
2049
]
=
{
0
};
char
usb_buf_re
[
2049
]
=
{
0
};
memcpy
(
&
usb_buf_re
[
1024
],
buffer
,
2048
);
memcpy
(
&
usb_buf_re
[
1024
],
buffer
,
2048
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
mcb
(
SCREEN_SHOT_START
);
mcb
(
SCREEN_SHOT_START
);
}
}
if
(
pUsbFram2
->
buff
[
0
]
==
0x02
&&
pUsbFram2
->
buff
[
1
]
==
0x02
){
if
(
pUsbFram2
->
buff
[
0
]
==
0x02
&&
pUsbFram2
->
buff
[
1
]
==
0x02
){
cout
<<
"stop screen shot"
<<
endl
;
cout
<<
"stop screen shot"
<<
endl
;
isPlay
=
false
;
char
usb_buf_re
[
2049
]
=
{
0
};
char
usb_buf_re
[
2049
]
=
{
0
};
memcpy
(
&
usb_buf_re
[
1024
],
buffer
,
2048
);
memcpy
(
&
usb_buf_re
[
1024
],
buffer
,
2048
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
hid_write
(
hid_fd
,(
unsigned
char
*
)
usb_buf_re
,
2049
);
...
@@ -115,7 +120,10 @@ void hid_thread::run()
...
@@ -115,7 +120,10 @@ void hid_thread::run()
continue
;
continue
;
}
}
if
(
isPlay
==
false
){
mcb
(
SCREEN_SHOT_STOP
);
continue
;
}
if
(
pUsbFram1
->
head
==
0x44332211
)
{
if
(
pUsbFram1
->
head
==
0x44332211
)
{
while
(
pNaluParsing
->
lock
)
{
while
(
pNaluParsing
->
lock
)
{
...
@@ -148,6 +156,8 @@ void hid_thread::run()
...
@@ -148,6 +156,8 @@ void hid_thread::run()
}
}
frameId
=
pUsbFram2
->
id
;
frameId
=
pUsbFram2
->
id
;
}
}
}
}
}
}
void
hid_thread
::
setCallback
(
Func
cb
){
void
hid_thread
::
setCallback
(
Func
cb
){
...
...
VideoDecoder/src/VideoReader/hid_thread.h
View file @
b04e98a8
...
@@ -5,12 +5,15 @@
...
@@ -5,12 +5,15 @@
#include "NALUParsing.h"
#include "NALUParsing.h"
#include "usb/hidapi.h"
#include "usb/hidapi.h"
#include "iostream"
#include "iostream"
using
namespace
std
;
using
namespace
std
;
typedef
std
::
function
<
void
(
int
s
)
>
Func
;
typedef
std
::
function
<
void
(
int
s
)
>
Func
;
class
hid_thread
:
public
QThread
class
hid_thread
:
public
QThread
{
{
public
:
public
:
bool
isPlay
=
false
;
hid_device
*
hid_fd
;
hid_device
*
hid_fd
;
NALUParsing
*
pNaluParsing
;
NALUParsing
*
pNaluParsing
;
void
setCallback
(
Func
cb
);
void
setCallback
(
Func
cb
);
...
...
bin32/VideoDecode.exe
View file @
b04e98a8
No preview for this file type
src/mainwindow.cpp
View file @
b04e98a8
...
@@ -99,6 +99,9 @@ void MainWindow::slotBtnClick(bool isChecked)
...
@@ -99,6 +99,9 @@ void MainWindow::slotBtnClick(bool isChecked)
///显示视频数据,此函数不宜做耗时操作,否则会影响播放的流畅性。
///显示视频数据,此函数不宜做耗时操作,否则会影响播放的流畅性。
void
MainWindow
::
onDisplayVideo
(
std
::
shared_ptr
<
VideoFrame
>
videoFrame
,
int
frameNum
)
void
MainWindow
::
onDisplayVideo
(
std
::
shared_ptr
<
VideoFrame
>
videoFrame
,
int
frameNum
)
{
{
if
(
hidThread
->
isPlay
==
false
){
return
;
}
ui
->
label_frameNum
->
setText
(
QString
(
"%1"
).
arg
(
frameNum
));
ui
->
label_frameNum
->
setText
(
QString
(
"%1"
).
arg
(
frameNum
));
ui
->
widget_videoPlayer
->
inputOneFrame
(
videoFrame
);
ui
->
widget_videoPlayer
->
inputOneFrame
(
videoFrame
);
...
...
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