mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Remove direct dependency from Core to MacCameraHelper.mm
This commit is contained in:
1 parent
6442742f00
commit
240a974e95
6 files changed
+33
-20
No files matched your search
@@ -332,10 +332,8 @@ std::vector<std::string> Camera::getDeviceList() {
|
||||
if (winCamera) {
|
||||
return winCamera->getDeviceList();
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
|
||||
#elif PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
|
||||
return System_GetCameraDeviceList();
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
return __mac_getDeviceList();
|
||||
#elif defined(USING_QT_UI) // Qt:macOS / Qt:Linux
|
||||
return __qt_getDeviceList();
|
||||
#elif PPSSPP_PLATFORM(LINUX) // SDL:Linux
|
||||
@@ -359,12 +357,10 @@ int Camera::startCapture() {
|
||||
void* resolution = static_cast<void*>(new std::vector<int>({ width, height }));
|
||||
winCamera->sendMessage({ CAPTUREDEVICE_COMMAND::START, resolution });
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) || defined(USING_QT_UI)
|
||||
#elif PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) || defined(USING_QT_UI)
|
||||
char command[40] = {0};
|
||||
snprintf(command, sizeof(command), "startVideo_%dx%d", width, height);
|
||||
System_CameraCommand(command);
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
__mac_startCapture(width, height);
|
||||
#elif PPSSPP_PLATFORM(LINUX)
|
||||
__v4l_startCapture(width, height);
|
||||
#else
|
||||
@@ -379,10 +375,8 @@ int Camera::stopCapture() {
|
||||
if (winCamera) {
|
||||
winCamera->sendMessage({ CAPTUREDEVICE_COMMAND::STOP, nullptr });
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) || defined(USING_QT_UI)
|
||||
#elif PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS) || defined(USING_QT_UI)
|
||||
System_CameraCommand("stopVideo");
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
__mac_stopCapture();
|
||||
#elif PPSSPP_PLATFORM(LINUX)
|
||||
__v4l_stopCapture();
|
||||
#else
|
||||
|
||||
+1
-2
@@ -55,7 +55,6 @@ void __cameraDummyImage(int width, int height, unsigned char** outData, int* out
|
||||
std::vector<std::string> __mac_getDeviceList();
|
||||
int __mac_startCapture(int width, int height);
|
||||
int __mac_stopCapture();
|
||||
|
||||
#elif PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID)
|
||||
#include <fcntl.h>
|
||||
#include <linux/videodev2.h>
|
||||
@@ -84,4 +83,4 @@ int __mac_stopCapture();
|
||||
std::vector<std::string> __v4l_getDeviceList();
|
||||
int __v4l_startCapture(int width, int height);
|
||||
int __v4l_stopCapture();
|
||||
#endif
|
||||
#endif
|
||||
@@ -115,9 +115,7 @@ static inline FShaderBit operator +(FShaderBit bit, int i) {
|
||||
}
|
||||
|
||||
struct ShaderID {
|
||||
ShaderID() {
|
||||
clear();
|
||||
}
|
||||
ShaderID() : d(0) {}
|
||||
void clear() {
|
||||
d = 0;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ SDLJoystick *joystick = NULL;
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/HW/Camera.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Config.h"
|
||||
@@ -503,6 +504,19 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
#endif /* PPSSPP_PLATFORM(WINDOWS) */
|
||||
return true;
|
||||
}
|
||||
case SystemRequestType::CAMERA_COMMAND:
|
||||
#if PPSSPP_PLATFORM(MAC)
|
||||
if (!strncmp(param1.c_str(), "startVideo", 10)) {
|
||||
int width = 0, height = 0;
|
||||
sscanf(param1.c_str(), "startVideo_%dx%d", &width, &height);
|
||||
__mac_startCapture(width, height);
|
||||
} else if (!strcmp(param1.c_str(), "stopVideo")) {
|
||||
__mac_stopCapture();
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case SystemRequestType::NOTIFY_UI_EVENT:
|
||||
{
|
||||
switch ((UIEventNotification)param3) {
|
||||
@@ -532,6 +546,14 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
void System_AskForPermission(SystemPermission permission) {}
|
||||
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }
|
||||
|
||||
std::vector<std::string> System_GetCameraDeviceList() {
|
||||
#if PPSSPP_PLATFORM(MAC)
|
||||
return __mac_getDeviceList();
|
||||
#elif PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID)
|
||||
return __v4l_getDeviceList();
|
||||
#endif
|
||||
}
|
||||
|
||||
void System_LaunchUrl(LaunchUrlType urlType, std::string_view url) {
|
||||
switch (urlType) {
|
||||
case LaunchUrlType::BROWSER_URL:
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
|
||||
void update() override;
|
||||
|
||||
InputMode PassInputToMapper() const {
|
||||
InputMode PassInputToMapper() const override {
|
||||
return InputMode::Other | InputMode::Keyboard | InputMode::Mouse;
|
||||
}
|
||||
|
||||
|
||||
@@ -2024,15 +2024,15 @@ void System_AudioPushSamples(const int32_t *audio, int numSamples, float volume)
|
||||
|
||||
void System_AudioGetDebugStats(char *buf, size_t bufSize) { if (buf) buf[0] = '\0'; }
|
||||
void System_AudioClear() {}
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
|
||||
std::vector<std::string> System_GetCameraDeviceList() { return std::vector<std::string>(); }
|
||||
bool System_AudioRecordingIsAvailable() { return false; }
|
||||
bool System_AudioRecordingState() { return false; }
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
std::vector<std::string> __mac_getDeviceList() { return std::vector<std::string>(); }
|
||||
int __mac_startCapture(int width, int height) { return 0; }
|
||||
int __mac_stopCapture() { return 0; }
|
||||
#else
|
||||
// Stub for now.
|
||||
std::vector<std::string> System_GetCameraDeviceList() {
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: To avoid having to define these here, these should probably be turned into system "requests".
|
||||
|
||||
Reference in new issue
Block a user