Fix(record): correct MJPEG upside-down playback
and remove 0-byte AVI residue on encoder open failure
This commit is contained in:
@@ -284,13 +284,13 @@ bool BmpToJpeg(LPVOID lpBuffer, int width, int height, int quality,
|
||||
return false;
|
||||
}
|
||||
|
||||
// 复制数据(注意:DIB 是底部到顶部,需要翻转)
|
||||
// 输入已为 top-down 的紧凑 BGR24(调用方已通过 Process24BitBmp /
|
||||
// ConvertScreenshot32to24 完成翻转与去对齐),此处直接按行拷贝即可
|
||||
BYTE* srcData = (BYTE*)lpBuffer;
|
||||
BYTE* dstData = (BYTE*)bitmapData.Scan0;
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
// DIB 是从底部开始的,所以需要翻转
|
||||
BYTE* srcRow = srcData + (height - 1 - y) * rowSize;
|
||||
BYTE* srcRow = srcData + y * rowSize;
|
||||
BYTE* dstRow = dstData + y * bitmapData.Stride;
|
||||
memcpy(dstRow, srcRow, width * 3);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <Vfw.h>
|
||||
#pragma comment(lib,"Vfw32.lib")
|
||||
#include "LangManager.h"
|
||||
|
||||
#define ERR_INVALID_PARAM 1
|
||||
#define ERR_NO_ENCODER 2
|
||||
@@ -30,13 +31,13 @@ public:
|
||||
{
|
||||
switch (result) {
|
||||
case ERR_INVALID_PARAM:
|
||||
return ("无效参数");
|
||||
return _L("无效参数").GetString();
|
||||
case ERR_NOT_SUPPORT:
|
||||
return ("不支持的位深度,需要24位或32位");
|
||||
return _L("不支持的位深度,需要24位或32位").GetString();
|
||||
case ERR_NO_ENCODER:
|
||||
return ("未安装x264编解码器 \n下载地址:https://sourceforge.net/projects/x264vfw");
|
||||
return _L("未安装x264编解码器 \n下载地址:https://sourceforge.net/projects/x264vfw").GetString();
|
||||
case ERR_INTERNAL:
|
||||
return("创建AVI文件失败");
|
||||
return _L("创建AVI文件失败").GetString();
|
||||
default:
|
||||
return "succeed";
|
||||
}
|
||||
|
||||
@@ -1911,6 +1911,7 @@ void CScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
FCCHandler handler = nID == IDM_SAVEAVI ? ENCODER_MJPEG : ENCODER_H264;
|
||||
int code;
|
||||
if (code = m_aviStream.Open(m_aviFile, m_BitmapInfor_Full, rate, handler)) {
|
||||
DeleteFile(m_aviFile); // 删除 AVIFileOpen 残留的 0 字节文件
|
||||
MessageBoxL(CString("Create Video(*.avi) Failed:\n") + m_aviFile + "\r\n" + _TR("错误代码: ") +
|
||||
CBmpToAvi::GetErrMsg(code).c_str(), "提示", MB_ICONINFORMATION);
|
||||
m_aviFile = _T("");
|
||||
|
||||
@@ -1888,3 +1888,7 @@ FRPC Զ
|
||||
撤销 FRP 配置=Revoke FRP Configuration
|
||||
已撤销授权 %s 的 FRP 配置,远程端口 %d 已释放。=Revoked FRP configuration for license %s. Remote port %d has been released.
|
||||
撤销成功=Revoked Successfully
|
||||
无效参数=Invalid argument
|
||||
不支持的位深度,需要24位或32位=Bitmap depth is unsupported
|
||||
未安装x264编解码器 \n下载地址:https://sourceforge.net/projects/x264vfw=x264 Encoder is required \nDownload via:https://sourceforge.net/projects/x264vfw
|
||||
创建AVI文件失败=Create AVI file failed
|
||||
|
||||
@@ -1879,3 +1879,7 @@ FRPC Զ
|
||||
撤销 FRP 配置=撤銷 FRP 配置
|
||||
已撤销授权 %s 的 FRP 配置,远程端口 %d 已释放。=已撤銷授權 %s 的 FRP 配置,遠端連接埠 %d 已釋放。
|
||||
撤销成功=撤銷成功
|
||||
无效参数无效参数
|
||||
不支持的位深度,需要24位或32位=不支持的位深度,需要24位或32位
|
||||
未安装x264编解码器 \n下载地址:https://sourceforge.net/projects/x264vfw=未安装x264编解码器 \n下载地址:https://sourceforge.net/projects/x264vfw
|
||||
创建AVI文件失败=创建AVI文件失败
|
||||
|
||||
Reference in New Issue
Block a user