| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/capture/content/android/screen_capture_machine_android.h" | 5 #include "media/capture/content/android/screen_capture_machine_android.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | |
| 8 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 10 #include "jni/ScreenCapture_jni.h" | 9 #include "jni/ScreenCapture_jni.h" |
| 11 #include "media/capture/content/video_capture_oracle.h" | 10 #include "media/capture/content/video_capture_oracle.h" |
| 12 #include "third_party/libyuv/include/libyuv.h" | 11 #include "third_party/libyuv/include/libyuv.h" |
| 13 | 12 |
| 14 using base::android::AttachCurrentThread; | 13 using base::android::AttachCurrentThread; |
| 15 using base::android::ScopedJavaLocalRef; | 14 using base::android::ScopedJavaLocalRef; |
| 16 | 15 |
| 17 namespace media { | 16 namespace media { |
| 18 | 17 |
| 19 // static | 18 // static |
| 20 bool ScreenCaptureMachineAndroid::RegisterScreenCaptureMachine(JNIEnv* env) { | 19 bool ScreenCaptureMachineAndroid::RegisterScreenCaptureMachine(JNIEnv* env) { |
| 21 return RegisterNativesImpl(env); | 20 return RegisterNativesImpl(env); |
| 22 } | 21 } |
| 23 | 22 |
| 24 ScreenCaptureMachineAndroid::ScreenCaptureMachineAndroid() {} | 23 ScreenCaptureMachineAndroid::ScreenCaptureMachineAndroid() {} |
| 25 | 24 |
| 26 ScreenCaptureMachineAndroid::~ScreenCaptureMachineAndroid() {} | 25 ScreenCaptureMachineAndroid::~ScreenCaptureMachineAndroid() {} |
| 27 | 26 |
| 28 // static | 27 // static |
| 29 ScopedJavaLocalRef<jobject> | 28 ScopedJavaLocalRef<jobject> |
| 30 ScreenCaptureMachineAndroid::createScreenCaptureMachineAndroid( | 29 ScreenCaptureMachineAndroid::createScreenCaptureMachineAndroid( |
| 31 jlong nativeScreenCaptureMachineAndroid) { | 30 jlong nativeScreenCaptureMachineAndroid) { |
| 32 return (Java_ScreenCapture_createScreenCaptureMachine( | 31 return (Java_ScreenCapture_createScreenCaptureMachine( |
| 33 AttachCurrentThread(), base::android::GetApplicationContext(), | 32 AttachCurrentThread(), nativeScreenCaptureMachineAndroid)); |
| 34 nativeScreenCaptureMachineAndroid)); | |
| 35 } | 33 } |
| 36 | 34 |
| 37 void ScreenCaptureMachineAndroid::OnRGBAFrameAvailable(JNIEnv* env, | 35 void ScreenCaptureMachineAndroid::OnRGBAFrameAvailable(JNIEnv* env, |
| 38 jobject obj, | 36 jobject obj, |
| 39 jobject buf, | 37 jobject buf, |
| 40 jint row_stride, | 38 jint row_stride, |
| 41 jint left, | 39 jint left, |
| 42 jint top, | 40 jint top, |
| 43 jint width, | 41 jint width, |
| 44 jint height, | 42 jint height, |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 frame->visible_data(VideoFrame::kUPlane), | 308 frame->visible_data(VideoFrame::kUPlane), |
| 311 frame->stride(VideoFrame::kUPlane), | 309 frame->stride(VideoFrame::kUPlane), |
| 312 frame->visible_data(VideoFrame::kVPlane), | 310 frame->visible_data(VideoFrame::kVPlane), |
| 313 frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(), | 311 frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(), |
| 314 frame->visible_rect().height(), libyuv::kFilterBilinear); | 312 frame->visible_rect().height(), libyuv::kFilterBilinear); |
| 315 | 313 |
| 316 capture_frame_cb.Run(frame, start_time, true); | 314 capture_frame_cb.Run(frame, start_time, true); |
| 317 } | 315 } |
| 318 | 316 |
| 319 } // namespace media | 317 } // namespace media |
| OLD | NEW |