mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
QT Api for Camera (Linux/macOS)
Allow the use of different resolutions (win/android/iOS)
This commit is contained in:
1 parent
84c1fc86a1
commit
58b04ef77b
17 files changed
+354
-974
No files matched your search
@@ -99,8 +99,7 @@ VideoFormatTransform g_VideoFormats[] =
|
||||
|
||||
const int g_cVideoFormats = 4;
|
||||
|
||||
|
||||
MediaParam defaultVideoParam = { 480, 272, 0, MFVideoFormat_RGB24 };
|
||||
MediaParam defaultVideoParam = { 640, 480, 0, MFVideoFormat_RGB24 };
|
||||
MediaParam defaultAudioParam = { 44100, 2, 0, MFAudioFormat_PCM };
|
||||
|
||||
HRESULT GetDefaultStride(IMFMediaType *pType, LONG *plStride);
|
||||
@@ -363,7 +362,6 @@ WindowsCaptureDevice::WindowsCaptureDevice(CAPTUREDEVIDE_TYPE type) :
|
||||
case CAPTUREDEVIDE_TYPE::VIDEO:
|
||||
targetMediaParam = defaultVideoParam;
|
||||
imageRGB = (unsigned char*)av_malloc(av_image_get_buffer_size(AV_PIX_FMT_RGB24, targetMediaParam.width, targetMediaParam.height, 1));
|
||||
av_image_fill_linesizes(imgRGBLineSizes, AV_PIX_FMT_RGB24, targetMediaParam.width);
|
||||
imgJpegSize = av_image_get_buffer_size(AV_PIX_FMT_YUVJ411P, targetMediaParam.width, targetMediaParam.height, 1);
|
||||
imageJpeg = (unsigned char*)av_malloc(imgJpegSize);
|
||||
break;
|
||||
@@ -414,7 +412,7 @@ bool WindowsCaptureDevice::init() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsCaptureDevice::start() {
|
||||
bool WindowsCaptureDevice::start(UINT32 width, UINT32 height) {
|
||||
HRESULT hr = S_OK;
|
||||
IMFAttributes *pAttributes = nullptr;
|
||||
IMFMediaType *pType = nullptr;
|
||||
@@ -436,6 +434,10 @@ bool WindowsCaptureDevice::start() {
|
||||
return false;
|
||||
}
|
||||
|
||||
targetMediaParam.width = width;
|
||||
targetMediaParam.height = height;
|
||||
av_image_fill_linesizes(imgRGBLineSizes, AV_PIX_FMT_RGB24, targetMediaParam.width);
|
||||
|
||||
m_pCallback = new ReaderCallback(this);
|
||||
|
||||
switch (state) {
|
||||
@@ -699,6 +701,7 @@ void WindowsCaptureDevice::messageHandler() {
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
MFStartup(MF_VERSION);
|
||||
CAPTUREDEVIDE_MESSAGE message;
|
||||
std::vector<int>* resolution;
|
||||
|
||||
if (type == CAPTUREDEVIDE_TYPE::VIDEO) {
|
||||
setCurrentThreadName("Camera");
|
||||
@@ -710,7 +713,8 @@ void WindowsCaptureDevice::messageHandler() {
|
||||
init();
|
||||
break;
|
||||
case CAPTUREDEVIDE_COMMAND::START:
|
||||
start();
|
||||
resolution = static_cast<std::vector<int>*>(message.opacity);
|
||||
start(resolution->at(0), resolution->at(1));
|
||||
break;
|
||||
case CAPTUREDEVIDE_COMMAND::STOP:
|
||||
stop();
|
||||
|
||||
Reference in new issue
Block a user