mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
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:
1 parent
948062907b
commit
9d33e828ab
3 files changed
+35
-7
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in new issue
Block a user