| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 jboolean flip_horiz); | 46 jboolean flip_horiz); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 enum InternalState { | 49 enum InternalState { |
| 50 kIdle, // The device is opened but not in use. | 50 kIdle, // The device is opened but not in use. |
| 51 kAllocated, // All resouces have been allocated and camera can be started. | 51 kAllocated, // All resouces have been allocated and camera can be started. |
| 52 kCapturing, // Video is being captured. | 52 kCapturing, // Video is being captured. |
| 53 kError // Hit error. User needs to recover by destroying the object. | 53 kError // Hit error. User needs to recover by destroying the object. |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Automatically generated enum to interface with Java world. |
| 57 enum AndroidImageFormat { |
| 58 #define DEFINE_ANDROID_IMAGEFORMAT(name, value) name = value, |
| 59 #include "media/video/capture/android/imageformat_list.h" |
| 60 #undef DEFINE_ANDROID_IMAGEFORMAT |
| 61 }; |
| 62 |
| 56 explicit VideoCaptureDeviceAndroid(const Name& device_name); | 63 explicit VideoCaptureDeviceAndroid(const Name& device_name); |
| 57 bool Init(); | 64 bool Init(); |
| 65 VideoPixelFormat GetColorspace(); |
| 58 void SetErrorState(const std::string& reason); | 66 void SetErrorState(const std::string& reason); |
| 59 | 67 |
| 60 // Prevent racing on accessing |state_| and |observer_| since both could be | 68 // Prevent racing on accessing |state_| and |observer_| since both could be |
| 61 // accessed from different threads. | 69 // accessed from different threads. |
| 62 base::Lock lock_; | 70 base::Lock lock_; |
| 63 InternalState state_; | 71 InternalState state_; |
| 64 VideoCaptureDevice::EventHandler* observer_; | 72 VideoCaptureDevice::EventHandler* observer_; |
| 65 | 73 |
| 66 Name device_name_; | 74 Name device_name_; |
| 67 VideoCaptureCapability current_settings_; | 75 VideoCaptureCapability current_settings_; |
| 68 | 76 |
| 69 // Java VideoCaptureAndroid instance. | 77 // Java VideoCaptureAndroid instance. |
| 70 base::android::ScopedJavaGlobalRef<jobject> j_capture_; | 78 base::android::ScopedJavaGlobalRef<jobject> j_capture_; |
| 71 | 79 |
| 72 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | 80 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
| 73 }; | 81 }; |
| 74 | 82 |
| 75 } // namespace media | 83 } // namespace media |
| 76 | 84 |
| 77 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 85 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
| OLD | NEW |