Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: media/screen_capture/android/screen_capturer_android.h

Issue 1140113002: Implement screen capture for android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/screen_capture/android/screen_capturer_android.h
diff --git a/media/screen_capture/android/screen_capturer_android.h b/media/screen_capture/android/screen_capturer_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee87493369267797789d6b59755ba52f63367642
--- /dev/null
+++ b/media/screen_capture/android/screen_capturer_android.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2015 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_SCREEN_CAPTURE_ANDROID_SCREEN_CAPTURER_ANDROID_H_
+#define MEDIA_SCREEN_CAPTURE_ANDROID_SCREEN_CAPTURER_ANDROID_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h"
+#include "third_party/webrtc/modules/desktop_capture/screen_capture_frame_queue.h"
+#include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
+
+namespace media {
+
+// ScreenCapturerAndroid captures 32bit RGB using SurfaceFlinger.
+class ScreenCapturerAndroid : public webrtc::ScreenCapturer {
miu 2015/05/20 03:33:27 After looking at all the code, I really don't thin
jiajia.qin 2015/05/20 12:07:16 Agree with you. Inheriting from webrtc::ScreenCapt
+ public:
+ explicit ScreenCapturerAndroid();
+ virtual ~ScreenCapturerAndroid();
+
+ static bool RegisterScreenCapturer(JNIEnv* env);
+
+ // Implement org.chromium.media.ScreenCapture.nativeOnFrameAvailable.
+ void OnFrameAvailable(
+ JNIEnv* env,
+ jobject obj,
+ jbyteArray data,
+ jint width,
+ jint height);
+
+ // Implement org.chromium.media.ScreenCapture.nativeOnActivityResult.
+ void OnActivityResult(JNIEnv* env, jobject obj, jint result);
+
+ // Overridden from ScreenCapturer:
+ void Start(webrtc::DesktopCapturer::Callback* callback) override;
+ void Capture(const webrtc::DesktopRegion& region) override;
+ bool GetScreenList(ScreenList* screens) override;
+ bool SelectScreen(webrtc::ScreenId id) override;
+
+ private:
+ // Queue of the frames buffers.
+ webrtc::ScreenCaptureFrameQueue queue_;
+
+ // Java ScreenCaptureAndroid instance.
+ base::android::ScopedJavaLocalRef<jobject> j_capture_;
+
+ webrtc::DesktopCapturer::Callback* callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenCapturerAndroid);
+};
+
+} // namespace webrtc
+
+#endif // MEDIA_SCREEN_CAPTURE_ANDROID_SCREEN_CAPTURER_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698