| 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 #ifndef MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ | 5 #ifndef DEVICE_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
| 6 #define MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ | 6 #define DEVICE_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "media/capture/content/screen_capture_device_core.h" | 12 #include "device/capture/capture_export.h" |
| 13 #include "device/capture/content/screen_capture_device_core.h" |
| 13 | 14 |
| 14 namespace media { | 15 namespace device { |
| 15 | 16 |
| 16 // ScreenCaptureMachineAndroid captures 32bit RGB or YUV420 triplanar. | 17 // ScreenCaptureMachineAndroid captures 32bit RGB or YUV420 triplanar. |
| 17 class ScreenCaptureMachineAndroid : public media::VideoCaptureMachine { | 18 class CAPTURE_EXPORT ScreenCaptureMachineAndroid : public VideoCaptureMachine { |
| 18 public: | 19 public: |
| 19 ScreenCaptureMachineAndroid(); | 20 ScreenCaptureMachineAndroid(); |
| 20 ~ScreenCaptureMachineAndroid() override; | 21 ~ScreenCaptureMachineAndroid() override; |
| 21 | 22 |
| 22 static bool RegisterScreenCaptureMachine(JNIEnv* env); | 23 static bool RegisterScreenCaptureMachine(JNIEnv* env); |
| 23 static base::android::ScopedJavaLocalRef<jobject> | 24 static base::android::ScopedJavaLocalRef<jobject> |
| 24 createScreenCaptureMachineAndroid(jlong nativeScreenCaptureMachineAndroid); | 25 createScreenCaptureMachineAndroid(jlong nativeScreenCaptureMachineAndroid); |
| 25 | 26 |
| 26 // Implement org.chromium.media.ScreenCapture.nativeOnRGBAFrameAvailable. | 27 // Implement org.chromium.device.ScreenCapture.nativeOnRGBAFrameAvailable. |
| 27 void OnRGBAFrameAvailable(JNIEnv* env, | 28 void OnRGBAFrameAvailable(JNIEnv* env, |
| 28 jobject obj, | 29 jobject obj, |
| 29 jobject buf, | 30 jobject buf, |
| 30 jint row_stride, | 31 jint row_stride, |
| 31 jint left, | 32 jint left, |
| 32 jint top, | 33 jint top, |
| 33 jint width, | 34 jint width, |
| 34 jint height, | 35 jint height, |
| 35 jlong timestamp); | 36 jlong timestamp); |
| 36 // Implement org.chromium.media.ScreenCapture.nativeOnI420FrameAvailable. | 37 // Implement org.chromium.device.ScreenCapture.nativeOnI420FrameAvailable. |
| 37 void OnI420FrameAvailable(JNIEnv* env, | 38 void OnI420FrameAvailable(JNIEnv* env, |
| 38 jobject obj, | 39 jobject obj, |
| 39 jobject y_buffer, | 40 jobject y_buffer, |
| 40 jint y_stride, | 41 jint y_stride, |
| 41 jobject u_buffer, | 42 jobject u_buffer, |
| 42 jobject v_buffer, | 43 jobject v_buffer, |
| 43 jint uv_row_stride, | 44 jint uv_row_stride, |
| 44 jint uv_pixel_stride, | 45 jint uv_pixel_stride, |
| 45 jint left, | 46 jint left, |
| 46 jint top, | 47 jint top, |
| 47 jint width, | 48 jint width, |
| 48 jint height, | 49 jint height, |
| 49 jlong timestamp); | 50 jlong timestamp); |
| 50 | 51 |
| 51 // Implement org.chromium.media.ScreenCapture.nativeOnActivityResult. | 52 // Implement org.chromium.device.ScreenCapture.nativeOnActivityResult. |
| 52 void OnActivityResult(JNIEnv* env, jobject obj, jboolean result); | 53 void OnActivityResult(JNIEnv* env, jobject obj, jboolean result); |
| 53 | 54 |
| 54 // VideoCaptureMachine overrides. | 55 // VideoCaptureMachine overrides. |
| 55 void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, | 56 void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
| 56 const media::VideoCaptureParams& params, | 57 const media::VideoCaptureParams& params, |
| 57 const base::Callback<void(bool)> callback) override; | 58 const base::Callback<void(bool)> callback) override; |
| 58 void Stop(const base::Closure& callback) override; | 59 void Stop(const base::Closure& callback) override; |
| 59 void MaybeCaptureForRefresh() override; | 60 void MaybeCaptureForRefresh() override; |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 // Makes all the decisions about which frames to copy, and how. | 63 // Makes all the decisions about which frames to copy, and how. |
| 63 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; | 64 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; |
| 64 | 65 |
| 65 // Cache the last frame for possible refreshing. | 66 // Cache the last frame for possible refreshing. |
| 66 scoped_refptr<VideoFrame> lastFrame_; | 67 scoped_refptr<VideoFrame> lastFrame_; |
| 67 | 68 |
| 68 // Java VideoCaptureAndroid instance. | 69 // Java VideoCaptureAndroid instance. |
| 69 base::android::ScopedJavaLocalRef<jobject> j_capture_; | 70 base::android::ScopedJavaLocalRef<jobject> j_capture_; |
| 70 | 71 |
| 71 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureMachineAndroid); | 72 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureMachineAndroid); |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 } // namespace media | 75 } // namespace device |
| 75 | 76 |
| 76 #endif // MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ | 77 #endif // DEVICE_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
| OLD | NEW |