Chromium Code Reviews| Index: media/capture/content/android/screen_capture_machine_android.h |
| diff --git a/media/capture/content/android/screen_capture_machine_android.h b/media/capture/content/android/screen_capture_machine_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0aea99b2cb907101a9f3b09c867aae7a0d599dd0 |
| --- /dev/null |
| +++ b/media/capture/content/android/screen_capture_machine_android.h |
| @@ -0,0 +1,87 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
| +#define MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |
| + |
| +#include <jni.h> |
| +#include <memory> |
| + |
| +#include "base/android/scoped_java_ref.h" |
| +#include "media/capture/content/screen_capture_device_core.h" |
| + |
| +namespace media { |
| + |
| +// ScreenCaptureMachineAndroid captures 32bit RGB or YUV420 triplanar. |
| +class MEDIA_EXPORT ScreenCaptureMachineAndroid |
| + : public media::VideoCaptureMachine { |
| + public: |
| + ScreenCaptureMachineAndroid(); |
| + ~ScreenCaptureMachineAndroid() override; |
| + |
| + static bool RegisterScreenCaptureMachine(JNIEnv* env); |
| + static base::android::ScopedJavaLocalRef<jobject> |
| + createScreenCaptureMachineAndroid(jlong nativeScreenCaptureMachineAndroid); |
| + |
| + // Implement org.chromium.media.ScreenCapture.nativeOnRGBAFrameAvailable. |
| + void OnRGBAFrameAvailable(JNIEnv* env, |
| + jobject obj, |
| + jobject buf, |
| + jint row_stride, |
| + jint left, |
| + jint top, |
| + jint cropWidth, |
|
miu
2016/06/08 21:06:50
nit (ditto): s/crop// (and everywhere in the .cc
braveyao
2016/06/08 22:49:50
Done.
|
| + jint cropHeight, |
| + jlong timestamp); |
| + // Implement org.chromium.media.ScreenCapture.nativeOnI420FrameAvailable. |
| + void OnI420FrameAvailable(JNIEnv* env, |
| + jobject obj, |
| + jobject y_buffer, |
| + jint y_Zde, |
| + jobject u_buffer, |
| + jobject v_buffer, |
| + jint uv_row_stride, |
| + jint uv_pixel_stride, |
| + jint left, |
| + jint top, |
| + jint width, |
| + jint height, |
| + jlong timestamp); |
| + |
| + // Implement org.chromium.media.ScreenCapture.nativeOnActivityResult. |
| + void OnActivityResult(JNIEnv* env, jobject obj, jboolean result); |
| + |
| + // VideoCaptureMachine overrides. |
| + void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, |
| + const media::VideoCaptureParams& params, |
| + const base::Callback<void(bool)> callback) override; |
| + void Stop(const base::Closure& callback) override; |
| + void MaybeCaptureForRefresh() override; |
| + |
| + private: |
| + void OnIncomingFrameAvailable(const uint8_t* y_src, |
| + int y_stride, |
| + const uint8_t* u_src, |
| + int u_stride, |
| + const uint8_t* v_src, |
| + int v_stride, |
| + int width, |
| + int height, |
| + int64_t timestamp); |
| + |
| + // Makes all the decisions about which frames to copy, and how. |
| + scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; |
| + |
| + // Cache the last frame for possible refreshing. |
| + scoped_refptr<VideoFrame> lastFrame_; |
| + |
| + // Java VideoCaptureAndroid instance. |
| + base::android::ScopedJavaLocalRef<jobject> j_capture_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ScreenCaptureMachineAndroid); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ |