CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/HW/Camera.h
Views: 1401
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(LINUX) && !PPSSPP_PLATFORM(ANDROID)
55
#include <fcntl.h>
56
#include <linux/videodev2.h>
57
#include <sys/ioctl.h>
58
#include <sys/mman.h>
59
60
#include "Common/Thread/ThreadUtil.h"
61
62
typedef struct {
63
void *start;
64
int length;
65
} v4l_buf_t;
66
67
static int v4l_fd = -1;
68
static uint32_t v4l_format;
69
static int v4l_hw_width;
70
static int v4l_hw_height;
71
static int v4l_height_fixed_aspect;
72
static int v4l_ideal_width;
73
static int v4l_ideal_height;
74
75
static pthread_t v4l_thread;
76
static int v4l_buffer_count;
77
static v4l_buf_t *v4l_buffers;
78
79
std::vector<std::string> __v4l_getDeviceList();
80
int __v4l_startCapture(int width, int height);
81
int __v4l_stopCapture();
82
#endif
83