feat: Use AHardwareBuffer* for frame.toArrayBuffer() (#1888)
* feat: Route images through `ImageWriter` into OpenGL pipeline * fix: Use RGB format * fix: Every device supports YUV, RGB and NATIVE * Update VideoPipeline.kt * log format * Plug ImageReader between OpenGL pipeline * Call Frame Processor * Format * Remove logs * feat: Use `HardwareBuffer` for `toArrayBuffer()` * Format
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "JFrame.h"
|
||||
|
||||
#include <android/hardware_buffer_jni.h>
|
||||
#include <fbjni/ByteBuffer.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <jni.h>
|
||||
@@ -58,9 +59,10 @@ int JFrame::getBytesPerRow() const {
|
||||
return getBytesPerRowMethod(self());
|
||||
}
|
||||
|
||||
local_ref<JByteBuffer> JFrame::toByteBuffer() const {
|
||||
static const auto toByteBufferMethod = getClass()->getMethod<JByteBuffer()>("toByteBuffer");
|
||||
return toByteBufferMethod(self());
|
||||
AHardwareBuffer* JFrame::getHardwareBuffer() const {
|
||||
static const auto getHardwareBufferMethod = getClass()->getMethod<jobject()>("getHardwareBufferBoxed");
|
||||
auto hardwareBuffer = getHardwareBufferMethod(self());
|
||||
return AHardwareBuffer_fromHardwareBuffer(jni::Environment::current(), hardwareBuffer.get());
|
||||
}
|
||||
|
||||
void JFrame::incrementRefCount() {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/hardware_buffer.h>
|
||||
#include <fbjni/ByteBuffer.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <jni.h>
|
||||
@@ -26,7 +27,7 @@ public:
|
||||
jlong getTimestamp() const;
|
||||
local_ref<JString> getOrientation() const;
|
||||
local_ref<JString> getPixelFormat() const;
|
||||
local_ref<JByteBuffer> toByteBuffer() const;
|
||||
AHardwareBuffer* getHardwareBuffer() const;
|
||||
void incrementRefCount();
|
||||
void decrementRefCount();
|
||||
void close();
|
||||
|
||||
Reference in New Issue
Block a user