OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2009 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 /* | |
12 * Author: lexnikitin@google.com (Alexey Nikitin) | |
13 * | |
14 * V4LLookup provides basic functionality to work with V2L2 devices in Linux | |
15 * The functionality is implemented as a class with virtual methods for | |
16 * the purpose of unit testing. | |
17 */ | |
18 #ifndef WEBRTC_MEDIA_DEVICES_V4LLOOKUP_H_ | |
19 #define WEBRTC_MEDIA_DEVICES_V4LLOOKUP_H_ | |
20 | |
21 #include <string> | |
22 | |
23 #ifdef WEBRTC_LINUX | |
24 namespace cricket { | |
25 class V4LLookup { | |
26 public: | |
27 virtual ~V4LLookup() {} | |
28 | |
29 static bool IsV4L2Device(const std::string& device_path) { | |
30 return GetV4LLookup()->CheckIsV4L2Device(device_path); | |
31 } | |
32 | |
33 static void SetV4LLookup(V4LLookup* v4l_lookup) { | |
34 v4l_lookup_ = v4l_lookup; | |
35 } | |
36 | |
37 static V4LLookup* GetV4LLookup() { | |
38 if (!v4l_lookup_) { | |
39 v4l_lookup_ = new V4LLookup(); | |
40 } | |
41 return v4l_lookup_; | |
42 } | |
43 | |
44 protected: | |
45 static V4LLookup* v4l_lookup_; | |
46 // Making virtual so it is easier to mock | |
47 virtual bool CheckIsV4L2Device(const std::string& device_path); | |
48 }; | |
49 | |
50 } // namespace cricket | |
51 | |
52 #endif // WEBRTC_LINUX | |
53 #endif // WEBRTC_MEDIA_DEVICES_V4LLOOKUP_H_ | |
OLD | NEW |