| 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 11 matching lines...) Expand all Loading... |
| 22 // on JAVA thread (i.e., UI thread). Both will access |state_| and |client_|, | 22 // on JAVA thread (i.e., UI thread). Both will access |state_| and |client_|, |
| 23 // but only VideoCaptureManager would change their value. | 23 // but only VideoCaptureManager would change their value. |
| 24 class MEDIA_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice { | 24 class MEDIA_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice { |
| 25 public: | 25 public: |
| 26 virtual ~VideoCaptureDeviceAndroid(); | 26 virtual ~VideoCaptureDeviceAndroid(); |
| 27 | 27 |
| 28 static VideoCaptureDevice* Create(const Name& device_name); | 28 static VideoCaptureDevice* Create(const Name& device_name); |
| 29 static bool RegisterVideoCaptureDevice(JNIEnv* env); | 29 static bool RegisterVideoCaptureDevice(JNIEnv* env); |
| 30 | 30 |
| 31 // VideoCaptureDevice implementation. | 31 // VideoCaptureDevice implementation. |
| 32 virtual void AllocateAndStart( | 32 virtual void AllocateAndStart(const VideoCaptureParams& params, |
| 33 const VideoCaptureCapability& capture_format, | 33 scoped_ptr<Client> client) OVERRIDE; |
| 34 scoped_ptr<Client> client) OVERRIDE; | |
| 35 virtual void StopAndDeAllocate() OVERRIDE; | 34 virtual void StopAndDeAllocate() OVERRIDE; |
| 36 | 35 |
| 37 // Implement org.chromium.media.VideoCapture.nativeOnFrameAvailable. | 36 // Implement org.chromium.media.VideoCapture.nativeOnFrameAvailable. |
| 38 void OnFrameAvailable( | 37 void OnFrameAvailable( |
| 39 JNIEnv* env, | 38 JNIEnv* env, |
| 40 jobject obj, | 39 jobject obj, |
| 41 jbyteArray data, | 40 jbyteArray data, |
| 42 jint length, | 41 jint length, |
| 43 jint rotation, | 42 jint rotation, |
| 44 jboolean flip_vert, | 43 jboolean flip_vert, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 // Prevent racing on accessing |state_| and |client_| since both could be | 65 // Prevent racing on accessing |state_| and |client_| since both could be |
| 67 // accessed from different threads. | 66 // accessed from different threads. |
| 68 base::Lock lock_; | 67 base::Lock lock_; |
| 69 InternalState state_; | 68 InternalState state_; |
| 70 bool got_first_frame_; | 69 bool got_first_frame_; |
| 71 base::TimeTicks expected_next_frame_time_; | 70 base::TimeTicks expected_next_frame_time_; |
| 72 base::TimeDelta frame_interval_; | 71 base::TimeDelta frame_interval_; |
| 73 scoped_ptr<VideoCaptureDevice::Client> client_; | 72 scoped_ptr<VideoCaptureDevice::Client> client_; |
| 74 | 73 |
| 75 Name device_name_; | 74 Name device_name_; |
| 76 VideoCaptureCapability current_settings_; | 75 VideoCaptureFormat capture_format_; |
| 77 | 76 |
| 78 // Java VideoCaptureAndroid instance. | 77 // Java VideoCaptureAndroid instance. |
| 79 base::android::ScopedJavaGlobalRef<jobject> j_capture_; | 78 base::android::ScopedJavaGlobalRef<jobject> j_capture_; |
| 80 | 79 |
| 81 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | 80 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 } // namespace media | 83 } // namespace media |
| 85 | 84 |
| 86 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 85 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
| OLD | NEW |