OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_SCREEN_CAPTURE_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
| 6 #define MEDIA_SCREEN_CAPTURE_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 "base/memory/weak_ptr.h" |
| 13 #include "media/capture/content/screen_capture_device_core.h" |
| 14 |
| 15 namespace media { |
| 16 |
| 17 // ScreenCaptureMachineAndroid captures 32bit RGB using SurfaceFlinger. |
| 18 class MEDIA_EXPORT ScreenCaptureMachineAndroid |
| 19 : public media::VideoCaptureMachine, |
| 20 public base::SupportsWeakPtr<ScreenCaptureMachineAndroid> { |
| 21 public: |
| 22 ScreenCaptureMachineAndroid(); |
| 23 ~ScreenCaptureMachineAndroid() override; |
| 24 |
| 25 static bool RegisterScreenCaptureMachine(JNIEnv* env); |
| 26 |
| 27 // Implement org.chromium.media.ScreenCapture.nativeOnFrameAvailable. |
| 28 void OnFrameAvailable(JNIEnv* env, |
| 29 jobject obj, |
| 30 jbyteArray data, |
| 31 jint cropWidth, |
| 32 jint cropHeight, |
| 33 jlong timestamp); |
| 34 |
| 35 // Implement org.chromium.media.ScreenCapture.nativeOnActivityResult. |
| 36 void OnActivityResult(JNIEnv* env, jobject obj, jint result); |
| 37 |
| 38 // VideoCaptureMachine overrides. |
| 39 void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, |
| 40 const media::VideoCaptureParams& params, |
| 41 const base::Callback<void(bool)> callback) override; |
| 42 void Stop(const base::Closure& callback) override; |
| 43 void MaybeCaptureForRefresh() override; |
| 44 |
| 45 private: |
| 46 // Makes all the decisions about which frames to copy, and how. |
| 47 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; |
| 48 |
| 49 VideoCaptureFormat capture_format_; |
| 50 |
| 51 // Java VideoCaptureAndroid instance. |
| 52 base::android::ScopedJavaLocalRef<jobject> j_capture_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureMachineAndroid); |
| 55 }; |
| 56 |
| 57 } // namespace media |
| 58 |
| 59 #endif // MEDIA_SCREEN_CAPTURE_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
OLD | NEW |