Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: webrtc/api/android/jni/native_handle_impl.h

Issue 2547483003: Move /webrtc/api/android files to /webrtc/sdk/android (Closed)
Patch Set: Move to api folder under Android instead of src Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/android/jni/jni_onload.cc ('k') | webrtc/api/android/jni/native_handle_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_API_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
12 #define WEBRTC_API_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
13
14 #include <jni.h>
15
16 #include "webrtc/common_video/include/video_frame_buffer.h"
17 #include "webrtc/common_video/rotation.h"
18
19 namespace webrtc_jni {
20
21 // Open gl texture matrix, in column-major order. Operations are
22 // in-place.
23 class Matrix {
24 public:
25 Matrix(JNIEnv* jni, jfloatArray a);
26
27 jfloatArray ToJava(JNIEnv* jni);
28
29 // Crop arguments are relative to original size.
30 void Crop(float cropped_width,
31 float cropped_height,
32 float crop_x,
33 float crop_y);
34
35 void Rotate(webrtc::VideoRotation rotation);
36
37 private:
38 static void Multiply(const float a[16], const float b[16], float result[16]);
39 float elem_[16];
40 };
41
42 // Wrapper for texture object.
43 struct NativeHandleImpl {
44 NativeHandleImpl(JNIEnv* jni,
45 jint j_oes_texture_id,
46 jfloatArray j_transform_matrix);
47
48 NativeHandleImpl(int id, const Matrix& matrix);
49
50 const int oes_texture_id;
51 Matrix sampling_matrix;
52 };
53
54 class AndroidTextureBuffer : public webrtc::NativeHandleBuffer {
55 public:
56 AndroidTextureBuffer(int width,
57 int height,
58 const NativeHandleImpl& native_handle,
59 jobject surface_texture_helper,
60 const rtc::Callback0<void>& no_longer_used);
61 ~AndroidTextureBuffer();
62 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
63
64 // First crop, then scale to dst resolution, and then rotate.
65 rtc::scoped_refptr<AndroidTextureBuffer> CropScaleAndRotate(
66 int cropped_width,
67 int cropped_height,
68 int crop_x,
69 int crop_y,
70 int dst_width,
71 int dst_height,
72 webrtc::VideoRotation rotation);
73
74 private:
75 NativeHandleImpl native_handle_;
76 // Raw object pointer, relying on the caller, i.e.,
77 // AndroidVideoCapturerJni or the C++ SurfaceTextureHelper, to keep
78 // a global reference. TODO(nisse): Make this a reference to the C++
79 // SurfaceTextureHelper instead, but that requires some refactoring
80 // of AndroidVideoCapturerJni.
81 jobject surface_texture_helper_;
82 rtc::Callback0<void> no_longer_used_cb_;
83 };
84
85 } // namespace webrtc_jni
86
87 #endif // WEBRTC_API_JAVA_JNI_NATIVE_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/api/android/jni/jni_onload.cc ('k') | webrtc/api/android/jni/native_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698