| 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 21 matching lines...) Expand all Loading... |
| 91 // accessed from different threads. | 91 // accessed from different threads. |
| 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::TimeDelta frame_interval_; | 96 base::TimeDelta frame_interval_; |
| 97 std::unique_ptr<VideoCaptureDevice::Client> client_; | 97 std::unique_ptr<VideoCaptureDevice::Client> client_; |
| 98 | 98 |
| 99 // List of |photo_callbacks_| in flight, being served in Java side. | 99 // List of |photo_callbacks_| in flight, being served in Java side. |
| 100 base::Lock photo_callbacks_lock_; | 100 base::Lock photo_callbacks_lock_; |
| 101 std::list<std::unique_ptr<TakePhotoCallback>> photo_callbacks_; | 101 std::list<ScopedCallback<TakePhotoCallback>> photo_callbacks_; |
| 102 | 102 |
| 103 Name device_name_; | 103 Name device_name_; |
| 104 VideoCaptureFormat capture_format_; | 104 VideoCaptureFormat capture_format_; |
| 105 | 105 |
| 106 // Java VideoCaptureAndroid instance. | 106 // Java VideoCaptureAndroid instance. |
| 107 base::android::ScopedJavaLocalRef<jobject> j_capture_; | 107 base::android::ScopedJavaLocalRef<jobject> j_capture_; |
| 108 | 108 |
| 109 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | 109 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace media | 112 } // namespace media |
| 113 | 113 |
| 114 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 114 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
| OLD | NEW |