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..4aa9344d27d66ca7228f21b4f24a7a578e261da6 |
| --- /dev/null |
| +++ b/media/capture/content/android/screen_capture_machine_android.h |
| @@ -0,0 +1,75 @@ |
| +// 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 "base/memory/weak_ptr.h" |
| +#include "media/capture/content/screen_capture_device_core.h" |
| + |
| +namespace media { |
| + |
| +// ScreenCaptureMachineAndroid captures 32bit RGB using SurfaceFlinger. |
|
mcasas
2016/05/19 19:11:41
Or YUV420 triplanar? I didn't see SurfaceFlinger
r
braveyao
2016/05/20 22:27:26
Done.
|
| +class MEDIA_EXPORT ScreenCaptureMachineAndroid |
| + : public media::VideoCaptureMachine, |
| + public base::SupportsWeakPtr<ScreenCaptureMachineAndroid> { |
|
mcasas
2016/05/19 19:11:41
Hmm considering the notes in [1], I'd say it's bes
braveyao
2016/05/20 22:27:26
Checked again, maybe we don't need a weakptr here
|
| + public: |
| + ScreenCaptureMachineAndroid(); |
| + ~ScreenCaptureMachineAndroid() override; |
| + |
| + static bool RegisterScreenCaptureMachine(JNIEnv* env); |
| + static base::android::ScopedJavaLocalRef<jobject> |
| + createScreenCaptureMachineAndroid(jlong nativeScreenCaptureMachineAndroid); |
| + |
| + // Implement org.chromium.media.ScreenCapture.nativeOnFrameAvailable. |
|
mcasas
2016/05/19 19:11:41
s/nativeOnFrameAvailable/nativeOnRGBAFrameAvailabl
braveyao
2016/05/20 22:27:26
Shame on me... forgot to modify the comments accor
mcasas
2016/05/23 18:19:55
I thought the gyp/gn infra uses this annotations
t
braveyao
2016/05/24 00:03:26
Acknowledged.
|
| + void OnRGBAFrameAvailable(JNIEnv* env, |
| + jobject obj, |
| + jobject buf, |
| + jint width, |
| + jint height, |
| + jint rowStride, |
| + jlong timestamp); |
| + // Implement org.chromium.media.ScreenCapture.nativeOnFrameAvailable. |
| + void OnI420FrameAvailable(JNIEnv* env, |
| + jobject obj, |
| + jobject y_buffer, |
| + jint y_stride, |
| + jobject u_buffer, |
| + jint u_stride, |
| + jobject v_buffer, |
| + jint v_stride, |
| + 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: |
| + // 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_ |