* Create `VideoPipeline` c++ * Remove folly C++ dependency * Create `VideoPipeline` HybridClass * Set up OpenGL * Add outputs * Update VideoPipeline.kt * Bum `minSdkVersion` to `26` * Create `VideoPipelineOutput` * Create output funcs * Set output pipelines * Add FP/Recording on Output change * Update VideoPipeline.cpp * Create `PassThroughShader` * Try to draw? I have honestly no idea * fix: Fix `setFrameProcessor` nameclash * fix: Fix `high-res-sizes` being null * Add preview output * Create `OpenGLContext.cpp` * Make screen red * This _should_ work (MESSY) * FINALLY RENDER TEXTURE * Rotate * Mirror * Clean up a bit * Add `getWidth()`/`getHeight()` * Cleanup * fix: Use uniforms instead of attributes * Draw with passed rotation/mirror mode * feat: Use SurfaceTexture's transformMatrix in OpenGL pipeline (#1727) * feat: Use Transform Matrix from SurfaceTexture * Renam * feat: Fix OpenGL Shader * Update VideoPipeline.kt * Measure elapsed time * fix: Fix low resolution * Render to offscreen * Render to every context * Release `SurfaceTexture` on close * Use one OpenGL context to render to multiple EGLSurfaces * Clean up a bit * fix: Fix recording pipeline not triggering * fix: Synchronize close to prevent nulls * Update OpenGLRenderer.cpp * fix: Hardcode Android recorder size
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
//
|
|
// Created by Marc Rousavy on 25.07.21.
|
|
//
|
|
|
|
#include "JVisionCameraScheduler.h"
|
|
#include <fbjni/fbjni.h>
|
|
|
|
namespace vision {
|
|
|
|
using namespace facebook;
|
|
using TSelf = jni::local_ref<JVisionCameraScheduler::jhybriddata>;
|
|
|
|
TSelf JVisionCameraScheduler::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
return makeCxxInstance(jThis);
|
|
}
|
|
|
|
void JVisionCameraScheduler::dispatchAsync(const std::function<void()>& job) {
|
|
// 1. add job to queue
|
|
_jobs.push(job);
|
|
scheduleTrigger();
|
|
}
|
|
|
|
void JVisionCameraScheduler::scheduleTrigger() {
|
|
// 2. schedule `triggerUI` to be called on the java thread
|
|
static auto method = _javaPart->getClass()->getMethod<void()>("scheduleTrigger");
|
|
method(_javaPart.get());
|
|
}
|
|
|
|
void JVisionCameraScheduler::trigger() {
|
|
std::unique_lock<std::mutex> lock(_mutex);
|
|
// 3. call job we enqueued in step 1.
|
|
auto job = _jobs.front();
|
|
job();
|
|
_jobs.pop();
|
|
}
|
|
|
|
void JVisionCameraScheduler::registerNatives() {
|
|
registerHybrid({
|
|
makeNativeMethod("initHybrid", JVisionCameraScheduler::initHybrid),
|
|
makeNativeMethod("trigger", JVisionCameraScheduler::trigger),
|
|
});
|
|
}
|
|
|
|
} // namespace vision
|