OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/capture/video/android/video_capture_device_factory_android.h" | 5 #include "media/capture/video/android/video_capture_device_factory_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return; | 101 return; |
102 | 102 |
103 jsize num_formats = env->GetArrayLength(collected_formats.obj()); | 103 jsize num_formats = env->GetArrayLength(collected_formats.obj()); |
104 for (int i = 0; i < num_formats; ++i) { | 104 for (int i = 0; i < num_formats; ++i) { |
105 base::android::ScopedJavaLocalRef<jobject> format( | 105 base::android::ScopedJavaLocalRef<jobject> format( |
106 env, env->GetObjectArrayElement(collected_formats.obj(), i)); | 106 env, env->GetObjectArrayElement(collected_formats.obj(), i)); |
107 | 107 |
108 VideoPixelFormat pixel_format = | 108 VideoPixelFormat pixel_format = |
109 media::PIXEL_FORMAT_UNKNOWN; | 109 media::PIXEL_FORMAT_UNKNOWN; |
110 switch (media::Java_VideoCaptureFactory_getCaptureFormatPixelFormat( | 110 switch (media::Java_VideoCaptureFactory_getCaptureFormatPixelFormat( |
111 env, format.obj())) { | 111 env, format)) { |
112 case VideoCaptureDeviceAndroid::ANDROID_IMAGE_FORMAT_YV12: | 112 case VideoCaptureDeviceAndroid::ANDROID_IMAGE_FORMAT_YV12: |
113 pixel_format = media::PIXEL_FORMAT_YV12; | 113 pixel_format = media::PIXEL_FORMAT_YV12; |
114 break; | 114 break; |
115 case VideoCaptureDeviceAndroid::ANDROID_IMAGE_FORMAT_NV21: | 115 case VideoCaptureDeviceAndroid::ANDROID_IMAGE_FORMAT_NV21: |
116 pixel_format = media::PIXEL_FORMAT_NV21; | 116 pixel_format = media::PIXEL_FORMAT_NV21; |
117 break; | 117 break; |
118 default: | 118 default: |
119 continue; | 119 continue; |
120 } | 120 } |
121 VideoCaptureFormat capture_format( | 121 VideoCaptureFormat capture_format( |
122 gfx::Size(media::Java_VideoCaptureFactory_getCaptureFormatWidth( | 122 gfx::Size( |
123 env, format.obj()), | 123 media::Java_VideoCaptureFactory_getCaptureFormatWidth(env, format), |
124 media::Java_VideoCaptureFactory_getCaptureFormatHeight( | 124 media::Java_VideoCaptureFactory_getCaptureFormatHeight(env, |
125 env, format.obj())), | 125 format)), |
126 media::Java_VideoCaptureFactory_getCaptureFormatFramerate(env, | 126 media::Java_VideoCaptureFactory_getCaptureFormatFramerate(env, format), |
127 format.obj()), | |
128 pixel_format); | 127 pixel_format); |
129 capture_formats->push_back(capture_format); | 128 capture_formats->push_back(capture_format); |
130 DVLOG(1) << device.display_name << " " | 129 DVLOG(1) << device.display_name << " " |
131 << VideoCaptureFormat::ToString(capture_format); | 130 << VideoCaptureFormat::ToString(capture_format); |
132 } | 131 } |
133 } | 132 } |
134 | 133 |
135 // static | 134 // static |
136 VideoCaptureDeviceFactory* | 135 VideoCaptureDeviceFactory* |
137 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 136 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
138 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 137 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
139 return new VideoCaptureDeviceFactoryAndroid(); | 138 return new VideoCaptureDeviceFactoryAndroid(); |
140 } | 139 } |
141 | 140 |
142 } // namespace media | 141 } // namespace media |
OLD | NEW |