1# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import("../../webrtc.gni")
10
11# Note this target is missing an implementation for the video capture.
12# Targets must link with either 'video_capture' or
13# 'video_capture_internal_impl' depending on whether they want to
14# use the internal capturer.
15rtc_library("video_capture_module") {
16  visibility = [ "*" ]
17  sources = [
18    "device_info_impl.cc",
19    "device_info_impl.h",
20    "video_capture.h",
21    "video_capture_config.h",
22    "video_capture_defines.h",
23    "video_capture_factory.cc",
24    "video_capture_factory.h",
25    "video_capture_impl.cc",
26    "video_capture_impl.h",
27  ]
28
29  deps = [
30    "..:module_api",
31    "../../api:scoped_refptr",
32    "../../api/video:video_frame",
33    "../../api/video:video_frame_i420",
34    "../../api/video:video_rtp_headers",
35    "../../common_video",
36    "../../media:rtc_media_base",
37    "../../rtc_base:rtc_base_approved",
38    "../../rtc_base:stringutils",
39    "../../rtc_base/synchronization:mutex",
40    "../../rtc_base/synchronization:rw_lock_wrapper",
41    "../../system_wrappers",
42    "//third_party/libyuv",
43  ]
44  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
45}
46
47if (!build_with_chromium) {
48  rtc_source_set("video_capture_internal_impl") {
49    visibility = [ "*" ]
50    deps = [
51      ":video_capture_module",
52      "../../api:scoped_refptr",
53      "../../rtc_base:checks",
54      "../../rtc_base:rtc_base_approved",
55      "../../rtc_base/synchronization:mutex",
56      "../../system_wrappers",
57    ]
58
59    if (is_linux) {
60      sources = [
61        "linux/device_info_linux.cc",
62        "linux/device_info_linux.h",
63        "linux/video_capture_linux.cc",
64        "linux/video_capture_linux.h",
65      ]
66      deps += [ "../../media:rtc_media_base" ]
67    }
68    if (is_win) {
69      sources = [
70        "windows/device_info_ds.cc",
71        "windows/device_info_ds.h",
72        "windows/help_functions_ds.cc",
73        "windows/help_functions_ds.h",
74        "windows/sink_filter_ds.cc",
75        "windows/sink_filter_ds.h",
76        "windows/video_capture_ds.cc",
77        "windows/video_capture_ds.h",
78        "windows/video_capture_factory_windows.cc",
79      ]
80
81      libs = [ "strmiids.lib" ]
82
83      if (build_with_mozilla) {
84        sources += [
85          "windows/BaseFilter.cpp",
86          "windows/BaseInputPin.cpp",
87          "windows/BasePin.cpp",
88          "windows/MediaType.cpp",
89        ]
90      }
91    }
92
93    if (build_with_mozilla && is_android) {
94      include_dirs = [
95        "/config/external/nspr",
96        "/nsprpub/lib/ds",
97        "/nsprpub/pr/include",
98      ]
99
100      sources = [
101        "android/device_info_android.cc",
102        "android/video_capture_android.cc",
103      ]
104    }
105  }
106
107  if (!is_android && rtc_include_tests) {
108    rtc_test("video_capture_tests") {
109      sources = [ "test/video_capture_unittest.cc" ]
110      ldflags = []
111      if (is_linux || is_mac) {
112        ldflags += [
113          "-lpthread",
114          "-lm",
115        ]
116      }
117      if (is_linux) {
118        ldflags += [
119          "-lrt",
120          "-lXext",
121          "-lX11",
122        ]
123      }
124
125      deps = [
126        ":video_capture_internal_impl",
127        ":video_capture_module",
128        "../../api:scoped_refptr",
129        "../../api/video:video_frame",
130        "../../api/video:video_frame_i420",
131        "../../api/video:video_rtp_headers",
132        "../../common_video",
133        "../../rtc_base:rtc_base_approved",
134        "../../rtc_base/synchronization:mutex",
135        "../../system_wrappers",
136        "../../test:frame_utils",
137        "../../test:test_main",
138        "../../test:test_support",
139        "../../test:video_test_common",
140        "../utility",
141        "//testing/gtest",
142        "//third_party/abseil-cpp/absl/memory",
143      ]
144    }
145  }
146}
147