niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
mflodman@webrtc.org | c80d9d9 | 2012-02-06 10:11:25 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 11 | #include "video_engine/vie_input_manager.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
| 13 | #include <cassert> |
| 14 | |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 15 | #include "common_types.h" // NOLINT |
andrew@webrtc.org | 94caca7 | 2012-10-30 21:58:00 +0000 | [diff] [blame^] | 16 | #include "webrtc/modules/video_capture/include/video_capture_factory.h" |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 17 | #include "modules/video_coding/main/interface/video_coding.h" |
| 18 | #include "modules/video_coding/main/interface/video_coding_defines.h" |
| 19 | #include "system_wrappers/interface/critical_section_wrapper.h" |
| 20 | #include "system_wrappers/interface/rw_lock_wrapper.h" |
| 21 | #include "system_wrappers/interface/trace.h" |
mflodman@webrtc.org | a4863db | 2011-12-22 08:51:52 +0000 | [diff] [blame] | 22 | #include "video_engine/include/vie_errors.h" |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 23 | #include "video_engine/vie_capturer.h" |
| 24 | #include "video_engine/vie_defines.h" |
| 25 | #include "video_engine/vie_file_player.h" |
| 26 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | namespace webrtc { |
| 28 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 29 | ViEInputManager::ViEInputManager(const int engine_id) |
| 30 | : engine_id_(engine_id), |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 31 | map_cs_(CriticalSectionWrapper::CreateCriticalSection()), |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 32 | vie_frame_provider_map_(), |
| 33 | capture_device_info_(NULL), |
| 34 | module_process_thread_(NULL) { |
| 35 | WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_), |
| 36 | "%s", __FUNCTION__); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 38 | for (int idx = 0; idx < kViEMaxCaptureDevices; idx++) { |
| 39 | free_capture_device_id_[idx] = true; |
| 40 | } |
| 41 | capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo( |
| 42 | ViEModuleId(engine_id_)); |
| 43 | for (int idx = 0; idx < kViEMaxFilePlayers; idx++) { |
| 44 | free_file_id_[idx] = true; |
| 45 | } |
| 46 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 48 | ViEInputManager::~ViEInputManager() { |
| 49 | WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_), |
| 50 | "%s", __FUNCTION__); |
| 51 | while (vie_frame_provider_map_.Size() != 0) { |
| 52 | MapItem* item = vie_frame_provider_map_.First(); |
| 53 | assert(item); |
| 54 | ViEFrameProviderBase* frame_provider = |
| 55 | static_cast<ViEFrameProviderBase*>(item->GetItem()); |
| 56 | vie_frame_provider_map_.Erase(item); |
| 57 | delete frame_provider; |
| 58 | } |
| 59 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 60 | if (capture_device_info_) { |
| 61 | delete capture_device_info_; |
| 62 | capture_device_info_ = NULL; |
| 63 | } |
| 64 | } |
| 65 | void ViEInputManager::SetModuleProcessThread( |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 66 | ProcessThread* module_process_thread) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 67 | assert(!module_process_thread_); |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 68 | module_process_thread_ = module_process_thread; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | int ViEInputManager::NumberOfCaptureDevices() { |
| 72 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s", |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 73 | __FUNCTION__); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 74 | assert(capture_device_info_); |
| 75 | return capture_device_info_->NumberOfDevices(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | } |
| 77 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 78 | int ViEInputManager::GetDeviceName(WebRtc_UWord32 device_number, |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 79 | char* device_nameUTF8, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 80 | WebRtc_UWord32 device_name_length, |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 81 | char* device_unique_idUTF8, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 82 | WebRtc_UWord32 device_unique_idUTF8Length) { |
| 83 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 84 | "%s(device_number: %d)", __FUNCTION__, device_number); |
| 85 | assert(capture_device_info_); |
| 86 | return capture_device_info_->GetDeviceName(device_number, device_nameUTF8, |
| 87 | device_name_length, |
| 88 | device_unique_idUTF8, |
| 89 | device_unique_idUTF8Length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 90 | } |
| 91 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 92 | int ViEInputManager::NumberOfCaptureCapabilities( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 93 | const char* device_unique_idUTF8) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 94 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s", |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 95 | __FUNCTION__); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 96 | assert(capture_device_info_); |
| 97 | return capture_device_info_->NumberOfCapabilities(device_unique_idUTF8); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 98 | } |
| 99 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 100 | int ViEInputManager::GetCaptureCapability( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 101 | const char* device_unique_idUTF8, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 102 | const WebRtc_UWord32 device_capability_number, |
| 103 | CaptureCapability& capability) { |
| 104 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 105 | "%s(device_unique_idUTF8: %s, device_capability_number: %d)", |
| 106 | __FUNCTION__, device_unique_idUTF8, device_capability_number); |
| 107 | assert(capture_device_info_); |
| 108 | VideoCaptureCapability module_capability; |
| 109 | int result = capture_device_info_->GetCapability(device_unique_idUTF8, |
| 110 | device_capability_number, |
| 111 | module_capability); |
| 112 | if (result != 0) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | return result; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 114 | |
| 115 | // Copy from module type to public type. |
| 116 | capability.expectedCaptureDelay = module_capability.expectedCaptureDelay; |
| 117 | capability.height = module_capability.height; |
| 118 | capability.width = module_capability.width; |
| 119 | capability.interlaced = module_capability.interlaced; |
| 120 | capability.rawType = module_capability.rawType; |
| 121 | capability.codecType = module_capability.codecType; |
| 122 | capability.maxFPS = module_capability.maxFPS; |
| 123 | return result; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 124 | } |
| 125 | |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 126 | int ViEInputManager::GetOrientation(const char* device_unique_idUTF8, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 127 | RotateCapturedFrame& orientation) { |
| 128 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 129 | "%s(device_unique_idUTF8: %s,)", __FUNCTION__, |
| 130 | device_unique_idUTF8); |
| 131 | assert(capture_device_info_); |
| 132 | VideoCaptureRotation module_orientation; |
| 133 | int result = capture_device_info_->GetOrientation(device_unique_idUTF8, |
| 134 | module_orientation); |
| 135 | // Copy from module type to public type. |
| 136 | switch (module_orientation) { |
| 137 | case kCameraRotate0: |
| 138 | orientation = RotateCapturedFrame_0; |
| 139 | break; |
| 140 | case kCameraRotate90: |
| 141 | orientation = RotateCapturedFrame_90; |
| 142 | break; |
| 143 | case kCameraRotate180: |
| 144 | orientation = RotateCapturedFrame_180; |
| 145 | break; |
| 146 | case kCameraRotate270: |
| 147 | orientation = RotateCapturedFrame_270; |
| 148 | break; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 149 | } |
| 150 | return result; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 151 | } |
| 152 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 153 | int ViEInputManager::DisplayCaptureSettingsDialogBox( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 154 | const char* device_unique_idUTF8, |
| 155 | const char* dialog_titleUTF8, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 156 | void* parent_window, |
| 157 | WebRtc_UWord32 positionX, |
| 158 | WebRtc_UWord32 positionY) { |
| 159 | assert(capture_device_info_); |
| 160 | return capture_device_info_->DisplayCaptureSettingsDialogBox( |
| 161 | device_unique_idUTF8, dialog_titleUTF8, parent_window, positionX, |
| 162 | positionY); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 163 | } |
| 164 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 165 | int ViEInputManager::CreateCaptureDevice( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 166 | const char* device_unique_idUTF8, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 167 | const WebRtc_UWord32 device_unique_idUTF8Length, |
| 168 | int& capture_id) { |
| 169 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 170 | "%s(device_unique_id: %s)", __FUNCTION__, device_unique_idUTF8); |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 171 | CriticalSectionScoped cs(map_cs_.get()); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 172 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 173 | // Make sure the device is not already allocated. |
| 174 | for (MapItem* item = vie_frame_provider_map_.First(); item != NULL; |
| 175 | item = vie_frame_provider_map_.Next(item)) { |
| 176 | // Make sure this is a capture device. |
| 177 | if (item->GetId() >= kViECaptureIdBase && |
| 178 | item->GetId() <= kViECaptureIdMax) { |
| 179 | ViECapturer* vie_capture = static_cast<ViECapturer*>(item->GetItem()); |
| 180 | assert(vie_capture); |
| 181 | // TODO(mflodman) Can we change input to avoid this cast? |
| 182 | const char* device_name = |
| 183 | reinterpret_cast<const char*>(vie_capture->CurrentDeviceName()); |
| 184 | if (strncmp(device_name, |
| 185 | reinterpret_cast<const char*>(device_unique_idUTF8), |
| 186 | strlen(device_name)) == 0) { |
| 187 | return kViECaptureDeviceAlreadyAllocated; |
| 188 | } |
| 189 | } |
| 190 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 191 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 192 | // Make sure the device name is valid. |
| 193 | bool found_device = false; |
| 194 | for (WebRtc_UWord32 device_index = 0; |
| 195 | device_index < capture_device_info_->NumberOfDevices(); ++device_index) { |
| 196 | if (device_unique_idUTF8Length > kVideoCaptureUniqueNameLength) { |
| 197 | // User's string length is longer than the max. |
| 198 | return -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 199 | } |
| 200 | |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 201 | char found_name[kVideoCaptureDeviceNameLength] = ""; |
| 202 | char found_unique_name[kVideoCaptureUniqueNameLength] = ""; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 203 | capture_device_info_->GetDeviceName(device_index, found_name, |
| 204 | kVideoCaptureDeviceNameLength, |
| 205 | found_unique_name, |
| 206 | kVideoCaptureUniqueNameLength); |
| 207 | |
| 208 | // TODO(mflodman) Can we change input to avoid this cast? |
| 209 | const char* cast_id = reinterpret_cast<const char*>(device_unique_idUTF8); |
| 210 | if (strncmp(cast_id, reinterpret_cast<const char*>(found_unique_name), |
| 211 | strlen(cast_id)) == 0) { |
| 212 | WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, ViEId(engine_id_), |
| 213 | "%s:%d Capture device was found by unique ID: %s. Returning", |
| 214 | __FUNCTION__, __LINE__, device_unique_idUTF8); |
| 215 | found_device = true; |
| 216 | break; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 217 | } |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 218 | } |
| 219 | if (!found_device) { |
| 220 | WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, ViEId(engine_id_), |
| 221 | "%s:%d Capture device NOT found by unique ID: %s. Returning", |
| 222 | __FUNCTION__, __LINE__, device_unique_idUTF8); |
| 223 | return kViECaptureDeviceDoesNotExist; |
| 224 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 225 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 226 | int newcapture_id = 0; |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 227 | if (GetFreeCaptureId(&newcapture_id) == false) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 228 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 229 | "%s: Maximum supported number of capture devices already in " |
| 230 | "use", __FUNCTION__); |
| 231 | return kViECaptureDeviceMaxNoDevicesAllocated; |
| 232 | } |
| 233 | ViECapturer* vie_capture = ViECapturer::CreateViECapture( |
| 234 | newcapture_id, engine_id_, device_unique_idUTF8, |
| 235 | device_unique_idUTF8Length, *module_process_thread_); |
| 236 | if (!vie_capture) { |
| 237 | ReturnCaptureId(newcapture_id); |
| 238 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 239 | "%s: Could not create capture module for %s", __FUNCTION__, |
| 240 | device_unique_idUTF8); |
| 241 | return kViECaptureDeviceUnknownError; |
| 242 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 243 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 244 | if (vie_frame_provider_map_.Insert(newcapture_id, vie_capture) != 0) { |
| 245 | ReturnCaptureId(newcapture_id); |
| 246 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 247 | "%s: Could not insert capture module for %s", __FUNCTION__, |
| 248 | device_unique_idUTF8); |
| 249 | return kViECaptureDeviceUnknownError; |
| 250 | } |
| 251 | capture_id = newcapture_id; |
| 252 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 253 | "%s(device_unique_id: %s, capture_id: %d)", __FUNCTION__, |
| 254 | device_unique_idUTF8, capture_id); |
| 255 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 256 | } |
| 257 | |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 258 | int ViEInputManager::CreateCaptureDevice(VideoCaptureModule* capture_module, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 259 | int& capture_id) { |
| 260 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s", |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 261 | __FUNCTION__); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 262 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 263 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 264 | int newcapture_id = 0; |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 265 | if (!GetFreeCaptureId(&newcapture_id)) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 266 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 267 | "%s: Maximum supported number of capture devices already in " |
| 268 | "use", __FUNCTION__); |
| 269 | return kViECaptureDeviceMaxNoDevicesAllocated; |
| 270 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 271 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 272 | ViECapturer* vie_capture = ViECapturer::CreateViECapture( |
| 273 | newcapture_id, engine_id_, capture_module, *module_process_thread_); |
| 274 | if (!vie_capture) { |
| 275 | ReturnCaptureId(newcapture_id); |
| 276 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 277 | "%s: Could attach capture module.", __FUNCTION__); |
| 278 | return kViECaptureDeviceUnknownError; |
| 279 | } |
| 280 | if (vie_frame_provider_map_.Insert(newcapture_id, vie_capture) != 0) { |
| 281 | ReturnCaptureId(newcapture_id); |
| 282 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 283 | "%s: Could not insert capture module", __FUNCTION__); |
| 284 | return kViECaptureDeviceUnknownError; |
| 285 | } |
| 286 | capture_id = newcapture_id; |
| 287 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 288 | "%s, capture_id: %d", __FUNCTION__, capture_id); |
| 289 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 290 | } |
| 291 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 292 | int ViEInputManager::DestroyCaptureDevice(const int capture_id) { |
| 293 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 294 | "%s(capture_id: %d)", __FUNCTION__, capture_id); |
| 295 | ViECapturer* vie_capture = NULL; |
| 296 | { |
| 297 | // We need exclusive access to the object to delete it. |
| 298 | // Take this write lock first since the read lock is taken before map_cs_. |
mflodman@webrtc.org | cee447a | 2012-06-28 07:29:46 +0000 | [diff] [blame] | 299 | ViEManagerWriteScoped wl(this); |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 300 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 301 | |
| 302 | vie_capture = ViECapturePtr(capture_id); |
| 303 | if (!vie_capture) { |
| 304 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 305 | "%s(capture_id: %d) - No such capture device id", |
| 306 | __FUNCTION__, capture_id); |
| 307 | return -1; |
| 308 | } |
| 309 | WebRtc_UWord32 num_callbacks = |
| 310 | vie_capture->NumberOfRegisteredFrameCallbacks(); |
| 311 | if (num_callbacks > 0) { |
| 312 | WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, |
| 313 | ViEId(engine_id_), "%s(capture_id: %d) - %u registered " |
| 314 | "callbacks when destroying capture device", |
| 315 | __FUNCTION__, capture_id, num_callbacks); |
| 316 | } |
| 317 | vie_frame_provider_map_.Erase(capture_id); |
| 318 | ReturnCaptureId(capture_id); |
| 319 | // Leave cs before deleting the capture object. This is because deleting the |
| 320 | // object might cause deletions of renderers so we prefer to not have a lock |
| 321 | // at that time. |
| 322 | } |
| 323 | delete vie_capture; |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | int ViEInputManager::CreateExternalCaptureDevice( |
| 328 | ViEExternalCapture*& external_capture, |
| 329 | int& capture_id) { |
| 330 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s", |
| 331 | __FUNCTION__); |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 332 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 333 | |
| 334 | int newcapture_id = 0; |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 335 | if (GetFreeCaptureId(&newcapture_id) == false) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 336 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 337 | "%s: Maximum supported number of capture devices already in " |
| 338 | "use", __FUNCTION__); |
| 339 | return kViECaptureDeviceMaxNoDevicesAllocated; |
| 340 | } |
| 341 | |
| 342 | ViECapturer* vie_capture = ViECapturer::CreateViECapture( |
| 343 | newcapture_id, engine_id_, NULL, 0, *module_process_thread_); |
| 344 | if (!vie_capture) { |
| 345 | ReturnCaptureId(newcapture_id); |
| 346 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 347 | "%s: Could not create capture module for external capture.", |
| 348 | __FUNCTION__); |
| 349 | return kViECaptureDeviceUnknownError; |
| 350 | } |
| 351 | |
| 352 | if (vie_frame_provider_map_.Insert(newcapture_id, vie_capture) != 0) { |
| 353 | ReturnCaptureId(newcapture_id); |
| 354 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 355 | "%s: Could not insert capture module for external capture.", |
| 356 | __FUNCTION__); |
| 357 | return kViECaptureDeviceUnknownError; |
| 358 | } |
| 359 | capture_id = newcapture_id; |
| 360 | external_capture = vie_capture; |
| 361 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 362 | "%s, capture_id: %d)", __FUNCTION__, capture_id); |
| 363 | return 0; |
| 364 | } |
| 365 | |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 366 | int ViEInputManager::CreateFilePlayer(const char* file_nameUTF8, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 367 | const bool loop, |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 368 | const webrtc::FileFormats file_format, |
| 369 | VoiceEngine* voe_ptr, int& file_id) { |
| 370 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 371 | "%s(device_unique_id: %s)", __FUNCTION__, file_nameUTF8); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 372 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 373 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 374 | int new_file_id = 0; |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 375 | if (GetFreeFileId(&new_file_id) == false) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 376 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 377 | "%s: Maximum supported number of file players already in use", |
| 378 | __FUNCTION__); |
| 379 | return kViEFileMaxNoOfFilesOpened; |
| 380 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 381 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 382 | ViEFilePlayer* vie_file_player = ViEFilePlayer::CreateViEFilePlayer( |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 383 | new_file_id, engine_id_, file_nameUTF8, loop, file_format, voe_ptr); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 384 | if (!vie_file_player) { |
| 385 | ReturnFileId(new_file_id); |
| 386 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 387 | "%s: Could not open file %s for playback", __FUNCTION__, |
| 388 | file_nameUTF8); |
| 389 | return kViEFileUnknownError; |
| 390 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 391 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 392 | if (vie_frame_provider_map_.Insert(new_file_id, vie_file_player) != 0) { |
| 393 | ReturnCaptureId(new_file_id); |
| 394 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 395 | "%s: Could not insert file player for %s", __FUNCTION__, |
| 396 | file_nameUTF8); |
| 397 | delete vie_file_player; |
| 398 | return kViEFileUnknownError; |
| 399 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 400 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 401 | file_id = new_file_id; |
| 402 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 403 | "%s(filename: %s, file_id: %d)", __FUNCTION__, file_nameUTF8, |
| 404 | new_file_id); |
| 405 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 406 | } |
| 407 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 408 | int ViEInputManager::DestroyFilePlayer(int file_id) { |
| 409 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 410 | "%s(file_id: %d)", __FUNCTION__, file_id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 411 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 412 | ViEFilePlayer* vie_file_player = NULL; |
| 413 | { |
| 414 | // We need exclusive access to the object to delete it. |
| 415 | // Take this write lock first since the read lock is taken before map_cs_. |
mflodman@webrtc.org | cee447a | 2012-06-28 07:29:46 +0000 | [diff] [blame] | 416 | ViEManagerWriteScoped wl(this); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 417 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 418 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 419 | vie_file_player = ViEFilePlayerPtr(file_id); |
| 420 | if (!vie_file_player) { |
| 421 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), |
| 422 | "%s(file_id: %d) - No such file player", __FUNCTION__, |
| 423 | file_id); |
| 424 | return -1; |
| 425 | } |
| 426 | int num_callbacks = vie_file_player->NumberOfRegisteredFrameCallbacks(); |
| 427 | if (num_callbacks > 0) { |
| 428 | WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, |
| 429 | ViEId(engine_id_), "%s(file_id: %d) - %u registered " |
| 430 | "callbacks when destroying file player", __FUNCTION__, |
| 431 | file_id, num_callbacks); |
| 432 | } |
| 433 | vie_frame_provider_map_.Erase(file_id); |
| 434 | ReturnFileId(file_id); |
| 435 | // Leave cs before deleting the file object. This is because deleting the |
| 436 | // object might cause deletions of renderers so we prefer to not have a lock |
| 437 | // at that time. |
| 438 | } |
| 439 | delete vie_file_player; |
| 440 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 441 | } |
| 442 | |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 443 | bool ViEInputManager::GetFreeCaptureId(int* freecapture_id) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 444 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s", |
| 445 | __FUNCTION__); |
| 446 | for (int id = 0; id < kViEMaxCaptureDevices; id++) { |
| 447 | if (free_capture_device_id_[id]) { |
| 448 | // We found a free capture device id. |
| 449 | free_capture_device_id_[id] = false; |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 450 | *freecapture_id = id + kViECaptureIdBase; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 451 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 452 | "%s: new id: %d", __FUNCTION__, *freecapture_id); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 453 | return true; |
| 454 | } |
| 455 | } |
| 456 | return false; |
| 457 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 458 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 459 | void ViEInputManager::ReturnCaptureId(int capture_id) { |
| 460 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 461 | "%s(%d)", __FUNCTION__, capture_id); |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 462 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 463 | if (capture_id >= kViECaptureIdBase && |
| 464 | capture_id < kViEMaxCaptureDevices + kViECaptureIdBase) { |
| 465 | free_capture_device_id_[capture_id - kViECaptureIdBase] = true; |
| 466 | } |
| 467 | return; |
| 468 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 469 | |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 470 | bool ViEInputManager::GetFreeFileId(int* free_file_id) { |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 471 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s", |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 472 | __FUNCTION__); |
| 473 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 474 | for (int id = 0; id < kViEMaxFilePlayers; id++) { |
| 475 | if (free_file_id_[id]) { |
| 476 | // We found a free capture device id. |
| 477 | free_file_id_[id] = false; |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 478 | *free_file_id = id + kViEFileIdBase; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 479 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 480 | "%s: new id: %d", __FUNCTION__, *free_file_id); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 481 | return true; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 482 | } |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 483 | } |
| 484 | return false; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 485 | } |
| 486 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 487 | void ViEInputManager::ReturnFileId(int file_id) { |
| 488 | WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), |
| 489 | "%s(%d)", __FUNCTION__, file_id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 490 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 491 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 492 | if (file_id >= kViEFileIdBase && |
| 493 | file_id < kViEMaxFilePlayers + kViEFileIdBase) { |
| 494 | free_file_id_[file_id - kViEFileIdBase] = true; |
| 495 | } |
| 496 | return; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 497 | } |
| 498 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 499 | ViEFrameProviderBase* ViEInputManager::ViEFrameProvider( |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 500 | const ViEFrameCallback* capture_observer) const { |
| 501 | assert(capture_observer); |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 502 | CriticalSectionScoped cs(map_cs_.get()); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 503 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 504 | for (MapItem* provider_item = vie_frame_provider_map_.First(); provider_item |
| 505 | != NULL; provider_item = vie_frame_provider_map_.Next(provider_item)) { |
| 506 | ViEFrameProviderBase* vie_frame_provider = |
| 507 | static_cast<ViEFrameProviderBase*>(provider_item->GetItem()); |
| 508 | assert(vie_frame_provider != NULL); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 509 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 510 | if (vie_frame_provider->IsFrameCallbackRegistered(capture_observer)) { |
| 511 | // We found it. |
| 512 | return vie_frame_provider; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 513 | } |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 514 | } |
| 515 | // No capture device set for this channel. |
| 516 | return NULL; |
| 517 | } |
| 518 | |
| 519 | ViEFrameProviderBase* ViEInputManager::ViEFrameProvider(int provider_id) const { |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 520 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 521 | MapItem* map_item = vie_frame_provider_map_.Find(provider_id); |
| 522 | if (!map_item) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 523 | return NULL; |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 524 | } |
| 525 | ViEFrameProviderBase* vie_frame_provider = |
| 526 | static_cast<ViEFrameProviderBase*>(map_item->GetItem()); |
| 527 | return vie_frame_provider; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 528 | } |
| 529 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 530 | ViECapturer* ViEInputManager::ViECapturePtr(int capture_id) const { |
| 531 | if (!(capture_id >= kViECaptureIdBase && |
| 532 | capture_id <= kViECaptureIdBase + kViEMaxCaptureDevices)) |
| 533 | return NULL; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 534 | |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 535 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 536 | MapItem* map_item = vie_frame_provider_map_.Find(capture_id); |
| 537 | if (!map_item) { |
| 538 | return NULL; |
| 539 | } |
| 540 | ViECapturer* vie_capture = static_cast<ViECapturer*>(map_item->GetItem()); |
| 541 | return vie_capture; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 542 | } |
| 543 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 544 | ViEFilePlayer* ViEInputManager::ViEFilePlayerPtr(int file_id) const { |
| 545 | if (file_id < kViEFileIdBase || file_id > kViEFileIdMax) { |
| 546 | return NULL; |
| 547 | } |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 548 | CriticalSectionScoped cs(map_cs_.get()); |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 549 | MapItem* map_item = vie_frame_provider_map_.Find(file_id); |
| 550 | if (!map_item) { |
| 551 | return NULL; |
| 552 | } |
| 553 | ViEFilePlayer* vie_file_player = |
| 554 | static_cast<ViEFilePlayer*>(map_item->GetItem()); |
| 555 | return vie_file_player; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 556 | } |
| 557 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 558 | ViEInputManagerScoped::ViEInputManagerScoped( |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 559 | const ViEInputManager& vie_input_manager) |
| 560 | : ViEManagerScopedBase(vie_input_manager) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 561 | } |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 562 | |
| 563 | ViECapturer* ViEInputManagerScoped::Capture(int capture_id) const { |
| 564 | return static_cast<const ViEInputManager*>(vie_manager_)->ViECapturePtr( |
| 565 | capture_id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 566 | } |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 567 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 568 | ViEFrameProviderBase* ViEInputManagerScoped::FrameProvider( |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 569 | const ViEFrameCallback* capture_observer) const { |
| 570 | return static_cast<const ViEInputManager*>(vie_manager_)->ViEFrameProvider( |
| 571 | capture_observer); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 572 | } |
| 573 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 574 | ViEFrameProviderBase* ViEInputManagerScoped::FrameProvider( |
| 575 | int provider_id) const { |
| 576 | return static_cast<const ViEInputManager*>(vie_manager_)->ViEFrameProvider( |
| 577 | provider_id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 578 | } |
| 579 | |
mflodman@webrtc.org | e8be22c | 2011-12-15 10:19:29 +0000 | [diff] [blame] | 580 | ViEFilePlayer* ViEInputManagerScoped::FilePlayer(int file_id) const { |
| 581 | return static_cast<const ViEInputManager*>(vie_manager_)->ViEFilePlayerPtr( |
| 582 | file_id); |
| 583 | } |
| 584 | |
| 585 | } // namespace webrtc |