OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
6 #define MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 6 #define MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Registers the Java VideoCaptureDevice pointer, used by the rest of the | 50 // Registers the Java VideoCaptureDevice pointer, used by the rest of the |
51 // methods of the class to operate the Java capture code. This method must be | 51 // methods of the class to operate the Java capture code. This method must be |
52 // called after the class constructor and before AllocateAndStart(). | 52 // called after the class constructor and before AllocateAndStart(). |
53 bool Init(); | 53 bool Init(); |
54 | 54 |
55 // VideoCaptureDevice implementation. | 55 // VideoCaptureDevice implementation. |
56 void AllocateAndStart(const VideoCaptureParams& params, | 56 void AllocateAndStart(const VideoCaptureParams& params, |
57 std::unique_ptr<Client> client) override; | 57 std::unique_ptr<Client> client) override; |
58 void StopAndDeAllocate() override; | 58 void StopAndDeAllocate() override; |
59 bool TakePhoto(const TakePhotoCallback& photo_callback) override; | 59 void TakePhoto(ScopedCallback<TakePhotoCallback> callback) override; |
60 | 60 |
61 // Implement org.chromium.media.VideoCapture.nativeOnFrameAvailable. | 61 // Implement org.chromium.media.VideoCapture.nativeOnFrameAvailable. |
62 void OnFrameAvailable(JNIEnv* env, | 62 void OnFrameAvailable(JNIEnv* env, |
63 const base::android::JavaParamRef<jobject>& obj, | 63 const base::android::JavaParamRef<jobject>& obj, |
64 const base::android::JavaParamRef<jbyteArray>& data, | 64 const base::android::JavaParamRef<jbyteArray>& data, |
65 jint length, | 65 jint length, |
66 jint rotation); | 66 jint rotation); |
67 | 67 |
68 // Implement org.chromium.media.VideoCapture.nativeOnError. | 68 // Implement org.chromium.media.VideoCapture.nativeOnError. |
69 void OnError(JNIEnv* env, | 69 void OnError(JNIEnv* env, |
(...skipping 22 matching lines...) Expand all Loading... |
92 base::Lock lock_; | 92 base::Lock lock_; |
93 InternalState state_; | 93 InternalState state_; |
94 bool got_first_frame_; | 94 bool got_first_frame_; |
95 base::TimeTicks expected_next_frame_time_; | 95 base::TimeTicks expected_next_frame_time_; |
96 base::TimeTicks first_ref_time_; | 96 base::TimeTicks first_ref_time_; |
97 base::TimeDelta frame_interval_; | 97 base::TimeDelta frame_interval_; |
98 std::unique_ptr<VideoCaptureDevice::Client> client_; | 98 std::unique_ptr<VideoCaptureDevice::Client> client_; |
99 | 99 |
100 // List of |photo_callbacks_| in flight, being served in Java side. | 100 // List of |photo_callbacks_| in flight, being served in Java side. |
101 base::Lock photo_callbacks_lock_; | 101 base::Lock photo_callbacks_lock_; |
102 std::list<std::unique_ptr<TakePhotoCallback>> photo_callbacks_; | 102 std::list<std::unique_ptr<ScopedCallback<TakePhotoCallback>>> |
| 103 photo_callbacks_; |
103 | 104 |
104 Name device_name_; | 105 Name device_name_; |
105 VideoCaptureFormat capture_format_; | 106 VideoCaptureFormat capture_format_; |
106 | 107 |
107 // Java VideoCaptureAndroid instance. | 108 // Java VideoCaptureAndroid instance. |
108 base::android::ScopedJavaLocalRef<jobject> j_capture_; | 109 base::android::ScopedJavaLocalRef<jobject> j_capture_; |
109 | 110 |
110 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | 111 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace media | 114 } // namespace media |
114 | 115 |
115 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 116 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
OLD | NEW |