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

Side by Side Diff: media/capture/content/android/screen_capture_machine_android.h

Issue 2468383002: Android ScreenCapture: add support to device rotation. (Closed)
Patch Set: address comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ 5 #ifndef MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_
6 #define MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ 6 #define MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "media/capture/capture_export.h"
12 #include "media/capture/content/screen_capture_device_core.h" 13 #include "media/capture/content/screen_capture_device_core.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 // ScreenCaptureMachineAndroid captures 32bit RGB or YUV420 triplanar. 17 // ScreenCaptureMachineAndroid captures 32bit RGB or YUV420 triplanar.
17 class ScreenCaptureMachineAndroid : public media::VideoCaptureMachine { 18 class CAPTURE_EXPORT ScreenCaptureMachineAndroid : public VideoCaptureMachine {
18 public: 19 public:
19 ScreenCaptureMachineAndroid(); 20 ScreenCaptureMachineAndroid();
20 ~ScreenCaptureMachineAndroid() override; 21 ~ScreenCaptureMachineAndroid() override;
21 22
22 static bool RegisterScreenCaptureMachine(JNIEnv* env); 23 static bool RegisterScreenCaptureMachine(JNIEnv* env);
23 static base::android::ScopedJavaLocalRef<jobject> 24 static base::android::ScopedJavaLocalRef<jobject>
24 createScreenCaptureMachineAndroid(jlong nativeScreenCaptureMachineAndroid); 25 createScreenCaptureMachineAndroid(jlong nativeScreenCaptureMachineAndroid);
25 26
26 // Implement org.chromium.media.ScreenCapture.nativeOnRGBAFrameAvailable. 27 // Implement org.chromium.media.ScreenCapture.nativeOnRGBAFrameAvailable.
27 void OnRGBAFrameAvailable(JNIEnv* env, 28 void OnRGBAFrameAvailable(JNIEnv* env,
(...skipping 16 matching lines...) Expand all
44 jint uv_pixel_stride, 45 jint uv_pixel_stride,
45 jint left, 46 jint left,
46 jint top, 47 jint top,
47 jint width, 48 jint width,
48 jint height, 49 jint height,
49 jlong timestamp); 50 jlong timestamp);
50 51
51 // Implement org.chromium.media.ScreenCapture.nativeOnActivityResult. 52 // Implement org.chromium.media.ScreenCapture.nativeOnActivityResult.
52 void OnActivityResult(JNIEnv* env, jobject obj, jboolean result); 53 void OnActivityResult(JNIEnv* env, jobject obj, jboolean result);
53 54
55 // Implement org.chromium.media.ScreenCaptuer.nativeOnOrientationChange.
56 void OnOrientationChange(JNIEnv* env, jobject obj, jint rotation);
57
54 // VideoCaptureMachine overrides. 58 // VideoCaptureMachine overrides.
55 void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, 59 void Start(const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy,
56 const media::VideoCaptureParams& params, 60 const media::VideoCaptureParams& params,
57 const base::Callback<void(bool)> callback) override; 61 const base::Callback<void(bool)> callback) override;
58 void Stop(const base::Closure& callback) override; 62 void Stop(const base::Closure& callback) override;
59 void MaybeCaptureForRefresh() override; 63 void MaybeCaptureForRefresh() override;
60 64
61 private: 65 private:
66 // Indicates the orientation of the device.
67 enum DeviceOrientation { kLandscape, kPortrait, kDefault };
68
62 // Makes all the decisions about which frames to copy, and how. 69 // Makes all the decisions about which frames to copy, and how.
63 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_; 70 scoped_refptr<media::ThreadSafeCaptureOracle> oracle_proxy_;
64 71
65 // Cache the last frame for possible refreshing. 72 // Cache the last frame for possible refreshing.
66 scoped_refptr<VideoFrame> lastFrame_; 73 scoped_refptr<VideoFrame> lastFrame_;
67 74
68 // Java VideoCaptureAndroid instance. 75 // Java VideoCaptureAndroid instance.
69 base::android::ScopedJavaLocalRef<jobject> j_capture_; 76 base::android::ScopedJavaLocalRef<jobject> j_capture_;
70 77
71 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureMachineAndroid); 78 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureMachineAndroid);
72 }; 79 };
73 80
74 } // namespace media 81 } // namespace media
75 82
76 #endif // MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_ 83 #endif // MEDIA_CAPTURE_CONTENT_ANDROID_SCREEN_CAPTURE_MACHINE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698