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 13 matching lines...) Expand all Loading... |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
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/interface/video_frame_buffer.h" | |
35 | |
36 namespace webrtc_jni { | 34 namespace webrtc_jni { |
37 | 35 |
38 // Wrapper for texture object. | 36 // Wrapper for texture object. |
39 class NativeHandleImpl { | 37 struct NativeHandleImpl { |
40 public: | 38 NativeHandleImpl(JNIEnv* jni, |
41 NativeHandleImpl(); | 39 jint j_oes_texture_id, |
| 40 jfloatArray j_transform_matrix); |
42 | 41 |
43 void* GetHandle(); | 42 const int oes_texture_id; |
44 int GetTextureId(); | 43 float sampling_matrix[16]; |
45 void SetTextureObject(void* texture_object, int texture_id); | |
46 | |
47 private: | |
48 jobject texture_object_; | |
49 int32_t texture_id_; | |
50 }; | |
51 | |
52 class JniNativeHandleBuffer : public webrtc::NativeHandleBuffer { | |
53 public: | |
54 JniNativeHandleBuffer(void* native_handle, int width, int height); | |
55 | |
56 // TODO(pbos): Override destructor to release native handle, at the moment the | |
57 // native handle is not released based on refcount. | |
58 | |
59 private: | |
60 rtc::scoped_refptr<webrtc::VideoFrameBuffer> NativeToI420Buffer() override; | |
61 }; | 44 }; |
62 | 45 |
63 } // namespace webrtc_jni | 46 } // namespace webrtc_jni |
64 | 47 |
65 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ | 48 #endif // TALK_APP_WEBRTC_JAVA_JNI_NATIVE_HANDLE_IMPL_H_ |
OLD | NEW |