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