Camera: Compress webcam frames to fit the game's framesize

The PSP camera keeps JPEG frames within the framesize from the video setup.
Go!Edit stores frames in 15KB slots and only takes frames that fit, so our
uncompressed-quality webcam frames were dropped and one frame got repeated
for the whole clip. Lower the JPEG quality until a frame fits.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-29 11:44:10 -06:00
1 parent 948062907b
commit 9d33e828ab
3 files changed
+35 -7

No files matched your search

+15
View File
@@ -418,6 +418,21 @@ void Camera::onCameraDeviceChange() {
}
}
int Camera::getMaxFrameSize() {
int framesize = 0;
if (config) {
if (config->type == Camera::ConfigType::CfVideoEx) {
framesize = config->videoExParam.framesize;
} else if (config->type == Camera::ConfigType::CfVideo) {
framesize = config->videoParam.framesize;
}
}
if (framesize <= 0 || framesize > VIDEO_BUFFER_SIZE) {
return VIDEO_BUFFER_SIZE;
}
return framesize;
}
void Camera::pushCameraImage(long long length, unsigned char* image) {
std::lock_guard<std::mutex> lock(videoBufferMutex);
if (!videoBuffer) {
+3
View File
@@ -121,4 +121,7 @@ namespace Camera {
int startCapture();
int stopCapture();
void pushCameraImage(long long length, unsigned char *image);
// The largest JPEG frame the game accepts (framesize in the video setup). The PSP camera compresses
// to fit it, so capture code should too.
int getMaxFrameSize();
}