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