Index: webrtc/api/java/jni/native_handle_impl.h |
diff --git a/webrtc/api/java/jni/native_handle_impl.h b/webrtc/api/java/jni/native_handle_impl.h |
index b781815718dfd89f2d175060b3ef69a4b4e88e7e..0d0153281eac1480a5dd07190cc117b6d976d5d1 100644 |
--- a/webrtc/api/java/jni/native_handle_impl.h |
+++ b/webrtc/api/java/jni/native_handle_impl.h |
@@ -18,14 +18,37 @@ |
namespace webrtc_jni { |
+// Open gl texture matrix, in column-major order. Operations are |
+// in-place. |
+class Matrix { |
+ public: |
+ Matrix(JNIEnv* jni, jfloatArray a); |
+ |
+ jfloatArray ToJava(JNIEnv* jni); |
+ |
+ // Crop arguments are relative to original size. |
+ void Crop(float cropped_width, |
+ float cropped_height, |
+ float crop_x, |
+ float crop_y); |
+ |
+ void Rotate(webrtc::VideoRotation rotation); |
+ |
+ private: |
+ static void Multiply(const float a[16], const float b[16], float result[16]); |
+ float elem_[16]; |
+}; |
+ |
// Wrapper for texture object. |
struct NativeHandleImpl { |
NativeHandleImpl(JNIEnv* jni, |
jint j_oes_texture_id, |
jfloatArray j_transform_matrix); |
+ NativeHandleImpl(int id, const Matrix& matrix); |
+ |
const int oes_texture_id; |
- float sampling_matrix[16]; |
+ Matrix sampling_matrix; |
}; |
class AndroidTextureBuffer : public webrtc::NativeHandleBuffer { |
@@ -42,6 +65,8 @@ class AndroidTextureBuffer : public webrtc::NativeHandleBuffer { |
rtc::scoped_refptr<AndroidTextureBuffer> CropScaleAndRotate( |
int cropped_width, |
int cropped_height, |
+ int crop_x, |
+ int crop_y, |
int dst_width, |
int dst_height, |
webrtc::VideoRotation rotation); |