Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/HW/Camera.h
5671 views
1
// Copyright (c) 2020- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
#pragma once
18
19
#include "ppsspp_config.h"
20
#include "Core/HLE/sceUsbCam.h"
21
22
#include "ext/jpge/jpgd.h"
23
#include "ext/jpge/jpge.h"
24
25
extern "C" {
26
#ifdef USE_FFMPEG
27
#include "libswscale/swscale.h"
28
#include "libavutil/imgutils.h"
29
#endif //USE_FFMPEG
30
}
31
32
void __cameraDummyImage(int width, int height, unsigned char** outData, int* outLen);
33
34
#if defined(USING_QT_UI)
35
#include <QAbstractVideoSurface>
36
#include <QCameraInfo>
37
38
class MyViewfinder : public QAbstractVideoSurface {
39
Q_OBJECT
40
public:
41
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
42
bool present(const QVideoFrame &frame);
43
};
44
45
static int qtc_ideal_width;
46
static int qtc_ideal_height;
47
static QCamera *qt_camera;
48
static QAbstractVideoSurface *qt_viewfinder;
49
50
std::vector<std::string> __qt_getDeviceList();
51
int __qt_startCapture(int width, int height);
52
int __qt_stopCapture();
53
54
#elif PPSSPP_PLATFORM(MAC)
55
std::vector<std::string> __mac_getDeviceList();
56
int __mac_startCapture(int width, int height);
57
int __mac_stopCapture();
58
59
#elif PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID)
60
#include <fcntl.h>
61
#include <linux/videodev2.h>
62
#include <sys/ioctl.h>
63
#include <sys/mman.h>
64
65
#include "Common/Thread/ThreadUtil.h"
66
67
typedef struct {
68
void *start;
69
int length;
70
} v4l_buf_t;
71
72
static int v4l_fd = -1;
73
static uint32_t v4l_format;
74
static int v4l_hw_width;
75
static int v4l_hw_height;
76
static int v4l_height_fixed_aspect;
77
static int v4l_ideal_width;
78
static int v4l_ideal_height;
79
80
static pthread_t v4l_thread;
81
static int v4l_buffer_count;
82
static v4l_buf_t *v4l_buffers;
83
84
std::vector<std::string> __v4l_getDeviceList();
85
int __v4l_startCapture(int width, int height);
86
int __v4l_stopCapture();
87
#endif
88