forked from carbotaniuman/libcamera_meme
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multi camera support to backend (#9)
* Move stuff into own folders * Refactor JNI * create tasks/launch * Fix jni types * Fix el stupid * fix pedantic warnings * run format * Fix compile * Clang-format memes * fix weird wpiformat things * Add grey-passthrough shader * asdf * Remove prints and fix indexing
- Loading branch information
Showing
43 changed files
with
1,665 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
build | ||
.cache/ | ||
compile_commands.json | ||
photon_sysroot* | ||
build-pi/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
cppHeaderFileInclude { | ||
\.h$ | ||
\.hpp$ | ||
\.inc$ | ||
\.inl$ | ||
} | ||
|
||
cppSrcFileInclude { | ||
\.cpp$ | ||
} | ||
|
||
modifiableFileExclude { | ||
\.jpg$ | ||
\.jpeg$ | ||
\.png$ | ||
\.gif$ | ||
\.so$ | ||
\.dll$ | ||
\.webp$ | ||
\.ico$ | ||
gradlew | ||
} | ||
|
||
includeProject { | ||
^photonLib/ | ||
} | ||
|
||
includeOtherLibs { | ||
^frc/ | ||
^networktables/ | ||
^units/ | ||
^wpi/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (C) Photon Vision. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "java", | ||
"name": "LibCameraJNI", | ||
"request": "launch", | ||
"mainClass": "org.photonvision.raspi.LibCameraJNI", | ||
"projectName": "photon-libcamera-gl-driver_ef1a9c31" | ||
}, | ||
{ | ||
"name": "(gdb) Launch", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/libcamera_meme", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${fileDirname}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Set Disassembly Flavor to Intel", | ||
"text": "-gdb-set disassembly-flavor intel", | ||
"ignoreFailures": true | ||
} | ||
], | ||
"preLaunchTask": "Build libcamera_meme" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"label": "Build libcamera_meme", | ||
"type": "shell", | ||
"command": "cmake", | ||
"args": [ | ||
"--build", | ||
"build", | ||
"--target", | ||
"libcamera_meme" | ||
], | ||
"options": { | ||
"cwd": "${workspaceFolder}/" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) Photon Vision. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <condition_variable> | ||
#include <mutex> | ||
#include <optional> | ||
#include <utility> | ||
|
||
template <typename T> class BlockingFuture { | ||
public: | ||
BlockingFuture() = default; | ||
|
||
void set(T &&item) { | ||
std::unique_lock<std::mutex> lock(m_mutex); | ||
m_data = std::make_optional<>(std::forward<T>(item)); | ||
lock.unlock(); | ||
m_cond.notify_one(); | ||
} | ||
|
||
T take() { | ||
std::unique_lock<std::mutex> lock(m_mutex); | ||
m_cond.wait(lock, [&] { return m_data.has_value(); }); | ||
|
||
auto item = std::move(m_data.value()); | ||
m_data.reset(); | ||
return item; | ||
} | ||
|
||
private: | ||
std::optional<T> m_data; | ||
std::mutex m_mutex; | ||
std::condition_variable m_cond; | ||
}; |
Oops, something went wrong.