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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user