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 #include "media/video/capture/android/video_capture_device_android.h" | 5 #include "media/video/capture/android/video_capture_device_android.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "jni/VideoCapture_jni.h" | 12 #include "jni/VideoCapture_jni.h" |
13 #include "media/video/capture/android/video_capture_device_factory_android.h" | 13 #include "media/video/capture/android/video_capture_device_factory_android.h" |
14 | 14 |
15 using base::android::AttachCurrentThread; | 15 using base::android::AttachCurrentThread; |
16 using base::android::CheckException; | 16 using base::android::CheckException; |
17 using base::android::GetClass; | 17 using base::android::GetClass; |
18 using base::android::MethodID; | 18 using base::android::MethodID; |
19 using base::android::JavaRef; | 19 using base::android::JavaRef; |
20 using base::android::ScopedJavaLocalRef; | 20 using base::android::ScopedJavaLocalRef; |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 // static | 24 // static |
25 bool VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice(JNIEnv* env) { | 25 bool VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice(JNIEnv* env) { |
26 return RegisterNativesImpl(env); | 26 return RegisterNativesImpl(env); |
27 } | 27 } |
28 | 28 |
29 // TODO(mcasas): Remove the following static methods when they are no longer | |
30 // referenced from VideoCaptureDeviceFactory, i.e. when all OS platforms have | |
31 // splitted the VideoCaptureDevice into VideoCaptureDevice and | |
32 // VideoCaptureDeviceFactory. | |
33 | |
34 // static | |
35 VideoCaptureDevice* VideoCaptureDevice::Create( | |
36 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | |
37 const Name& device_name) { | |
38 NOTREACHED(); | |
39 return NULL; | |
40 } | |
41 // static | |
42 void VideoCaptureDevice::GetDeviceNames(Names* device_names) { | |
43 NOTREACHED(); | |
44 } | |
45 | |
46 // static | |
47 void VideoCaptureDevice::GetDeviceSupportedFormats( | |
48 const Name& device, | |
49 VideoCaptureFormats* supported_formats) { | |
50 NOTREACHED(); | |
51 } | |
52 | |
53 const std::string VideoCaptureDevice::Name::GetModel() const { | 29 const std::string VideoCaptureDevice::Name::GetModel() const { |
54 // Android cameras are not typically USB devices, and this method is currently | 30 // Android cameras are not typically USB devices, and this method is currently |
55 // only used for USB model identifiers, so this implementation just indicates | 31 // only used for USB model identifiers, so this implementation just indicates |
56 // an unknown device model. | 32 // an unknown device model. |
57 return ""; | 33 return ""; |
58 } | 34 } |
59 | 35 |
60 VideoCaptureDeviceAndroid::VideoCaptureDeviceAndroid(const Name& device_name) | 36 VideoCaptureDeviceAndroid::VideoCaptureDeviceAndroid(const Name& device_name) |
61 : state_(kIdle), got_first_frame_(false), device_name_(device_name) {} | 37 : state_(kIdle), got_first_frame_(false), device_name_(device_name) {} |
62 | 38 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { | 192 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { |
217 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; | 193 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; |
218 { | 194 { |
219 base::AutoLock lock(lock_); | 195 base::AutoLock lock(lock_); |
220 state_ = kError; | 196 state_ = kError; |
221 } | 197 } |
222 client_->OnError(reason); | 198 client_->OnError(reason); |
223 } | 199 } |
224 | 200 |
225 } // namespace media | 201 } // namespace media |
OLD | NEW |