xref: /aosp_15_r20/external/webrtc/modules/video_capture/windows/video_capture_factory_windows.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 "api/scoped_refptr.h"
12 #include "modules/video_capture/windows/video_capture_ds.h"
13 
14 namespace webrtc {
15 namespace videocapturemodule {
16 
17 // static
CreateDeviceInfo()18 VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
19   // TODO(tommi): Use the Media Foundation version on Vista and up.
20   return DeviceInfoDS::Create();
21 }
22 
Create(const char * device_id)23 rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
24     const char* device_id) {
25   if (device_id == nullptr)
26     return nullptr;
27 
28   // TODO(tommi): Use Media Foundation implementation for Vista and up.
29   auto capture = rtc::make_ref_counted<VideoCaptureDS>();
30   if (capture->Init(device_id) != 0) {
31     return nullptr;
32   }
33 
34   return capture;
35 }
36 
37 }  // namespace videocapturemodule
38 }  // namespace webrtc
39