Skip to content

Commit 7cbf89e

Browse files
committed
modify:screen capture format support scale
ci:update
1 parent 072df08 commit 7cbf89e

5 files changed

Lines changed: 28 additions & 11 deletions

File tree

.github/workflows/msbuild.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ jobs:
5151
run: |
5252
cd vcpkg
5353
./bootstrap-vcpkg.bat
54-
./vcpkg.exe install lua:x86-windows opencv[contrib,freetype]:x86-windows libqrencode:x86-windows leptonica:x86-windows
54+
./vcpkg.exe install lua:x86-windows opencv[contrib,freetype]:x86-windows libqrencode:x86-windows leptonica:x86-windows tesseract:x86-windows
5555
./vcpkg.exe integrate install
5656
shell: pwsh
5757
- name: vcpkg install (x64)
5858
if: matrix.platform == 'x64'
5959
run: |
6060
cd vcpkg
6161
./bootstrap-vcpkg.bat
62-
./vcpkg.exe install lua:x64-windows opencv[contrib,freetype]:x64-windows libqrencode:x64-windows leptonica:x64-windows
62+
./vcpkg.exe install lua:x64-windows opencv[contrib,freetype]:x64-windows libqrencode:x64-windows leptonica:x64-windows tesseract:x64-windows
6363
./vcpkg.exe integrate install
6464
shell: pwsh
6565
- name: vcpkg install (ARM64)

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Modify the database configuration in XSQL in the configuration file to your
8484
The default configuration does not enable database support. If the database interface is required, you need to enable the database yourself
8585

8686
#### Windows
87-
need to vcpkg configure third-part env.refer vcpkg install guide.after installed and execution:vcpkg.exe install lua:x86-windows opencv[contrib,freetype]:x86-windows libqrencode:x86-windows leptonica:x86-windows lua:x64-windows opencv[contrib,freetype]:x64-windows libqrencode:x64-windows leptonica:x64-windows
87+
need to vcpkg configure third-part env.refer vcpkg install guide.after installed and execution:vcpkg.exe install lua:x86-windows opencv[contrib,freetype]:x86-windows libqrencode:x86-windows leptonica:x86-windows tesseract:x86-windows lua:x64-windows opencv[contrib,freetype]:x64-windows libqrencode:x64-windows leptonica:x64-windows tesseract:x64-windows
8888
use vs open and compile,suport windows 7sp1 and above
8989
Just Run it
9090

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ git clone https://gitee.com/xengine/XEngine_IPMacData.git XEngine_Source/XEngine
9696
git clone https://gitee.com/xengine/XEngine_PhoneData.git XEngine_Source/XEngine_DependLibrary/XEngine_PhoneData
9797

9898
#### Windows
99-
需要vcpkg配置第三方环境,具体参考vcpkg安装方式,安装好后执行:vcpkg.exe install lua:x86-windows opencv[contrib,freetype]:x86-windows libqrencode:x86-windows leptonica:x86-windows lua:x64-windows opencv[contrib,freetype]:x64-windows libqrencode:x64-windows leptonica:x64-windows
99+
需要vcpkg配置第三方环境,具体参考vcpkg安装方式,安装好后执行:vcpkg.exe install lua:x86-windows opencv[contrib,freetype]:x86-windows libqrencode:x86-windows leptonica:x86-windows tesseract:x86-windows lua:x64-windows opencv[contrib,freetype]:x64-windows libqrencode:x64-windows leptonica:x64-windows tesseract:x64-windows
100100
使用VS打开并且编译,支持WINDOWS 7SP1以上系统
101101
直接运行即可
102102

XEngine_Docment/Docment_zh.docx

3.06 KB
Binary file not shown.

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_AVRecord.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ static XHANDLE xhAudio = NULL;
66
static XHANDLE xhSound = NULL;
77
static XHANDLE xhScreen = NULL;
88
static XHANDLE xhPacket = NULL;
9-
static XHANDLE xhFilter = 0;
9+
static XHANDLE xhFilter = NULL;
10+
static XHANDLE xhScale = NULL;
1011

1112
void XCALLBACK HTTPTask_TaskPost_CBVideo(XHANDLE*** pppSt_AVBuffer, XPVOID lParam)
1213
{
13-
int nListCount = 0;
14-
XHANDLE** ppSt_AVPacket;
15-
VideoCodec_Stream_EnCodec(xhVideo, pppSt_AVBuffer, &ppSt_AVPacket, &nListCount);
16-
for (int i = 0; i < nListCount; i++)
14+
XHANDLE** ppSt_AVFrame;
15+
if (VideoCodec_Help_ScaleConvert(xhScale, (*pppSt_AVBuffer)[0], &ppSt_AVFrame))
1716
{
18-
AVFormat_Packet_StreamWrite(xhPacket, 0, ppSt_AVPacket[i]);
17+
int nListCount = 0;
18+
XHANDLE** ppSt_AVPacket;
19+
VideoCodec_Stream_EnCodec(xhVideo, ppSt_AVFrame[0], &ppSt_AVPacket, &nListCount);
20+
for (int j = 0; j < nListCount; j++)
21+
{
22+
AVFormat_Packet_StreamWrite(xhPacket, 0, ppSt_AVPacket[j]);
23+
}
24+
AVHelp_Memory_FreeAVList(&ppSt_AVPacket, nListCount);
1925
}
20-
AVHelp_Memory_FreeAVList(&ppSt_AVPacket, nListCount);
26+
AVHelp_Memory_FreeAVList(&ppSt_AVFrame, 1, false);
2127
}
2228
void XCALLBACK HTTPTask_TaskPost_CBAudio(XHANDLE*** pppSt_AVBuffer, XPVOID lParam)
2329
{
@@ -61,6 +67,10 @@ bool HTTPTask_TaskPost_AVRecordStart(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuff
6167
XENGINE_AVRECORD st_AVRecord = {};
6268
if (!ModuleProtocol_Parse_AVRecord(lpszMsgBuffer, nMsgLen, &st_AVRecord))
6369
{
70+
st_HDRParam.nHttpCode = 400;
71+
HttpProtocol_Server_SendMsgEx(xhHTTPPacket, m_MemorySend.get(), &nSDLen, &st_HDRParam);
72+
XEngine_Network_Send(lpszClientAddr, m_MemorySend.get(), nSDLen);
73+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求屏幕录制失败,解析协议失败,错误码:%lX"), lpszClientAddr, ModuleProtocol_GetLastError());
6474
return false;
6575
}
6676
//屏幕采集
@@ -98,6 +108,10 @@ bool HTTPTask_TaskPost_AVRecordStart(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuff
98108
//初始化屏幕编码器
99109
XENGINE_PROTOCOL_AVINFO st_AVInfo = {};
100110
AVCollect_Video_GetInfo(xhScreen, &st_AVInfo);
111+
112+
xhScale = VideoCodec_Help_ScaleInit(st_AVInfo.st_VideoInfo.nWidth, st_AVInfo.st_VideoInfo.nHeight, st_AVInfo.st_VideoInfo.nFormat, st_AVInfo.st_VideoInfo.nWidth, st_AVInfo.st_VideoInfo.nHeight, ENUM_AVCODEC_VIDEO_SAMPLEFMT_YUV420P);
113+
114+
st_AVInfo.st_VideoInfo.nFormat = 0;
101115
st_AVInfo.st_VideoInfo.enAVCodec = ENUM_XENGINE_AVCODEC_VIDEO_TYPE_H264;
102116
xhVideo = VideoCodec_Stream_EnInit(&st_AVInfo.st_VideoInfo);
103117
if (NULL == xhVideo)
@@ -111,6 +125,8 @@ bool HTTPTask_TaskPost_AVRecordStart(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuff
111125
VideoCodec_Stream_GetAVCodec(xhVideo, &xhVideoCodec);
112126
AVFormat_Packet_StreamCreate(xhPacket, xhVideoCodec);
113127
BaseLib_Memory_FreeCStyle((XPPMEM)&xhVideoCodec);
128+
//转换
129+
114130
//启用音频
115131
if (_tcsxlen(st_AVRecord.tszAudioDevice) > 0)
116132
{
@@ -187,6 +203,7 @@ bool HTTPTask_TaskPost_AVRecordStop(LPCXSTR lpszClientAddr)
187203
AVFilter_Audio_Destroy(xhFilter);
188204

189205
AVFormat_Packet_Stop(xhPacket);
206+
VideoCodec_Help_ScaleUninit(xhScale);
190207
xhScreen = NULL;
191208
xhSound = NULL;
192209
xhVideo = NULL;

0 commit comments

Comments
 (0)