OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 14 matching lines...) Expand all Loading... |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 * | 26 * |
27 */ | 27 */ |
28 | 28 |
29 #ifndef TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 29 #ifndef TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ |
30 #define TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 30 #define TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ |
31 | 31 |
32 #include <jni.h> | 32 #include <jni.h> |
33 | 33 |
34 #include "webrtc/common_video/include/video_frame_buffer.h" | 34 #include "webrtc/common_video/include/video_frame_buffer.h" |
| 35 #include "webrtc/common_video/rotation.h" |
35 | 36 |
36 namespace webrtc_jni { | 37 namespace webrtc_jni { |
37 | 38 |
38 // Wrapper for texture object. | 39 // Wrapper for texture object. |
39 struct NativeHandleImpl { | 40 struct NativeHandleImpl { |
40 NativeHandleImpl(JNIEnv* jni, | 41 NativeHandleImpl(JNIEnv* jni, |
41 jint j_oes_texture_id, | 42 jint j_oes_texture_id, |
42 jfloatArray j_transform_matrix); | 43 jfloatArray j_transform_matrix); |
43 | 44 |
44 const int oes_texture_id; | 45 const int oes_texture_id; |
45 float sampling_matrix[16]; | 46 float sampling_matrix[16]; |
46 }; | 47 }; |
47 | 48 |
48 class AndroidTextureBuffer : public webrtc::NativeHandleBuffer { | 49 class AndroidTextureBuffer : public webrtc::NativeHandleBuffer { |
49 public: | 50 public: |
50 AndroidTextureBuffer(int width, | 51 AndroidTextureBuffer(int width, |
51 int height, | 52 int height, |
52 const NativeHandleImpl& native_handle, | 53 const NativeHandleImpl& native_handle, |
53 jobject surface_texture_helper, | 54 jobject surface_texture_helper, |
54 const rtc::Callback0<void>& no_longer_used); | 55 const rtc::Callback0<void>& no_longer_used); |
55 ~AndroidTextureBuffer(); | 56 ~AndroidTextureBuffer(); |
56 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 57 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
57 | 58 |
58 rtc::scoped_refptr<AndroidTextureBuffer> CropAndScale( | 59 rtc::scoped_refptr<AndroidTextureBuffer> ScaleAndRotate( |
59 int cropped_input_width, | |
60 int cropped_input_height, | |
61 int dst_widht, | 60 int dst_widht, |
62 int dst_height); | 61 int dst_height, |
| 62 webrtc::VideoRotation rotation); |
63 | 63 |
64 private: | 64 private: |
65 NativeHandleImpl native_handle_; | 65 NativeHandleImpl native_handle_; |
66 // Raw object pointer, relying on the caller, i.e., | 66 // Raw object pointer, relying on the caller, i.e., |
67 // AndroidVideoCapturerJni or the C++ SurfaceTextureHelper, to keep | 67 // AndroidVideoCapturerJni or the C++ SurfaceTextureHelper, to keep |
68 // a global reference. TODO(nisse): Make this a reference to the C++ | 68 // a global reference. TODO(nisse): Make this a reference to the C++ |
69 // SurfaceTextureHelper instead, but that requires some refactoring | 69 // SurfaceTextureHelper instead, but that requires some refactoring |
70 // of AndroidVideoCapturerJni. | 70 // of AndroidVideoCapturerJni. |
71 jobject surface_texture_helper_; | 71 jobject surface_texture_helper_; |
72 rtc::Callback0<void> no_longer_used_cb_; | 72 rtc::Callback0<void> no_longer_used_cb_; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace webrtc_jni | 75 } // namespace webrtc_jni |
76 | 76 |
77 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 77 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ |
OLD | NEW |