andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 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 | |
| 11 | #include "ref_count.h" |
| 12 | #include "video_capture_windows.h" |
| 13 | #include "trace.h" |
| 14 | |
| 15 | namespace webrtc |
| 16 | { |
| 17 | namespace videocapturemodule |
| 18 | { |
| 19 | VideoCaptureModule* VideoCaptureImpl::Create( |
| 20 | const WebRtc_Word32 id, |
| 21 | const char* deviceUniqueIdUTF8) |
| 22 | { |
| 23 | |
| 24 | if (deviceUniqueIdUTF8 == NULL) |
| 25 | { |
| 26 | return NULL; |
| 27 | } |
| 28 | |
| 29 | char productId[kVideoCaptureProductIdLength]; |
| 30 | videocapturemodule::DeviceInfoWindows::GetProductId(deviceUniqueIdUTF8, |
| 31 | productId, |
| 32 | sizeof(productId)); |
| 33 | |
| 34 | RefCountImpl<videocapturemodule::VideoCaptureDS>* newCaptureModule = |
| 35 | new RefCountImpl<videocapturemodule::VideoCaptureDS>(id); |
| 36 | |
| 37 | if (newCaptureModule->Init(id, deviceUniqueIdUTF8) != 0) |
| 38 | { |
| 39 | delete newCaptureModule; |
| 40 | newCaptureModule = NULL; |
| 41 | } |
| 42 | return newCaptureModule; |
| 43 | } |
| 44 | } //namespace videocapturemodule |
| 45 | } //namespace webrtc |