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