1470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com/*
2843c8c78ff74f2ea11c5eb6384255d11ebe68b6dxians@webrtc.org *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *
4470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  Use of this source code is governed by a BSD-style license
5470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  that can be found in the LICENSE file in the root of the source
6470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  tree. An additional intellectual property rights grant can be found
7470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  in the file PATENTS.  All contributing project authors may
8470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  be found in the AUTHORS file in the root of the source tree.
9470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com */
10470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
11a9b74ad716031e7ce63ae0b792b1ba4d2b223d13pbos@webrtc.org#include "webrtc/modules/video_capture/windows/video_capture_ds.h"
12a9b74ad716031e7ce63ae0b792b1ba4d2b223d13pbos@webrtc.org#include "webrtc/modules/video_capture/windows/video_capture_mf.h"
1398f53510b222f71fdd8b799b2f33737ceeb28c61Henrik Kjellander#include "webrtc/system_wrappers/include/ref_count.h"
14470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
158187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.orgnamespace webrtc {
168187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.orgnamespace videocapturemodule {
17470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
188187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org// static
198187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.orgVideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
20dfc5bb9c97fdd8df3cd86afe2b378ebf89cea628pbos@webrtc.org    const int32_t id) {
218187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  // TODO(tommi): Use the Media Foundation version on Vista and up.
228187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  return DeviceInfoDS::Create(id);
238187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org}
248187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org
25dfc5bb9c97fdd8df3cd86afe2b378ebf89cea628pbos@webrtc.orgVideoCaptureModule* VideoCaptureImpl::Create(const int32_t id,
268187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org                                             const char* device_id) {
278187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  if (device_id == NULL)
288187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org    return NULL;
29470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
308187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  // TODO(tommi): Use Media Foundation implementation for Vista and up.
318187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  RefCountImpl<VideoCaptureDS>* capture = new RefCountImpl<VideoCaptureDS>(id);
328187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  if (capture->Init(id, device_id) != 0) {
338187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org    delete capture;
348187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org    capture = NULL;
358187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  }
368187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org
378187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org  return capture;
38470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com}
398187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org
408187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org}  // namespace videocapturemodule
418187877402bc54cb3b563a480c0a7f02f1a896b5tommi@webrtc.org}  // namespace webrtc
42